]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix ZSTD compression level ignored in FileSet
authorAlain Spineux <alain@baculasystems.com>
Thu, 10 Aug 2023 13:41:01 +0000 (15:41 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:02 +0000 (13:57 +0200)
- before all ZSTD* where enabling ZSTD level 10
  now all ZSTD* match there own level and ZSTD match ZSTD10
- embellish the code

bacula/src/filed/backup.c
bacula/src/filed/job.c

index dac29f88c3f17153d8c9ecc7f4fa0e4eddad50b6..dcea6fea339132eea4bff390f3bdce27aa0a4813 100644 (file)
@@ -227,8 +227,9 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
 #ifdef HAVE_ZSTD
    ZSTD_freeCCtx((ZSTD_CCtx*)jcr->ZSTD_compress_workset);
+   jcr->ZSTD_compress_workset = NULL;
 #endif
-   
+
    crypto_session_end(jcr);
 
    bdelete_and_null(jcr->sd_packet_mgr);
@@ -1543,7 +1544,7 @@ static bool do_zstd_compression(bctx_t &bctx)
       size_t ret = ZSTD_compressCCtx((ZSTD_CCtx*) jcr->ZSTD_compress_workset,
                                      bctx.cbuf2, bctx.max_compress_len,
                                      bctx.rbuf, sd->msglen,
-                                     10);
+                                     bctx.ff_pkt->Compress_level);
       
       if (ZSTD_isError(ret)) {
          /** this should NEVER happen */
index d7f2d14c00a622b0ad74d4856531f8d49129cd38..c0d9f3db32f69f6fb4ba46055001b5ed170b95a3 100644 (file)
@@ -2099,6 +2099,8 @@ static int set_options(findFOPTS *fo, const char *opts)
                fo->Compress_level = 10;
                break;
             }
+         } else {
+            Dmsg1(10, "Ignore unknown compression code Z%c in the FileSet\n", *p);
          }
          break;
       case 'd':                 /* Deduplication 0=none 1=Storage 2=Local */