sql: Use normal priority for metadata schema change updates#162544
sql: Use normal priority for metadata schema change updates#162544shghasemi wants to merge 1 commit intocockroachdb:masterfrom
Conversation
|
Merging to
|
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
fqazi
left a comment
There was a problem hiding this comment.
Looks, good one minor suggestion
@fqazi reviewed 2 files and all commit messages, and made 3 comments.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @shghasemi).
pkg/sql/schema_changer.go line 2905 at r1 (raw file):
// txn is a convenient wrapper around descs.Txn(). func (sc *SchemaChanger) txn( ctx context.Context, useBulkPri bool, f func(context.Context, descs.Txn) error,
Lets switch this to use the option pattern:
type txnOptions struct {
bulkPri bool
}
type txnOption interface {
apply(*txnOptions)
}
type bulkPriOption bool
bool (b bulkPriOption) apply(t *txnOptions){
t.bulkPri = bool(b)
}
func WithBulkPri(b bool) txnOption{
return bulkPriOption(b)
}
func (sc *SchemaChanger) txn(
ctx context.Context, f func(context.Context, descs.Txn), txnOptions...) {
pkg/sql/backfill.go line 155 at r1 (raw file):
) historicalTxnRunner { runner := func(ctx context.Context, retryable scTxnFn) error { return sc.fixedTimestampTxnWithExecutor(ctx, useBulkPri, readAsOf, func(
For simplicity lets exclude the fixed timestamp operations. I know we read descriptors below, but these are mainly for CREATE TABLE AS / REFRESH MATERIALIZED VIEW type backfills.
275514c to
7aa8208
Compare
shghasemi
left a comment
There was a problem hiding this comment.
@shghasemi made 2 comments.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @fqazi).
pkg/sql/backfill.go line 155 at r1 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
For simplicity lets exclude the fixed timestamp operations. I know we read descriptors below, but these are mainly for CREATE TABLE AS / REFRESH MATERIALIZED VIEW type backfills.
They are also used to run validation.
Line 766 in f275471
Should we set them to always run with bulkPri?
pkg/sql/schema_changer.go line 2905 at r1 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Lets switch this to use the option pattern:
type txnOptions struct { bulkPri bool } type txnOption interface { apply(*txnOptions) } type bulkPriOption bool bool (b bulkPriOption) apply(t *txnOptions){ t.bulkPri = bool(b) } func WithBulkPri(b bool) txnOption{ return bulkPriOption(b) } func (sc *SchemaChanger) txn( ctx context.Context, f func(context.Context, descs.Txn), txnOptions...) {
Done
Previously, all schema change updates were executed with a bulk normal priority. This had unintended side effects on overloaded systems, where trivial schema changes were unable to make progress. With this change, we only apply the low priority for operations that involve doing backfills or validation. Fixes: cockroachdb#162042 Release note: None
7aa8208 to
db83426
Compare
fqazi
left a comment
There was a problem hiding this comment.
@fqazi reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @shghasemi).
pkg/sql/backfill.go line 155 at r1 (raw file):
Previously, shghasemi wrote…
They are also used to run validation.
Line 766 in f275471
Should we set them to always run with bulkPri?
Yeah, lets leave those at the bulk priority.
Previously, all schema change updates were executed with a bulk normal priority. This had unintended side effects on overloaded systems, where trivial schema changes were unable to make progress. With this change, we only apply the low priority for operations that involve doing backfills or validation.
Fixes: #162042
Release note: None