mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
* master: start a margin past the file ids handed out without a record A master records how far it hands file ids out, and the one that takes over starts from the record. A master from before the record existed leaves none: the first master that has it, taking over from one that does not, counts on from the largest id written and hands out again the ids that had not landed. That is every cluster on the day it is upgraded. The largest needle id a volume server reports shows it. Under masters that record, every id in use is below the recorded ceiling; one at or past it, or any at all with no ceiling recorded, was handed out without a record, and so may others above it. The sequence then goes on a margin of 2^24 past it. Three masters of the previous version, the two followers restarted with this one, then the leader killed while ids are assigned: 510 of 1228 ids were handed out twice, and none of 1252 with the margin. Three masters of this version alone never take it: the ranges stay a step apart. * master: margin a late server's ids past only other masters' ceilings A volume server that first reports after the master that took over has handed out ids holds none of them, yet its ids can sit under the ceiling this master recorded since and so miss the margin, though they were handed out without a record. Compare a server's first report to this master against the ceilings other masters recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: give up its own file id ceiling when the leader changes A master that leads again, having stayed up, counted on from where it stopped under the ceiling it had recorded. A master that records nothing may have led in between, as one of the previous version can during a rolling upgrade, going on from the servers' reports below that ceiling: the ids it handed out that had not landed were handed out again. The margin does not catch it, as the reports stay under the ceiling and the servers are known. On a leader change a master now gives up its own ceiling and moves its sequence to the highest one recorded, so its next assignment records a new ceiling past all of them. goraft calls the leader change listener from its loop, so this takes no lock a raft command is held under. * master: drop a file id drawn before a leader change gave its ceiling up nextFileId read its own ceiling before the draw and checked that copy after it. A leader change that gave the ceiling up between the two left the stale copy passing, so an id drawn below the old ceiling could be handed out after a master in between had handed it out too. Read the own ceiling again after the draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: pin leading again to the ceiling recorded before The test checked the id against a bound far below the recorded ceiling, so a drop that moved the sequence only a little would still pass. Check the id and the new ceiling against the ceiling recorded before the leader changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: count a server's first report after a leader change as its first The servers that reported to a master were kept for the life of the process. When the master led again after one that records nothing, a server it knew from before was compared against the ceiling it had just recorded, which may already be past the ids the master in between handed out, so a late report took no margin. Forget the reporters on a leader change, so their next report is compared against the other masters' ceilings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>