Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-1815

Zlib replace saved stream with restart

    • Type: Icon: Task Task
    • Resolution: Done
    • None
    • Affects Version/s: None
    • Component/s: None

      @michaelcahill, to test this, add code to force rollbacks and turn on the debugging code that compares the compressed result against the original source, then test/format will hit it pretty quickly.

      --- a/ext/compressors/zlib/zlib_compress.c
      +++ b/ext/compressors/zlib/zlib_compress.c
      @@ -236,7 +236,7 @@ zlib_compress_raw(WT_COMPRESSOR *compressor, WT_SESSION *session,
              ZLIB_OPAQUE opaque;
              z_stream zs;
              uint32_t curr_slot, last_slot;
      -       int ret;
      +       int ret, rbcnt;
       
              curr_slot = last_slot = 0;
              (void)split_pct;
      @@ -277,6 +277,7 @@ zlib_compress_raw(WT_COMPRESSOR *compressor, WT_SESSION *session,
               * page results in forced eviction based on in-memory size, even though
               * the data fits into a single on-disk block.
               */
      +       rbcnt = 1;
              while (zs.avail_out > 0 && zs.total_in <= zs.total_out * 20) {
                      /* Find the slot we will try to compress up to. */
                      if ((curr_slot = zlib_find_slot(
      @@ -290,7 +291,7 @@ zlib_compress_raw(WT_COMPRESSOR *compressor, WT_SESSION *session,
                                          compressor, session, "deflate", ret));
       
                      /* Roll back if the last deflate didn't complete. */
      -               if (zs.avail_in > 0)
      +               if (zs.avail_in > 0 || ++rbcnt > 10)
                              goto rollback;
       
                      last_slot = curr_slot;
      @@ -341,7 +342,7 @@ rollback:   if ((ret = deflateReset(&zs)) != Z_OK)
                      *result_lenp = 1;
              }
       
      -#if 0
      +#if 1
              /* Decompress the result and confirm it matches the original source. */
              if (last_slot > 0) {
                      void *decomp;
      

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: