Background:
Cloud Spanner uses the seqno field in DML statements of transactions to identify duplicate or out-of-order requests. This field is ignored for other queries. The value must always be monotonically increasing for every DML operation.
Problem:
The Transaction#read() method isn't a DML operation, and doesn't use the seqno field. Yet, when the user calls it, the @seqno value is auto-incremented. This is because the read query is executed inside the context of safe_execute() block.
While this won't cause any failure, we should avoid incrementing seqno for non-DML operations. This might lead to confusing debugging situations in the future, when the value is noticed to jump from n to n + 2 directly (for any n >= 1). This can happen if there are DML operations interleaved with a .read() operation.
Background:
Cloud Spanner uses the
seqnofield in DML statements of transactions to identify duplicate or out-of-order requests. This field is ignored for other queries. The value must always be monotonically increasing for every DML operation.Problem:
The
Transaction#read()method isn't a DML operation, and doesn't use theseqnofield. Yet, when the user calls it, the@seqnovalue is auto-incremented. This is because the read query is executed inside the context ofsafe_execute()block.While this won't cause any failure, we should avoid incrementing
seqnofor non-DML operations. This might lead to confusing debugging situations in the future, when the value is noticed to jump fromnton + 2directly (for any n >= 1). This can happen if there are DML operations interleaved with a.read()operation.