-
Notifications
You must be signed in to change notification settings - Fork 1.8k
out_s3: Add ZSTD Compression Support #10794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shadowshot-x
wants to merge
11
commits into
fluent:master
Choose a base branch
from
shadowshot-x:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−11
Open
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b0f7776
out_s3: add zstd support
2ed01ff
aws: add zstd compression type
de74f79
aws: add zstd compression support
1eb854d
tests: internal: aws_compress: zstd test cases added
82f61ac
tests: internal: aws_compress: zstd test cases added
1ced9cf
out_s3: Dynamic encoding header selection based on compression method
9024ddd
out_s3: Free s3 headers in case of encoding header not present
8461581
out_s3: remove unused zstd header file
9e614d4
upstream: add null check for stream cleanup
shadowshot-x dbd27e5
aws: fix zstd compression pointer
6418a32
tests: fix typecasting for zstd_compress
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#include <fluent-bit/flb_mem.h> | ||
#include <fluent-bit/flb_utils.h> | ||
#include <fluent-bit/flb_gzip.h> | ||
#include <fluent-bit/flb_zstd.h> | ||
shadowshot-x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#include <fluent-bit/aws/flb_aws_compress.h> | ||
#include "flb_tests_internal.h" | ||
|
@@ -35,6 +36,9 @@ static void flb_aws_compress_test_cases(struct flb_aws_test_case *cases); | |
static void flb_aws_compress_truncate_b64_test_cases__gzip_decode( | ||
struct flb_aws_test_case *cases, | ||
size_t max_out_len); | ||
static void flb_aws_compress_truncate_b64_test_cases__zstd_decode( | ||
struct flb_aws_test_case *cases, | ||
size_t max_out_len); | ||
|
||
shadowshot-x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** ------ Test Cases ------ **/ | ||
void test_compression_gzip() | ||
|
@@ -53,6 +57,22 @@ void test_compression_gzip() | |
flb_aws_compress_test_cases(cases); | ||
} | ||
|
||
void test_compression_zstd() | ||
{ | ||
struct flb_aws_test_case cases[] = | ||
{ | ||
{ | ||
"zstd", | ||
"hello hello hello hello hello hello", | ||
"KLUv/SAjZQAAMGhlbGxvIAEAuUsR", | ||
0 | ||
}, | ||
{ 0 } | ||
}; | ||
|
||
flb_aws_compress_test_cases(cases); | ||
} | ||
|
||
void test_b64_truncated_gzip() | ||
{ | ||
struct flb_aws_test_case cases[] = | ||
|
@@ -70,6 +90,22 @@ struct flb_aws_test_case cases[] = | |
41); | ||
} | ||
|
||
void test_b64_truncated_zstd() | ||
{ | ||
struct flb_aws_test_case cases[] = | ||
{ | ||
{ | ||
"zstd", | ||
"hello hello hello hello hello hello", | ||
"hello hello hello hello hello hello", | ||
0 /* Expected ret */ | ||
}, | ||
{ 0 } | ||
}; | ||
|
||
flb_aws_compress_truncate_b64_test_cases__zstd_decode(cases,41); | ||
} | ||
shadowshot-x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
void test_b64_truncated_gzip_truncation() | ||
{ | ||
struct flb_aws_test_case cases[] = | ||
|
@@ -202,7 +238,9 @@ struct flb_aws_test_case cases[] = | |
|
||
TEST_LIST = { | ||
{ "test_compression_gzip", test_compression_gzip }, | ||
{ "test_compression_zstd", test_compression_zstd }, | ||
{ "test_b64_truncated_gzip", test_b64_truncated_gzip }, | ||
{ "test_b64_truncated_zstd", test_b64_truncated_zstd }, | ||
{ "test_b64_truncated_gzip_truncation", test_b64_truncated_gzip_truncation }, | ||
shadowshot-x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ "test_b64_truncated_gzip_truncation_buffer_too_small", | ||
test_b64_truncated_gzip_truncation_buffer_too_small }, | ||
|
@@ -231,6 +269,14 @@ static void flb_aws_compress_truncate_b64_test_cases__gzip_decode( | |
cases, max_out_len, &flb_gzip_uncompress); | ||
} | ||
|
||
static void flb_aws_compress_truncate_b64_test_cases__zstd_decode( | ||
struct flb_aws_test_case *cases, | ||
size_t max_out_len) | ||
{ | ||
flb_aws_compress_general_test_cases(FLB_AWS_COMPRESS_TEST_TYPE_B64_TRUNCATE, | ||
cases, max_out_len, &flb_zstd_uncompress); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, we needed to add type casting here: diff --git a/tests/internal/aws_compress.c b/tests/internal/aws_compress.c
index 7bb9d24b0..f26536eed 100644
--- a/tests/internal/aws_compress.c
+++ b/tests/internal/aws_compress.c
@@ -274,7 +274,7 @@ static void flb_aws_compress_truncate_b64_test_cases__zstd_decode(
size_t max_out_len)
{
flb_aws_compress_general_test_cases(FLB_AWS_COMPRESS_TEST_TYPE_B64_TRUNCATE,
- cases, max_out_len, &flb_zstd_uncompress);
+ cases, max_out_len, (int *)&flb_zstd_uncompress);
}
/* General test case loop flb_aws_compress */ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @cosmo0920 . Sorry I left it out I think |
||
|
||
shadowshot-x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/* General test case loop flb_aws_compress */ | ||
static void flb_aws_compress_general_test_cases(int test_type, | ||
struct flb_aws_test_case *cases, | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.