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

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


The following commit(s) were added to refs/heads/lifecyc-sync by this push:
     new b990b722 Fix bugs
b990b722 is described below

commit b990b7229f69c69cfb3815e4ed32f223640f2629
Author: Gao Hongtao <hanahm...@gmail.com>
AuthorDate: Mon Aug 4 22:42:59 2025 +0800

    Fix bugs
    
    Signed-off-by: Gao Hongtao <hanahm...@gmail.com>
---
 banyand/backup/lifecycle/steps.go   | 5 +++++
 banyand/backup/snapshot/snapshot.go | 7 +------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/banyand/backup/lifecycle/steps.go 
b/banyand/backup/lifecycle/steps.go
index 7005fe35..ebf860ea 100644
--- a/banyand/backup/lifecycle/steps.go
+++ b/banyand/backup/lifecycle/steps.go
@@ -19,6 +19,7 @@ package lifecycle
 
 import (
        "fmt"
+       "os"
 
        "github.com/pkg/errors"
 
@@ -59,6 +60,10 @@ func (l *lifecycleService) getSnapshots(groups 
[]*commonv1.Group, p *Progress) (
                        l.l.Error().Err(errDir).Msgf("Failed to get snapshot 
directory for %s", snp.Name)
                        continue
                }
+               if _, err := os.Stat(snapshotDir); os.IsNotExist(err) {
+                       l.l.Error().Err(err).Msgf("Snapshot directory %s does 
not exist", snapshotDir)
+                       continue
+               }
                if snp.Catalog == commonv1.Catalog_CATALOG_STREAM {
                        streamDir = snapshotDir
                }
diff --git a/banyand/backup/snapshot/snapshot.go 
b/banyand/backup/snapshot/snapshot.go
index 981890e5..edcd17b5 100644
--- a/banyand/backup/snapshot/snapshot.go
+++ b/banyand/backup/snapshot/snapshot.go
@@ -22,7 +22,6 @@ import (
        "context"
        "errors"
        "fmt"
-       "os"
        "path/filepath"
        "time"
 
@@ -77,11 +76,7 @@ func Dir(snapshot *databasev1.Snapshot, streamRoot, 
measureRoot, propertyRoot st
        default:
                return "", errors.New("unknown catalog type")
        }
-       snpPath := filepath.Join(baseDir, storage.SnapshotsDir, snapshot.Name)
-       if _, err := os.Stat(snpPath); os.IsNotExist(err) {
-               return "", fmt.Errorf("snapshot directory %s does not exist", 
snpPath)
-       }
-       return snpPath, nil
+       return filepath.Join(baseDir, storage.SnapshotsDir, snapshot.Name), nil
 }
 
 // LocalDir returns the local directory path of the snapshot.

Reply via email to