googleapis / googleapis/ruby-spanner
tx.read() operation shouldn't increment seqno field
- 主要言語
- Ruby
- スター
- 6
- フォーク
- 24
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Background:
Cloud Spanner uses the [`seqno`](https://github.com/googleapis/googleapis/blob/dd546bf83f7aa6dd24e17d3e83d9a397a6dd680c/google/spanner/v1/spanner.proto#L629-L639) 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()`](https://github.com/googleapis/ruby-spanner/blob/c6cde4010632724449bc4a653221f94a9c262669/google-cloud-spanner/lib/google/cloud/spanner/transaction.rb#L711) 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()`](https://github.com/googleapis/ruby-spanner/blob/c6cde4010632724449bc4a653221f94a9c262669/google-cloud-spanner/lib/google/cloud/spanner/transaction.rb#L1169-L1185) 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.
コントリビューションガイド
調査の方向性
Start in google-cloud-spanner/lib/google/cloud/spanner/transaction.rb at Transaction#read() and safe_execute(), which the issue identifies as the relevant entry points. Trace how read queries affect @seqno and verify that a read leaves it unchanged while DML operations still advance it monotonically.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ruby
- 領域
- database
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 48/100