Fix RegionFileCache write logic

This commit is contained in:
Shane Freeder 2019-05-07 16:26:37 +01:00
parent 9db83af2ab
commit 39bcf78e87
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
3 changed files with 17 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From dfe7064ed97f2a3c987416aea3c613aea3fc8a7a Mon Sep 17 00:00:00 2001
From d38104d04a34c19ab958709583fbfe9eeb32b222 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 88b5aa3a51..b062a31c49 100644
index 88b5aa3a5..b062a31c4 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -253,8 +253,7 @@ public class RegionFile implements AutoCloseable {
@ -20,7 +20,7 @@ index 88b5aa3a51..b062a31c49 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index ad76ed27dc..75731c9195 100644
index ad76ed27d..20f563144 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -79,6 +79,7 @@ public abstract class RegionFileCache implements AutoCloseable {
@ -31,10 +31,12 @@ index ad76ed27dc..75731c9195 100644
RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
Throwable throwable = null;
@@ -103,6 +104,15 @@ public abstract class RegionFileCache implements AutoCloseable {
@@ -103,6 +104,18 @@ public abstract class RegionFileCache implements AutoCloseable {
}
+ // Paper start
+ return;
+ } catch (Exception ex) {
+ laste = ex;
+ }
@ -44,6 +46,7 @@ index ad76ed27dc..75731c9195 100644
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste);
+ MinecraftServer.LOGGER.error("Failed to save chunk", laste);
+ }
+ // Paper end
}
public void close() throws IOException {

View File

@ -1,4 +1,4 @@
From 8ac5f448a3d1bb55990864dc5fba7820bdf9e93f Mon Sep 17 00:00:00 2001
From b6fadc58f2a42f8c8156d4437f6f265c9ee2098a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 29 Jul 2018 15:48:50 -0400
Subject: [PATCH] Provide option to use a versioned world folder for testing
@ -59,7 +59,7 @@ index a9b71c85d..8c3880c83 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index c8573a8ee..1b12a1611 100644
index 6425b14f2..990d34efd 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -10,13 +10,41 @@ import java.io.IOException;
@ -128,7 +128,7 @@ index c8573a8ee..1b12a1611 100644
@Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit
@@ -129,9 +167,33 @@ public abstract class RegionFileCache implements AutoCloseable {
@@ -132,9 +170,33 @@ public abstract class RegionFileCache implements AutoCloseable {
// CraftBukkit start
public boolean chunkExists(ChunkCoordIntPair pos) throws IOException {

View File

@ -1,4 +1,4 @@
From 474d222e2b8dde31dc97fb3a077f44a82b5f2b20 Mon Sep 17 00:00:00 2001
From 5e39f5c9c4bedcb73854976493e6a0aa4df4c585 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 15 Feb 2019 01:08:19 -0500
Subject: [PATCH] Allow Saving of Oversized Chunks
@ -31,7 +31,7 @@ this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
index 9fd8a75dae..d49afd622e 100644
index 9fd8a75da..d49afd622 100644
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -69,6 +69,7 @@ public class NBTCompressedStreamTools {
@ -51,7 +51,7 @@ index 9fd8a75dae..d49afd622e 100644
a((NBTBase) nbttagcompound, dataoutput);
}
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
index b7c94fe238..80eea5dfbd 100644
index b7c94fe23..80eea5dfb 100644
--- a/src/main/java/net/minecraft/server/NBTTagList.java
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
@@ -11,7 +11,7 @@ import java.util.Objects;
@ -64,7 +64,7 @@ index b7c94fe238..80eea5dfbd 100644
public NBTTagList() {}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index e68f901943..ed2ccebb23 100644
index e68f90194..ed2ccebb2 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -23,7 +23,7 @@ public class RegionFile implements AutoCloseable {
@ -286,7 +286,7 @@ index e68f901943..ed2ccebb23 100644
+
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 1b12a16113..6893f3cd34 100644
index 990d34efd..b61864641 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -47,6 +47,7 @@ public abstract class RegionFileCache implements AutoCloseable {
@ -503,8 +503,8 @@ index 1b12a16113..6893f3cd34 100644
+// }
+ // Paper end
} catch (Exception ex) {
laste = ex;
// Paper start
return;
--
2.21.0