Skip to content

[Bug]: Bigtable segment truncation creates invalid range when open end key is startKey + null byte #39842

Description

@aa-dit-yuh

What happened?

What happened?

When reading from Cloud Bigtable using Apache Beam, reading is performed in buffered segments. When a segment hits memory limits or row limits during a read, Beam pauses the stream and calls truncateRequest to construct a new ReadRowsRequest for the remainder of the key range starting from (start_key_open: lastKey).
For key ranges where the open end key is the start key with an appended null byte (e.g., [K, K\0), common in single-row scans, prefix scans, or dynamic work rebalancing splits), EndPoint.compareTo compares "K\0" to "K", evaluating to endCmp > 0. Because endCmp > 0, truncateRequest did not skip the range after reading key K, and generated a request with (start_key_open: K, end_key_open: K\0).
Cloud Bigtable server validates start_key_open as K\0 and strictly enforces start_key < end_key. Because K\0 < K\0 is false, Bigtable server rejects the request with:

io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Error in field 'row_ranges' : Error in element #0 : start_key must be less than end_key

Issue Severity

Priority: 2 (intermittent pipeline failure under memory/buffer load)

Affected Versions

2.68.0, 2.69.0, 2.70.0, master

Component

Java SDK / sdks/java/io/google-cloud-platform (BigtableIO)

Issue Priority

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

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions