Add ZstdCompressAction to support configurable Zstandard compression levels - #4234
Open
katstack wants to merge 1 commit into
Open
Add ZstdCompressAction to support configurable Zstandard compression levels#4234katstack wants to merge 1 commit into
katstack wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
ZstdCompressAction, replacing the genericCommonsCompressAction("zstd", ...)path (added in #1514) with a dedicated action that supports a configurablecompressionLevel, following the same incremental pattern already used byGzCompressAction(LOG4J2-2598) andZipCompressAction.Supported range is the standard positive Zstd levels
[1, ZstdConstants.ZSTD_CLEVEL_MAX](currently[1, 22]).compressionLevel=-1(unset) continues to resolve to the Zstd default level (3), consistent with the existing behavior documented inFileExtension/rolling-file.adoc.What this PR deliberately does not do
Negative ("fast compression") Zstd levels are not supported. The rolling-appender framework uses
Deflater.DEFAULT_COMPRESSION(-1) as a format-agnostic sentinel for "unspecified compression level," so an explicitcompressionLevel=-1would be indistinguishable from "not set." Onmain,compressionLevelhas already been replaced by a more genericcompressionOptionsmap (#2921); on2.xit remains the mechanism, so this PR stays scoped to extending it rather than adding another special case on top of the sentinel.Testing
ZstdCompressActionTestcovers the new validation/mapping logic, including a test pinning the currently-assumedZstdConstantsbounds so a future zstd-jni/commons-compress upgrade that shifts them fails loudly instead of silently drifting from the documented range. Also ran the existingGzCompressActionTest/ZipCompressActionTest/Bzip2CompressActionTest/rolling-appender suites locally with no regressions, and./mvnw verifypasses on both JDK 8 and JDK 17.References