Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ba36622
main: reproduce the TTL migration losing local leader groups
claude Oct 16, 2026
47f852e
kv, main, adapter: keep local leader groups through the coordinator w…
claude Oct 16, 2026
44725dd
main: guard every ShardedCoordinator capability through the startup w…
claude Oct 16, 2026
35f698e
main: forward LinearizableReadForKey through the startup gate
claude Oct 16, 2026
b0d42e8
adapter: reproduce TTL migration refusing every shard but the first
claude Oct 16, 2026
301aaa0
kv, adapter: scan each local leader group's own share of the TTL anchors
claude Oct 16, 2026
d795cd3
kv, adapter: reproduce the group-owned scan's staged, bound and legac…
claude Oct 16, 2026
50494e8
kv, adapter: bound the group-owned scan, defer staged routes, serve l…
claude Oct 16, 2026
aebfb98
Merge main into feature/focused-pascal-dbr58v
claude Oct 16, 2026
8fec364
kv, adapter: reproduce legacy-route rows served against the owner's s…
claude Oct 16, 2026
49af1bf
kv: serve legacy-route rows only while the logical owner holds none
claude Oct 16, 2026
8ca392b
adapter: reproduce TTL-inline ticks starving later scan plans
claude Oct 16, 2026
5c3fc97
adapter: rotate TTL-inline scan plans across ticks
claude Oct 16, 2026
832b048
kv: reproduce the group-owned scan re-reading every wide-column row
claude Oct 16, 2026
a73a7c0
kv: skip the point-read pass for rows the group-owned scan serves
claude Oct 16, 2026
5ac9319
backup: allow pebble's sstable reader through the import boundary
claude Oct 17, 2026
5ddbf9c
Merge main into feature/focused-pascal-dbr58v
claude Oct 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions adapter/redis_delta_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ type DeltaCompactor struct {
// quickly without waiting for the next scheduled pass.
urgentCh chan urgentCompactionRequest

stateMu sync.Mutex
backoffUntil time.Time
handlerCursor int
stateMu sync.Mutex
backoffUntil time.Time
// handlerCursor and ttlInlinePlanCursor are where the next tick's
// background handlers and TTL-inline scan plans start, so a tick that runs
// out of budget hands the rest of the rotation to the next one.
handlerCursor int
ttlInlinePlanCursor int

ttlInlineGroupsUnknownOnce sync.Once
}

// DeltaCompactorOption configures a DeltaCompactor.
Expand Down Expand Up @@ -340,7 +346,7 @@ func (c *DeltaCompactor) compactBackgroundHandlers(ctx context.Context, readTS u
return nil
}
handlers := c.allHandlers()
start := c.backgroundHandlerStart(len(handlers))
start := c.rotationStart(&c.handlerCursor, len(handlers))
var combined error
for offset := range handlers {
if ctx.Err() != nil {
Expand All @@ -349,33 +355,36 @@ func (c *DeltaCompactor) compactBackgroundHandlers(ctx context.Context, readTS u
idx := (start + offset) % len(handlers)
h := handlers[idx]
err := c.compactHandlerSafely(ctx, h, readTS)
c.advanceBackgroundHandlerCursor(idx, len(handlers))
c.advanceRotation(&c.handlerCursor, idx, len(handlers))
if err != nil && !errors.Is(err, context.Canceled) {
combined = errors.CombineErrors(combined, err)
}
}
return errors.WithStack(combined)
}

func (c *DeltaCompactor) backgroundHandlerStart(total int) int {
// rotationStart returns where a rotation over total items starts this tick.
// cursor is one of the compactor's rotation cursors, guarded by stateMu.
func (c *DeltaCompactor) rotationStart(cursor *int, total int) int {
if total <= 0 {
return 0
}
c.stateMu.Lock()
defer c.stateMu.Unlock()
if c.handlerCursor < 0 || c.handlerCursor >= total {
c.handlerCursor = 0
if *cursor < 0 || *cursor >= total {
*cursor = 0
}
return c.handlerCursor
return *cursor
}

func (c *DeltaCompactor) advanceBackgroundHandlerCursor(current, total int) {
// advanceRotation moves cursor past current, the item a tick just ran.
func (c *DeltaCompactor) advanceRotation(cursor *int, current, total int) {
if total <= 0 {
return
}
c.stateMu.Lock()
defer c.stateMu.Unlock()
c.handlerCursor = (current + 1) % total
*cursor = (current + 1) % total
}

func (c *DeltaCompactor) compactHandlerSafely(ctx context.Context, h collectionDeltaHandler, readTS uint64) (err error) {
Expand Down
Loading
Loading