Files
seaweedfs/weed/wdclient
928c744977 filer: ask the master for log chunks the volume map lacks (#12937)
* filer: ask the master for log chunks the volume map lacks

loadLogFileEntries reads the log chunks that SubscribeMetadata and
SubscribeLocalMetadata replay from the persisted log, and it looked each
chunk's volume up only in the filer's cached volume map. A volume missing
there fails with "volume N not found", which isChunkNotFoundError takes
for a deleted volume, so the replay skips the rest of the log file. Once
the same pass reads a later entry from a file whose volume the map does
hold, for any path, the subscriber's position moves past the skipped
file, and filer.sync, filer.backup, filer.meta.tail or an S3 gateway
never receive its events.

A live volume is missing from the map in two cases:

- A starting filer serves subscriptions once its gRPC port is up, but
  gets its volume map only when it registers with the master, and
  AnnounceOnceCaughtUp holds that until the peers found at startup have
  caught up (at most a minute). Until then the map holds only volumes
  the filer has looked up through the master for other reads.
- A failed chunk read sets the volume's cached locations aside and looks
  the volume up again, which a cache-only lookup answers with "not
  found", as #11964 found for NewChunkStreamReaderFromFiler.

Use GetLookupFileIdFunction, which asks the master on a miss, like the
streaming reader since #11964 and the replay's other lookups.

Asking the master adds one more way to fail: no answer, when the master
cannot be reached before the client's retries run out. That error still
reads "volume N not found", since no locations are known, but it says
nothing about the volume, and skipping would lose the file's events for
good. wdclient now marks it with ErrLookupUnanswered, and
isChunkNotFoundError does not count a marked error as not found: the
replay returns it, and the subscriber resumes from there once the master
answers. A volume the master says does not exist is still skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: trim the replay lookup comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-11-24 15:52:56 -08:00
..