Xline icon indicating copy to clipboard operation
Xline copied to clipboard

[Bug]: requests in a single txn do not execute in sequence

Open bsbds opened this issue 8 months ago • 1 comments

The operations in a single txn should be executed sequentially. However in Xline, we don't check for conflicts inside a single txn, all commands result are based on the storage state before the txn is exected. This behaviour is inconsistent with etcd.

bsbds avatar Oct 08 '23 03:10 bsbds

Background

We have two stage execute and after_sync, however during a multi-request txn execution of these two stage, one executing child request does not see the effect of a previous executed child request.

Solution

To resolve this issue, an extra state during these stages is required. Let's call it TxnState. We create this temporary state every time when execting a txn request. For a put and delete_range request, we update the TxnState, and for a range or compare, we read from both the TxnState and current storage, and use the merged result for the request.

bsbds avatar Nov 02 '23 03:11 bsbds