mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove all bucket metadata
fix https://github.com/chrislusf/seaweedfs/issues/2118
This commit is contained in:
parent
b71c3cfba4
commit
9357911a95
|
@ -32,6 +32,9 @@ type AbstractSqlStore struct {
|
||||||
dbsLock sync.Mutex
|
dbsLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (store *AbstractSqlStore) CanDropWholeBucket() bool {
|
||||||
|
return store.SupportBucketTable
|
||||||
|
}
|
||||||
func (store *AbstractSqlStore) OnBucketCreation(bucket string) {
|
func (store *AbstractSqlStore) OnBucketCreation(bucket string) {
|
||||||
store.dbsLock.Lock()
|
store.dbsLock.Lock()
|
||||||
defer store.dbsLock.Unlock()
|
defer store.dbsLock.Unlock()
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
|
||||||
|
|
||||||
lastFileName := ""
|
lastFileName := ""
|
||||||
includeLastFile := false
|
includeLastFile := false
|
||||||
if !isDeletingBucket {
|
if !isDeletingBucket || !f.Store.CanDropWholeBucket() {
|
||||||
for {
|
for {
|
||||||
entries, _, err := f.ListDirectoryEntries(ctx, entry.FullPath, lastFileName, includeLastFile, PaginationSize, "", "", "")
|
entries, _, err := f.ListDirectoryEntries(ctx, entry.FullPath, lastFileName, includeLastFile, PaginationSize, "", "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -43,4 +43,5 @@ type FilerStore interface {
|
||||||
type BucketAware interface {
|
type BucketAware interface {
|
||||||
OnBucketCreation(bucket string)
|
OnBucketCreation(bucket string)
|
||||||
OnBucketDeletion(bucket string)
|
OnBucketDeletion(bucket string)
|
||||||
|
IsDropBucketAltogether() bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ type VirtualFilerStore interface {
|
||||||
AddPathSpecificStore(path string, storeId string, store FilerStore)
|
AddPathSpecificStore(path string, storeId string, store FilerStore)
|
||||||
OnBucketCreation(bucket string)
|
OnBucketCreation(bucket string)
|
||||||
OnBucketDeletion(bucket string)
|
OnBucketDeletion(bucket string)
|
||||||
|
CanDropWholeBucket() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type FilerStoreWrapper struct {
|
type FilerStoreWrapper struct {
|
||||||
|
@ -42,6 +43,13 @@ func NewFilerStoreWrapper(store FilerStore) *FilerStoreWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fsw *FilerStoreWrapper) CanDropWholeBucket() bool {
|
||||||
|
if ba, ok := fsw.defaultStore.(BucketAware); ok {
|
||||||
|
return ba.IsDropBucketAltogether()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (fsw *FilerStoreWrapper) OnBucketCreation(bucket string) {
|
func (fsw *FilerStoreWrapper) OnBucketCreation(bucket string) {
|
||||||
for _, store := range fsw.storeIdToStore {
|
for _, store := range fsw.storeIdToStore {
|
||||||
if ba, ok := store.(BucketAware); ok {
|
if ba, ok := store.(BucketAware); ok {
|
||||||
|
|
Loading…
Reference in a new issue