mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
filer.sync: count only the not-found sentinel as a missing destination
LookupEntry already maps every miss to filer_pb.ErrNotFound, plain-text ones included. Matching the sentinel's text in any error also counted an Unavailable lookup carrying that text as a miss, which let the caller delete and recreate the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
165721bdcf
commit
950d83f00e
2 files changed
+6
-6
No files matched your search
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
@@ -299,12 +298,11 @@ func (fs *FilerSink) entryMissing(key string) (bool, error) {
|
||||
return missing, err
|
||||
}
|
||||
|
||||
// isEntryNotFound reports a lookup not-found. The string check is a deliberate
|
||||
// compatibility fallback: a cross-cluster gRPC error often arrives as a plain
|
||||
// status string that no longer wraps the filer_pb.ErrNotFound sentinel, so
|
||||
// errors.Is alone would miss it.
|
||||
// isEntryNotFound reports a lookup not-found. filer_pb.LookupEntry already maps
|
||||
// every miss, plain-text ones included, to the sentinel; the same text on any
|
||||
// other status is a failed read.
|
||||
func isEntryNotFound(err error) bool {
|
||||
return errors.Is(err, filer_pb.ErrNotFound) || strings.Contains(err.Error(), filer_pb.ErrNotFound.Error())
|
||||
return errors.Is(err, filer_pb.ErrNotFound)
|
||||
}
|
||||
|
||||
func (fs *FilerSink) CreateEntry(key string, entry *filer_pb.Entry, signatures []int32) error {
|
||||
|
||||
@@ -38,6 +38,8 @@ func TestUpdateEntryRecreatesOnlyOnNotFound(t *testing.T) {
|
||||
{"not found", status.Error(codes.NotFound, filer_pb.ErrNotFound.Error()), false, 1},
|
||||
{"canceled", status.Error(codes.Canceled, "context canceled"), true, 2},
|
||||
{"unavailable", status.Error(codes.Unavailable, "connection refused"), true, 2},
|
||||
{"unavailable with the not-found text", status.Error(codes.Unavailable, filer_pb.ErrNotFound.Error()), true, 2},
|
||||
{"plain-text not found", status.Error(codes.Unknown, filer_pb.ErrNotFound.Error()), false, 1},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
lis, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
|
||||
Reference in new issue
Block a user