Files
seaweedfs/weed/shell
Chris LuandClaude Opus 5.5 856762b20d volume.fix.replication: keep every needle on copyCount survivors when trimming (#12897)
* volume.fix.replication: keep every needle on copyCount survivors when trimming

The trim refused only needles that no survivor held. When replicas have
diverged, a needle written while one survivor was down could be held only
by the doomed replica and one other survivor, so the trim left it on a
single copy while the volume still looked healthy. Count the survivors
holding each live needle and refuse unless it stays on
min(copyCount, survivors) of them; a delete on any survivor still covers it.

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

* balancer: list trim candidates best first

PickOneReplicaToDelete and PickOneMisplacedVolume now return the first of
ReplicasToDelete and MisplacedVolumesToDelete, which list every replica
the pick chooses from in the same order, so a caller that refuses the
pick can try the next one.

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

* volume.fix.replication: trim the next candidate when the pick is short

When the preferred replica would leave a needle short of copies, try the
next candidate in the same preference order instead of skipping the
volume. A replica that missed writes is often the only safe one to
trim, and it need not be the smallest. Index and status errors still
skip the volume.

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

* volume.fix.replication: fold survivor indexes into per-needle counts

countUncoveredNeedles kept every survivor's filtered index until the
check ended. Count the survivors holding each needle of the doomed
replica in a byte per needle instead, and release each survivor's index
before reading the next.

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

* volume.fix.replication: test a rewrite after a delete on one survivor

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:22:18 -08:00
..