Skip to content

Introduces a separate thread in the UserManager. #21857

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

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

johann-listunov
Copy link
Contributor

@johann-listunov johann-listunov commented Jul 15, 2025

Add a separate thread to the UserManger to handle the load of the user-cache asynchronously.
This pre-loads the user-cache as fast as possible (as soon as the global version changes)
Also, compared to the old version, this allows the read-only operation to work on the user-cache
for longer and not block each other while trying to load a new version. On a high load environment this also
means a more responsive UserManger.

Scope & Purpose

  • 💩 Bugfix
  • 🍕 New feature
  • 🔥 Performance improvement
  • 🔨 Refactoring/simplification

Checklist

  • Tests
    • Regression tests
    • C++ Unit tests
    • integration tests
    • resilience tests
  • 📖 CHANGELOG entry made
  • 📚 documentation written (release notes, API changes, ...)
  • Backports
    • Backport for 3.12.0: (Please link PR)
    • Backport for 3.11: (Please link PR)
    • Backport for 3.10: (Please link PR)

Related Information

(Please reference tickets / specification / other PRs etc)

  • Docs PR:
  • Enterprise PR:
  • GitHub issue / Jira ticket:
  • Design document:

@cla-bot cla-bot bot added the cla-signed label Jul 15, 2025

std::lock_guard guard{_loadFromDBLock}; // must be first
WRITE_LOCKER(writeGuard, _userCacheLock); // must be second
READ_LOCKER(readGuard, _userCacheLock); // must be second
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove comment.

@@ -379,27 +409,34 @@ VPackBuilder auth::UserManager::allUsers() {
}

void auth::UserManager::triggerCacheRevalidation() {
triggerLocalReload();
uint64_t versionToReloadTo = globalVersion() + 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be const.

}
}
// This test is not really applicable anymore.
// Neither triggerGlobalReload or triggerLocal reload are incrementing the
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// Neither triggerGlobalReload or triggerLocal reload are incrementing the
// Neither triggerGlobalReload or triggerLocalReload are incrementing the

@@ -229,7 +229,7 @@ function testSuite() {
}
let aliveStatus = waitForAlive(30, coordinator.url, { auth: { bearer: jwt } });
// note: this should actually work, but currently doesn't TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant