Skip to content

Commit

Permalink
Reacquire shadow disk to read-only after changed to ready with long t…
Browse files Browse the repository at this point in the history
…imeout
  • Loading branch information
drbasic committed Dec 25, 2024
1 parent 527dc89 commit da24f35
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ bool TShadowDiskActor::AreWritesToSrcDiskForbidden() const

bool TShadowDiskActor::AreWritesToSrcDiskImpossible() const
{
return AreWritesToSrcDiskForbidden() || ForcedReAcquireInProgress;
return AreWritesToSrcDiskForbidden() ||
(ForcedReAcquireInProgress && State == EActorState::Preparing);
}

bool TShadowDiskActor::WaitingForAcquire() const
Expand Down Expand Up @@ -1166,7 +1167,12 @@ bool TShadowDiskActor::HandleRWClientIdChanged(
}

// Reacquire shadow disk with new clientId.
AcquireShadowDisk(ctx, EAcquireReason::ForcedReAcquire);
const bool clientChanged =
CurrentShadowDiskClientId !=
MakeShadowDiskClientId(SourceDiskClientId, ReadOnlyMount());
if (clientChanged || !WaitingForAcquire()) {
AcquireShadowDisk(ctx, EAcquireReason::ForcedReAcquire);
}

// It is necessary to handle the EvRWClientIdChanged message in the base
// class TNonreplicatedPartitionMigrationCommonActor too.
Expand Down

0 comments on commit da24f35

Please sign in to comment.