googleapis / googleapis/ruby-spanner
tx.read() operation shouldn't increment seqno field
- Ngôn ngữ chính
- Ruby
- Star
- 6
- Fork
- 24
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu trong google-cloud-spanner/lib/google/cloud/spanner/transaction.rb tại Transaction#read() và safe_execute(), những điểm mà issue xác định là các entry point liên quan. Theo dõi cách các truy vấn đọc ảnh hưởng đến @seqno và xác minh rằng một thao tác đọc giữ nguyên giá trị này, trong khi các thao tác DML vẫn tăng nó theo thứ tự đơn điệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ruby
- Lĩnh vực
- database
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 48/100