Browse Source

add ctx to logs, error handling

pull/7485/head
chrislu 2 weeks ago
parent
commit
46052c61de
  1. 6
      weed/filer/cassandra/cassandra_store.go
  2. 6
      weed/filer/cassandra2/cassandra_store.go
  3. 2
      weed/filer/mongodb/mongodb_store.go

6
weed/filer/cassandra/cassandra_store.go

@ -209,8 +209,8 @@ func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, dirPath u
resEachEntryFunc, resEachEntryFuncErr := eachEntryFunc(entry) resEachEntryFunc, resEachEntryFuncErr := eachEntryFunc(entry)
if resEachEntryFuncErr != nil { if resEachEntryFuncErr != nil {
err = resEachEntryFuncErr
glog.V(0).Infof("Failed in process eachEntryFnc: %v", err)
err = fmt.Errorf("failed to process eachEntryFunc for entry %q: %w", entry.FullPath, resEachEntryFuncErr)
glog.V(0).InfofCtx(ctx, "failed to process eachEntryFunc for entry %q: %v", entry.FullPath, resEachEntryFuncErr)
break break
} }
@ -219,7 +219,7 @@ func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, dirPath u
} }
} }
if errClose := iter.Close(); errClose != nil { if errClose := iter.Close(); errClose != nil {
glog.V(0).Infof("list iterator close: %v", errClose)
glog.V(0).InfofCtx(ctx, "list iterator close: %v", errClose)
if err == nil { if err == nil {
return lastFileName, errClose return lastFileName, errClose
} }

6
weed/filer/cassandra2/cassandra_store.go

@ -209,8 +209,8 @@ func (store *Cassandra2Store) ListDirectoryEntries(ctx context.Context, dirPath
resEachEntryFunc, resEachEntryFuncErr := eachEntryFunc(entry) resEachEntryFunc, resEachEntryFuncErr := eachEntryFunc(entry)
if resEachEntryFuncErr != nil { if resEachEntryFuncErr != nil {
err = resEachEntryFuncErr
glog.V(0).Infof("Failed in process eachEntryFnc: %v", err)
err = fmt.Errorf("failed to process eachEntryFunc for entry %q: %w", entry.FullPath, resEachEntryFuncErr)
glog.V(0).InfofCtx(ctx, "failed to process eachEntryFunc for entry %q: %v", entry.FullPath, resEachEntryFuncErr)
break break
} }
@ -220,7 +220,7 @@ func (store *Cassandra2Store) ListDirectoryEntries(ctx context.Context, dirPath
} }
if errClose := iter.Close(); errClose != nil { if errClose := iter.Close(); errClose != nil {
glog.V(0).Infof("list iterator close: %v", errClose)
glog.V(0).InfofCtx(ctx, "list iterator close: %v", errClose)
if err == nil { if err == nil {
return lastFileName, errClose return lastFileName, errClose
} }

2
weed/filer/mongodb/mongodb_store.go

@ -331,7 +331,7 @@ func (store *MongodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dir
} }
if errClose := cur.Close(ctx); errClose != nil { if errClose := cur.Close(ctx); errClose != nil {
glog.V(0).InfofCtx(ctx, "list iterator close: %v", err)
glog.V(0).InfofCtx(ctx, "list iterator close: %v", errClose)
if err == nil { if err == nil {
return lastFileName, errClose return lastFileName, errClose
} }

Loading…
Cancel
Save