mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-07 12:37:41 +01:00
filer.remote.sync: a failed mount lookup at startup never resolves to now
collectLastSyncOffset returned time.Now() when the mounted directory lookup failed, which skips every event since the saved offset. The saved offset is used instead; without one the daemon exits so a restart retries. (cherry picked from commit 8fd3124f5b3d3f8c3a291263a710047b4aff81ae)
This commit is contained in:
1 parent
3b8c4702bd
commit
4f8f817461
2 files changed
+45
-10
No files matched your search
@@ -588,6 +588,24 @@ func TestFilerLookupsOnTheSyncPathCarryADeadline(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveLastSyncOffsetKeepsTheSavedOffsetWhenTheLookupFails(t *testing.T) {
|
||||
saved := time.Date(2026, 11, 4, 17, 57, 10, 0, time.UTC)
|
||||
lookupFails := func() (*filer_pb.Entry, error) { return nil, context.DeadlineExceeded }
|
||||
savedOffset := func() (int64, error) { return saved.UnixNano(), nil }
|
||||
|
||||
got := resolveLastSyncOffset("/buckets/x", 0, lookupFails, savedOffset)
|
||||
if !got.Equal(saved) {
|
||||
t.Fatalf("resolved %v, want the saved offset %v: a failed mount lookup must not start the replay at now", got, saved)
|
||||
}
|
||||
|
||||
// a mount that answers resumes from the saved offset when it postdates the directory
|
||||
entry := &filer_pb.Entry{Name: "x", Attributes: &filer_pb.FuseAttributes{Crtime: saved.Add(-time.Hour).Unix()}}
|
||||
got = resolveLastSyncOffset("/buckets/x", 0, func() (*filer_pb.Entry, error) { return entry, nil }, savedOffset)
|
||||
if !got.Equal(saved) {
|
||||
t.Fatalf("resolved %v, want %v", got, saved)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoteUploadReaderSharesOneChunkCache(t *testing.T) {
|
||||
entry := entryWith("blob.bin", nil, chunk("3,01", "e1"))
|
||||
for i := 0; i < 3; i++ {
|
||||
|
||||
Reference in new issue
Block a user