Add option to flush region files on save (#9149)

This commit is contained in:
Redned 2023-05-12 15:07:24 -05:00 committed by GitHub
parent efd47e3a68
commit 1edfefdef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View file

@ -5486,10 +5486,10 @@ index 0000000000000000000000000000000000000000..fb42d776f15f735fb59e972e00e2b512
+}
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4dcadc24b3d73178ee1a4b64b8c6343e5285e59
index 0000000000000000000000000000000000000000..748cc48c6c42c694d1c9b685e96fbe6d8337d3f3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -0,0 +1,1204 @@
@@ -0,0 +1,1211 @@
+package io.papermc.paper.chunk.system.scheduling;
+
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
@ -5749,6 +5749,13 @@ index 0000000000000000000000000000000000000000..e4dcadc24b3d73178ee1a4b64b8c6343
+ }
+ if (flush) {
+ RegionFileIOThread.flush();
+ if (this.world.paperConfig().chunks.flushRegionsOnSave) {
+ try {
+ this.world.chunkSource.chunkMap.regionFileCache.flush();
+ } catch (IOException ex) {
+ LOGGER.error("Exception when flushing regions in world {}", this.world.getWorld().getName(), ex);
+ }
+ }
+ }
+ if (logProgress) {
+ LOGGER.info("Saved " + savedChunk + " block chunks, " + savedEntity + " entity chunks, " + savedPoi + " poi chunks in world '" + this.world.getWorld().getName() + "' in " + format.format(1.0E-9 * (System.nanoTime() - start)) + "s");