aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2019-02-23 15:59:20 -0500
committerAikar <[email protected]>2019-02-23 16:31:43 -0500
commit5719e128fa0c3282f8ee28f91bd8248cbcef9bec (patch)
treebd1c48871fcf82c4b18f5b1e6816008e091666b0
parent64efe67de36f1cdb276b1b30839c16f5e8ad4f53 (diff)
downloadPaper-5719e128fa0c3282f8ee28f91bd8248cbcef9bec.tar.gz
Paper-5719e128fa0c3282f8ee28f91bd8248cbcef9bec.zip
Updated Upstream (Spigot)
This brings in Spigots Oversized Chunks fix so that servers migrating from Spigot 1.12 to Paper 1.12 can safely transition the save formats. Spigot Changes: 79a30d7d Allow Saving Large Chunks
-rw-r--r--Spigot-Server-Patches/0063-Add-exception-reporting-event.patch30
-rw-r--r--Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch10
-rw-r--r--Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch14
-rw-r--r--Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch41
-rw-r--r--Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch35
m---------work/Spigot0
6 files changed, 74 insertions, 56 deletions
diff --git a/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch
index 4175c32b2f..4d3da8480e 100644
--- a/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch
+++ b/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch
@@ -1,4 +1,4 @@
-From 6ceadeb266a7fc9a4a41c7819ce49ec3e034b39c Mon Sep 17 00:00:00 2001
+From 1f25a64e8de47c04bf521861d9b57662227ac759 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <[email protected]>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644
-index 000000000..93397188b
+index 00000000..93397188
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,38 @@
@@ -50,7 +50,7 @@ index 000000000..93397188b
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 08d6ef09a..d5ef4ed0e 100644
+index c79d3a93..65952ea9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@@ -89,7 +89,7 @@ index 08d6ef09a..d5ef4ed0e 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-index 2b320cbd1..4e7e8e5fd 100644
+index 2b320cbd..4e7e8e5f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -12,6 +12,7 @@ import java.util.Iterator;
@@ -144,7 +144,7 @@ index 2b320cbd1..4e7e8e5fd 100644
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
-index 83322b85b..b943a9b20 100644
+index 83322b85..b943a9b2 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,7 @@
@@ -172,7 +172,7 @@ index 83322b85b..b943a9b20 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
-index 936d6c640..50056f49a 100644
+index 936d6c64..50056f49 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -1,5 +1,6 @@
@@ -199,7 +199,7 @@ index 936d6c640..50056f49a 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
-index 1ba26de5c..6a92b5af8 100644
+index c13e1eef..d2f08802 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@
@@ -209,7 +209,7 @@ index 1ba26de5c..6a92b5af8 100644
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
-@@ -82,6 +83,7 @@ public class RegionFile {
+@@ -103,6 +104,7 @@ public class RegionFile {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
@@ -217,7 +217,7 @@ index 1ba26de5c..6a92b5af8 100644
}
}
-@@ -209,6 +211,7 @@ public class RegionFile {
+@@ -247,6 +249,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
@@ -226,7 +226,7 @@ index 1ba26de5c..6a92b5af8 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
-index c15a0d1f8..5f9e9ddef 100644
+index c15a0d1f..5f9e9dde 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,5 +1,6 @@
@@ -245,7 +245,7 @@ index c15a0d1f8..5f9e9ddef 100644
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
-index 1c7c187c7..68a045323 100644
+index 1c7c187c..68a04532 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -7,6 +7,7 @@ import java.util.Random;
@@ -273,7 +273,7 @@ index 1c7c187c7..68a045323 100644
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
-index 9ff4f23ab..6fce3015f 100644
+index 9ff4f23a..6fce3015 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@
@@ -293,7 +293,7 @@ index 9ff4f23ab..6fce3015f 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
-index 89197281e..6be9c1815 100644
+index 89197281..6be9c181 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@
@@ -329,7 +329,7 @@ index 89197281e..6be9c1815 100644
this.tileEntityListTick.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
-index 93b9134d6..26753fac5 100644
+index 93b9134d..26753fac 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference;
@@ -375,5 +375,5 @@ index 93b9134d6..26753fac5 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--
-2.18.0
+2.20.1
diff --git a/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch
index e024da8af3..b6cbc2cd95 100644
--- a/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch
+++ b/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch
@@ -1,4 +1,4 @@
-From bc3a702f71fbd98ac83d02992c8df88a9207e765 Mon Sep 17 00:00:00 2001
+From 98431cfef4644e54f94e1379dce74e6648c497b9 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 4 Mar 2013 23:46:10 -0500
Subject: [PATCH] Chunk Save Reattempt
@@ -6,7 +6,7 @@ Subject: [PATCH] Chunk Save Reattempt
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
-index 4c3faa201..12bd558a7 100644
+index 4c3faa20..12bd558a 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -194,11 +194,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -28,10 +28,10 @@ index 4c3faa201..12bd558a7 100644
synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
-index 6a92b5af8..5bcbd718f 100644
+index d2f08802..c3424a35 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
-@@ -210,8 +210,7 @@ public class RegionFile {
+@@ -248,8 +248,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) {
@@ -42,5 +42,5 @@ index 6a92b5af8..5bcbd718f 100644
}
--
-2.18.0
+2.20.1
diff --git a/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch
index 5245e68f98..0a24c2e3cc 100644
--- a/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch
+++ b/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch
@@ -1,11 +1,11 @@
-From b4237ef0e075d98a14b87bfd673d34b96cb1d966 Mon Sep 17 00:00:00 2001
+From 65277bb5c79ac221f24ca1bded6e71b69f559815 Mon Sep 17 00:00:00 2001
From: Antony Riley <[email protected]>
Date: Tue, 29 Mar 2016 06:56:23 +0300
Subject: [PATCH] Reduce IO ops opening a new region file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
-index 5bcbd718f..2bd85e2d1 100644
+index c3424a35..eac8b22b 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream;
@@ -21,7 +21,7 @@ index 5bcbd718f..2bd85e2d1 100644
import java.util.List;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPInputStream;
-@@ -67,8 +70,16 @@ public class RegionFile {
+@@ -72,8 +75,16 @@ public class RegionFile {
int k;
@@ -37,9 +37,9 @@ index 5bcbd718f..2bd85e2d1 100644
- k = this.c.readInt();
+ k = headerAsInts.get(); // Paper
this.d[j] = k;
- if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) {
- for (int l = 0; l < (k & 255); ++l) {
-@@ -78,7 +89,7 @@ public class RegionFile {
+ // Spigot start
+ int length = k & 255;
+@@ -99,7 +110,7 @@ public class RegionFile {
}
for (j = 0; j < 1024; ++j) {
@@ -49,5 +49,5 @@ index 5bcbd718f..2bd85e2d1 100644
}
} catch (IOException ioexception) {
--
-2.18.0
+2.20.1
diff --git a/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch
index 3be82ad0db..d210377896 100644
--- a/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch
+++ b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch
@@ -1,4 +1,4 @@
-From ec510b0b41b7924da4737613c9c10441498eb46f Mon Sep 17 00:00:00 2001
+From 25f06715b685a629d93544f7a05d99c243b6d56e Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Sat, 11 Aug 2018 00:49:20 -0400
Subject: [PATCH] Detect and repair corrupt Region Files
@@ -11,12 +11,12 @@ I don't know why mojang only checks for 4096, when anything less than 8192 is a
But to be safe, it will attempt to back up the file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
-index 2bd85e2d..d334d634 100644
+index eac8b22b..d58cda9a 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
-@@ -23,10 +23,10 @@ import javax.annotation.Nullable;
- public class RegionFile {
-
+@@ -28,10 +28,10 @@ public class RegionFile {
+ private static final boolean ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("net.minecraft.server.RegionFile.enableExtendedSave", "true"));
+ // Spigot end
private static final byte[] a = new byte[4096];
- private final File b;
- private RandomAccessFile c;
@@ -29,7 +29,7 @@ index 2bd85e2d..d334d634 100644
private List<Boolean> f;
private int g;
private long h;
-@@ -40,10 +40,11 @@ public class RegionFile {
+@@ -45,10 +45,11 @@ public class RegionFile {
this.h = file.lastModified();
}
@@ -44,17 +44,24 @@ index 2bd85e2d..d334d634 100644
this.g += 8192;
}
-@@ -81,16 +82,16 @@ public class RegionFile {
- for (j = 0; j < 1024; ++j) {
- k = headerAsInts.get(); // Paper
- this.d[j] = k;
-- if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) {
-+ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (k & 255) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid
- for (int l = 0; l < (k & 255); ++l) {
+@@ -96,22 +97,23 @@ public class RegionFile {
+ this.c.seek(j * 4 + 4); // Go back to where we were
+ }
+ }
+- if (k != 0 && (k >> 8) + (length) <= this.f.size()) {
++ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (length) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid
+ for (int l = 0; l < (length); ++l) {
+ // Spigot end
this.f.set((k >> 8) + l, Boolean.valueOf(false));
}
-- }
-+ } else if (k != 0) deleteChunk(j); // Paper
+ }
+ // Spigot start
+- else if (length > 0) {
++ else if (k != 0) { // Paper
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Invalid chunk: ({0}, {1}) Offset: {2} Length: {3} runs off end file. {4}", new Object[]{j % 32, (int) (j / 32), k >> 8, length, file});
++ deleteChunk(j); // Paper
+ }
+ // Spigot end
}
for (j = 0; j < 1024; ++j) {
@@ -64,7 +71,7 @@ index 2bd85e2d..d334d634 100644
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
-@@ -264,6 +265,55 @@ public class RegionFile {
+@@ -302,6 +304,55 @@ public class RegionFile {
}
@@ -121,5 +128,5 @@ index 2bd85e2d..d334d634 100644
private final int b;
--
-2.19.1
+2.20.1
diff --git a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch
index 621025acf1..01219eb379 100644
--- a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch
+++ b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch
@@ -1,4 +1,4 @@
-From 026320c912a5ce008130be4a5089eceea3a24da2 Mon Sep 17 00:00:00 2001
+From 0c66385b2ab612b92641c37518e15ba12530b3ff Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Fri, 15 Feb 2019 01:08:19 -0500
Subject: [PATCH] Allow Saving of Oversized Chunks
@@ -51,10 +51,10 @@ index 2162d3ad..8b5aeb1b 100644
a((NBTBase) nbttagcompound, dataoutput);
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
-index d334d634..34f72c3d 100644
+index d58cda9a..56783ab5 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
-@@ -78,6 +78,7 @@ public class RegionFile {
+@@ -83,6 +83,7 @@ public class RegionFile {
}
header.clear();
IntBuffer headerAsInts = header.asIntBuffer();
@@ -62,7 +62,7 @@ index d334d634..34f72c3d 100644
// Paper End
for (j = 0; j < 1024; ++j) {
k = headerAsInts.get(); // Paper
-@@ -101,7 +102,7 @@ public class RegionFile {
+@@ -123,7 +124,7 @@ public class RegionFile {
}
@Nullable
@@ -71,7 +71,7 @@ index d334d634..34f72c3d 100644
if (this.d(i, j)) {
return null;
} else {
-@@ -149,8 +150,8 @@ public class RegionFile {
+@@ -179,8 +180,8 @@ public class RegionFile {
}
@Nullable
@@ -82,16 +82,18 @@ index d334d634..34f72c3d 100644
}
protected synchronized void a(int i, int j, byte[] abyte, int k) {
-@@ -161,7 +162,7 @@ public class RegionFile {
- int k1 = (k + 5) / 4096 + 1;
+@@ -198,8 +199,9 @@ public class RegionFile {
if (k1 >= 256) {
-- return;
-+ throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead
+ // Spigot start
+- if (!ENABLE_EXTENDED_SAVE) return;
++ if (!USE_SPIGOT_OVERSIZED_METHOD) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b});
++ if (!ENABLE_EXTENDED_SAVE) return;
+ // Spigot end
}
- if (i1 != 0 && j1 == k1) {
-@@ -312,6 +313,101 @@ public class RegionFile {
+@@ -351,6 +353,110 @@ public class RegionFile {
logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e);
}
}
@@ -172,6 +174,15 @@ index d334d634..34f72c3d 100644
+
+ }
+
++ private static final boolean USE_SPIGOT_OVERSIZED_METHOD = Boolean.getBoolean("Paper.useSpigotExtendedSaveMethod"); // Paper
++ static {
++ if (USE_SPIGOT_OVERSIZED_METHOD) {
++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Using Spigot Oversized Chunk save method. Warning this will result in extremely fragmented chunks, as well as making the entire region file unable to be to used in any other software but Forge or Spigot (not usable in Vanilla or CraftBukkit). Paper's method is highly recommended.");
++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
++ }
++ }
++
+ public class ChunkTooLargeException extends RuntimeException {
+ public ChunkTooLargeException(int x, int z, int sectors) {
+ super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)");
@@ -193,7 +204,7 @@ index d334d634..34f72c3d 100644
// Paper end
class ChunkBuffer extends ByteArrayOutputStream {
-@@ -325,8 +421,40 @@ public class RegionFile {
+@@ -364,8 +470,40 @@ public class RegionFile {
this.c = j;
}
diff --git a/work/Spigot b/work/Spigot
-Subproject e8ded36bc9c1661fc04f83762e3e0e94a273787
+Subproject 79a30d7d26b9078dbf6071cbbfa060673bf117b