aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-12-23 23:49:22 -0800
committerChris Lu <chris.lu@gmail.com>2020-12-23 23:49:22 -0800
commitb5e2be635adb51808282358a1eab0b61080982d6 (patch)
tree6705103b08018f0f38916807446afad9cfe0c338
parentc4a202ec417554f170a21d7331b44f860ea72274 (diff)
downloadseaweedfs-b5e2be635adb51808282358a1eab0b61080982d6.tar.xz
seaweedfs-b5e2be635adb51808282358a1eab0b61080982d6.zip
adjust for directory listing
-rw-r--r--weed/filer/hbase/hbase_store.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/weed/filer/hbase/hbase_store.go b/weed/filer/hbase/hbase_store.go
index 8a9ea7fc1..cc690c48a 100644
--- a/weed/filer/hbase/hbase_store.go
+++ b/weed/filer/hbase/hbase_store.go
@@ -112,7 +112,7 @@ func (store *HbaseStore) DeleteEntry(ctx context.Context, path util.FullPath) (e
func (store *HbaseStore) DeleteFolderChildren(ctx context.Context, path util.FullPath) (err error) {
family := map[string][]string{store.cfMetaDir: {COLUMN_NAME}}
- expectedPrefix := []byte(path+"/")
+ expectedPrefix := []byte(path + "/")
scan, err := hrpc.NewScanRange(ctx, store.table, expectedPrefix, nil, hrpc.Families(family))
if err != nil {
return err
@@ -133,6 +133,11 @@ func (store *HbaseStore) DeleteFolderChildren(ctx context.Context, path util.Ful
if !bytes.HasPrefix(cell.Row, expectedPrefix) {
break
}
+ fullpath := util.FullPath(cell.Row)
+ dir, _ := fullpath.DirAndName()
+ if dir != string(dirPath) {
+ continue
+ }
err = store.doDelete(ctx, store.cfMetaDir, cell.Row)
if err != nil {
@@ -149,7 +154,7 @@ func (store *HbaseStore) ListDirectoryEntries(ctx context.Context, dirPath util.
func (store *HbaseStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*filer.Entry, error) {
family := map[string][]string{store.cfMetaDir: {COLUMN_NAME}}
- expectedPrefix := []byte(dirPath.Child(prefix))
+ expectedPrefix := []byte(string(dirPath) + "/" + prefix)
scan, err := hrpc.NewScanRange(ctx, store.table, expectedPrefix, nil, hrpc.Families(family))
if err != nil {
return nil, err
@@ -176,12 +181,13 @@ func (store *HbaseStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPa
}
fullpath := util.FullPath(cell.Row)
-
+ dir, fileName := fullpath.DirAndName()
+ if dir != string(dirPath) {
+ continue
+ }
value := cell.Value
- _, fileName := fullpath.DirAndName()
-
if fileName == startFileName && !includeStartFile {
continue
}