mrproliu commented on code in PR #1046:
URL: 
https://github.com/apache/skywalking-banyandb/pull/1046#discussion_r3042737626


##########
banyand/internal/storage/storage.go:
##########
@@ -64,7 +64,9 @@ const (
 var (
        // ErrUnknownShard indicates that the shard is not found.
        ErrUnknownShard = errors.New("unknown shard")
-       errOpenDatabase = errors.New("fails to open the database")
+       // ErrNoCurrentSnapshot is returned when a shard has no current 
snapshot available.
+       ErrNoCurrentSnapshot = errors.New("no current snapshot available")

Review Comment:
   For this issue: `stream/trace do work before the nil-snapshot check`.
   Should I need to check the the current snapshot first, then do index related 
snapshot. Such as change to: 
   ```go
   func (tst *tsTable) TakeFileSnapshot(dst string) (bool, error) {
        if tst.index == nil {
                return false, fmt.Errorf("cannot take file snapshot: index is 
not initialized for this tsTable")
        }
           // check the snapshot exist before take index snapshot. 
        snapshot := tst.currentSnapshot()
        if snapshot == nil {
                return false, storage.ErrNoCurrentSnapshot
        }
        defer snapshot.decRef()
   ```



-- 
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