Files
Chris LuandGitHub 3a61debaa5 filer: rebuild peer metadata subscriptions after a master reconnect (#10648)
* filer: keep the existing peer subscription on a repeated add

A cluster node add for a peer that is already followed restarted the
subscription, dropping the metadata events between the two runs.

* master: tell a connecting client the current cluster membership

Cluster node updates are only broadcast to the clients connected at that
moment. A filer that lost its master stream while a peer came back never
learned about the peer, and stopped replicating its metadata for good.

* test: a filer joining the master learns about the filers already there

* test: a filer resubscribes to a peer that registered while it was disconnected

Runs the reported sequence against real processes: filer2 leaves, filer1
is paused and its master stream is broken, filer2 registers again, and
filer1 has to replicate from it after reconnecting.
2026-08-08 10:28:25 -07:00
..
fmt
2025-12-19 15:33:16 -08:00
fmt
2025-12-19 15:33:16 -08:00

Metadata Subscribe Integration Tests

This directory contains integration tests for the SeaweedFS metadata subscription functionality.

Tests

TestMetadataSubscribeBasic

Tests basic metadata subscription functionality:

  • Start a SeaweedFS cluster (master, volume, filer)
  • Subscribe to metadata changes
  • Upload files and verify events are received

TestMetadataSubscribeSingleFilerNoStall

Regression test for issue #4977:

  • Tests that metadata subscription doesn't stall in single-filer setups
  • Simulates high-load file uploads while a subscriber tries to keep up
  • Verifies that events are received without significant stalling

The bug was that in single-filer setups, SubscribeMetadata would block indefinitely on MetaAggregator.MetaLogBuffer which remains empty (no peers to aggregate from). The fix ensures that when the buffer is empty, the subscription returns to read from persisted logs on disk.

TestMetadataSubscribeResumeFromDisk

Tests that subscription can resume from disk:

  • Upload files before starting subscription
  • Wait for logs to be flushed to disk
  • Start subscription from the beginning
  • Verify pre-uploaded files are received from disk

Running Tests

# Run all tests (requires weed binary in PATH or built)
go test -v ./test/metadata_subscribe/...

# Skip integration tests
go test -short ./test/metadata_subscribe/...

# Run with increased timeout for slow systems
go test -v -timeout 5m ./test/metadata_subscribe/...

Requirements

  • weed binary must be available in PATH or in the parent directories
  • Tests create temporary directories that are cleaned up after completion
  • Tests use ports 9333 (master), 8080 (volume), 8888 (filer)