kv: mask system config gossip info in tenant GossipSubscription stream#52598
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Aug 17, 2020
Merged
Conversation
Member
tbg
reviewed
Aug 11, 2020
pkg/config/system_mask.go
Outdated
| // SystemConfigMask is a mask that can be applied to a set of system config | ||
| // entries to filter out unwanted entries. | ||
| type SystemConfigMask struct { | ||
| keys []roachpb.Key |
Member
There was a problem hiding this comment.
nit: name this allowed so that it's clear this is an allowlist?
tbg
reviewed
Aug 11, 2020
| func (m SystemConfigMask) Apply(entries SystemConfigEntries) SystemConfigEntries { | ||
| var res SystemConfigEntries | ||
| for _, key := range m.keys { | ||
| i := sort.Search(len(entries.Values), func(i int) bool { |
Member
There was a problem hiding this comment.
if entries.Values is also sorted (as it is?), shouldn't it be possible to "merge search" here by discarding entries.Values[:i+1] after each hit? Probably not worth it though, given m.keys is small in practice.
Contributor
Author
There was a problem hiding this comment.
Yes, this seems possible, but it's probably not worth the complexity. I actually thought of doing so while writing this, and then remembered that at some point during the TLA+ training, you convinced me with some fancy math that doing this was still O(m*log(n)).
tbg
approved these changes
Aug 11, 2020
Fixes cockroachdb#52361. This commit creates a new GossipSubscriptionSystemConfigMask object that the KV server uses to filter out most system config keys within the "system-db" gossip key. The keys remaining after the filter are only those that a tenant SQL process needs access to, namely just enough of the zone hierarchy to understand which zone configurations apply to their keyspace.
f81cd1b to
b5f85a7
Compare
Contributor
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #52361.
This commit creates a new GossipSubscriptionSystemConfigMask object that the
KV server uses to filter out most system config keys within the "system-db"
gossip key. The keys remaining after the filter are only those that a tenant
SQL process needs access to, namely just enough of the zone hierarchy to
understand which zone configurations apply to their keyspace.