Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: SpannerIO Change Streams may skip ChildPartitionsRecord when advancing tracker to artificial query end timestamp

Aperta
#40,232 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
google-cloud, java

Direzione di ricerca

The issue is in QueryChangeStreamAction.java around line 360. Start by understanding the restriction tracker and how it claims timestamps. Look at the logic for unbounded queries when stopAfterQuerySucceeds is false. The fix is to avoid advancing the tracker to the artificial changeStreamQueryEndTimestamp and instead leave it at the last claimed position. Run tests related to Spanner Change Streams to verify the fix doesn't break existing behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

io java P1
What happened?

When reading from an unbounded Spanner Change Stream (or a Mutable Change Stream with a capped query end timestamp), QueryChangeStreamAction issues change stream queries with an artificial changeStreamQueryEndTimestamp (now + 2 minutes).

Previously, when the query completed and needed to resume (!stopAfterQuerySucceeds), QueryChangeStreamAction called tracker.tryClaim(changeStreamQueryEndTimestamp) before returning ProcessContinuation.resume():

https://github.com/apache/beam/blob/ac4acbb6282/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.java#L360-L365

In a very rare timing corner case where a change stream query finishes without returning the ChildPartitionsRecord at the end of a partition's range, claiming changeStreamQueryEndTimestamp can advance the restriction tracker past the partition's actual end timestamp. On the next continuation, the query resumes from changeStreamQueryEndTimestamp + 1ns, which falls outside the partition's valid timestamp range and returns an out-of-range start_timestamp error, causing QueryChangeStreamAction to mark the partition FINISHED before scheduling its child partitions.

Workaround & Scope

This is a client-side workaround in Apache Beam for this rare edge case while a fix is being implemented on the Spanner server side:

  • Unbounded queries: When !stopAfterQuerySucceeds, leaving the restriction tracker at the last claimed position (from the last processed data or heartbeat record) instead of advancing to changeStreamQueryEndTimestamp ensures the subsequent query resumes from lastClaimedTimestamp + 1ns and reads any remaining records (including ChildPartitionsRecord) before the partition ends. This workaround addresses the issue for unbounded queries.
  • Bounded queries: For bounded queries where changeStreamQueryEndTimestamp reaches endTimestamp (stopAfterQuerySucceeds == true), this client-side workaround does not apply and will be addressed by the Spanner server-side fix.
Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components
  • Component: Java SDK
  • Component: IO Connectors
Lingua principale
Java
Stelle
8.7k
Fork
4.7k
Merge medio
2g 8h
PR unite (30g)
246

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/beam

Tutte le issue di apache/beam

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.