aboutsummaryrefslogtreecommitdiff
path: root/weed/pb/grpc_client_server.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-12-11 10:25:02 -0800
committerGitHub <noreply@github.com>2025-12-11 10:25:02 -0800
commit84b8a8e010269b84a1d6f2b7c730cc49b85bf280 (patch)
treeebca3a8efd3100dbb40139ecbffa47b0a7d2b1e0 /weed/pb/grpc_client_server.go
parentc6d6ee8297b7bb569d52b22fa677613514475ce2 (diff)
downloadseaweedfs-84b8a8e010269b84a1d6f2b7c730cc49b85bf280.tar.xz
seaweedfs-84b8a8e010269b84a1d6f2b7c730cc49b85bf280.zip
filer.sync: fix checkpoint not being saved properly (#7719)
* filer.sync: fix race condition on first checkpoint save Initialize lastWriteTime to time.Now() instead of zero time to prevent the first checkpoint save from being triggered immediately when the first event arrives. This gives async jobs time to complete and update the watermark before the checkpoint is saved. Previously, the zero time caused lastWriteTime.Add(3s).Before(now) to be true on the first event, triggering an immediate checkpoint save attempt. But since jobs are processed asynchronously, the watermark was still 0 (initial value), causing the save to be skipped due to the 'if offsetTsNs == 0 { return nil }' check. Fixes #7717 * filer.sync: save checkpoint on graceful shutdown Add graceful shutdown handling to save the final checkpoint when filer.sync is terminated. Previously, any sync progress within the last 3-second checkpoint interval would be lost on shutdown. Changes: - Add syncState struct to track current processor and offset save info - Add atomic pointers syncStateA2B and syncStateB2A for both directions - Register grace.OnInterrupt hook to save checkpoints on shutdown - Modify doSubscribeFilerMetaChanges to update sync state atomically This ensures that when filer.sync is restarted, it resumes from the correct position instead of potentially replaying old events. Fixes #7717
Diffstat (limited to 'weed/pb/grpc_client_server.go')
0 files changed, 0 insertions, 0 deletions