-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
allocator: safe format allocator log messages #116295
Conversation
036fd68
to
2fd0b11
Compare
2fd0b11
to
e6dc7e7
Compare
Introduce a string method for `storeStatus`, which previously printed ordinals. Add testing for both the store list and store pool string methods. Part of: cockroachdb#102948 Release note: None
Add testing for the string output of candidates and load. These are later used as regression tests for implementing safe formatting. Part of: cockroachdb#102948 Release note: None
Implement `SafeValue` for `LeaseTransferOutcome` to unredact the transfer outcome in logs. Note this is currently used only in draining when shedding leases. Release note: None Part of: cockroachdb#102948
b1224ac
to
e793b32
Compare
Implement `SafeFormat` for `Load` to unredact load messages in logs. Release note: None Part of: cockroachdb#102948
`AllocatorAction`, `TargetReplicaType` and `ReplicaStatus` were previously hidden in redacted logs. Implement `redact.SafeValue` to unredact. Also, implement `SafeFormatError` for allocator errors. Release note: None Part of: cockroachdb#102948
`raftRangeProgress` is used to format the raft progress for a range. Update `raftRangeProgress` to return a redactable string to show in redacted logs. Release note: None Part of: cockroachdb#102948
Implement `SafeFormat` for `StorePool` and `StoreList` to unredact log messages. Release note: None Part of: cockroachdb#102948
Clean up inconsistent parentheses and make range rebalance logging consistent with lease rebalance logging. Epic: none Release note: None
e793b32
to
ea43cc4
Compare
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.
Thanks for cleaning this all up! Only once question/concern about whether constraints are considered sensitive, otherwise it all looks good.
Reviewed 4 of 4 files at r1, 4 of 4 files at r2, 2 of 2 files at r3, 5 of 5 files at r4, 4 of 4 files at r5, 2 of 2 files at r6, 5 of 5 files at r7, 1 of 1 files at r8, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @kvoli)
pkg/kv/kvserver/allocator/allocatorimpl/allocator.go
line 442 at r5 (raw file):
} b.SafeRune('{') b.Print(ae.constraints[i])
I'm concerned that constraints may be considered sensitive data. We consider database and table names as sensitive data, but this is a little less clear. Who is the right person to make this call?
pkg/kv/kvserver/allocator/allocatorimpl/allocator_scorer_test.go
line 1677 at r2 (raw file):
cl = append(cl, candidate{ store: roachpb.StoreDescriptor{StoreID: roachpb.StoreID(i)}, valid: i%2 == 0,
nit: No need to change this, but it might have been easier for all these i%2
cases to instead have 12 different candidates, and each of them only change one parameter (e.g. - i%12 == 5). The advantage of that approach would be if there were "cross-wired" mappings it would be very obvious.
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.
TYFTR -- replied below re: constraints being considered sensitive.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andrewbaptist)
pkg/kv/kvserver/allocator/allocatorimpl/allocator.go
line 442 at r5 (raw file):
Previously, andrewbaptist (Andrew Baptist) wrote…
I'm concerned that constraints may be considered sensitive data. We consider database and table names as sensitive data, but this is a little less clear. Who is the right person to make this call?
These will be redacted -- as they do not implement a SafeFormat
or SafeValue
method which Print
here checks for.
cockroach/pkg/roachpb/span_config.go
Line 139 in 6fae6a7
func (c ConstraintsConjunction) String() string { |
This behavior hasn't changed, just that the parts around the constraints won't be redacted now.
Should be good for another review round @andrewbaptist. |
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.
TYFTR bors r=andrewbaptist |
Build succeeded: |
See individual commit messages.
Note stringer tests are added in earlier PRs in order to assert against regressions.
Resolves: #102948
Release note: None