Skip to content
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

A mechanism to notify MVC about relevant client library status changes on the cluster #5857

Merged

Conversation

sfc-gh-vgasiunas
Copy link
Collaborator

Introducing 2 new statuses for uploaded client libraries: "download" and "active". The intention is that the "download" status instructs the clients to download the library, and "active" status to use the library to connect to the server. (The client-side behavior is not implemented yet). Whenever new client libraries are uploaded with one of those statuses, the clients are notified about these changes.

For notification we introduce a global client library change counter. It is maintained as a value the system key space, and is atomically incremented by the transactions that change client library status to "download" or "active". Cluster controller monitors the changes of the counter by monitoring it. It notifies the clients about the change over the ClientDBInfo structure, which is extended with an additional field to store change counter. Currently clients can monitor the changes by waiting on the DatabaseContext::onClientLibStatusChanged future.

ClientLibManagement workload is extended to test notifications after uploads and client library status changes.

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.

  • The PR has a description, explaining both the problem and the solution.
  • The description mentions which forms of testing were done and the testing seems reasonable.
  • Every function/class/actor that was touched is reasonably well documented.

For Release-Branches

If this PR is made against a release-branch, please also check the following:

  • This change/bugfix is a cherry-pick from the next younger branch (younger release-branch or master if this is the youngest branch)
  • There is a good reason why this PR needs to go into a release branch and this reason is documented (either in the description above or in a linked GitHub issue)

@sfc-gh-vgasiunas sfc-gh-vgasiunas requested review from xis19, sfc-gh-abeamon and sfc-gh-mpilman and removed request for xis19 October 26, 2021 17:49
@sfc-gh-vgasiunas
Copy link
Collaborator Author

Only the last 2 commits are new to this PR, the others are from the previous one. It seems is better to wait until the first PR is merged.

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: f304b61
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS Catalina 10.15

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: 875824b
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: 875824b
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: 276dbd4
  • Result: FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS Catalina 10.15

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: 276dbd4
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@@ -46,7 +47,7 @@ struct ClientLibBinaryInfo {
#define ASSERT_INDEX_IN_RANGE(idx, arr) ASSERT(idx >= 0 && idx < sizeof(arr) / sizeof(arr[0]))

const std::string& getStatusName(ClientLibStatus status) {
static const std::string statusNames[] = { "disabled", "available", "uploading" };
static const std::string statusNames[] = { "disabled", "available", "uploading", "download", "active" };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the available state represent? Would this be for clients to opt in to download it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Available means it is possible to download the library, but the clients are not instructed to download it yet. Maybe we don't need the that state. I introduced it before designing the client-side behavior.


void updateClientLibChangeCounter(Transaction& tr, ClientLibStatus status) {
static const int64_t counterIncVal = 1;
if (status == ClientLibStatus::DOWNLOAD || status == ClientLibStatus::ACTIVE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there states that would trigger a client to unload a library (e.g. if we switched from ACTIVE/DOWNLOAD to DISABLED)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good point. We should also notify about libraries losing "ACTIVE/DOWNLOAD" status or libraries with "ACTIVE/DOWNLOAD" being deleted.

@@ -489,7 +506,7 @@ ACTOR Future<Void> downloadClientLibrary(Database db,
}

// Allow downloading only libraries in the available state
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is out of date

fdbclient/ClientLibManagement.actor.cpp Show resolved Hide resolved
@@ -1467,7 +1494,7 @@ Reference<ClientInfo> MultiVersionApi::getLocalClient() {

void MultiVersionApi::selectApiVersion(int apiVersion) {
if (!localClient) {
localClient = makeReference<ClientInfo>(ThreadSafeApi::api);
// localClient = makeReference<ClientInfo>(ThreadSafeApi::api);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're getting rid of this, we can get rid of the whole if block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forgot to change this. It should take IClientApi::localApi here

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: 9408c11
  • Result: FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS Catalina 10.15

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: 9408c11
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS Catalina 10.15

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: d6a5cc8
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: d6a5cc8
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

sfc-gh-abeamon
sfc-gh-abeamon previously approved these changes Nov 10, 2021
@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS Catalina 10.15

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: 51b8ccf
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: 51b8ccf
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@sfc-gh-mpilman sfc-gh-mpilman merged commit 0dfb721 into apple:master Nov 11, 2021
@sfc-gh-vgasiunas sfc-gh-vgasiunas deleted the notify-client-lib-changes branch April 25, 2022 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants