mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-28 05:15:00 +08:00
leveldb3: ensure repeatable adding removing buckets
This commit is contained in:
parent
e2c7e3fe6d
commit
ca73013453
@ -137,6 +137,18 @@ func (store *LevelDB3Store) findDB(fullpath weed_util.FullPath, isForChildren bo
|
||||
return db, bucket, shortPath, nil
|
||||
}
|
||||
|
||||
func (store *LevelDB3Store) closeDB(bucket string) {
|
||||
|
||||
store.dbsLock.Lock()
|
||||
defer store.dbsLock.Unlock()
|
||||
|
||||
if db, found := store.dbs[bucket]; found {
|
||||
db.Close()
|
||||
delete(store.dbs, bucket)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (store *LevelDB3Store) BeginTransaction(ctx context.Context) (context.Context, error) {
|
||||
return ctx, nil
|
||||
}
|
||||
@ -240,7 +252,7 @@ func (store *LevelDB3Store) DeleteFolderChildren(ctx context.Context, fullpath w
|
||||
}
|
||||
|
||||
if bucket != DEFAULT && shortPath == "/" {
|
||||
db.Close()
|
||||
store.closeDB(bucket)
|
||||
if bucket != "" { // just to make sure
|
||||
os.RemoveAll(store.dir + "/" + bucket)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user