fix: do not automatically reduce redundancy we move keys if the database does not have remote replicas. This is to prevent problems when dropping remote replicas from a configuration.

This commit is contained in:
Evan Tschannen 2018-06-08 16:17:27 -07:00
parent 48fbc407fd
commit b9826dc1cb
4 changed files with 7 additions and 5 deletions

View File

@ -955,6 +955,7 @@ ACTOR Future<Void> dataDistributionRelocator( DDQueueData *self, RelocateData rd
&self->startMoveKeysParallelismLock,
&self->finishMoveKeysParallelismLock,
self->recoveryVersion,
self->teamCollections.size() > 1,
relocateShardInterval.pairID );
state Future<Void> pollHealth = (!anyHealthy || signalledTransferComplete) ? Never() : delay( SERVER_KNOBS->HEALTH_POLL_TIME, TaskDataDistributionLaunch );
try {

View File

@ -407,8 +407,7 @@ ACTOR Future<Void> checkFetchingState( Database cx, vector<UID> dest, KeyRange k
// keyServers[k].dest must be the same for all k in keys
// Set serverKeys[dest][keys] = true; serverKeys[src][keys] = false for all src not in dest
// Should be cancelled and restarted if keyServers[keys].dest changes (?so this is no longer true?)
ACTOR Future<Void> finishMoveKeys( Database occ, KeyRange keys, vector<UID> destinationTeam,
MoveKeysLock lock, int durableStorageQuorum, FlowLock *finishMoveKeysParallelismLock, Version recoveryVersion, UID relocationIntervalId )
ACTOR Future<Void> finishMoveKeys( Database occ, KeyRange keys, vector<UID> destinationTeam, MoveKeysLock lock, int durableStorageQuorum, FlowLock *finishMoveKeysParallelismLock, Version recoveryVersion, bool hasRemote, UID relocationIntervalId )
{
state TraceInterval interval("RelocateShard_FinishMoveKeys");
state TraceInterval waitInterval("");
@ -568,7 +567,7 @@ ACTOR Future<Void> finishMoveKeys( Database occ, KeyRange keys, vector<UID> dest
state vector<UID> newDestinations;
std::set<UID> completeSrcSet(completeSrc.begin(), completeSrc.end());
for(auto& it : dest) {
if(!completeSrcSet.count(it)) {
if(!hasRemote || !completeSrcSet.count(it)) {
newDestinations.push_back(it);
}
}
@ -840,6 +839,7 @@ ACTOR Future<Void> moveKeys(
FlowLock *startMoveKeysParallelismLock,
FlowLock *finishMoveKeysParallelismLock,
Version recoveryVersion,
bool hasRemote,
UID relocationIntervalId)
{
ASSERT( destinationTeam.size() );
@ -848,7 +848,7 @@ ACTOR Future<Void> moveKeys(
state Future<Void> completionSignaller = checkFetchingState( cx, healthyDestinations, keys, dataMovementComplete, relocationIntervalId );
Void _ = wait( finishMoveKeys( cx, keys, destinationTeam, lock, durableStorageQuorum, finishMoveKeysParallelismLock, recoveryVersion, relocationIntervalId ) );
Void _ = wait( finishMoveKeys( cx, keys, destinationTeam, lock, durableStorageQuorum, finishMoveKeysParallelismLock, recoveryVersion, hasRemote, relocationIntervalId ) );
//This is defensive, but make sure that we always say that the movement is complete before moveKeys completes
completionSignaller.cancel();

View File

@ -61,6 +61,7 @@ Future<Void> moveKeys(
FlowLock* const& startMoveKeysParallelismLock,
FlowLock* const& finishMoveKeysParallelismLock,
Version const& recoveryVersion,
bool const& hasRemote,
UID const& relocationIntervalId); // for logging only
// Eventually moves the given keys to the given destination team
// Caller is responsible for cancelling it before issuing an overlapping move,

View File

@ -136,7 +136,7 @@ struct MoveKeysWorkload : TestWorkload {
state Promise<Void> signal;
Void _ = wait( moveKeys( cx, keys, destinationTeamIDs, destinationTeamIDs, lock,
self->configuration.durableStorageQuorum,
signal, &fl1, &fl2, invalidVersion, relocateShardInterval.pairID ) );
signal, &fl1, &fl2, invalidVersion, false, relocateShardInterval.pairID ) );
TraceEvent(relocateShardInterval.end()).detail("Result","Success");
return Void();
} catch (Error& e) {