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/23 06:33:20 UTC

(skywalking-banyandb) branch bug/sidx created (now 6558d256)

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

hanahmily pushed a change to branch bug/sidx
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


      at 6558d256 Refactor readData method in block.go to simplify buffer management and improve memory handling. Update snapshot.go to ensure correct removal logic in the remove method.

This branch includes the following new commits:

     new 6558d256 Refactor readData method in block.go to simplify buffer management and improve memory handling. Update snapshot.go to ensure correct removal logic in the remove method.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(skywalking-banyandb) 01/01: Refactor readData method in block.go to simplify buffer management and improve memory handling. Update snapshot.go to ensure correct removal logic in the remove method.

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6558d2564efc6d13ab529085747c56096db5e1bf
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Tue Sep 23 14:33:01 2025 +0800

    Refactor readData method in block.go to simplify buffer management and improve memory handling. Update snapshot.go to ensure correct removal logic in the remove method.
---
 banyand/internal/sidx/block.go    | 9 +--------
 banyand/internal/sidx/snapshot.go | 1 +
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/banyand/internal/sidx/block.go b/banyand/internal/sidx/block.go
index 85bd370e..c3202937 100644
--- a/banyand/internal/sidx/block.go
+++ b/banyand/internal/sidx/block.go
@@ -528,14 +528,7 @@ func (b *block) readUserKeys(sr *seqReaders, bm *blockMetadata) error {
 }
 
 func (b *block) readData(decoder *encoding.BytesBlockDecoder, sr *seqReaders, bm *blockMetadata) error {
-	bb := bigValuePool.Get()
-	if bb == nil {
-		bb = &bytes.Buffer{}
-	}
-	defer func() {
-		bb.Buf = bb.Buf[:0]
-		bigValuePool.Put(bb)
-	}()
+	bb := &bytes.Buffer{}
 	bb.Buf = bytes.ResizeOver(bb.Buf[:0], int(bm.dataBlock.size))
 	sr.data.mustReadFull(bb.Buf)
 	dataBuf, err := zstd.Decompress(bb.Buf[:0], bb.Buf)
diff --git a/banyand/internal/sidx/snapshot.go b/banyand/internal/sidx/snapshot.go
index ce7cf6a6..809c0763 100644
--- a/banyand/internal/sidx/snapshot.go
+++ b/banyand/internal/sidx/snapshot.go
@@ -338,6 +338,7 @@ func (s *snapshot) remove(epoch uint64, toRemove map[uint64]struct{}) *snapshot
 		if _, shouldRemove := toRemove[pw.ID()]; !shouldRemove {
 			if pw.acquire() {
 				result.parts = append(result.parts, pw)
+				continue
 			}
 		}
 		pw.markForRemoval()