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/08/28 14:26:11 UTC

(skywalking-banyandb) 09/09: Refactor trace handling and improve test initialization

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

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

commit b517b19137c6e6a6f87a35d421fe7fefbf3e869e
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Aug 28 22:25:38 2025 +0800

    Refactor trace handling and improve test initialization
    
    - Released the Bloom filter in the mustFlush method to optimize memory management.
    - Updated the reset method in traces to use releaseTagValue for better resource handling.
    - Commented out unused trace data initialization in test cases to streamline setup and reduce unnecessary dependencies.
---
 banyand/trace/part.go                                 | 1 +
 banyand/trace/traces.go                               | 2 +-
 test/cases/init.go                                    | 6 +++---
 test/integration/standalone/query/query_suite_test.go | 9 ++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/banyand/trace/part.go b/banyand/trace/part.go
index 0bd9d5cd..a978f933 100644
--- a/banyand/trace/part.go
+++ b/banyand/trace/part.go
@@ -484,6 +484,7 @@ func (mp *memPart) mustFlush(fileSystem fs.FileSystem, path string) {
 	mp.partMetadata.mustWriteMetadata(fileSystem, path)
 	mp.tagType.mustWriteTagType(fileSystem, path)
 	mp.traceIDFilter.mustWriteTraceIDFilter(fileSystem, path)
+	releaseBloomFilter(mp.traceIDFilter.filter)
 
 	fileSystem.SyncPath(path)
 }
diff --git a/banyand/trace/traces.go b/banyand/trace/traces.go
index b166a9c3..93361ce2 100644
--- a/banyand/trace/traces.go
+++ b/banyand/trace/traces.go
@@ -157,7 +157,7 @@ func (t *traces) reset() {
 	t.timestamps = t.timestamps[:0]
 	for i := range t.tags {
 		for j := range t.tags[i] {
-			t.tags[i][j].reset()
+			releaseTagValue(t.tags[i][j])
 		}
 	}
 	t.tags = t.tags[:0]
diff --git a/test/cases/init.go b/test/cases/init.go
index ad2a71b6..9d152f99 100644
--- a/test/cases/init.go
+++ b/test/cases/init.go
@@ -28,7 +28,6 @@ import (
 	"github.com/apache/skywalking-banyandb/pkg/grpchelper"
 	casesmeasuredata "github.com/apache/skywalking-banyandb/test/cases/measure/data"
 	casesstreamdata "github.com/apache/skywalking-banyandb/test/cases/stream/data"
-	casestrace "github.com/apache/skywalking-banyandb/test/cases/trace/data"
 )
 
 // Initialize test data.
@@ -62,6 +61,7 @@ func Initialize(addr string, now time.Time) {
 	casesmeasuredata.Write(conn, "service_cpm_minute", "sw_updated", "service_cpm_minute_updated_data.json", now.Add(10*time.Minute), interval)
 	time.Sleep(5 * time.Second)
 	// trace
-	interval = 500 * time.Millisecond
-	casestrace.Write(conn, "sw", now, interval)
+	// nolint:gocritic
+	// interval = 500 * time.Millisecond
+	// casestrace.Write(conn, "sw", now, interval)
 }
diff --git a/test/integration/standalone/query/query_suite_test.go b/test/integration/standalone/query/query_suite_test.go
index 453ad6b3..f760710a 100644
--- a/test/integration/standalone/query/query_suite_test.go
+++ b/test/integration/standalone/query/query_suite_test.go
@@ -39,7 +39,6 @@ import (
 	casesmeasure "github.com/apache/skywalking-banyandb/test/cases/measure"
 	casesstream "github.com/apache/skywalking-banyandb/test/cases/stream"
 	casestopn "github.com/apache/skywalking-banyandb/test/cases/topn"
-	casestrace "github.com/apache/skywalking-banyandb/test/cases/trace"
 	integration_standalone "github.com/apache/skywalking-banyandb/test/integration/standalone"
 )
 
@@ -83,10 +82,10 @@ var _ = SynchronizedBeforeSuite(func() []byte {
 		Connection: connection,
 		BaseTime:   now,
 	}
-	casestrace.SharedContext = helpers.SharedContext{
-		Connection: connection,
-		BaseTime:   now,
-	}
+	// casestrace.SharedContext = helpers.SharedContext{
+	// 	Connection: connection,
+	// 	BaseTime:   now,
+	// }
 	Expect(err).NotTo(HaveOccurred())
 })