Skip to content

kvserver: add cluster setting to disable queues#104170

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
aadityasondhi:20230525.disable-queues-config
Jun 7, 2023
Merged

kvserver: add cluster setting to disable queues#104170
craig[bot] merged 1 commit intocockroachdb:masterfrom
aadityasondhi:20230525.disable-queues-config

Conversation

@aadityasondhi
Copy link
Copy Markdown
Contributor

This patch introduces a new set of cluster settings to disable work queues in the Store object. It makes use of the underlying disabled property of the BaseQueue.

Fixes: #102031

Release note: None

@aadityasondhi aadityasondhi requested a review from a team as a code owner May 31, 2023 21:14
@aadityasondhi aadityasondhi requested a review from a team May 31, 2023 21:14
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown

@andrewbaptist andrewbaptist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the comment in queue.go related to the disabled field. It currently says:
// Some tests in this package disable queues.
But now it is also configurable through these new settings.

Also update the MaybeRemove method in queue.go to check the disabled flag.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @aadityasondhi)


pkg/kv/kvserver/consistency_queue.go line 109 at r1 (raw file):

	kvserverbase.ConsistencyQueueEnabled.SetOnChange(&store.cfg.Settings.SV, func(ctx context.Context) {
		q.SetDisabled(!kvserverbase.ConsistencyQueueEnabled.Get(&store.cfg.Settings.SV))
	})

nit: I would do this a little differently since this is the exact same code on every queue. Add a parameter - something like disabledConfig *settings.BoolSetting to queueConfig and then pass in the parameter itself. This will avoid missing it on new queue creations, and it also prevents it from creating a queue and then having to disable it right afterwards.


pkg/kv/kvserver/split_queue.go line 183 at r1 (raw file):

}

func (sq *splitQueue) enabled() bool {

Remove this redundant setting.

@aadityasondhi aadityasondhi force-pushed the 20230525.disable-queues-config branch from f9c9b6b to 5e6fb85 Compare June 6, 2023 19:19
Copy link
Copy Markdown
Contributor Author

@aadityasondhi aadityasondhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

I ended up not adding a disabled check to MaybeRemove based on this comment:

https://github.com/cockroachdb/cockroach/blob/24f141b2cffd8325ca2e4504b2dabecb6132b81c/pkg/kv/kvserver/scanner.go#LL251C1-L253C1

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andrewbaptist)


pkg/kv/kvserver/consistency_queue.go line 109 at r1 (raw file):

Previously, andrewbaptist (Andrew Baptist) wrote…

nit: I would do this a little differently since this is the exact same code on every queue. Add a parameter - something like disabledConfig *settings.BoolSetting to queueConfig and then pass in the parameter itself. This will avoid missing it on new queue creations, and it also prevents it from creating a queue and then having to disable it right afterwards.

Done.


pkg/kv/kvserver/split_queue.go line 183 at r1 (raw file):

Previously, andrewbaptist (Andrew Baptist) wrote…

Remove this redundant setting.

Done.

@aadityasondhi aadityasondhi force-pushed the 20230525.disable-queues-config branch 4 times, most recently from 3bcc2ca to 03f768c Compare June 6, 2023 21:38
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jun 7, 2023

Thank you for updating your pull request.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added the O-community Originated from the community label Jun 7, 2023
@aadityasondhi aadityasondhi removed the O-community Originated from the community label Jun 7, 2023
@aadityasondhi aadityasondhi force-pushed the 20230525.disable-queues-config branch 2 times, most recently from 6321d47 to 77b87af Compare June 7, 2023 18:18
Copy link
Copy Markdown

@andrewbaptist andrewbaptist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Thanks for the iteration on this!

Reviewed 13 of 13 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aadityasondhi)

@aadityasondhi
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 7, 2023

This PR was included in a batch that successfully built, but then failed to merge into master. It will not be retried.

Additional information:

{"message":"Changes must be made through a pull request.","documentation_url":"https://docs.github.com/articles/about-protected-branches"}

This patch introduces a new set of cluster settings to disable work
queues in the `Store` object. It makes use of the underlying `disabled`
property of the `BaseQueue`.

Fixes: cockroachdb#102031

Release note: None
@aadityasondhi aadityasondhi force-pushed the 20230525.disable-queues-config branch from 77b87af to 2b91c38 Compare June 7, 2023 22:57
@aadityasondhi
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 7, 2023

Build succeeded:

@craig craig bot merged commit 99277e9 into cockroachdb:master Jun 7, 2023
@aadityasondhi aadityasondhi deleted the 20230525.disable-queues-config branch June 14, 2023 17:57
srosenberg added a commit to srosenberg/cockroach that referenced this pull request Oct 28, 2023
In [1], new cluster settings have been added, e.g.,
`kv.replica_gc_queue.enabled`, `kv.raft_log_queue.enabled`,
to selectively disable work queues per store, at runtime.

The new unit tests use a dummy `BoolSetting` which aliases
slot 0 of the global cluster setting `registry`. Thus, its
value corresponds to whichever cluster setting is registered
first during `init()`. Before the change in [2], the first
registered cluster setting is `bulkio.backup.merge_file_buffer_size`,
one with a non-zero value in slot 0.
After the change, it is `keyvisualizer.enabled`, one with a
zero value in slot 0. Subsequently, a number of the unit tests
failed because `baseQueue.mu.disabled` is now true instead
of previously, false.

The change in this PR fixes the bug by registering a fresh dummy
`BoolSetting`. We also rename `disabledConfig` to match the polarity
used in conjunction with `bq.SetDisabled`.

[1] cockroachdb#104170
[2] cockroachdb#113113

Epic: none

Release note: None
srosenberg added a commit to srosenberg/cockroach that referenced this pull request Nov 16, 2023
In [1], new cluster settings have been added, e.g.,
`kv.replica_gc_queue.enabled`, `kv.raft_log_queue.enabled`,
to selectively disable work queues per store, at runtime.

The new unit tests use a dummy `BoolSetting` which aliases
slot 0 of the global cluster setting `registry`. Thus, its
value corresponds to whichever cluster setting is registered
first during `init()`. Before the change in [2], the first
registered cluster setting is `bulkio.backup.merge_file_buffer_size`,
one with a non-zero value in slot 0.
After the change, it is `keyvisualizer.enabled`, one with a
zero value in slot 0. Subsequently, a number of the unit tests
failed because `baseQueue.mu.disabled` is now true instead
of previously, false.

The change in this PR fixes the bug by registering a fresh dummy
`BoolSetting`. We also rename `disabledConfig` to match the polarity
used in conjunction with `bq.SetDisabled`.

[1] cockroachdb#104170
[2] cockroachdb#113113

Epic: none

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kv: ensure queues have a means of being disabled

3 participants