-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
ALL
-
Execution Team 2024-04-01
If you have documents and an index {a: 1}:
// Collection: $recordId: 1 -> {_id: 1, a: 1} $recordId: 2 -> {_id: 2 a: 2} $recordId: 3 -> {_id: 3, a: 3} // {a: 1} index: {a: 1} -> $recordId: 1 {a: 2} -> $recordId: 2 {a: 3} -> $recordId: 3
Perform an insert via applyOps:
db.runCommand({ applyOps: [ { "op" : "i", "ns" : "test.mycoll", "o" : { "_id" : 34, "a": 34 }, "o2" : { "_id" : 34, }, "rid": NumberLong(1) } ] })
In the collection, we end up overwriting the document. But in the index, we add a new entry!
// Collection: $recordId: 1 -> {_id: 34, a: 34} $recordId: 2 -> {_id: 2 a: 2} $recordId: 3 -> {_id: 3, a: 3} // {a: 1} index: {a: 1} -> $recordId: 1 {a: 2} -> $recordId: 2 {a: 3} -> $recordId: 3 {a: 34} -> $recordId: 1 // new entry
And if you delete the document with {a: 34}, you'll have a dangling index entry:
// Collection: $recordId: 2 -> {_id: 2 a: 2} $recordId: 3 -> {_id: 3, a: 3} // {a: 1} index: {a: 1} -> $recordId: 1 // dangling {a: 2} -> $recordId: 2 {a: 3} -> $recordId: 3
- is related to
-
SERVER-90120 RecordIds can be reused
- Backlog
- related to
-
SERVER-88375 Initial sync / secondary oplog application don't update _nextId for recordId
- Open
-
SERVER-89741 Startup recovery / recoverFromOplogAsStandalone must work with recordIdsReplicated:true
- Closed