From f9b8a839ff9f635d320fc66a19d2e6c0c658db98 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 29 Mar 2019 02:16:55 -0400 Subject: [PATCH] Optimize Persistent Data Loading removes Mineshaft loading legacy as we had pre 1.13.2 to avoid managing that very large data file from legacy systems. Previous to 1.13.2 these data files were never loaded to begin with, so they effectively do not contain valid/relevant data. These files take a long time to convert on large worlds and crashes the server. Additionally, cache the result of a file being missing so we don't keep spam checking it. --- .../Optimize-Persistent-Data-Loading.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Spigot-Server-Patches/Optimize-Persistent-Data-Loading.patch diff --git a/Spigot-Server-Patches/Optimize-Persistent-Data-Loading.patch b/Spigot-Server-Patches/Optimize-Persistent-Data-Loading.patch new file mode 100644 index 0000000000..ef62ff8c7d --- /dev/null +++ b/Spigot-Server-Patches/Optimize-Persistent-Data-Loading.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 29 Mar 2019 01:25:11 -0400 +Subject: [PATCH] Optimize Persistent Data Loading + +removes Mineshaft loading legacy as we had pre 1.13.2 to avoid managing +that very large data file from legacy systems. + +Previous to 1.13.2 these data files were never loaded to begin with, so they +effectively do not contain valid/relevant data. + +These files take a long time to convert on large worlds and crashes the server. + +Additionally, cache the result of a file being missing so we don't keep spam checking it. + +diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java +index 8d51af286..e86d382c8 100644 +--- a/src/main/java/net/minecraft/server/WorldPersistentData.java ++++ b/src/main/java/net/minecraft/server/WorldPersistentData.java +@@ -0,0 +0,0 @@ public class WorldPersistentData { + + @Nullable + public T a(Function function, String s) { ++ if ("Mineshaft_index".equals(s) || "Mineshaft".equals(s)) return null; // Paper - mineshaft is useless data + T persistentbase = (T) this.data.get(s); // Paper - decompile fix + + if (persistentbase == null && this.e != null) { +@@ -0,0 +0,0 @@ public class WorldPersistentData { + persistentbase = function.apply(s); // Paper - decompile fix + persistentbase.a(a(this.e, this.b, s, 1631).getCompound("data")); + this.data.put(s, persistentbase); +- } ++ } else this.data.put(s, NO_RESULT); // Paper + } catch (Exception exception) { + WorldPersistentData.a.error("Error loading saved data: {}", s, exception); + } + } + +- return persistentbase; ++ return persistentbase == NO_RESULT ? null : persistentbase; // Paper + } ++ private static final PersistentBase NO_RESULT = new ForcedChunk("chunks"); // Paper + + public void a(String s, PersistentBase persistentbase) { + this.data.put(s, persistentbase); +@@ -0,0 +0,0 @@ public class WorldPersistentData { + } + + public static NBTTagCompound a(IDataManager idatamanager, DimensionManager dimensionmanager, String s, int i) throws IOException { ++ if ("Mineshaft".equals(s) || "Mineshaft_index".equals(s)) return new NBTTagCompound(); // Paper + File file = idatamanager.getDataFile(dimensionmanager, s); + FileInputStream fileinputstream = new FileInputStream(file); + Throwable throwable = null; +-- \ No newline at end of file