googleapis / googleapis/ruby-spanner

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

Abierto
#64 0 comentarios 0 reacciones 0 asignados Ver en GitHub
api: spanner priority: p3 type: cleanup
Lenguaje dominante
Ruby
Estrellas
6
Forks
24
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
ruby
Área
database
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.