mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 19:17:46 +01:00
mount: fence new handles and cover undelivered events in the watermark
A handle opened while an older event sat in the invalidation queue started with a zero watermark, so the delayed worker rolled its freshly looked-up entry back. The open now fences the handle with the event cursor captured before the lookup: the entry it installs reflects every event applied by then, so anything queued at or before that position is old news. Captured before, never after, so an event arriving mid-open cannot inflate the fence past the state the lookup returned — and the cursor now advances only after the store write, so the pairing is sound. Handles reusing an existing entry are not fenced, since that entry did not come from the lookup. The delivered-event cursor also misses events committed on the filer but not yet delivered to the subscription, which let a late-arriving older event roll back a server-side copy or an already-cached remote download. Those paths now take a barrier from a filer self-ping issued before the operation: events are stamped with that same clock, so the returned state is at least as new as anything at or below it. The ping is a single bounded attempt with the cursor as fallback.
This commit is contained in:
1 parent
36b25fca76
commit
239cfe64d3
6 files changed
+197
-7
No files matched your search
@@ -576,7 +576,6 @@ type metadataResponseSideEffects struct {
|
||||
}
|
||||
|
||||
func (mc *MetaCache) applyMetadataResponseNow(ctx context.Context, resp *filer_pb.SubscribeMetadataResponse, options MetadataResponseApplyOptions) error {
|
||||
mc.advanceLatestEventTs(resp.TsNs)
|
||||
if mc.shouldSkipDuplicateEvent(resp) {
|
||||
return nil
|
||||
}
|
||||
@@ -610,6 +609,10 @@ func (mc *MetaCache) applyMetadataResponseDirect(ctx context.Context, resp *file
|
||||
if _, err := mc.applyMetadataResponseLocked(ctx, resp, options, allowUncachedInsert); err != nil {
|
||||
return err
|
||||
}
|
||||
// Advance only after the store write: readers pairing a cursor capture
|
||||
// with a store read (the open-time handle fence) rely on the cursor never
|
||||
// leading the store.
|
||||
mc.advanceLatestEventTs(resp.TsNs)
|
||||
mc.applyMetadataSideEffects(resp, options)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user