Skip to content

Does zstd handle compression of changing files? #1926

@anayrat

Description

@anayrat

Hello,

I tried to use zstd to compress log files which are continuously appended.

Execute:

#!/bin/bash
while true
do
echo "line" >> /tmp/log.txt
done

When I tried to compress in another session I were faced to this issue:

zstd --compress --stdout /tmp/log.txt > /tmp/log.txt.zst
zstd: error 27 : Read error : Incomplete read : 66205544 / 66194080 B 
zstd -t /tmp/log.txt.zst
/tmp/log.txt.zst     : 0 MB...     /tmp/log.txt.zst : Decoding error (36) : Corrupted block detected 

Note gzip handle this:

gzip  --stdout /tmp/log.txt > /tmp/log.txt.gz 
gzip: /tmp/log.txt: file size changed while zipping
gzip -v -t /tmp/log.txt.gz
/tmp/log.txt.gz:	 OK

Same for lz4:

lz4 --compress --stdout /tmp/log.txt > /tmp/log.txt.lz4
lz4 -t /tmp/log.txt.lz4                                
/tmp/log.txt.lz4     : decoded 71455396 bytes                    

Regards,

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions