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

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


The following commit(s) were added to refs/heads/main by this push:
     new 15275e2e Update version to 0.10 and fix panic in sidx merge and flush 
operations. (#952)
15275e2e is described below

commit 15275e2e64198719d09307bb9566c3f953e93287
Author: Gao Hongtao <[email protected]>
AuthorDate: Tue Jan 20 12:32:08 2026 +0800

    Update version to 0.10 and fix panic in sidx merge and flush operations. 
(#952)
    
    * Update version to 0.10 and fix panic in sidx merge and flush operations.
    
    * Enhance debug logging in sidx merge and flush operations to track 
discrepancies in part counts.
---
 CHANGES.md                                         |  1 +
 api/proto/banyandb/version.go                      |  2 +-
 banyand/internal/sidx/merge.go                     | 11 +++++++----
 banyand/internal/sidx/sidx.go                      | 13 ++++++++++---
 test/e2e-v2/script/docker-compose/base-compose.yml |  2 +-
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3e70e8d2..2232be11 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -29,6 +29,7 @@ Release Notes.
 - Fix duplicate elements in stream query results by implementing element 
ID-based deduplication across scan, merge, and result building stages.
 - Fix data written to the wrong shard and related stream queries.
 - Fix the lifecycle panic when the trace has no sidx.
+- Fix panic in sidx merge and flush operations when part counts don't match 
expectations.
 
 ### Document
 
diff --git a/api/proto/banyandb/version.go b/api/proto/banyandb/version.go
index 2a4b305f..4ce532be 100644
--- a/api/proto/banyandb/version.go
+++ b/api/proto/banyandb/version.go
@@ -19,7 +19,7 @@
 package apiversion
 
 // Version is the version of the API.
-const Version = "0.9"
+const Version = "0.10"
 
 // Revision is the revision of the API. Building with -ldflags -X.
 var revision string
diff --git a/banyand/internal/sidx/merge.go b/banyand/internal/sidx/merge.go
index 41922f95..d5b64f14 100644
--- a/banyand/internal/sidx/merge.go
+++ b/banyand/internal/sidx/merge.go
@@ -22,7 +22,6 @@ import (
 
        "github.com/apache/skywalking-banyandb/pkg/encoding"
        "github.com/apache/skywalking-banyandb/pkg/fs"
-       "github.com/apache/skywalking-banyandb/pkg/logger"
 )
 
 var (
@@ -46,9 +45,13 @@ func (s *sidx) Merge(closeCh <-chan struct{}, partIDtoMerge 
map[uint64]struct{},
                        partsToMerge = append(partsToMerge, pw)
                }
        }
-
-       if len(partsToMerge) != len(partIDtoMerge) {
-               logger.Panicf("not enough parts to merge: %d", 
len(partsToMerge))
+       if d := s.l.Debug(); d.Enabled() {
+               if len(partsToMerge) != len(partIDtoMerge) {
+                       d.Int("parts_to_merge_count", len(partsToMerge)).
+                               Int("part_ids_to_merge_count", 
len(partIDtoMerge)).
+                               Str("root", s.root).
+                               Msg("parts to merge count does not match part 
ids to merge count")
+               }
        }
 
        // Create new merged part
diff --git a/banyand/internal/sidx/sidx.go b/banyand/internal/sidx/sidx.go
index 197c1870..18149770 100644
--- a/banyand/internal/sidx/sidx.go
+++ b/banyand/internal/sidx/sidx.go
@@ -131,6 +131,10 @@ func (s *sidx) Flush(partIDsToFlush map[uint64]struct{}) 
(*FlusherIntroduction,
        }
        defer snap.decRef()
 
+       if len(snap.parts) == 0 {
+               return nil, nil
+       }
+
        // Create flush introduction
        flushIntro := generateFlusherIntroduction()
 
@@ -153,10 +157,13 @@ func (s *sidx) Flush(partIDsToFlush map[uint64]struct{}) 
(*FlusherIntroduction,
                newPW := newPartWrapper(nil, mustOpenPart(pw.ID(), partPath, 
s.fileSystem))
                flushIntro.flushed[newPW.ID()] = newPW
        }
-
        if len(flushIntro.flushed) != len(partIDsToFlush) {
-               logger.Panicf("expected %d parts to flush, but got %d", 
len(partIDsToFlush), len(flushIntro.flushed))
-               return nil, nil
+               if d := s.l.Debug(); d.Enabled() {
+                       d.Int("flushed_count", len(flushIntro.flushed)).
+                               Str("root", s.root).
+                               Int("part_ids_to_flush_count", 
len(partIDsToFlush)).
+                               Msg("part ids to flush count does not match 
flushed count")
+               }
        }
        return flushIntro, nil
 }
diff --git a/test/e2e-v2/script/docker-compose/base-compose.yml 
b/test/e2e-v2/script/docker-compose/base-compose.yml
index 38fbc623..5b896a91 100644
--- a/test/e2e-v2/script/docker-compose/base-compose.yml
+++ b/test/e2e-v2/script/docker-compose/base-compose.yml
@@ -56,7 +56,7 @@ services:
       file: ../../../docker/base-compose.yml
       service: oap
     environment:
-      SW_STORAGE_BANYANDB_COMPATIBLE_SERVER_API_VERSIONS: "0.9,0.10"
+      SW_STORAGE_BANYANDB_COMPATIBLE_SERVER_API_VERSIONS: "0.10"
     networks:
       - e2e
     volumes:

Reply via email to