-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
As mentioned in the docuemnt, a write to a prepared document should block
If a write attempts to modify a document that was also modified by a prepared transaction, it will block and wait for the transaction to be committed or aborted before proceeding.
Assume there is a transaction txn2 want to update doc1, and doc1 is prepared by another transaction txn1.
According to this source code, txn1 only waits for a read operation.
WiredTigerRecordStore::updateRecord
int ret = wiredTigerPrepareConflictRetry(opCtx, [&] { return c->search(c); });
When txn1 commits or aborts, txn2 make progress for updating.
According to the code in wiredtiger, a update operation to a prepared upd causes transaction rollback.
There will be a situation as follows:
Concurrent transaction txn3 may update also prepare the document. If txn3 prepared doc1 before txn2 update doc1, txn2's update will failed, which contradicts the content in the document.
The events could be like this:
txn1 prepared doc1;
txn2 wants to update doc1 and blocks;
txn1 aborts;
txn2 ends blocking;
txn3 updates doc1 and prepared;
txn2 updates doc1 and failed.
txn2 will update after txn1 aborting, otherwise txn1 will rollback dute to txn2's update, so I guess when updating RecordStore, wirte lock are acquired, otherwise something bad will happen.
- is duplicated by
-
SERVER-60879 A update to a prepared document may faild
- Closed