Skip to content

Add Zstd/LZ4/(GZIP write) support for region files#2377

Closed
egg82 wants to merge 10 commits into
PaperMC:ver/1.14from
egg82:feature/zstd
Closed

Add Zstd/LZ4/(GZIP write) support for region files#2377
egg82 wants to merge 10 commits into
PaperMC:ver/1.14from
egg82:feature/zstd

Conversation

@egg82
Copy link
Copy Markdown
Contributor

@egg82 egg82 commented Jul 27, 2019

Using zstd-jni: https://github.com/luben/zstd-jni
There's a new option in PaperConfig for this which defaults to false.
Since the patch hooks Mojang's versioning system for new compression methods, it
should be internally consistent, easily-updatable, and reversible with a force-upgrade.

This will likely conflict with plugins and programs expecting region files to be compressed using the current standard.

@egg82
Copy link
Copy Markdown
Contributor Author

egg82 commented Jul 27, 2019

LZ4 PR here: #2376
Note that Zstd is optimized for compression, where LZ4 is optimized for decompression.

@hugmanrique
Copy link
Copy Markdown
Contributor

Related #416

Comment thread Spigot-Server-Patches/0406-Add-Zstd-support-for-region-files.patch Outdated
@PaulBGD
Copy link
Copy Markdown
Contributor

PaulBGD commented Jul 28, 2019

As a user/developer, I don't like this. This option generates worlds that look like regular Minecraft worlds, but can never be loaded in vanilla without a conversion program. I feel like a major change to the filetype should result in a different filetype, even if that means just changing the extension of the files.

@wizjany
Copy link
Copy Markdown
Contributor

wizjany commented Jul 28, 2019

To the contrary, the file format specifies a compression type. The fact that the vanilla implementation doesn't recognize this new type doesn't mean the file is not-to-spec. Given that this isn't meant to be a default, I don't think admins using this option will expect it to load in vanilla.

@VADemon
Copy link
Copy Markdown

VADemon commented Jul 28, 2019

@PaulBGD I wanted to complain that a standalone tool is missing, this is the downside. But you can repack the whole world using Paper again as egg82 said:

reversible with a --force-upgrade

@astei
Copy link
Copy Markdown
Contributor

astei commented Jul 29, 2019

Personally, I see no reason not to include this. If the user decides to enable zstandard or LZ4 compression, they must understand that their setup will be non-standard and tools that manipulate the world data directly will not work.

@egg82 egg82 changed the title Feature/zstd Add Zstd/LZ4/(GZIP write) support for region files Aug 3, 2019
@ghost
Copy link
Copy Markdown

ghost commented Aug 3, 2019

Thank you for making this default to false.

Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
@egg82
Copy link
Copy Markdown
Contributor Author

egg82 commented Aug 3, 2019

Thank you for making this default to false.

There's no way anyone here would want the default to be something other than what Mojang uses. It's far too risky with external tools and plugins.

Comment thread Spigot-Server-Patches/0406-Add-Zstd-LZ4-GZIP-write-support-for-region-files.patch Outdated
@LoneDev6
Copy link
Copy Markdown

LoneDev6 commented Aug 9, 2019

Do you think it will conflict with https://www.spigotmc.org/resources/regionerator.12219/ ?

@egg82
Copy link
Copy Markdown
Contributor Author

egg82 commented Aug 10, 2019

Do you think it will conflict with https://www.spigotmc.org/resources/regionerator.12219/ ?

Almost certainly, yes. Plugins that read files directly (such as Regionerator, Dynmap, etc) won't be able to read the chunk. Since the patch uses the standard file format to determine what compression algorithm is used, some will (hopefully) fail silently. If not, contact the author. Plugins will have access to the Zstd dictionary in Paper, and the patch is MIT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants