diff --git a/fdbserver/DataDistributionQueue.actor.cpp b/fdbserver/DataDistributionQueue.actor.cpp index ced7696618..a7f0ad5287 100644 --- a/fdbserver/DataDistributionQueue.actor.cpp +++ b/fdbserver/DataDistributionQueue.actor.cpp @@ -1449,10 +1449,11 @@ ACTOR Future BgDDMountainChopper(DDQueueData* self, int teamCollectionInde state Transaction tr(self->cx); state double lastRead = 0; state bool skipCurrentLoop = false; + state bool disableReadBalance = false; + state bool disableDiskBalance = false; + loop { state bool moved = false; - state bool disableReadBalance = false; - state bool disableDiskBalance = false; state Reference sourceTeam; state Reference destTeam; state GetTeamRequest srcReq; @@ -1471,19 +1472,19 @@ ACTOR Future BgDDMountainChopper(DDQueueData* self, int teamCollectionInde tr.setOption(FDBTransactionOptions::LOCK_AWARE); Optional val = wait(tr.get(rebalanceDDIgnoreKey)); lastRead = now(); - if (skipCurrentLoop && !val.present()) { + if (!val.present()) { // reset loop interval - rebalancePollingInterval = SERVER_KNOBS->BG_REBALANCE_POLLING_INTERVAL; + if (skipCurrentLoop) { + rebalancePollingInterval = SERVER_KNOBS->BG_REBALANCE_POLLING_INTERVAL; + } skipCurrentLoop = false; - } else if (val.present()) { + disableReadBalance = false; + disableDiskBalance = false; + } else { if (val.get().size() > 0) { int ddIgnore = BinaryReader::fromStringRef(val.get(), Unversioned()); - if (ddIgnore & DDIgnore::REBALANCE_DISK) { - disableDiskBalance = true; - } - if (ddIgnore & DDIgnore::REBALANCE_READ) { - disableReadBalance = true; - } + disableDiskBalance = (ddIgnore & DDIgnore::REBALANCE_DISK) > 0; + disableReadBalance = (ddIgnore & DDIgnore::REBALANCE_READ) > 0; skipCurrentLoop = disableReadBalance && disableDiskBalance; } else { skipCurrentLoop = true; @@ -1564,11 +1565,11 @@ ACTOR Future BgDDValleyFiller(DDQueueData* self, int teamCollectionIndex) state Transaction tr(self->cx); state double lastRead = 0; state bool skipCurrentLoop = false; + state bool disableReadBalance = false; + state bool disableDiskBalance = false; loop { state bool moved = false; - state bool disableReadBalance = false; - state bool disableDiskBalance = false; state Reference sourceTeam; state Reference destTeam; state GetTeamRequest srcReq; @@ -1587,19 +1588,19 @@ ACTOR Future BgDDValleyFiller(DDQueueData* self, int teamCollectionIndex) tr.setOption(FDBTransactionOptions::LOCK_AWARE); Optional val = wait(tr.get(rebalanceDDIgnoreKey)); lastRead = now(); - if (skipCurrentLoop && !val.present()) { + if (!val.present()) { // reset loop interval - rebalancePollingInterval = SERVER_KNOBS->BG_REBALANCE_POLLING_INTERVAL; + if (skipCurrentLoop) { + rebalancePollingInterval = SERVER_KNOBS->BG_REBALANCE_POLLING_INTERVAL; + } + skipCurrentLoop = false; + disableReadBalance = false; + disableDiskBalance = false; } else if (val.present()) { - // FIXME: better way for upgrade? for example, using a new key to record mode - if (val.get().size() > sizeof(int)) { + if (val.get().size() > 0) { int ddIgnore = BinaryReader::fromStringRef(val.get(), Unversioned()); - if (ddIgnore & DDIgnore::REBALANCE_DISK) { - disableDiskBalance = true; - } - if (ddIgnore & DDIgnore::REBALANCE_READ) { - disableReadBalance = true; - } + disableDiskBalance = (ddIgnore & DDIgnore::REBALANCE_DISK) > 0; + disableReadBalance = (ddIgnore & DDIgnore::REBALANCE_READ) > 0; skipCurrentLoop = disableReadBalance && disableDiskBalance; } else { skipCurrentLoop = true; diff --git a/fdbserver/workloads/BulkSetup.actor.h b/fdbserver/workloads/BulkSetup.actor.h index 039e99a9f2..fc7db9cf05 100644 --- a/fdbserver/workloads/BulkSetup.actor.h +++ b/fdbserver/workloads/BulkSetup.actor.h @@ -294,7 +294,8 @@ Future bulkSetup(Database cx, // Here we wait for data in flight to go to 0 (this will not work on a database with other users) if (postSetupWarming != 0) { try { - wait(delay(5.0) >> waitForLowInFlight(cx, workload)); // Wait for the data distribution in a small test to start + wait(delay(5.0) >> + waitForLowInFlight(cx, workload)); // Wait for the data distribution in a small test to start } catch (Error& e) { if (e.code() == error_code_actor_cancelled) throw;