adding system priority option to getDatabaseConfiguration, and several debugging improvements (#9864)

This commit is contained in:
Josh Slocum 2023-04-06 15:08:40 -05:00 committed by GitHub
parent 396f89a3f4
commit aef5130da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View File

@ -673,7 +673,10 @@ TEST_CASE("/ManagementAPI/ChangeConfig/TenantAndEncryptMode") {
return Void();
}
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Transaction* tr) {
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Transaction* tr, bool useSystemPriority) {
if (useSystemPriority) {
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
}
tr->setOption(FDBTransactionOptions::READ_LOCK_AWARE);
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
RangeResult res = wait(tr->getRange(configKeys, CLIENT_KNOBS->TOO_MANY));
@ -683,11 +686,11 @@ ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Transaction* tr) {
return config;
}
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Database cx) {
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Database cx, bool useSystemPriority) {
state Transaction tr(cx);
loop {
try {
DatabaseConfiguration config = wait(getDatabaseConfiguration(&tr));
DatabaseConfiguration config = wait(getDatabaseConfiguration(&tr, useSystemPriority));
return config;
} catch (Error& e) {
wait(tr.onError(e));

View File

@ -41,8 +41,8 @@ standard API and some knowledge of the contents of the system key space.
#include "fdbclient/MonitorLeader.h"
#include "flow/actorcompiler.h" // has to be last include
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Transaction* tr);
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Database cx);
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Transaction* tr, bool useSystemPriority = false);
ACTOR Future<DatabaseConfiguration> getDatabaseConfiguration(Database cx, bool useSystemPriority = false);
ACTOR Future<Void> waitForFullReplication(Database cx);
struct IQuorumChange : ReferenceCounted<IQuorumChange> {

View File

@ -5522,16 +5522,20 @@ ACTOR Future<Void> blobWorker(BlobWorkerInterface bwInterf,
state Reference<BlobWorkerData> self(new BlobWorkerData(bwInterf.id(), dbInfo, cx, persistentData));
self->id = bwInterf.id();
self->locality = bwInterf.locality;
TraceEvent("BlobWorkerInitStart", self->id).detail("Recovering", false).log();
try {
// Since the blob worker gets initalized through the blob manager it is more reliable to fetch the encryption
// state using the DB Config rather than passing it through the initalization request for the blob manager and
// blob worker
state Future<DatabaseConfiguration> configFuture = getDatabaseConfiguration(cx);
state Future<DatabaseConfiguration> configFuture = getDatabaseConfiguration(cx, true);
if (self->storage) {
wait(self->storage->init());
self->storage->set(KeyValueRef(persistID, BinaryWriter::toValue(self->id, Unversioned())));
wait(self->storage->commit());
TraceEvent("BlobWorkerStorageInitComplete", self->id).log();
}
if (BW_DEBUG) {
@ -5604,6 +5608,8 @@ ACTOR Future<Void> blobWorker(BlobWorkerInterface bwInterf,
state Reference<BlobWorkerData> self(new BlobWorkerData(bwInterf.id(), dbInfo, cx, persistentData));
self->id = bwInterf.id();
self->locality = bwInterf.locality;
TraceEvent("BlobWorkerInitStart", self->id).detail("Recovering", true).log();
try {
wait(self->storage->init());
wait(self->storage->commit());
@ -5616,7 +5622,7 @@ ACTOR Future<Void> blobWorker(BlobWorkerInterface bwInterf,
// Since the blob worker gets initalized through the blob manager it is more reliable to fetch the encryption
// state using the DB Config rather than passing it through the initalization request for the blob manager and
// blob worker
state Future<DatabaseConfiguration> configFuture = getDatabaseConfiguration(cx);
state Future<DatabaseConfiguration> configFuture = getDatabaseConfiguration(cx, true);
if (BW_DEBUG) {
printf("Initializing blob worker s3 stuff\n");

View File

@ -353,7 +353,9 @@ public:
TraceEvent("RkMinBlobWorkerVersion")
.detail("BWVersion", minVer)
.detail("MaxVer", self->maxVersion)
.detail("MinId", blobWorkers.size() > 0 ? blobWorkers[minIdx].id() : UID());
.detail("MinId", blobWorkers.size() > 0 ? blobWorkers[minIdx].id() : UID())
.detail("BMBlocked",
now() - self->unblockedAssignmentTime >= SERVER_KNOBS->BW_MAX_BLOCKED_INTERVAL);
}
}
wait(blobWorkerDelay);