-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
Storage NYC 2019-05-06
-
64
During the first drain phase of hybrid index builds, operations are applied in batches from the side table record store into the index. At the end of each batch (1000 operations by default), the side table cursor is saved and restored. This restore may reposition on new records, but not necessarily the newest records. This can cause batch applications after yield to apply causal operations out of order.
For example, imagine two writer threads, A and B, writing into the side table and an index build thread. In this example, thread A inserts then deletes the key {a: 1}. Thread B inserts an unrelated key.
writer A | writer B | index builder |
---|---|---|
start_transaction | ||
RID 1: insert key {a: 1} | ||
start_transaction | ||
RID 2: insert key {b: 1} | ||
commit_transaction | ||
Apply side write for RID 2 in a single batch. Save cursor. Commit. | ||
RID 3: delete key {a: 1} | ||
commit_transaction | ||
Reposition cursor on RID 3. Apply side write for RID 3 in a single batch. Save cursor. Commit | ||
Reposition cursor on RID 1. Apply side write for RID 1 in a single batch. Commit |
In this scenario, it is possible to insert the key {a: 1} into the index even after it has been deleted.
The fix for this bug should be to reposition cursors at the beginning of the record store after every yield to guarantee all causally related records are applied in order.
- related to
-
SERVER-40894 Remove unused setGhostCommitTimestampForWrite() and TimestampIndexBuildDrain
- Closed