-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 7.0.0, 6.0.5, 8.0.0
-
Component/s: Sharding
-
None
-
Environment:Sharded cluster running multi-document or retryable transactions with
replica-set failovers (term changes) concurrent with the balancer,
moveChunk, or moveRange.
-
Cluster Scalability
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
🔵 Done
sent to the recipient, even though the recipient
already received the document while its pre-image was still in range.
After the migration commits and the recipient takes ownership of the
range, the recipient holds a document that no longer exists on the donor.
In effect, a deleted document is silently resurrected.
Affected code
- Donor reconciliation: MigrationChunkClonerSource::_processDeferredXferMods
in src/mongo/db/s/migration_chunk_cloner_source.cpp - Out-of-range delete drop: MigrationChunkClonerSource::onDeleteOp in
the same file
Proposed fix
In the "document not found" branch of the deferred reconciliation,
extract the shard key from the deferred pre-image document key. If the
pre-image fell inside the chunk range, enqueue a delete for that
_id to the recipient.
The delete is precise, because nothing is sent for documents the
recipient never received, and it is idempotent, because a duplicate
delete by _id simply removes nothing on the recipient.
Impact and severity
High. This is a silent data-integrity problem for sharded clusters that
combine prepared transactions, failovers (term changes), and chunk
migrations. The resulting orphaned documents can reappear in queries
routed to the new owning shard and can violate unique constraints.
See the pull request for the implementation:
mongodb/mongo#1819