-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
None
-
Fully Compatible
-
v4.2
-
Execution Team 2019-08-26
-
69
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The code currently does this to timestamp the initial catalog write for index builds:
if (opCtx->recoveryUnit()->getCommitTimestamp().isNull() &&
replCoord->canAcceptWritesForDatabase(opCtx, "admin")) {
// Only primaries must timestamp this write. Secondaries run this from within a
// `TimestampBlock`. Primaries performing an index build via `applyOps` may have a
// wrapping commit timestamp that will be used instead.
opCtx->getServiceContext()->getOpObserver()->onOpMessage(
opCtx,
BSON("msg" << std::string(str::stream() << "Creating indexes. Coll: " << ns)));
}
Instead of canAcceptWritesForDatabase(), which incorrectly captures times when a primary is attempting to step down but hasn't yet, we can check for the node state to be STARTUP2; this bit of logic is attempting to differentiate between normal index builds that must be timestamped and index builds that are part of initial sync and must not be timestamped.
- is related to
-
SERVER-42843 shutting down a node while in PRIMARY state will flap writability flag
-
- Closed
-