Skip to content

tx.read() operation shouldn't increment seqno field #64

@SandeepTuniki

Description

@SandeepTuniki

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: spannerIssues related to the Spanner API.priority: p3Desirable enhancement or fix. May not be included in next release.type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions