filer.remote.sync: a directory not created yet starts now, as before

A gateway started before the first bucket looked up a missing buckets
directory, had no saved offset, and returned an error to the retry loop
on every attempt until a bucket appeared. A missing directory with no
saved offset has nothing to replay, so it starts now as it did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-11-06 01:27:19 -08:00
1 parent 1f332e5866
commit c31497a9a3
2 files changed
+12 -1

No files matched your search

+5 -1
View File
@@ -1105,7 +1105,8 @@ func collectLastSyncOffset(filerClient filer_pb.FilerClient, grpcDialOption grpc
// 3. the directory's creation time
// A mount lookup that fails never resolves to now: the saved offset still
// orders the replay, and without one the error goes back to the caller's
// retry loop instead of skipping every event since the failure.
// retry loop instead of skipping every event since the failure. Only a
// directory that does not exist yet, with no saved offset, starts now.
func resolveLastSyncOffset(mountedDir string, timeAgo time.Duration, lookupMount func() (*filer_pb.Entry, error), readOffset func() (int64, error)) (time.Time, error) {
var lastOffsetTs time.Time
if timeAgo == 0 {
@@ -1116,6 +1117,9 @@ func resolveLastSyncOffset(mountedDir string, timeAgo time.Duration, lookupMount
glog.V(0).Infof("get mounted directory %s: %v; resume from the saved offset %v", mountedDir, err, time.Unix(0, lastOffsetTsNs))
return time.Unix(0, lastOffsetTsNs), nil
}
if offsetErr == nil && errors.Is(err, filer_pb.ErrNotFound) {
return time.Now(), nil
}
return time.Time{}, fmt.Errorf("get mounted directory %s: %w; no saved sync offset (%v)", mountedDir, err, offsetErr)
}