hanahmily commented on code in PR #1005:
URL:
https://github.com/apache/skywalking-banyandb/pull/1005#discussion_r2921658271
##########
banyand/property/db/db.go:
##########
@@ -380,6 +382,27 @@ func (db *database) getShard(group string, id
common.ShardID) (*shard, bool) {
return nil, false
}
+// Drop closes and removes all shards for the given group and deletes the
group directory.
+func (db *database) Drop(groupName string) error {
+ value, ok := db.groups.LoadAndDelete(groupName)
+ if !ok {
+ return nil
+ }
+ gs := value.(*groupShards)
+ sLst := gs.shards.Load()
+ if sLst != nil {
+ var err error
+ for _, s := range *sLst {
+ multierr.AppendInto(&err, s.close())
+ }
+ if err != nil {
+ return err
+ }
+ }
+ db.lfs.MustRMAll(gs.location)
+ return nil
Review Comment:
Make sense. But I remember the grpc interceptor can handle the panic without
a process crash. Double-check "Drop"'s panic can be caught by it.
--
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]