Files
seaweedfs/weed/mount/meta_cache
Yip LeoandClaude Opus 5.5 ecd0493906 mount: keep following the metadata log when the cache refuses an event (#13141)
* mount: keep following the metadata log when the cache refuses an event

The mount applies each event of the filer's metadata log to its local
metadata cache, a leveldb store under -cacheDir. Once that disk is full
every write to the store fails, and an event the cache refuses goes one
of two ways:

- An event the stream delivers fails the follow, which the mount runs
  with FatalOnError: glog.Fatalf ends the process, every file open on
  the mount goes with it, and the mount does not come back when the disk
  has room again.
- An event replayed from the persisted log is returned to the follow
  loop, which resubscribes from it and fails on it again: the mount
  stays up, but no later event reaches its cache, so its listings stop
  changing.

A local change whose apply fails (create, mkdir, unlink, rmdir) drops
its directory's cached listing with InvalidateChildrenCache and goes on.
An event from the log now does the same: the cached listings it
changes, the parents it leaves and enters and a directory it creates,
moves or deletes, are dropped, so the next lookup reads the filer and
the next listing rebuilds them, and the event's kernel invalidations
still go out. The follow goes on. A warning reports the first such
event and then at most one a minute.

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

* mount: handle a refused event in the apply step that refused it

Review of the previous commit found two gaps.

A rename into a directory whose listing is being built applies the part
leaving the source at once and keeps the part entering the building
directory for the build to replay. When the part applied at once was
refused, the other part was not kept, and the build published its
listing without the renamed file. It is now kept whatever happens to
the part applied at once.

The listings a refused event changes were dropped, and its kernel
invalidations sent, by the follow's event function after the apply
returned. By then the apply loop could have taken a later request, such
as this mount's own create of the name a rename left, and the rename's
invalidation would then move the new file. The apply step that fails
now does both before it returns, as it sends the side effects of an
event the store takes, and on the apply loop, which owns buildingDirs
and is the only one to feed the invalidate worker. A local change whose
apply fails gets the same; its caller still drops its directory's
listing as before.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:42:25 -08:00
..
2022-02-14 01:09:31 -08:00