Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
Description
To insert a record into the primary index, the primary index will first search itself and only perform the insertion if the old record does not exist. However, the index search operation and the insertion operation are not atomic because index search does not lock the primary key; it is possible that two writers that insert records with the same key can both pass the uniqueness test and insert the record twice.
We should lock the primary key during index search, as we did for doing upsert.