Skip to content

Commit

Permalink
Linear flusher (#88)
Browse files Browse the repository at this point in the history
* Linear flusher

* Use a queue & a single thread

* Customizable flusher thread number

* Use try statements
  • Loading branch information
sofianedjerbi authored Aug 7, 2023
1 parent 1271516 commit 042f11d
Show file tree
Hide file tree
Showing 15 changed files with 239 additions and 188 deletions.
9 changes: 3 additions & 6 deletions patches/server/0003-Region-format-configuration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ Subject: [PATCH] Region format configuration


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 7da7e0aeb5eac9ac73a3570e716f1ceb11fd7027..b86c90cc3601e666998cfa12f44515f605bb53eb 100644
index 7da7e0aeb5eac9ac73a3570e716f1ceb11fd7027..f08bcc9ae1770fa847d8a5e873a554bef5485100 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -192,4 +192,10 @@ public class KaiijuConfig {
@@ -192,4 +192,7 @@ public class KaiijuConfig {
}
return builder.build();
}
+
+ public static boolean regionFormatDebug = false;
+
+ private static void regionFormatSettings() {
+ regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
+ }
}
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
Expand Down Expand Up @@ -85,7 +82,7 @@ index 0000000000000000000000000000000000000000..7164d9cd03186f0657783f83de3d6435
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cc1a7c4d38874ec218f7151685ae6cc00295c2e4..06233380f7580726753de34c1fb23d6347c9ac94 100644
index 7e5645d9cb64ce17f60c85619f5640c8de4b1e86..bc9204d2c925437e9ff5c5d62d9faf38c2938e48 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -893,7 +893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand Down
348 changes: 201 additions & 147 deletions patches/server/0004-Add-Linear-region-format.patch

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions patches/server/0005-Network-configuration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Subject: [PATCH] Network configuration


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index b86c90cc3601e666998cfa12f44515f605bb53eb..7c6d43d8a360530344ef296f4477750c8a298607 100644
index b7f43cce80742aa0cd523e930772ff84946f3eef..fa829cef4033625470dfae29ddf777e6c5ab8c55 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -198,4 +198,7 @@ public class KaiijuConfig {
private static void regionFormatSettings() {
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
@@ -203,4 +203,7 @@ public class KaiijuConfig {
else
linearFlushThreads = Math.max(linearFlushThreads, 1);
}
+
+ private static void networkSettings() {
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0006-Send-null-entity-packets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Subject: [PATCH] Send null entity packets
This is from Purpur. Don't send null entity packets.

diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 7c6d43d8a360530344ef296f4477750c8a298607..ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7 100644
index fa829cef4033625470dfae29ddf777e6c5ab8c55..47e23a196ae5e44600a64184b69141c00235baca 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -198,7 +198,10 @@ public class KaiijuConfig {
private static void regionFormatSettings() {
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
@@ -203,7 +203,10 @@ public class KaiijuConfig {
else
linearFlushThreads = Math.max(linearFlushThreads, 1);
}
+
+ public static boolean sendNullEntityPackets = true;
Expand All @@ -21,7 +21,7 @@ index 7c6d43d8a360530344ef296f4477750c8a298607..ab08e11f13921163b8ff1ff51ff9e9b8
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 6670e657e08e130f7e0368f418379fd1ece00cdf..5558d87ef182f82be7877455dd027082c6a80632 100644
index 81d0b2933040a451441f660f9e46199ae3b111e3..cdbc4be679d7e096c1005eaf84b74c4877479c43 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -201,6 +201,11 @@ public class ServerEntity {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0007-Alternate-Keepalive.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Don't kick players because 1 keepalive is lost.
This patch is from Purpur.

diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7..b42a3466f145a92608c8746fd4beb529b4a60b01 100644
index 47e23a196ae5e44600a64184b69141c00235baca..95b53b50606ea0ad47f407bebbb9e2bd445c0e66 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -200,8 +200,10 @@ public class KaiijuConfig {
@@ -205,8 +205,10 @@ public class KaiijuConfig {
}

public static boolean sendNullEntityPackets = true;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0008-Optimization-Configuration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Optimization Configuration


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index b42a3466f145a92608c8746fd4beb529b4a60b01..7b56cc1275319cf07a4a25280e0ff900bdca8afa 100644
index 95b53b50606ea0ad47f407bebbb9e2bd445c0e66..8aab072a21b0775338b8235a84f5f675f385cf37 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -206,4 +206,7 @@ public class KaiijuConfig {
@@ -211,4 +211,7 @@ public class KaiijuConfig {
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0009-Gameplay-Configuration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Gameplay Configuration


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 7b56cc1275319cf07a4a25280e0ff900bdca8afa..fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522 100644
index 8aab072a21b0775338b8235a84f5f675f385cf37..46ae5b84ee5b87b0ed0b93e920689e44288a50d2 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -209,4 +209,7 @@ public class KaiijuConfig {
@@ -214,4 +214,7 @@ public class KaiijuConfig {

private static void optimizationSettings() {
}
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0011-Server-mod-name.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Server mod name


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522..e1f50adfa216320bc53b460d11666064cb58c969 100644
index 46ae5b84ee5b87b0ed0b93e920689e44288a50d2..778de435ca3c13ccc2f2d86030e3529436a2d945 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -210,6 +210,9 @@ public class KaiijuConfig {
@@ -215,6 +215,9 @@ public class KaiijuConfig {
private static void optimizationSettings() {
}

Expand All @@ -19,7 +19,7 @@ index fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522..e1f50adfa216320bc53b460d11666064
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 06233380f7580726753de34c1fb23d6347c9ac94..1b3f895b51b634ee9cf69cdbbfd7a1e600de16f0 100644
index bc9204d2c925437e9ff5c5d62d9faf38c2938e48..5168d16b7e9ed08bdedd0e386f9671a63b6859be 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1812,7 +1812,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0012-Crash-on-broken-symlink.patch
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ index c4d28d887b4cc71dc713b1e3f46bc80f4484a95d..f50507ab85282d261985ce9b186581f5
// Paper start
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7099a44a2322ab390c21e74668c8657dcc9e5e87..475554797ffc279243ac0d88f1e619c3dd07bc4b 100644
index 1446db0111ba21514640e09e48a32d54b4a97a0c..475554797ffc279243ac0d88f1e619c3dd07bc4b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -426,8 +426,8 @@ public class ServerLevel extends Level implements WorldGenLevel {

private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {

- public EntityRegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
- public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
- super(format, linearCompression, directory, dsync); // Kaiiju
+ public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, boolean linearCrashOnBrokenSymlink, Path directory, boolean dsync) { // Kaiiju
+ super(format, linearCompression, linearCrashOnBrokenSymlink, directory, dsync); // Kaiiju
Expand Down Expand Up @@ -135,7 +135,7 @@ index 1d880f27dd147da683fc30ed6f1bfa43ecdb7d93..41598adf6d49a44bcaadfff379722146
}

diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484d5b133ee 100644
index e91e8aef8b63ea9d94e0ecb3e4a62655a8c77ce1..bbc6a0c70cbafbfa411ab418e4fec11ad101ae91 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -20,6 +20,7 @@ import net.minecraft.world.level.ChunkPos;
Expand Down Expand Up @@ -209,7 +209,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
+ guardAgainstBrokenSymlinks(path1); // Kaiiju - Crash on broken symlink
this.createRegionFile(regionPos);
}
// Kaiiju start - Polyglot

diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
index 9394d191c56aab78e63fd3f283efedd69384e323..dcfe4a285cc5865be3b0c1b8104b722895135dd0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0019-Toggle-shared-random-for-players.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Toggle shared random for players


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index e1f50adfa216320bc53b460d11666064cb58c969..c934341c17caf4696065ac6c39bdfef570c62f13 100644
index 778de435ca3c13ccc2f2d86030e3529436a2d945..cac747a46cccf8b115917a72340e9b81e7a437c9 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -211,8 +211,10 @@ public class KaiijuConfig {
@@ -216,8 +216,10 @@ public class KaiijuConfig {
}

public static String serverModName = "Kaiiju";
Expand All @@ -20,7 +20,7 @@ index e1f50adfa216320bc53b460d11666064cb58c969..c934341c17caf4696065ac6c39bdfef5
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 27b57db24587337ccdce29e492052ca419863323..fc6279a39fd5e1bd02b2d9e77f451cd9ba1baf78 100644
index ee15661227754149164893d6acf678d13b2e1b27..0c50b516d0ff1c2812a877b57148f01861f8027f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -566,6 +566,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0031-Option-to-disable-vanish-api.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable vanish api


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index c934341c17caf4696065ac6c39bdfef570c62f13..f49510c999ce5241f26dc9ba90a6148bf31467c7 100644
index cac747a46cccf8b115917a72340e9b81e7a437c9..a3c15f1009dad095b9411242e2d0347a6141984b 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -207,7 +207,10 @@ public class KaiijuConfig {
@@ -212,7 +212,10 @@ public class KaiijuConfig {
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0032-Option-to-disable-player-stats.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable player stats


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index f49510c999ce5241f26dc9ba90a6148bf31467c7..b23f2df433d7ebc871f4009081c28ed9054d91c7 100644
index a3c15f1009dad095b9411242e2d0347a6141984b..8c872b2ad341f0105275209201fda03706535161 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -208,9 +208,11 @@ public class KaiijuConfig {
@@ -213,9 +213,11 @@ public class KaiijuConfig {
}

public static boolean disableVanishApi = false;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0034-Option-to-disable-arm-swing-event.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable arm swing event


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index b23f2df433d7ebc871f4009081c28ed9054d91c7..ec71f3f52cb8f7931aabd94619d2e7a24491d7ad 100644
index 8c872b2ad341f0105275209201fda03706535161..9b118a6e22264c88c0460016822b1920631fff85 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -209,10 +209,12 @@ public class KaiijuConfig {
@@ -214,10 +214,12 @@ public class KaiijuConfig {

public static boolean disableVanishApi = false;
public static boolean disablePlayerStats = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable ensure tick thread checks


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index ec71f3f52cb8f7931aabd94619d2e7a24491d7ad..fa2a763e5784e7dae02c94a13751cbf746b6eee8 100644
index 9b118a6e22264c88c0460016822b1920631fff85..95015955a8076bc903c012704b57b1b84286aaae 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -210,11 +210,13 @@ public class KaiijuConfig {
@@ -215,11 +215,13 @@ public class KaiijuConfig {
public static boolean disableVanishApi = false;
public static boolean disablePlayerStats = false;
public static boolean disableArmSwingEvent = false;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0038-Don-t-kick-player-on-bad-packet.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Don't kick player on bad packet


diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index fa2a763e5784e7dae02c94a13751cbf746b6eee8..ebfa9e1dcca5ea8272e796f0409902d92b59ee76 100644
index 95015955a8076bc903c012704b57b1b84286aaae..6df1720159383c2f536b40ded1092a437c1a20af 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -201,10 +201,12 @@ public class KaiijuConfig {
@@ -206,10 +206,12 @@ public class KaiijuConfig {

public static boolean sendNullEntityPackets = true;
public static boolean alternateKeepAlive = false;
Expand Down

0 comments on commit 042f11d

Please sign in to comment.