You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2025/09/16 01:33:13 UTC
(skywalking-banyandb) 03/08: Refactor disk usage configuration flags for retention management
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch tsdb/force-cleanup
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit fc9092c4ccdec69d5787d8aab61e6ce216b86a00
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Sun Sep 14 21:32:36 2025 +0800
Refactor disk usage configuration flags for retention management
This commit introduces breaking changes by renaming disk usage configuration flags across all services. The `*-max-disk-usage-percent` flags are replaced with `*-retention-high-watermark`, and new retention configuration flags are added: `*-retention-low-watermark`, `*-retention-check-interval`, and `*-retention-cooldown`. Additionally, documentation and error messages are updated to reflect these changes, enhancing clarity and consistency in retention management.
---
CHANGES.md | 4 ++++
banyand/measure/svc_data.go | 4 ++--
banyand/measure/svc_standalone.go | 4 ++--
banyand/measure/write_liaison.go | 2 +-
banyand/measure/write_standalone.go | 2 +-
banyand/stream/svc_standalone.go | 4 ++--
banyand/stream/write_liaison.go | 2 +-
banyand/stream/write_standalone.go | 2 +-
banyand/trace/svc_standalone.go | 2 +-
banyand/trace/write_liaison.go | 2 +-
banyand/trace/write_standalone.go | 2 +-
docs/operation/troubleshooting/overhead.md | 2 +-
test/integration/standalone/other/disk_test.go | 4 ++--
13 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index dfa07445..dc161681 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -42,6 +42,10 @@ Release Notes.
- Optimize gRPC message size limits: increase server max receive message size to 16MB and client max receive message size to 32MB for better handling of large time-series data blocks.
- Add query access log support for stream, measure, trace, and property services to capture and log all query requests for monitoring and debugging purposes.
- Implement comprehensive version compatibility checking for both regular data transmission and chunked sync operations, ensuring proper API version and file format version validation with detailed error reporting and graceful handling of version mismatches.
+- **Breaking Change**: Rename disk usage configuration flags for all services:
+ - `*-max-disk-usage-percent` → `*-retention-high-watermark` (measure, stream, trace, property services)
+ - Add new retention configuration flags: `*-retention-low-watermark`, `*-retention-check-interval`, `*-retention-cooldown`
+ - The high watermark now serves dual purposes: write throttling and forced retention cleanup trigger
### Bug Fixes
diff --git a/banyand/measure/svc_data.go b/banyand/measure/svc_data.go
index 894972f2..7099a573 100644
--- a/banyand/measure/svc_data.go
+++ b/banyand/measure/svc_data.go
@@ -92,7 +92,7 @@ func (s *dataSVC) GetRemovalSegmentsTimeRange(group string) *timestamp.TimeRange
return s.schemaRepo.GetRemovalSegmentsTimeRange(group)
}
-// RetentionService interface implementation
+// RetentionService interface implementation.
func (s *dataSVC) GetDataPath() string {
return s.dataPath
@@ -137,7 +137,7 @@ func (s *dataSVC) FlagSet() *run.FlagSet {
flagS.VarP(&s.option.seriesCacheMaxSize, "measure-series-cache-max-size", "", "the max size of series cache in each group")
// Retention configuration flags
- flagS.Float64Var(&s.retentionConfig.HighWatermark, "measure-retention-high-watermark", 95.0, "disk usage high watermark percentage that triggers forced retention cleanup")
+ flagS.Float64Var(&s.retentionConfig.HighWatermark, "measure-retention-high-watermark", 95.0, "disk usage high watermark for forced retention cleanup")
flagS.Float64Var(&s.retentionConfig.LowWatermark, "measure-retention-low-watermark", 85.0, "disk usage low watermark percentage where forced retention cleanup stops")
flagS.DurationVar(&s.retentionConfig.CheckInterval, "measure-retention-check-interval", 5*time.Minute, "interval for checking disk usage")
flagS.DurationVar(&s.retentionConfig.Cooldown, "measure-retention-cooldown", 30*time.Second, "cooldown period between forced segment deletions")
diff --git a/banyand/measure/svc_standalone.go b/banyand/measure/svc_standalone.go
index 561abe61..f697c9b4 100644
--- a/banyand/measure/svc_standalone.go
+++ b/banyand/measure/svc_standalone.go
@@ -96,7 +96,7 @@ func (s *standalone) GetRemovalSegmentsTimeRange(group string) *timestamp.TimeRa
return s.schemaRepo.GetRemovalSegmentsTimeRange(group)
}
-// RetentionService interface implementation
+// RetentionService interface implementation.
func (s *standalone) GetDataPath() string {
return s.dataPath
@@ -141,7 +141,7 @@ func (s *standalone) FlagSet() *run.FlagSet {
flagS.VarP(&s.option.seriesCacheMaxSize, "measure-series-cache-max-size", "", "the max size of series cache in each group")
// Retention configuration flags
- flagS.Float64Var(&s.retentionConfig.HighWatermark, "measure-retention-high-watermark", 95.0, "disk usage high watermark percentage that triggers forced retention cleanup")
+ flagS.Float64Var(&s.retentionConfig.HighWatermark, "measure-retention-high-watermark", 95.0, "disk usage high watermark for forced retention cleanup")
flagS.Float64Var(&s.retentionConfig.LowWatermark, "measure-retention-low-watermark", 85.0, "disk usage low watermark percentage where forced retention cleanup stops")
flagS.DurationVar(&s.retentionConfig.CheckInterval, "measure-retention-check-interval", 5*time.Minute, "interval for checking disk usage")
flagS.DurationVar(&s.retentionConfig.Cooldown, "measure-retention-cooldown", 30*time.Second, "cooldown period between forced segment deletions")
diff --git a/banyand/measure/write_liaison.go b/banyand/measure/write_liaison.go
index 36fcd7aa..4b360c78 100644
--- a/banyand/measure/write_liaison.go
+++ b/banyand/measure/write_liaison.go
@@ -60,7 +60,7 @@ type writeQueueCallback struct {
func (w *writeQueueCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "measure is readonly because \"measure-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "measure is readonly because \"measure-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/banyand/measure/write_standalone.go b/banyand/measure/write_standalone.go
index a467e57d..dc7fd8b1 100644
--- a/banyand/measure/write_standalone.go
+++ b/banyand/measure/write_standalone.go
@@ -60,7 +60,7 @@ func setUpWriteCallback(l *logger.Logger, schemaRepo *schemaRepo, maxDiskUsagePe
func (w *writeCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "measure is readonly because \"measure-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "measure is readonly because \"measure-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/banyand/stream/svc_standalone.go b/banyand/stream/svc_standalone.go
index 03debf6f..1bc0f8fe 100644
--- a/banyand/stream/svc_standalone.go
+++ b/banyand/stream/svc_standalone.go
@@ -95,7 +95,7 @@ func (s *standalone) GetRemovalSegmentsTimeRange(group string) *timestamp.TimeRa
return s.schemaRepo.GetRemovalSegmentsTimeRange(group)
}
-// RetentionService interface implementation
+// RetentionService interface implementation.
func (s *standalone) GetDataPath() string {
return s.dataPath
@@ -141,7 +141,7 @@ func (s *standalone) FlagSet() *run.FlagSet {
flagS.VarP(&s.option.seriesCacheMaxSize, "stream-series-cache-max-size", "", "the max size of series cache in each group")
// Retention configuration flags
- flagS.Float64Var(&s.retentionConfig.HighWatermark, "stream-retention-high-watermark", 95.0, "disk usage high watermark percentage that triggers forced retention cleanup")
+ flagS.Float64Var(&s.retentionConfig.HighWatermark, "stream-retention-high-watermark", 95.0, "disk usage high watermark for forced retention cleanup")
flagS.Float64Var(&s.retentionConfig.LowWatermark, "stream-retention-low-watermark", 85.0, "disk usage low watermark percentage where forced retention cleanup stops")
flagS.DurationVar(&s.retentionConfig.CheckInterval, "stream-retention-check-interval", 5*time.Minute, "interval for checking disk usage")
flagS.DurationVar(&s.retentionConfig.Cooldown, "stream-retention-cooldown", 30*time.Second, "cooldown period between forced segment deletions")
diff --git a/banyand/stream/write_liaison.go b/banyand/stream/write_liaison.go
index b804be99..d8478f1b 100644
--- a/banyand/stream/write_liaison.go
+++ b/banyand/stream/write_liaison.go
@@ -59,7 +59,7 @@ func setUpWriteQueueCallback(l *logger.Logger, schemaRepo *schemaRepo, maxDiskUs
func (w *writeQueueCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "stream is readonly because \"stream-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "stream is readonly because \"stream-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/banyand/stream/write_standalone.go b/banyand/stream/write_standalone.go
index bcd5a88d..b2b69771 100644
--- a/banyand/stream/write_standalone.go
+++ b/banyand/stream/write_standalone.go
@@ -58,7 +58,7 @@ func setUpWriteCallback(l *logger.Logger, schemaRepo *schemaRepo, maxDiskUsagePe
func (w *writeCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "stream is readonly because \"stream-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "stream is readonly because \"stream-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/banyand/trace/svc_standalone.go b/banyand/trace/svc_standalone.go
index cc974cb9..bd3e7e05 100644
--- a/banyand/trace/svc_standalone.go
+++ b/banyand/trace/svc_standalone.go
@@ -198,7 +198,7 @@ func (s *standalone) GetRemovalSegmentsTimeRange(group string) *timestamp.TimeRa
return s.schemaRepo.GetRemovalSegmentsTimeRange(group)
}
-// RetentionService interface implementation
+// RetentionService interface implementation.
func (s *standalone) GetDataPath() string {
return s.dataPath
diff --git a/banyand/trace/write_liaison.go b/banyand/trace/write_liaison.go
index 18e95e66..438a9072 100644
--- a/banyand/trace/write_liaison.go
+++ b/banyand/trace/write_liaison.go
@@ -55,7 +55,7 @@ func setUpWriteQueueCallback(l *logger.Logger, schemaRepo *schemaRepo, maxDiskUs
func (w *writeQueueCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "trace is readonly because \"trace-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "trace is readonly because \"trace-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/banyand/trace/write_standalone.go b/banyand/trace/write_standalone.go
index c381eb72..653ffbd4 100644
--- a/banyand/trace/write_standalone.go
+++ b/banyand/trace/write_standalone.go
@@ -59,7 +59,7 @@ func setUpWriteCallback(l *logger.Logger, schemaRepo *schemaRepo, maxDiskUsagePe
func (w *writeCallback) CheckHealth() *common.Error {
if w.maxDiskUsagePercent < 1 {
- return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "trace is readonly because \"trace-max-disk-usage-percent\" is 0")
+ return common.NewErrorWithStatus(modelv1.Status_STATUS_DISK_FULL, "trace is readonly because \"trace-retention-high-watermark\" is 0")
}
diskPercent := observability.GetPathUsedPercent(w.schemaRepo.path)
if diskPercent < w.maxDiskUsagePercent {
diff --git a/docs/operation/troubleshooting/overhead.md b/docs/operation/troubleshooting/overhead.md
index a535208b..c4dca7a9 100644
--- a/docs/operation/troubleshooting/overhead.md
+++ b/docs/operation/troubleshooting/overhead.md
@@ -18,7 +18,7 @@ If you notice high disk usage on the BanyanDB server, follow these steps to trou
## Cannot Write Data
-The parameters `measure-max-disk-usage-percent`, `stream-max-disk-usage-percent`, and `property-max-disk-usage-percent` control what percentage of the disk these three different modules can use. If the disk usage exceeds these limits, or if we set these parameters to 0, the module will not accept writing. However, queries can still run. Once the disk usage goes down below the set limits, the module can accept data again.
+The parameters `measure-retention-high-watermark`, `stream-retention-high-watermark`, and `property-retention-high-watermark` control what percentage of the disk these three different modules can use. If the disk usage exceeds these limits, or if we set these parameters to 0, the module will not accept writing. However, queries can still run. Once the disk usage goes down below the set limits, the module can accept data again.
## Too Many Open Files
diff --git a/test/integration/standalone/other/disk_test.go b/test/integration/standalone/other/disk_test.go
index 5289e85b..13acd1b3 100644
--- a/test/integration/standalone/other/disk_test.go
+++ b/test/integration/standalone/other/disk_test.go
@@ -58,7 +58,7 @@ var _ = g.Describe("Disk", func() {
})
g.It(" is a standalone server, blocking writing, with disk full", func() {
addr, _, deferFn := setup.Standalone(
- "--measure-max-disk-usage-percent",
+ "--measure-retention-high-watermark",
"0",
)
defer deferFn()
@@ -104,7 +104,7 @@ var _ = g.Describe("Disk", func() {
closeDataNode1 := setup.DataNode(ep)
g.By("Starting liaison node")
liaisonAddr, closerLiaisonNode := setup.LiaisonNode(ep,
- "--measure-max-disk-usage-percent",
+ "--measure-retention-high-watermark",
"0")
defer func() {
closerLiaisonNode()