More work for 1.14
This commit is contained in:
@@ -6,12 +6,12 @@ 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 0f1c74dd33..9626396745 100644
|
||||
index 88b5aa3a51..b062a31c49 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
||||
@@ -0,0 +0,0 @@ public class RegionFile {
|
||||
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
|
||||
|
||||
this.b(i, j, (int) (SystemUtils.getTimeMillis() / 1000L));
|
||||
this.b(chunkcoordintpair, (int) (SystemUtils.getTimeMillis() / 1000L));
|
||||
} catch (IOException ioexception) {
|
||||
- ioexception.printStackTrace();
|
||||
- ServerInternalException.reportInternalException(ioexception); // Paper
|
||||
@@ -20,37 +20,31 @@ index 0f1c74dd33..9626396745 100644
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
index e507a996f1..5dbd1d517a 100644
|
||||
index ad76ed27dc..75731c9195 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
@@ -0,0 +0,0 @@ public class RegionFileCache {
|
||||
@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static synchronized void write(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
|
||||
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
||||
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
|
||||
RegionFile regionfile = a(file, i, j);
|
||||
RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit
|
||||
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
||||
Throwable throwable = null;
|
||||
@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable {
|
||||
|
||||
DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31);
|
||||
NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
|
||||
dataoutputstream.close();
|
||||
+ // Paper start
|
||||
+ laste = null; break; // Paper
|
||||
+ } catch (Exception exception) {
|
||||
+ //ChunkRegionLoader.a.error("Failed to save chunk", exception); // Paper
|
||||
+ laste = exception; // Paper
|
||||
+ }
|
||||
+ try {
|
||||
+ Thread.sleep(10);
|
||||
+ } catch (InterruptedException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
}
|
||||
|
||||
+ } catch (Exception ex) {
|
||||
+ laste = ex;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (laste != null) {
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste);
|
||||
+ MinecraftServer.LOGGER.error("Failed to save chunk", laste);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public static synchronized boolean chunkExists(File file, int i, int j) {
|
||||
public void close() throws IOException {
|
||||
--
|
||||
Reference in New Issue
Block a user