Skip to content

fix(posix): cephfs watcher ignore check, event order and kafka auth - #964

Draft
butonic wants to merge 1 commit into
opencloud-eu:mainfrom
butonic:cephfs-watcher-fixes
Draft

butonic wants to merge 1 commit into
opencloud-eu:mainfrom
butonic:cephfs-watcher-fixes

Conversation

@butonic

@butonic butonic commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

While checking out ceph/ceph#72437 I revisited oure cephfs watcher implementation.

The cephfs watcher passed the event path to the ignorer as-is, but the path is relative to the watch root and the ignorer only knows absolute paths. For moves it even passed the empty path. So only lock files were ever ignored. Since the MDS change notifier in ceph/ceph#72437 does not filter anything, every write to the metadata, tmp, upload and trash dirs triggered a scan. We now make the paths absolute first and check both ends of a move separately, like the inotify watcher does.

Events were scanned in one goroutine each, which threw away the per-rank order the MDS keeps and raced on a shared err. We now scan them in the order they arrive.

The kafka reader could only talk to plaintext brokers. The new kafkawatcher options configure TLS and SASL:

kafkawatcher:
  enable-tls: true
  tls-root-ca-cert: /etc/ssl/kafka-ca.pem
  sasl-mechanism: SCRAM-SHA-512   # PLAIN, SCRAM-SHA-256, SCRAM-SHA-512
  username: opencloud
  password: secret

opencloud still needs to pass these options through to the storage-users config. The gpfswatchfolder watcher has the same relative-path ignore bug, I left it alone for now.

Assisted by Claude Code (claude-opus-5-5): it reviewed the watcher against the ceph PR's wire format and wrote the change, the tests and this description.

The ignorer only knows absolute paths, but the cephfs watcher passed it
the path from the event, which is relative to the watch root, and for
moves the empty path. So only lock files were ever ignored. Since the
MDS change notifier does not filter anything, every write to the
metadata, tmp, upload and trash dirs triggered a scan. We now make each
path absolute first and check the source and destination of a move
separately, like the inotify watcher does: a move from the tmp dir only
scans the destination, a move into an ignored dir only the source.

Events were scanned in one goroutine each, which threw away the order
the MDS keeps per rank and raced on the shared err variable. We now scan
them in the order they arrive. Scan mostly just debounces, deletes and
moves have to happen before later events for the same path anyway.

The kafka reader could only talk to plaintext brokers. The new
kafkawatcher options configure TLS and SASL (PLAIN, SCRAM-SHA-256,
SCRAM-SHA-512).

related: ceph/ceph#72437

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic
butonic marked this pull request as draft November 2, 2026 12:21
@butonic

butonic commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

Two things this PR does not address:

  • metadata changes are not reported. The MDS only emits events for journaled namespace ops and for dirty Fw/Fx cap flushes. setattr is classified as none, so a truncate -s 0 file from a shell (journaled as setattr, no cap flush) produces no event, and neither do chmod, chown or xattr changes. We don't notice until something else triggers a scan of that path.
  • lost events go unnoticed. Events still in the MDS queue or in the librdkafka in-flight buffer when a rank dies are dropped silently, and queue overflows are only counted in notify status. There is no sequence number, so we cannot detect a gap. The ceph PR suggests a periodic sweep comparing ceph.dir.rctime to the time of the last sweep and rescanning dirs that changed. We could do that as a cheap variant of scan_fs for the cephfs watcher ... rctime is recursive, so we only descend into subtrees that actually changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant