Can two updates to the same primary key land in unrelated change stream partitions (not parent-child)?

I’m trying to understand the exact partitioning semantics of Spanner Change Streams. Specifically:
– Table: users, primary key: user_id

-- Time T1
UPDATE users SET name = ‘Alice’ WHERE user_id = ‘A’;

-- Time T3 (after some partition event at T2)
UPDATE users SET name = ‘Bob’ WHERE user_id = ‘A’;
I know from the docs that:

  • “Change records for a particular primary key are returned only on one partition for a particular time range.”
  • “The changes to a row defined by its primary key can be captured in one change stream partition for a specific time range, and then be captured in a different change stream partition for a different time range.”
    So I understand that the two updates can land in different partitions across a split/merge boundary via parent-child lineage (e.g., parent partition P1 holds the first update, child partition P1_child holds the second).
    My question is about unrelated lineages. Is it possible for the two updates to land in partitions with NO parent-child relationship? For example:
    Parent A ──split──:play_button: Child A1, Child A2
    Parent B ──split──:play_button: Child B1, Child B2

Record 1 (T1, pk=A) → Parent A
Record 2 (T3, pk=A) → Child B1 (child of Parent B, NOT Parent A)
I see that PartitionEventRecord supports move_in_events and move_out_events for key range moves between partitions. Does Spanner’s rebalancer actually move key ranges across unrelated partition lineages in practice, or is a primary key’s movement always confined to a single parent->child->grandchild chain?
Also:

  • If cross-lineage moves do happen, are they fully tracked via PartitionEventRecord such that a consumer following the correct protocol never misses or double-processes a record?
  • Does the constraint “records from child partitions should be processed only after records from all parent partitions have been processed” still apply when the child has moved in from an unrelated partition?
1 Like