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

@@ -670,6 +670,13 @@ func TestResolveLastSyncOffsetReturnsTheErrorToTheRetryLoop(t *testing.T) {
t.Fatalf("got %v, want the lookup error: without a saved offset the caller's retry loop decides, not an exit", err)
}
// no directory and no saved offset yet: a first run starts now
started := time.Now()
notFound := func() (*filer_pb.Entry, error) { return nil, fmt.Errorf("lookup /buckets: %w", filer_pb.ErrNotFound) }
if got, err := resolveLastSyncOffset("/buckets", 0, notFound, noOffset); err != nil || got.Before(started) {
t.Fatalf("got %v, %v; want now and no error before the directory exists", got, err)
}
// the mount answers but the saved offset is unreadable: never its creation time
mount := &filer_pb.Entry{Name: "x", Attributes: &filer_pb.FuseAttributes{Crtime: 1}}
if _, err := resolveLastSyncOffset("/buckets/x", 0, func() (*filer_pb.Entry, error) { return mount, nil }, readFails); err == nil || !strings.Contains(err.Error(), "filer unavailable") {