geforkt von Mirrors/Paper
bc0dd0df3d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 716b4fce Revert SnakeYAML upgrade ca6f8942 Update to Minecraft 1.18-rc3 57e7e952 #683: Add Player#showDemoScreen CraftBukkit Changes: c98abfb0 Update to Minecraft 1.18-rc3 9b258501 #960: Add Player#showDemoScreen d9542247 Produce remapped jars after bootstrap jar 99f3ddde SPIGOT-6808: Fix RegionAccessor#getBiome Spigot Changes: b7a4222e Update to Minecraft 1.18-rc3
43 Zeilen
2.3 KiB
Diff
43 Zeilen
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sat, 16 Oct 2021 01:36:00 -0700
|
|
Subject: [PATCH] Do not overload I/O threads with chunk data while flush
|
|
saving
|
|
|
|
If the chunk count is high, then the memory used by the
|
|
chunks adds up and could cause problems. By flushing
|
|
every so many chunks, the server will not become
|
|
stressed for memory. It will also not increase the total
|
|
time to save, as flush saving performs a full flush at
|
|
the end anyways.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index a3f3015f9eba9a2eccbc3f1f64bca4c66d52b9f2..7c4154b1b5ccc53af5f5fb186c2a5d1ff88c7af1 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -910,6 +910,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
// Paper end
|
|
|
|
protected void saveAllChunks(boolean flush) {
|
|
+ // Paper start - do not overload I/O threads with too much work when saving
|
|
+ int[] saved = new int[1];
|
|
+ int maxAsyncSaves = 50;
|
|
+ Runnable onChunkSave = () -> {
|
|
+ if (++saved[0] >= maxAsyncSaves) {
|
|
+ saved[0] = 0;
|
|
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.flush();
|
|
+ }
|
|
+ };
|
|
+ // Paper end - do not overload I/O threads with too much work when saving
|
|
if (flush) {
|
|
List<ChunkHolder> list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper
|
|
MutableBoolean mutableboolean = new MutableBoolean();
|
|
@@ -932,6 +942,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}).filter((ichunkaccess) -> {
|
|
return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk;
|
|
}).filter(this::save).forEach((ichunkaccess) -> {
|
|
+ onChunkSave.run(); // Paper - do not overload I/O threads with too much work when saving
|
|
mutableboolean.setTrue();
|
|
});
|
|
} while (mutableboolean.isTrue());
|