This is an automated email from the ASF dual-hosted git repository.

mrproliu pushed a commit to branch unstable-ut
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit caa105e7506f823f80936a06fe4d8bb924cc6739
Author: mrproliu <[email protected]>
AuthorDate: Tue Jun 2 11:39:18 2026 +0800

    Fix unstable measure dump UT
---
 banyand/internal/dump/measure/suite_test.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/banyand/internal/dump/measure/suite_test.go 
b/banyand/internal/dump/measure/suite_test.go
index c5f77a046..3c4de30ef 100644
--- a/banyand/internal/dump/measure/suite_test.go
+++ b/banyand/internal/dump/measure/suite_test.go
@@ -47,6 +47,7 @@ import (
        "github.com/apache/skywalking-banyandb/pkg/convert"
        localfs "github.com/apache/skywalking-banyandb/pkg/fs"
        "github.com/apache/skywalking-banyandb/pkg/index"
+       "github.com/apache/skywalking-banyandb/pkg/index/inverted"
        "github.com/apache/skywalking-banyandb/pkg/logger"
        pbv1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
        "github.com/apache/skywalking-banyandb/pkg/test"
@@ -358,6 +359,17 @@ func TestMeasureIndexedTagResolvedFromIndex(t *testing.T) {
 
        segmentPath := findSidxSegmentPath(t, rootPath)
 
+       // The series index persists asynchronously (unsafe batches + 
persister) and is
+       // flushed on stop; after a hard stop there is a brief window before 
all series
+       // are readable on disk. The fallback scan below sources EntityValues 
purely
+       // from this index, so wait until every written series is visible before
+       // asserting, otherwise the scan can race the flush and recover nothing.
+       sidxPath := filepath.Join(segmentPath, "sidx")
+       require.Eventually(t, func() bool {
+               count, _ := inverted.ReadOnlyDocCount(sidxPath)
+               return count >= int64(total)
+       }, 30*time.Second, 100*time.Millisecond, "series index not fully 
persisted after stop")
+
        ruleToTag := map[uint32]dump.IndexedTagSpec{
                strRuleID: {Family: "default", Name: "idxStr", Type: 
pbv1.ValueTypeStr},
                intRuleID: {Family: "default", Name: "idxInt", Type: 
pbv1.ValueTypeInt64},

Reply via email to