add back hunk to async SavedData IO

This commit is contained in:
Jake Potrebic 2024-04-26 19:33:30 -07:00
parent 9bac3894e1
commit 81f4405e26
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
40 changed files with 46 additions and 28 deletions

View file

@ -9,30 +9,28 @@ public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlo
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot; public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot;
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
index 658f3962543a36bc8c16f306ccb3e254b5b3d0a8..7bef8539d26bced77406f49c0b6fd2c04e6e641e 100644 index 658f3962543a36bc8c16f306ccb3e254b5b3d0a8..a1510dfd4824c0e246543d770f0e74f0f97c4ace 100644
--- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java --- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
@@ -27,6 +27,7 @@ public class FieldRename { @@ -27,6 +27,7 @@ public class FieldRename {
} }
return switch (owner) { return switch (owner) {
+ case "org/bukkit/scoreboard/DisplaySlot" -> FieldRename.convertDisplaySlot(apiVersion, from); // Paper - DisplaySlot + case "org/bukkit/scoreboard/DisplaySlot" -> FieldRename.convertDisplaySlot(from); // Paper - DisplaySlot
case "org/bukkit/block/banner/PatternType" -> FieldRename.convertPatternTypeName(apiVersion, from); case "org/bukkit/block/banner/PatternType" -> FieldRename.convertPatternTypeName(apiVersion, from);
case "org/bukkit/enchantments/Enchantment" -> FieldRename.convertEnchantmentName(apiVersion, from); case "org/bukkit/enchantments/Enchantment" -> FieldRename.convertEnchantmentName(apiVersion, from);
case "org/bukkit/block/Biome" -> FieldRename.convertBiomeName(apiVersion, from); case "org/bukkit/block/Biome" -> FieldRename.convertBiomeName(apiVersion, from);
@@ -43,6 +44,18 @@ public class FieldRename { @@ -43,6 +44,16 @@ public class FieldRename {
}; };
} }
+ // Paper start - DisplaySlot + // Paper start - DisplaySlot
+ private static final FieldRenameData DISPLAY_SLOT_DATA = FieldRenameData.Builder.newBuilder()
+ .forAllVersions()
+ .change("SIDEBAR_TEAM_", "SIDEBAR_")
+ .build();
+
+ @DoNotReroute + @DoNotReroute
+ public static String convertDisplaySlot(ApiVersion version, String from) { + public static String convertDisplaySlot(final String from) {
+ return FieldRename.DISPLAY_SLOT_DATA.getReplacement(version, from); + if (from.startsWith("SIDEBAR_") && !from.startsWith("SIDEBAR_TEAM_")) {
+ return from.replace("SIDEBAR_", "SIDEBAR_TEAM_");
+ }
+ return from;
+ } + }
+ // Paper end - DisplaySlot + // Paper end - DisplaySlot
+ +

View file

@ -103,10 +103,10 @@ index f31fcf3054b201e52ee84b9523820dc619762eef..2cd2e260e9a958c8aee7b2fb4e010ef8
} else { } else {
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0b7a38b9e92b19345a34c6226413a9b133264077..18640c8681f6a3b2276123d19e3e8f0a8c630b41 100644 index c7b7f153895a4b95b2071a31db00c9c4b69fa094..7fbeebe63f755624b967374072aa2e0565ce8c35 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -566,6 +566,7 @@ public class ServerChunkCache extends ChunkSource { @@ -559,6 +559,7 @@ public class ServerChunkCache extends ChunkSource {
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
Iterator iterator1 = list.iterator(); Iterator iterator1 = list.iterator();
@ -114,7 +114,7 @@ index 0b7a38b9e92b19345a34c6226413a9b133264077..18640c8681f6a3b2276123d19e3e8f0a
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next(); ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
LevelChunk chunk1 = chunkproviderserver_a.chunk; LevelChunk chunk1 = chunkproviderserver_a.chunk;
@@ -579,6 +580,7 @@ public class ServerChunkCache extends ChunkSource { @@ -572,6 +573,7 @@ public class ServerChunkCache extends ChunkSource {
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
this.level.tickChunk(chunk1, l); this.level.tickChunk(chunk1, l);
@ -123,7 +123,7 @@ index 0b7a38b9e92b19345a34c6226413a9b133264077..18640c8681f6a3b2276123d19e3e8f0a
} }
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4b7cad5f551d620dbd091111df94fb39efcb79ac..9cd54bc390f0629bf6b4494bd9c3a6e0927d1b7b 100644 index bc609da7105293dfa4ed339f553be66b0a632698..f9de1196c01c6e32ff1bfad33761bc64c1c6dc5d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9cd54bc390f0629bf6b4494bd9c3a6e0927d1b7b..215f03dfe0e6441588679efaedbcf04c352b404c 100644 index f9de1196c01c6e32ff1bfad33761bc64c1c6dc5d..b776f1083b8693d13ea523985bf6ec6a3f7ba8dc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -867,6 +867,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -867,6 +867,10 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -76,7 +76,7 @@ index e161ad0f53a21a68e8c78575ba5d3cdbdb11fca0..57e76b53e5e314c3e6b8856010f7a841
}); });
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 215f03dfe0e6441588679efaedbcf04c352b404c..aabaaf89f5e344791604a7e05122d9865bb0224e 100644 index b776f1083b8693d13ea523985bf6ec6a3f7ba8dc..b27dbee5bef643ed6e79845587f5c02ef238124c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1251,7 +1251,26 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1251,7 +1251,26 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -2009,7 +2009,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index aabaaf89f5e344791604a7e05122d9865bb0224e..2bfebbe0bc5a7f72c9ebe60fded260b3f94ac749 100644 index b27dbee5bef643ed6e79845587f5c02ef238124c..232ee4e3f32b93f5ae725b025abd538fe8927d90 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -187,10 +187,10 @@ index ed5154e41ca858f4d6b4d1c276c66831c038d2a6..cdb3c2cde5d9133ef60cf96d91762e6a
public String getDebugStatus() { public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 18640c8681f6a3b2276123d19e3e8f0a8c630b41..b99f50604bafecbc68835974c9ed0caa91911a40 100644 index 7fbeebe63f755624b967374072aa2e0565ce8c35..36caf354634d6675a3f1ec6829f4778e1d0623bc 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -506,18 +506,10 @@ public class ServerChunkCache extends ChunkSource { @@ -499,18 +499,10 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("pollingChunks"); gameprofilerfiller.push("pollingChunks");
gameprofilerfiller.push("filteringLoadedChunks"); gameprofilerfiller.push("filteringLoadedChunks");
@ -211,7 +211,7 @@ index 18640c8681f6a3b2276123d19e3e8f0a8c630b41..b99f50604bafecbc68835974c9ed0caa
if (this.level.tickRateManager().runsNormally()) { if (this.level.tickRateManager().runsNormally()) {
gameprofilerfiller.popPush("naturalSpawnCount"); gameprofilerfiller.popPush("naturalSpawnCount");
@@ -552,38 +544,109 @@ public class ServerChunkCache extends ChunkSource { @@ -545,38 +537,109 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("spawnAndTick"); gameprofilerfiller.popPush("spawnAndTick");
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
@ -337,7 +337,7 @@ index 18640c8681f6a3b2276123d19e3e8f0a8c630b41..b99f50604bafecbc68835974c9ed0caa
this.level.timings.chunkTicks.stopTiming(); // Paper this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners"); gameprofilerfiller.popPush("customSpawners");
@@ -595,11 +658,23 @@ public class ServerChunkCache extends ChunkSource { @@ -588,11 +651,23 @@ public class ServerChunkCache extends ChunkSource {
} }
gameprofilerfiller.popPush("broadcast"); gameprofilerfiller.popPush("broadcast");

View file

@ -28,7 +28,7 @@ index b21daeeb043df885fba5e6a7572d311fd0830815..8515cec5e21ad291ca427baaafb4c2f3
this.profiler.push(() -> { this.profiler.push(() -> {
String s = String.valueOf(worldserver); String s = String.valueOf(worldserver);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2bfebbe0bc5a7f72c9ebe60fded260b3f94ac749..89ecaaa774e59ad01eec0ce2fe546026a8b47ae8 100644 index 232ee4e3f32b93f5ae725b025abd538fe8927d90..05e7a908c18b5eef49afb088b7519185bc806056 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -8,7 +8,7 @@ we can instead use the nearby player tracking system to reduce
the number of tests per search. the number of tests per search.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 89ecaaa774e59ad01eec0ce2fe546026a8b47ae8..12a9342634ffa7d6aaa9a7fdd65a45bccec8dd13 100644 index 05e7a908c18b5eef49afb088b7519185bc806056..de3da37c40053789ba2c5d3754452ab49fa9962b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -581,6 +581,115 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -581,6 +581,115 @@ public class ServerLevel extends Level implements WorldGenLevel {

View file

@ -5,8 +5,28 @@ Subject: [PATCH] Write SavedData IO async
Co-Authored-By: Shane Freeder <theboyetronic@gmail.com> Co-Authored-By: Shane Freeder <theboyetronic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
index e049fbe4038aaea896f45b11ce9ce8f05922c898..7f6d1ccd147e5593412567bb2934ce5662da7ef0 100644
--- a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
@@ -110,6 +110,15 @@ public class ThreadedWorldUpgrader {
}
this.threadPool.execute(new ConvertTask(info, regionPos.x >> 5, regionPos.z >> 5));
+ // Paper start - Write SavedData IO async
+ this.threadPool.execute(() -> {
+ try {
+ worldPersistentData.close();
+ } catch (IOException exception) {
+ LOGGER.error("Failed to close persistent world data", exception);
+ }
+ });
+ // Paper end - Write SavedData IO async
}
this.threadPool.shutdown();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c7b7f153895a4b95b2071a31db00c9c4b69fa094..0b7a38b9e92b19345a34c6226413a9b133264077 100644 index 36caf354634d6675a3f1ec6829f4778e1d0623bc..b99f50604bafecbc68835974c9ed0caa91911a40 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -447,6 +447,13 @@ public class ServerChunkCache extends ChunkSource { @@ -447,6 +447,13 @@ public class ServerChunkCache extends ChunkSource {
@ -24,10 +44,10 @@ index c7b7f153895a4b95b2071a31db00c9c4b69fa094..0b7a38b9e92b19345a34c6226413a9b1
// CraftBukkit start - modelled on below // CraftBukkit start - modelled on below
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bc609da7105293dfa4ed339f553be66b0a632698..4b7cad5f551d620dbd091111df94fb39efcb79ac 100644 index de3da37c40053789ba2c5d3754452ab49fa9962b..12a9342634ffa7d6aaa9a7fdd65a45bccec8dd13 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1330,7 +1330,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1498,7 +1498,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
if (doFull) { if (doFull) {
@ -36,7 +56,7 @@ index bc609da7105293dfa4ed339f553be66b0a632698..4b7cad5f551d620dbd091111df94fb39
} }
this.timings.worldSaveChunks.startTiming(); // Paper this.timings.worldSaveChunks.startTiming(); // Paper
@@ -1366,7 +1366,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1534,7 +1534,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
} }
@ -45,7 +65,7 @@ index bc609da7105293dfa4ed339f553be66b0a632698..4b7cad5f551d620dbd091111df94fb39
if (progressListener != null) { if (progressListener != null) {
progressListener.progressStage(Component.translatable("menu.savingChunks")); progressListener.progressStage(Component.translatable("menu.savingChunks"));
} }
@@ -1389,12 +1389,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1557,12 +1557,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit end // CraftBukkit end
} }