-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Version vector: compute locations only once during commits. #11924
base: main
Are you sure you want to change the base?
Conversation
…y once, as recalcuating could generate a different random number, hence a different set of locations.
Result of foundationdb-pr-clang-ide on Linux CentOS 7
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux CentOS 7
|
Result of foundationdb-pr on Linux CentOS 7
|
@@ -842,6 +845,15 @@ struct LogPushData : NonCopyable { | |||
Tag chooseRouterTag() { | |||
return savedRandomRouterTag.present() ? savedRandomRouterTag.get() : logSystem->getRandomRouterTag(); | |||
} | |||
|
|||
void getPushLocations(std::vector<Tag> const& tags, std::vector<int>& locations, bool allLocations = false) { |
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.
This is not using tags
, which can be a much smaller set than the set storedLocations
. So this doesn't seem right.
The idea of logSystem->getPushLocations()
is to find the tlogs that should receive the tags. We don't want to send the message to a tlog that doesn't have to receive it.
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.
Yes, we may send the message to more tLogs than we need to, which is suboptimal. I will think of a way to optimize that.
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.
As I thought more about it, this is called by writeTypedMessage()
, which is called almost on every mutation, e.g., in writeMutation()
. So I think we need to optimize this to avoid sending every mutation to all tlogs.
Result of foundationdb-pr-clang-ide on Linux CentOS 7
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux CentOS 7
|
Result of foundationdb-pr on Linux CentOS 7
|
@@ -853,8 +865,7 @@ void LogPushData::writeTypedMessage(T const& item, bool metadataMessage, bool al | |||
for (auto& tag : next_message_tags) { | |||
prev_tags.push_back(tag); |
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.
What is the difference between "prev_tags" and "tags"? And, why is "tags" being used in place of "prev_tags" in the other/later commit?
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 we sure that the "prev_tags"/"tags" that is being used here is exactly the same set of tags that the resolver uses too? Or, is it possible that meta mutations (like, move_keys) can cause this set to be different on the resolver and the proxy?
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.
What is the difference between "prev_tags" and "tags"? And, why is "tags" being used in place of "prev_tags" in the other/later commit?
They are the same. I can remove tags
and just use prev_tags
as it is a class member.
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 we sure that the "prev_tags"/"tags" that is being used here is exactly the same set of tags that the resolver uses too? Or, is it possible that meta mutations (like, move_keys) can cause this set to be different on the resolver and the proxy?
Recall that the reason we moved metadata mutation processing to the Resolver was to handle move_keys and similar cases. We did this in order to calculate the tpcv
locations out of the complete set of tags for the batch. Version vector will not work unless that set is complete.
During commits with version vector enabled, compute location list only once on the resolver. Recalculating a second time could generate a different random number, hence a different set of locations. The location list is generted with a call to
getPushLocations
, which chooses random locations if the total number of tLogs mod the replica count results in collisions.Tested by loading commits from branch version-vector-disk-queue and observing
getPushLocations
is called in both the resolver and on the CP inassignMutationsToStorageServers
. Observed different locations chosen without the PR, resulting in data not sent to tLogs when it should have been. Added an assert if data was generated for a location but was not sent to a tLog to catch any such future cases.Joshua
20250204-185355-dlambrig-83a293ba8c4a1d87
Code-Reviewer Section
The general pull request guidelines can be found here.
Please check each of the following things and check all boxes before accepting a PR.
For Release-Branches
If this PR is made against a release-branch, please also check the following:
release-branch
ormain
if this is the youngest branch)