filer.remote.sync: no upload on an unanswered supersession lookup; bounded offset read

retriedWriteFile returns the supersession lookup's error instead of
treating an unanswered lookup as "not superseded": in a replay an older
snapshot could otherwise overwrite a newer remote object. The processor
retries the event. isSuperseded keeps its boolean form for the other call
sites. GetSyncOffset's KvGet carries a 30 s deadline so a startup that falls
back to the saved offset cannot hang on it.

TestGatewayUncachedRewriteIsStillUploaded asserted the upload on a failed
lookup; it now asserts the withheld upload and the lookup error.

(cherry picked from commit 8fc2e718f7cd8322615b4e40007be903ade2dbfa)
This commit is contained in:
james committed 2026-11-05 19:54:13 -07:00
1 parent 4f8f817461
commit e4c0acfa61
4 files changed
+40 -19

No files matched your search

+5 -2
View File
@@ -580,8 +580,11 @@ func TestFilerLookupsOnTheSyncPathCarryADeadline(t *testing.T) {
if current != nil || !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("currentEntry = %v, %v; want nil, deadline exceeded", current, err)
}
if isSuperseded(&blockingFilerClient{}, dir, event) {
t.Error("isSuperseded = true on a lookup that timed out; want false (the write failure is kept and retried)")
if superseded, lookupErr := supersessionLookup(&blockingFilerClient{}, dir, event); superseded || !errors.Is(lookupErr, context.DeadlineExceeded) {
t.Errorf("supersessionLookup = %v, %v on a lookup that timed out; want false, deadline exceeded (no upload starts on an unanswered lookup)", superseded, lookupErr)
}
if _, writeErr := retriedWriteFile(nil, &blockingFilerClient{}, dir, event, &remote_pb.RemoteStorageLocation{Name: "b2", Bucket: "b", Path: "/lease.json"}); !errors.Is(writeErr, context.DeadlineExceeded) {
t.Errorf("retriedWriteFile = %v on an unanswered supersession lookup; want the lookup error, not an upload", writeErr)
}
if elapsed := time.Since(started); elapsed > 5*time.Second {
t.Fatalf("two timed-out lookups took %v; the deadline did not bound them", elapsed)