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

Version cursors check fails with wt_cmp_dir.py

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • 3
    • StorEng - Defined Pipeline

      The wt_cmp_dir.py script fails when the version cursor check is enabled.

      Perform the following diff to enable the check (and verbose):

      diff --git a/tools/wt_cmp_uri.py b/tools/wt_cmp_uri.py
      index 62b50bc30..e52aa881a 100755
      --- a/tools/wt_cmp_uri.py
      +++ b/tools/wt_cmp_uri.py
      @@ -41,7 +41,7 @@ def usage_exit():
           print('  -t ts   read at a timestamp (a different timestamp for each dir may be specified)')
           sys.exit(1)
       
      -verboseFlag = False
      +verboseFlag = True
       def verbose(s):
           if verboseFlag:
               print("VERBOSE>>> " + s)
      @@ -208,8 +208,8 @@ def compare_cursors(cc1, cc2, version):
                       print('unexpected version cursor search')
                       ecode = 1
                       return
      -            vcc1 = CompareCursor(vcur1, cc1.uri, 'version(key={}) for {}'.format(k1, cc1.name))
      -            vcc2 = CompareCursor(vcur2, cc2.uri, 'version(key={}) for {}'.format(k2, cc2.name))
      +            vcc1 = CompareCursor(vcur1, cc1.uri, 'version(key={}) for {}'.format(k1, cc1.name), is_reverse(cc1.cursor.session,  cc1.uri))
      +            vcc2 = CompareCursor(vcur2, cc2.uri, 'version(key={}) for {}'.format(k2, cc2.name), is_reverse(cc2.cursor.session,  cc2.uri))
                   verbose('READY for version cursor')
                   ver_ecode = compare_version_cursors(vcc1, vcc2)
                   vcur1.close()
      @@ -339,8 +339,7 @@ def wiredtiger_compare_uri(args):
               print('Failed opening {} in {} at timestamp {}'.format(uri2, wtdir2, timestamp2))
               raise
       
      -    # Not running with version cursors, it's not quite ready for prime time.
      -    ecode = compare_cursors(cc1, cc2, False)
      +    ecode = compare_cursors(cc1, cc2, True)
       
           cc1.close()
           cc2.close()
      

      Then run the reproducer using test_cursor01.py:

      $ /opt/mongodbtoolchain/v4/bin/python3 ../test/suite/run.py -p cursor01
      $ cd WT_TEST/
      $ ../../tools/wt_cmp_dir test_cursor01.0 test_cursor01.0
      file:test_cursor01
      VERBOSE>>> wiredtiger_open(test_cursor01.0)
      VERBOSE>>> test_cursor01.0/file:test_cursor01: next
      VERBOSE>>>   key: 1 value: value0
      VERBOSE>>> test_cursor01.0/file:test_cursor01: next
      VERBOSE>>>   key: 1 value: value0
      VERBOSE>>> READY for version cursor
      VERBOSE>>> Version: GOT: 1:[0, 0, 0, 18446744073709551605, 18446744073709551615, 18446744073709551615, 3, 0, 0, 1, 'value0'] 1:[0, 0, 0, 18446744073709551605, 18446744073709551615, 18446744073709551615, 3, 0, 0, 1, 'value0']
      VERBOSE>>> Version: finished compare
      ../../tools/wt_cmp_dir: line 167: 20255 Segmentation fault      (core dumped) python3 $cmp_uri_script $timestamp_opt1 "$dir1"/$f $timestamp_opt2 "$dir2"/$f
      

      The core indicates a segfault with the hs cursor which is a field of the version cursor:

      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00007fce8a40695d in __curversion_next_int (cursor=cursor@entry=0x19a8c50) at ../src/cursor/cur_version.c:355
      355             F_SET(hs_cursor, WT_CURSTD_HS_READ_COMMITTED);
      [Current thread is 1 (Thread 0x7fce8bbc6740 (LWP 20255))]
      (gdb) p hs_cursor
      $1 = (WT_CURSOR *) 0x0
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: