Files
seaweedfs/test/metadata_subscribe
b64895ed0a filer: stop following a peer that stays unreachable (#12725)
* filer: stop following a peer that stays unreachable

* filer: re-track an answering peer only while it is still followed

A signature read that succeeds just before the master removes the peer
called initPeerWatermark after the removal, clearing its mark. The loop
then exits, so the watermark it re-tracked never advances or drops and
pins aggregated readers at the settled horizon.

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

* filer: forget a peer's unreachable clock when the master removes it

Only a successful connection cleared the clock, so every departed address
that once failed stayed in the map for the filer's lifetime, and a re-added
peer inherited the old outage. The removal now drops it, and the clock is
guarded by peerChansLock so the removed peer's exiting loop cannot start a
new one.

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

* filer: report the unreachable mark only when it is set

Once peerResumeRetention forgets the mark of a peer that stays
unreachable, markPeerWatermarkRemoved no longer marks it (its watermarks
are gone), but notePeerUnreachable still saw no mark and logged
"treating it as removed" on every retry. markPeerWatermarkRemoved now
reports whether it set a new mark.

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

* test: fix the unreachable-peer subscriber's start before the baseline write

The subscriber goroutine picked its start time itself, so a baseline write
that finished first fell before the subscription and the test failed after
20 seconds with correct delivery.

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 11:00:15 -08: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)