Repository navigation
Add save-all [flush] for region threading - #517
Closed
lewisgibson wants to merge 2 commits into
Closed
lewisgibson wants to merge 2 commits into
lewisgibson wants to merge 2 commits into
Conversation
Folia does not register /save-all, so backup scripts bracketing a copy with save-off, save-all flush and save-on get Unknown command. See the patch for details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Folia does not register
/save-all, so a backup script that runssave-off,save-all flushandsave-ongets "Unknown command" and archives region files that are still being written. The world has to be flushed to disk before it is archived.This enables the command again. Each region section is saved by a task on the region that owns it, each player on its entity scheduler, and the level data and global saved data on the global region. The files are then flushed from a background thread, so no tick thread waits, and the reply ("Saved the game") is sent once they are on disk, including to rcon clients, which are answered when the command returns and so have to wait for it. As in Paper, a failure the server only logs while saving does not change the reply. An entity that is mid-teleport between regions at the moment of the save is not in that archive.
Tested on ver/26.2.x with 3 tick threads and 5 bots building in different regions of the overworld and the nether, each block change acknowledged by the server before the command:
save-off,save-all flushover rcon, a copy of the world while the server keeps running with saving off, thensave-on. In the copies 207205 of 207205 acknowledged blocks were present, every region file parsed, no region file changed while saving was off and every reply wasSaving the game (this may take a moment!)Saved the game. Every fourth copy booted as a server (5 of 5). A flush took 0.7 to 1.7 seconds. The unpatched build answers "Unknown or incomplete command" and every one of its copies is missing every block.kill -9straight after the reply (0.07 to 0.1 s later), five rounds on one world, withsave-all flushand withsave-offfirst: nothing acknowledged was lost. The control, plainsave-all, lost 690 blocks in its round, as expected.This was done with AI (Claude Opus 5.5 and GPT Astra, high effort). I've reviewed it and tested it myself.