Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Label index and schema index updates are generated during application of each transaction and added to a queue to be applied using WorkSync at the at the end of the whole batch of transactions. Also concurrently applying transaction batches may apply their changes in the same "session", with the help of WorkSync. Order which transactions apply are coordinated using the high-level locks which are released per transaction after being fully applied. The exception to this is node creation, which doesn't acquire high-level lock. The saving grace has been, perhaps unknowingly the lower-level LockService, which is used only during commit and was introduced to allow safe property reading in the face of concurrent property updates. Since some time back that has been replaced by the safe-zone approach, but still remains for background index population, since index population cannot be tied to specific transaction id, which safe-zone revolves around. The LockService guarded for e.g. node CREATE followed by DELETE being reordered to DELETE followed by CREATE. Almost. It turns out that those locks were released before applying label index and schema index updates. This allowed a race where transactions could queue updates to the WorkSync in the wrong order, allowing the unexpected reordering mentioned above. The fix here is to hold the locks slightly longer so that closing of appliers happens before releasing them. This necessitates the LockGroup to be instantiated before the appliers, which means the locks will be held throughout a whole transaction batch, as opposed to held only for a single transaction in a batch. The only effect this has is to potentially delay some index population job currently running. A note here is that embedded mode never applies batches of sizes larger than 1, but clustered setups do.
- Loading branch information
Showing
3 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters