-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
settings: add functionality for settings override #73774
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2021 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package settingswatcher | ||
|
||
// OverridesMonitor is an interface through which the settings watcher can | ||
// receive setting overrides. Used for non-system tenants. | ||
// | ||
// The expected usage is to listen for a message on NotifyCh(), and use | ||
// Current() to retrieve the updated list of overrides when a message is | ||
// received. | ||
type OverridesMonitor interface { | ||
// NotifyCh returns a channel that receives a message any time the current set | ||
// of overrides changes. | ||
NotifyCh() <-chan struct{} | ||
|
||
// Overrides retrieves the current set of setting overrides, as a map from | ||
// setting key to RawValue. Any settings that are present must be set to the | ||
// overridden value. | ||
Overrides() map[string]RawValue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm my understanding: the expected implementation of OverridesMonitor will internally keep tenant-specific overrides and all-tenant overrides and return the merged map here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OverridesMonitor will do an RPC through the tenant connector to listen for overrides. The host side of that API will "merge" the overrides. The tenant side won't be able to tell what kind of override it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I think we should reconsider that -- but it doesn't really change the API used here either way, so I'm happy to wait on that until the implementation of the monitor and its corresponding host RPC API to litigate that.
(basically I just don't want deleting one all-tenants override to force a read of the every tenant's possible per-tenant override for that setting, so I want them to be stateful and keep track of two layers)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with that goal. My plan was along the lines of a single process per KV node that watches the entire
tenant_settings
table and keeps all the information in memory, updating any connected tenants as necessary. I expect that we won't have a ton of entries in that table - thinking we'll have a handful of all-tenant settings and a few one-off tenant-specific settings.