hanahmily commented on code in PR #850:
URL: 
https://github.com/apache/skywalking-banyandb/pull/850#discussion_r2543777701


##########
banyand/internal/sidx/sidx_test.go:
##########
@@ -149,6 +153,44 @@ func TestSIDX_Write_BatchRequest(t *testing.T) {
        assert.Equal(t, int64(1), stats.WriteCount.Load()) // One batch write
 }
 
+func TestSIDX_Take_File_Snapshot(t *testing.T) {
+       logger.Init(logger.Logging{
+               Env:   "dev",
+               Level: flags.LogLevel,
+       })
+
+       t.Run("Take snapshot of existing sidx", func(t *testing.T) {
+               dir, defFn := test.Space(require.New(t))
+               defer defFn()
+
+               snapshotDir := filepath.Join(dir, "snapshot")
+
+               idx := createTestSIDX(t)
+               defer func() {
+                       assert.NoError(t, idx.Close())
+               }()
+
+               // Test batch write requests
+               reqs := []WriteRequest{
+                       createTestWriteRequest(1, 100, "data1", 
createTestTag("tag1", "value1")),
+                       createTestWriteRequest(1, 101, "data2", 
createTestTag("tag1", "value2")),
+                       createTestWriteRequest(2, 200, "data3", 
createTestTag("tag2", "value3")),
+               }
+
+               writeTestData(t, idx, reqs, 2, 2) // Test with segmentID=2, 
partID=2
+
+               raw := idx.(*sidx)
+               flushIntro, err := raw.Flush(map[uint64]struct{}{2: {}})
+               require.NoError(t, err)
+               require.NotNil(t, flushIntro)
+               raw.IntroduceFlushed(flushIntro)
+               flushIntro.Release()
+
+               err = idx.TakeFileSnapshot(snapshotDir)
+               assert.NoError(t, err)

Review Comment:
   Could you verify the snapshot's content matches the original structure?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to