Skip to content

PSMDB-1846 More improvements for shutdown handling during FCBIS#1697

Merged
igorsol merged 3 commits intov8.0from
psmdb-1846
Feb 25, 2026
Merged

PSMDB-1846 More improvements for shutdown handling during FCBIS#1697
igorsol merged 3 commits intov8.0from
psmdb-1846

Conversation

@igorsol
Copy link

@igorsol igorsol commented Feb 25, 2026

This PR adjusts the file-copy-based initial sync flow when switching the storage location, aiming to make storage switching more robust during initial sync and shutdown races.

Changes:

  • Allow untimestamped writes (after abandoning any active snapshot) before aborting index builds during storage location switching.
  • Wrap _switchStorageLocation() in a function-level try/catch to convert DBExceptions into Status and add debug logging on failure.
  • Move/add shutdown checks to run after the storage switch in the download/dummy switch callbacks to better handle shutdown initiation during the unlocked window.

@igorsol igorsol requested a review from Copilot February 25, 2026 23:29
@igorsol igorsol changed the title Psmdb 1846 PSMDB-1846 More improvements for shutdown handling during FCBIS Feb 25, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the file-copy-based initial sync flow when switching the storage location, aiming to make storage switching more robust during initial sync and shutdown races.

Changes:

  • Allow untimestamped writes (after abandoning any active snapshot) before aborting index builds during storage location switching.
  • Wrap _switchStorageLocation() in a function-level try/catch to convert DBExceptions into Status and add debug logging on failure.
  • Move/add shutdown checks to run after the storage switch in the download/dummy switch callbacks to better handle shutdown initiation during the unlocked window.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1716 to +1720
// modifies _mdb_catalog.wt which requires untimestamped writes to be allowed.
// abandonSnapshot() first to ensure no active WT transaction (required by the invariant
// in allowAllUntimestampedWrites).
shard_role_details::getRecoveryUnit(opCtx)->abandonSnapshot();
shard_role_details::getRecoveryUnit(opCtx)->allowAllUntimestampedWrites();
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

_switchStorageLocation() now enables allowAllUntimestampedWrites() for the index-build abort path, but it doesn’t also disable replicated writes. In this same file, the other allowAllUntimestampedWrites() usage is immediately followed by UnreplicatedWritesBlock to ensure these local catalog writes don’t attempt to generate oplog entries / validation (see _truncateOplogAndDropReplicatedDatabases). Consider adding an UnreplicatedWritesBlock (or equivalent) here around the index-build abort/closeCatalog sequence so the behavior is consistent and safe during initial sync.

Copilot uses AI. Check for mistakes.
Comment on lines +1703 to 1705
const boost::optional<startup_recovery::StartupRecoveryMode> recoveryMode) try {
LOGV2_DEBUG(128469, 1, "Switching storage location", "newLocation"_attr = newLocation);
invariant(shard_role_details::getLocker(opCtx)->isW());
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The PR description still contains the default placeholder text (“Anything in this description will be included… Replace or delete this text before merging… Add links to testing…”). Please update the PR description (and include testing links) before merging so the commit message and review context are accurate.

Copilot uses AI. Check for mistakes.
@igorsol igorsol merged commit e33cc96 into v8.0 Feb 25, 2026
8 checks passed
@igorsol igorsol deleted the psmdb-1846 branch February 25, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants