You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "hanahmily (via GitHub)" <gi...@apache.org> on 2026/04/09 06:06:06 UTC
[PR] fix(storage): disable rotation task on warm and cold lifecycle nodes [skywalking-banyandb]
hanahmily opened a new pull request, #1055:
URL: https://github.com/apache/skywalking-banyandb/pull/1055
### Fix apache/skywalking#13793 - Warm stage segments exceed configured segment_interval after lifecycle migration
- [x] Add a unit test to verify that the fix works.
- [x] Explain briefly why the bug exists and how to fix it.
**Root cause:** The rotation task in `rotation.go` uses `NextTime(eventTime)` to pre-create segments. For multi-day intervals (e.g., 3-day warm stage), this produces incorrect segment boundaries. For example, with a 3-day interval and an event at day 3 23:59, `NextTime` creates a segment starting at day 6 instead of day 4. This doesn't affect hot nodes with 1-day intervals because `NextTime(near-midnight) ≈ next midnight`.
**Fix:** Disable the rotation task on warm and cold nodes. These nodes receive data via lifecycle migration, which creates segments on demand via `CreateSegmentIfNotExist` with correct boundaries. The rotation task is only needed on hot nodes where it pre-creates the next segment ahead of time.
**Changes:**
- Add `DisableRotation` flag to `TSDBOpts` in the storage layer
- Wire `DisableRotation` in measure, stream, and trace `OpenDB` functions: rotation is disabled when a node matches any lifecycle stage, and also when no stage matches (safety measure)
- Add `TestRotationDisabled` unit test verifying correct 3-day segment boundaries with rotation disabled
- Update `docs/concept/rotation.md` and `docs/operation/lifecycle.md` with documentation on rotation and retention behavior in lifecycle deployments
- [x] Update the [`CHANGES` log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(storage): disable rotation task on warm and cold lifecycle nodes [skywalking-banyandb]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1055:
URL: https://github.com/apache/skywalking-banyandb/pull/1055#discussion_r3055786892
##########
banyand/internal/storage/tsdb.go:
##########
@@ -244,6 +245,9 @@ func OpenTSDB[T TSTable, O any](ctx context.Context, opts TSDBOpts[T, O], cache
return nil, err
}
obsservice.MetricsCollector.Register(location, db.collect)
+ if opts.DisableRotation {
+ return db, nil
+ }
Review Comment:
`OpenTSDB` returns early when `opts.DisableRotation` is true, which skips `startRotationTask()` entirely. That task currently also drives TTL retention scheduling, idle segment closing, and index reset for past segments, so this change effectively disables those behaviors even when `DisableRetention` is false (e.g., the last lifecycle stage/cold nodes). Consider decoupling “segment pre-creation” from the rest of `startRotationTask` (e.g., still start the goroutine/scheduler but gate only the new-segment creation path).
```suggestion
```
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(storage): disable rotation task on warm and cold lifecycle nodes [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #1055:
URL: https://github.com/apache/skywalking-banyandb/pull/1055
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org