Commit Graph

2681 Commits

Author SHA1 Message Date
Yann Collet
a6db7a7b9b fixed cmaketest
(buffer_t){NULL,0} is not considered a constant.
{NULL,0} is.
2017-01-18 11:57:34 -08:00
Przemyslaw Skibinski
957a6d596b updated link to copyright notice 2017-01-18 19:04:00 +01:00
Przemyslaw Skibinski
c3a04deda2 fixed clang warnings in gzread.c and gzwrite.c 2017-01-18 14:36:10 +01:00
Przemyslaw Skibinski
c9512db301 gzcompatibility.h updated to zlib 1.2.11 2017-01-18 12:51:44 +01:00
Przemyslaw Skibinski
3805a00904 gzwrite.c updated to zlib 1.2.11 2017-01-18 12:47:32 +01:00
Przemyslaw Skibinski
5735fd74ee gzread.c updated to zlib 1.2.11 2017-01-18 12:14:01 +01:00
Przemyslaw Skibinski
7f82aad187 gzlib.c updated to zlib 1.2.11 2017-01-18 12:08:08 +01:00
Przemyslaw Skibinski
69f7990fc5 gzguts.h updated to zlib 1.2.11 2017-01-18 12:01:50 +01:00
Przemyslaw Skibinski
5edab91bbb get_crc_table only with ZLIB_VERNUM >= 0x1270 2017-01-18 10:39:39 +01:00
Yann Collet
0d6b8f65a9 ZSTDMT_free() scrubs potentially unfinished jobs to release their resources
In some complex scenarios (free() without finishing compression),
it is possible that some resources are still into jobs
and not collected back into pools.
In which case, previous version of free() would miss them.
This would be equivalent to a leak.

New version ensures that it even foes after such resource.
It requires job consumers to properly mark resources as released,
by replacing entries by NULL after releasing back to the pool.

Obviously, it's not recommended to free() zstdmt context mid-term,
still that's now a supported scenario.

The same methodology is also used to ensure proper resource collection
after an error is detected.

Still to do :
- detect compression errors (not just allocation ones)
- properly manage resource when init() is called without finishing previous compression.
2017-01-17 17:46:33 -08:00
Yann Collet
d0a1d45582 ZSTDMT_{flush,end}Stream() now block on next job completion when nothing to flush
The main issue was to avoid a caller to continually loop on {flush,end}Stream()
when there was nothing ready to be flushed but still some compression work ongoing in a worker thread.
The continuous loop would have resulted in wasted energy.
The new version makes call to {flush,end}Stream blocking when there is nothing ready to be flushed.
Of course, if all worker threads have exhausted job, it will return zero (all flush completed).

Note : There are still some remaining issues to report error codes
and properly collect back resources into pools when an error is triggered.
2017-01-17 16:15:18 -08:00
Yann Collet
a73c412932 completed ZSTDMT streaming compression
Provides the baseline compression API :
size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel);
size_t ZSTDMT_compressStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
size_t ZSTDMT_flushStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output);
size_t ZSTDMT_endStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output);

Not tested yet
2017-01-17 15:31:16 -08:00
Sean Purcell
57d423c5df Don't create dict in streaming apis if dictSize == 0 2017-01-17 14:31:35 -08:00
Yann Collet
8e44bd83f1 updated NEWS 2017-01-17 13:15:25 -08:00
Przemyslaw Skibinski
8a0bc30a2d Merge remote-tracking branch 'refs/remotes/facebook/dev' into dev11 2017-01-17 13:02:29 +01:00
Przemyslaw Skibinski
5b114d3c01 zlibWrapper: added get_crc_table 2017-01-17 13:02:06 +01:00
Przemyslaw Skibinski
d72f4b6b7a added "Makefile is validated" 2017-01-17 12:40:06 +01:00
Yann Collet
123c8a3cb8 Merge pull request #511 from indygreg/cdict-dictid
Set dictionary ID in ZSTD_initCStream_usingCDict()
2017-01-16 20:17:44 -08:00
Yann Collet
33fce03045 added test checking dictID when using ZSTD_initCStream_usingCDict()
It shows that dictID is not properly added into frame header
2017-01-16 19:46:22 -08:00
Gregory Szorc
7d6f478d15 Set dictionary ID in ZSTD_initCStream_usingCDict()
When porting python-zstandard to use ZSTD_initCStream_usingCDict()
so compression dictionaries could be reused, an automated test
failed due to compressed content changing.

I tracked this down to ZSTD_initCStream_usingCDict() not
setting the dictID field of the ZSTD_CCtx attached to the
ZSTD_CStream instance.

I'm not 100% convinced this is the correct or full solution,
as I'm still seeing one automated test failing with this change.
2017-01-14 17:44:54 -08:00
Yann Collet
aa64b01138 Merge pull request #510 from iburinoc/baddict
Fixed decompress_usingDict not propagating corrupted dictionary error
2017-01-12 22:10:04 +01:00
Sean Purcell
c44c4d5223 Fix missing 'OK' logging on fuzzer testcase 2017-01-12 09:38:33 -08:00
Yann Collet
5b726dbe4d fix gcc-arm warning "suggest braces around empty body" 2017-01-12 17:46:46 +01:00
Yann Collet
ad9f6bd123 zstdmt : fix : resources properly collected even when early fail
In previous version, main function would return early when detecting a job error.
Late threads resources were therefore not collected back into pools.
New version just register the error, but continue the collecting process.
All buffers and context should be released back to pool before leaving main function.
2017-01-12 03:06:35 +01:00
Sean Purcell
834ab50fa3 Fixed decompress_usingDict not propagating corrupted dictionary error 2017-01-11 17:31:34 -08:00
Yann Collet
b05c4828ea zstdmt : correctly check for cctx and buffer allocation
Result from getBuffer and getCCtx could be NULL when allocation fails.
Now correctly checks : job creation stop and last job reports an allocation error.
releaseBuffer and releaseCCtx are now also compatible with NULL input.

Identified a new potential issue :
when early job fails, later jobs are not collected for resource retrieval.
2017-01-12 02:01:28 +01:00
Yann Collet
107bcbbbc2 zstdmt : changed internal naming from frame to chunk
Since the result of mt compression is a single frame,
changed naming, which implied the concatenation of multiple frames.

minor : ensures that content size is written in header
2017-01-12 01:25:46 +01:00
Yann Collet
5eb749e734 ZSTDMT_compress() creates a single frame
The new strategy involves cutting frame at block level.
The result is a single frame, preserving ZSTD_getDecompressedSize()

As a consequence, bench can now make a full round-trip,
since the result is compatible with ZSTD_decompress().

This strategy will not make it possible to decode the frame with multiple threads
since the exact cut between independent blocks is not known.
MT decoding needs further discussions.
2017-01-11 18:21:25 +01:00
Yann Collet
04cbc36499 minor refactor (release CCtx 1st) and comment clarification 2017-01-11 16:08:08 +01:00
Yann Collet
085179bb78 fixed ZSTDMT_createCCtx() : checked inner objects are properly created 2017-01-11 15:58:05 +01:00
Yann Collet
8ce1cc2bec improved ZSTD_createCCtxPool() cancellation
use ZSTD_freeCCtxPool() to release the partially created pool.
avoids to duplicate logic.

Also : identified a new difficult corner case :
when freeing the Pool, all CCtx should be previously released back to the pool.
Otherwise, it means some CCtx are still in use.
There is currently no clear policy on what to do in such a case.
Note : it's supposed to never happen.
Since pool creation/usage is static, it has no external user,
which limits risks.
2017-01-11 15:44:26 +01:00
Yann Collet
47557ba2b2 fixed ZSTDMT_createCCtxPool() when inner CCtx creation fails 2017-01-11 15:35:56 +01:00
Yann Collet
b8cdc16969 Merge pull request #509 from terrelln/dict-builder-32
Handle cover dictionary builder maximum input size for 32-bit mode
2017-01-10 06:30:28 +01:00
Nick Terrell
8d984699db Document memory requirements for COVER algorithm 2017-01-09 18:20:10 -08:00
Nick Terrell
555e281637 Handle large input size in 32-bit mode correctly 2017-01-09 18:20:06 -08:00
Nick Terrell
c220d4c74d Use COVER_MEMMULT when training with COVER. 2017-01-09 16:49:04 -08:00
Yann Collet
56958500fc minor man page update 2017-01-09 19:47:09 +01:00
Yann Collet
4736dffd41 Merge pull request #507 from terrelln/dict-builder-optimize
Add new dictionary builder
2017-01-03 20:33:33 +01:00
Nick Terrell
a8b4fe0481 Add COVER dictionary builder to fuzzer unit tests 2017-01-02 18:45:19 -08:00
Nick Terrell
3a1fefcf00 Simplify COVER parameters 2017-01-02 17:51:38 -08:00
Yann Collet
8566799781 separated ppc and ppc64 tests, for more regular timing 2017-01-03 00:25:01 +01:00
Nick Terrell
cbb3ce376b Add cover cli to playtests 2017-01-02 14:43:11 -08:00
Nick Terrell
df8415c502 Add COVER to the zstd cli 2017-01-02 14:43:08 -08:00
Nick Terrell
9103ed6c8b Add cover.c to build files 2017-01-02 13:22:53 -08:00
Nick Terrell
96b39f65fa Add COVER dictionary builder 2017-01-02 13:22:51 -08:00
Yann Collet
6334b04d61 compile object files, for faster recompilation 2017-01-02 03:22:18 +01:00
Yann Collet
747452677d fixed cmake tests 2017-01-02 02:05:45 +01:00
Yann Collet
cdb2763f4a new Makefile target zstdmt 2017-01-02 01:43:56 +01:00
Yann Collet
f1cb55192c fixed linux warnings 2017-01-02 01:11:55 +01:00
Yann Collet
0ec6a95ba1 minor fixes 2017-01-02 00:49:42 +01:00