mrproliu opened a new pull request, #1120:
URL: https://github.com/apache/skywalking-banyandb/pull/1120

   ## What
   
   Inspector reports cold-tier segments shorter than the configured
   `SegmentInterval` on multi-stage clusters — e.g. a 3-day segment under a
   15-day `SegmentInterval` for `sw_metricsHour`.
   
   ## Why
   
   Two independent bugs:
   
   1. **Receiver**: `segment.create()` used `IntervalUnit.Standard`, which
      aligned `start` only to day / hour boundaries — `Num` was ignored.
      Out-of-order chunked-sync arrivals during lifecycle migration could
      create new segments that got truncated by an existing later neighbour,
      producing a span shorter than configured.
   2. **Sender**: `getTargetStageInterval` always returned `Stages[0]`. On
      3+ stage clusters this fed the wrong (current-stage) interval into
      target bucket math and progress keys for non-first-stage migrations.
   
   ## How
   
   - New `IntervalRule.Standard(t)` aligns to a `Num*Unit`-from-epoch grid in
     UTC and returns the result in `t.Location()`. `segment.create` and
     `wqueue.GetTimeRange` now use it.
   - `segment.create` bumps the aligned `start` past any legacy off-grid
     neighbour so writes are never routed into a segment whose nominal range
     no longer covers them.
   - `GroupConfig.TargetSegmentInterval` carries the actual next-stage interval,
     populated by `parseGroup` and read by `getTargetStageInterval`.
   
   ## Compatibility
   
   Existing data is untouched. Legacy off-grid segments continue to function and
   age out via TTL. A new `INFO` log surfaces the transition-period case where
   a new segment is forced shorter than its configured `SegmentInterval` due to
   a legacy neighbour — self-heals once the neighbour ages out.
   
   ## Tests
   
   - `IntervalRule.Standard`: epoch-grid alignment, location preservation,
     pre-epoch floor division.
   - `segment.create`: same / adjacent bucket out-of-order arrival, hour
     intervals, 32-goroutine concurrent alignment, legacy-neighbour
     no-misroute, persisted metadata round-trip.
   - Lifecycle: `getTargetStageInterval` table-driven across 2 / 3 / 4-stage
     configs and all fallback paths; 64-goroutine concurrent reader.
   - Updated `rotation_test.go` and `wqueue_test.go` assertions to align with
     the new grid behavior.
   
   - [ ] If this pull request closes/resolves/fixes an existing issue, replace 
the issue number. Fixes apache/skywalking#<issue number>.
   - [x] Update the [`CHANGES` 
log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to