Xline
Xline copied to clipboard
[Bug]: Read different values in execute during read state
Description
In read state, after the wait for cmd ids or log index are completed, we directly read from the current storage. However, I find that if there's multiple reads for a same key in a txn request, it might read different values.
The root cause of this is that duing serializable read there might be other commands being executed on the same server. And one txn may read the storage multiple times. Thus will lead to inconsistency in a single txn.
Solution
When we do read operations in a txn request, we specify a read_revision
for reads. When we execute a range request, we use the same read_revision to read the result. Thus this can gaurentee that we can read the same value for the same key.
Details
To obtain the read_revision
. We need let the barriers return the revision of that command we waited, and pass it to execute
in do_serializable
.