-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Flush regionfiles on save configuration option
The windows file system does not write metadata unless the FileChannel is explicitly flushed with metaData=true. Note: Setting SYNC (not DSYNC) on the FileChannel does not appear to write the metadata. Specifically, we are interested in writing the last modified timestamp so that fs watchers can detect when RegionFiles are modified.
1 parent
30046e0
commit 88bbead
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
paper-server/patches/features/0030-Flush-regionfiles-on-save-configuration-option.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Spottedleaf <[email protected]> | ||
Date: Mon, 20 Jan 2025 13:30:34 -0800 | ||
Subject: [PATCH] Flush regionfiles on save configuration option | ||
|
||
The windows file system does not write metadata unless | ||
the FileChannel is explicitly flushed with metaData=true. | ||
|
||
Note: Setting SYNC (not DSYNC) on the FileChannel does not appear | ||
to write the metadata. | ||
|
||
Specifically, we are interested in writing the last modified | ||
timestamp so that fs watchers can detect when RegionFiles are | ||
modified. | ||
|
||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java | ||
index 1acea58838f057ab87efd103cbecb6f5aeaef393..98fbc5c8044bd945d64569f13412a6e7e49a4e7f 100644 | ||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java | ||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java | ||
@@ -1258,6 +1258,14 @@ public final class MoonriseRegionFileIO { | ||
|
||
try { | ||
this.regionDataController.finishWrite(this.chunkX, this.chunkZ, writeData); | ||
+ // Paper start - flush regionfiles on save | ||
+ if (this.world.paperConfig().chunks.flushRegionsOnSave) { | ||
+ final RegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ); | ||
+ if (regionFile != null) { | ||
+ regionFile.flush(); | ||
+ } // else: evicted from cache, which should have called flush | ||
+ } | ||
+ // Paper end - flush regionfiles on save | ||
} catch (final Throwable thr) { | ||
failedWrite = thr instanceof IOException; | ||
LOGGER.error("Failed to write chunk data for task: " + this.toString(), thr); |