Skip to content

[core] Register late bootstrap keys after unaligned checkpoints - #10295

Open
LuciferYang wants to merge 3 commits into
apache:masterfrom
LuciferYang:m/core-104-assigner-uc
Open

LuciferYang wants to merge 3 commits into
apache:masterfrom
LuciferYang:m/core-104-assigner-uc

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

Under unaligned checkpoints the barrier can overtake buffered KEY_PART records, so GlobalIndexAssigner.prepareSnapshotPreBarrier runs endBoostrap (setting bootstrap=false and nulling bootstrapKeys) while KEY_PART records are still queued. Those late records then reach bootstrapKey with bootstrap == false, where checkArgument(inBoostrap()) throws (and the now-null bootstrapKeys would NPE), crashing the assigner and re-failing on restart in the same window. Aligned checkpoints never hit this, since barrier alignment processes every pre-barrier KEY_PART before endBoostrap.

This registers a late bootstrap key directly into keyIndex instead of asserting inBoostrap(). It uses first-writer-wins (register only when the key is absent), so a late KEY_PART cannot overwrite an entry the running assigner already assigned to a live input row, which would otherwise leave keyIndex pointing at a bucket the data no longer lives in and misroute later same-key records into a cross-bucket duplicate primary key. The in-bootstrap buffering path and the aligned-checkpoint path are byte-for-byte unchanged.

Limitation: under unaligned-checkpoint reordering, if a data row for the same key is processed before the late KEY_PART, the record in the previously-assigned partition is not retracted. Preserving that ordering fully is an operator/checkpoint-layer concern beyond this assigner; this change keeps keyIndex self-consistent and removes the crash.

This closes #10294.

Tests

  • testLateBootstrapKeyAfterEndRegistersKey pins that a KEY_PART after endBoostrap registers instead of crashing.
  • testLateBootstrapKeyDoesNotOverwriteAssignedKey pins first-writer-wins: a late KEY_PART does not overwrite an already-assigned key.
  • testLateBootstrapKeyRegistersAndRetractsOldPartition pins the cross-partition registration path.

API and Format

No.

Documentation

No.

With execution.checkpointing.unaligned=true the checkpoint barrier
can run the assigner's endBootstrap while KEY_PART records from slower
channels are still queued. The first late bootstrapKey then failed
the in-bootstrap assertion, failing the task and likely restart-looping
under the same backpressure that motivated unaligned checkpoints.

A late KEY_PART record's purpose is only to register its key in the
index, which by then is bulk-loaded: put the key directly instead of
crashing.

Assisted-by: GLM-5.3
Guard the late-KEY_PART put with keyIndex.get(key)==null so a KEY_PART
arriving after endBoostrap under unaligned checkpoints cannot overwrite an
index entry an input record already assigned. Add tests pinning both the
no-overwrite guard and the late-key registration (cross-partition retraction).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GlobalIndexAssigner crashes on a late bootstrap key after an unaligned checkpoint

1 participant