Skip to content
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

Enable file compression on file rotation #694

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

averater
Copy link
Contributor

Add option to have dlt files compressed on file rotation so the current file stays uncompressed but all other are compressed. This is so all files can be copied without issues as the current file otherwise is likely to be truncated.

WIP

Make dlt files compressed on file rotation so the current file is
uncompressed but all other are compressed. This is so all files can
be copied without issues as the current file otherwise is likely to
be truncated.
To enable compilation without gzip support
Fix closing of files in error case
Change to Gzip OFF when disabled
Fix function parameter gzfile
@lti9hc
Copy link
Collaborator

lti9hc commented Nov 27, 2024

Hello @averater,
Could you rebase your PR, it is old and I could not checkout the PR such as "Enable file gzip config" commit
Thank you

@lti9hc
Copy link
Collaborator

lti9hc commented Nov 27, 2024

Do you want to combine #691 into this PR? or we need to review and merge 691 PR first and then you rebase this PR later

@averater
Copy link
Contributor Author

Hello @averater, Could you rebase your PR, it is old and I could not checkout the PR such as "Enable file gzip config" commit Thank you

Done

@averater
Copy link
Contributor Author

Do you want to combine #691 into this PR? or we need to review and merge 691 PR first and then you rebase this PR later

I'm not sure how the review process will go for this commit. If there are only minor changes needed then we can abandon 691. But if there are more things needed or if this takes to much time then I think we can get 691 in first as that should be trivial. And then rebase this one on top of 691 once it is merged (that will be an easy rebase).

@minminlittleshrimp minminlittleshrimp self-requested a review December 6, 2024 04:22
@minminlittleshrimp
Copy link
Collaborator

Hello @averater
Conflict and need resolving, please take care and ping me for reviewing later.
Thanks

erikstenlund and others added 5 commits December 6, 2024 07:35
Adds check in dlt_logstorage_sync_to_file that gzlog is NULL if the dlt-daemon
is compiled with gzip, otherwise that statement will always return true if
using gzip-compression on logs.
dlt_logstorage_log_file_name assumed the suffix always is .dlt which
is not be the case if gzip compression is enabled. Changed to assume
.dlt.gz when smax is calculated as it prevents buffer overflow if
filenames are long and gzip is enabled.
@averater
Copy link
Contributor Author

averater commented Dec 6, 2024

Hello @averater Conflict and need resolving, please take care and ping me for reviewing later. Thanks

@minminlittleshrimp done

@minminlittleshrimp
Copy link
Collaborator

Please commit with sign-off. Thanks.

tmp = &config->records;
while ((*tmp)->next != NULL) {
int len = strlen((*tmp)->name);
const char *suffix = ".dlt";
Copy link
Collaborator

@minminlittleshrimp minminlittleshrimp Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need more context/info/description about this feature:

  1. Is it trying to do a dynamic activate compress mode, e.g. logging .dlt and then immediately switch to .dlt.gz using compress function for file/fd? If not, we just be fine with .gz file count from 0 or 1 since .gz and .dlt are already different file types.
  2. If it does so, why dont we just apply compress function in native logstorage file rotation, adding new func here seems doing a duplicated task?
  3. Minor suggestion: adding macro name FILE cannot directly inform user/dev that it is for file rotation, any better naming scheme here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The feature it to log normal dlt and only when a file is "full" it compress it. This way the stored files are compressed but the current file is uncompressed. This is for the use case of copying stored files while logging is in progress.
    I think the purpose of removing older files and having a max number of files is to not fill storage. Then it would make sense to bunch dlt and gz.dlt together into one count.

  2. It is quite different tasks to compress into an open file and to compress an entire file. I thought this way was the easiest and cleanest way.

  3. I thought of it but couldn't figure out a better name that is nice and short. Maybe ARCHIVE is better?

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.

4 participants