-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Layered Tables
-
Storage Engines - Foundations
-
147.937
-
SE Foundations - 2026-08-18
-
1
In __clayered_update_ingest, the branch that closes a leftover ingest cursor is guarded by CLAYERED_ENTER_ROLE_CHANGE. The branch is only reachable on a step-up today (a follower always sets CLAYERED_ENTER_OPEN_INGEST, so the close arm cannot fire on a step-down), but the guard is misleading and fragile: if a follower operation mode is ever added that skips opening the ingest constituent (the way CLAYERED_ENTER_SKIP_STABLE already exists for stable), a role-change guard would silently close the follower's ingest cursor on step-down and reads would miss ingest content written after the step-down timestamp.
Tighten the guard to CLAYERED_ENTER_STEP_UP so the close is structurally confined to the promoted leader, where the step-up drain has already moved ingest content into stable. Add regression coverage that a cursor which read ingest content while the step-down timestamp was set still sees that content through its first access after the demotion to follower, and after a subsequent promotion back to leader.