-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Optimize out the version vector specific code (on the client) when the feature is disabled #7482
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
Conversation
when the version vector feature is disabled.
| // Cache of the latest commit versions of storage servers. | ||
| VersionVector ssVersionVectorCache; | ||
|
|
||
| // Introduced mainly to optimize out the version vector related code (on the client side) |
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.
Shall we propagate the version vector knob enable/disable information, from GRV proxy to client, in "GetReadVersionReply" message and use that information in place of using this check? But I think that idea may not work correctly on recovery boundaries (because "GetReadVersionReply" messages may cross recovery boundaries). We can explore that idea further if we think that is a better approach than using this check.
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.
- it seems returning vv status from the GRV request would be better- Can the client use the fact that new GRV proxies were created (
monitorClientDBInfoChange) as a signal that recovery happened? - I'd prefer removing
mayNeedfrom the function name. It sounds ambiguous.. perhaps rename toversionVectorCacheActive() - can you make this an inline function for speed
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.
Done.
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.
it seems returning vv status from the GRV request would be better-
I thought more about it. This might not work if the knob was turned on before recovery and turned off after that. The version vector cache (on the client) won't get cleared after recovery and reads could reference a stale latest commit version from the version vector.
Doxense CI Report for Windows 10
|
Result of foundationdb-pr-macos on macOS BigSur 11.5.2
|
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr on Linux CentOS 7
|
- Optiize out the code in DatabaseContext::getLatestCommitVersions() in the case where the feature is turned off.
Result of foundationdb-pr-macos on macOS BigSur 11.5.2
|
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr on Linux CentOS 7
|
| // Introduced mainly to optimize out the version vector related code (on the client side) | ||
| // when the version vector feature is disabled (on the server side). | ||
| // @param ssVersionVectorDelta version vector changes sent by GRV proxy | ||
| inline bool versionVectorCacheActive(const VersionVector& ssVersionVectorDelta) { |
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.
it looks like the version vector constructor initializes maxVersion to invalidVersion for ssVersionVectorCache. From that point forward, the PR makes things such that we don't allow ssVersionVectorCache to be modified with clear() or applyDelta() if maxVersion is set to invalidVersion.
So ssVersionVectorCache will never be set? I may be misunderstanding the code.. !
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.
From that point forward, the PR makes things such that we don't allow ssVersionVectorCache to be modified with clear() or applyDelta() if maxVersion is set to invalidVersion.
Not quite. We don't allow ssVersionVectorCache to be modified if (a) maxVersion is set to invalidVersion and (b) the version vector delta received from the GRV also has maxVersion set to invalidVersion. Basically, invoking "clear()" or "applyDelta()" won't have any effect in this case.
| if (cx->isCurrentGrvProxy(v.proxyId)) { | ||
| cx->ssVersionVectorCache.applyDelta(v.ssVersionVectorDelta); | ||
| } else { | ||
| continue; // stale GRV reply, retry |
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.
Unrelated to this change, this line can potentially become a busy loop. Maybe we should add a backoff here in a separate PR.
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.
On "continue" another "GetReadVersionRequest" gets sent, and wouldn't it wait on the "choose" statement after that? Trying to understand how it will become a busy loop. But maybe we can discuss that offline.
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS BigSur 11.5.2
|
Result of foundationdb-pr on Linux CentOS 7
|
Optimize out the version vector specific code (on the client) when the feature is disabled
Optimize out the version vector specific code (on the client) when the feature is disabled
Optimize out the version vector specific code on the client (the code that tries to update the version vector on receiving a read version reply from a GRV proxy, and the code in "DatabaseContext::getLatestCommitVersions()") when the version vector feature is disabled.
Testing:
Simulation tests:
Compiler: gcc.
Version vector disabled: 20220629-102752-sre-16a065a2c3175517 (no failures).
Version vector enabled: 20220629-100711-sre-ced0735ad8d1075d (no failures).
Code-Reviewer Section
The general 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-branchormainif this is the youngest branch)