-
Notifications
You must be signed in to change notification settings - Fork 455
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
[coordinator] Delete related etcd keys when aggregator placement deleted #2133
[coordinator] Delete related etcd keys when aggregator placement deleted #2133
Conversation
flushTimesMgrOpts := aggregator.NewFlushTimesManagerOptions() | ||
electionMgrOpts := aggregator.NewElectionManagerOptions() |
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.
meganit: do this after getting the store?
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.
Also, are these guaranteed to be default?
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.
Sure thing.
return fmt.Errorf( | ||
"error check flush times key exists for deleted instance: %v", | ||
flushTimesKeyErr) |
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.
Think this would work better as a multierror, so you can still delete the rest of the flush time keys if one errors? Also lets us try to delete election keys too
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.
Good point, will do.
return fmt.Errorf( | ||
"error checking election key exists for deleted instance: %v", err) |
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.
Think this would work better as a multierror, so you can still delete the rest of the election keys if one errors?
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.
Agreed, will do.
continue | ||
} | ||
if elem.ShardSetID() == shardSetID { | ||
existingShardSetIDs++ |
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.
Should this just break
?
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.
Agreed, will do.
if found { | ||
continue | ||
} | ||
shardSetIDs = append(shardSetIDs, value) |
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.
nit; probably a bit cleaner as
if !found {
shardSetIDs = append(shardSetIDs, value)
}
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.
Sure thing.
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.
LGTM
What this PR does / why we need it:
Keys related to the aggregator were not being cleaned up after placement deletion and as such there's no way to really cleanly reset an environment after aggregator has been setup (i.e. coordinator placement deleted, aggregator placement deleted and aggregator topic deleted).
Here were the remaining keys that should be removed if they still exist after placement deletion:
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: