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

Make durable_start_ts equal to stop_ts if stop_ts is less than durable_start_ts and greater than start_ts

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 5.2.0, 5.0.5
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 5
    • Storage - Ra 2021-10-18, Storage - Ra 2021-11-01

      As part of WT-7169, the crash (during checkpoint) in the test_timestamp22.py occurred due to the commit timestamp generated was in between the previous durable and commit_ts.

      Below is the reproducer:

      In transaction 5, if the commit timestamp is in between any of the previous commit and durable timestamp, WiredTiger crashes during the checkpoint. If not, WiredTiger does not crash. For instance, if the commit timestamp in Transaction 5 is 4, WiredTiger crashes. If it is 7 then WiredTiger does not crash)

      create_params = 'key_format=i,value_format=S'
      self.session.create(self.uri, create_params)
      cursor = self.session.open_cursor(self.uri)
      
      # Transaction 1
      self.session.begin_transaction()
      cursor[1] = 'a' 
      self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(2))
      self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(3)+ ',durable_timestamp=' + self.timestamp_str(6))
      
      # Transaction 2
      self.session.begin_transaction()
      cursor[1] = 'b'
      self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(8))
      
      # Transaction 3
      self.session.begin_transaction()
      cursor[1] = 'c'
      self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(9))
      self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(11)+ ',durable_timestamp=' + self.timestamp_str(15))
      
      # Transaction 4
      self.session.begin_transaction()
      cursor[1] = 'd'
      self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(16))
      self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(18)+ ',durable_timestamp=' + self.timestamp_str(21))
      
      #  Transaction 5
      self.session.begin_transaction()
      cursor[1] = 'e'
      self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(4))
      
      self.session.checkpoint()
      

      Error:

      [1632288975:409195][757:0x7f241a338740], practice_test.test_practice.test_practice, file:WiredTigerHS.wt, close_ckpt: __wt_time_value_validate, 439: value time window has a durable start time after its stop time; time window start: (0, 6)/(0, 3)/5 stop: (0, 4)/(0, 4)/6: Invalid argument
      [1632288975:409228][757:0x7f241a338740], practice_test.test_practice.test_practice, file:WiredTigerHS.wt, close_ckpt: __cell_check_value_validity, 22: value timestamp window failed validation: Invalid argument
      [1632288975:409237][757:0x7f241a338740], practice_test.test_practice.test_practice, file:WiredTigerHS.wt, close_ckpt: __cell_check_value_validity, 22: the process must exit and restart: WT_PANIC: WiredTiger library panic
      [1632288975:409243][757:0x7f241a338740], practice_test.test_practice.test_practice, file:WiredTigerHS.wt, close_ckpt: __wt_abort, 28: aborting WiredTiger library

      (crash) Backtrace:

      #0  0x00007ffff7a20fb7 in raise () from /lib/x86_64-linux-gnu/libc.so.6
      #1  0x00007ffff7a22921 in abort () from /lib/x86_64-linux-gnu/libc.so.6
      #2  0x00007ffff520a7d3 in __wt_abort (session=session@entry=0xd44720) at ../src/os_common/os_abort.c:30
      #3  0x00007ffff507f7e9 in __wt_panic_func (session=session@entry=0xd44720, error=<optimized out>, func=func@entry=0x7ffff52ea860 <__PRETTY_FUNCTION__.15613> "__cell_check_value_validity", line=line@entry=22, 
          fmt=fmt@entry=0x7ffff52c4650 "value timestamp window failed validation") at ../src/support/err.c:387
      #4  0x00007ffff52392a5 in __cell_check_value_validity (expected_error=false, tw=0x7fffffffbd40, session=0xd44720) at ../src/include/cell_inline.h:21
      #5  __cell_pack_value_validity (tw=0x7fffffffbd40, pp=<synthetic pointer>, session=0xd44720) at ../src/include/cell_inline.h:46
      #6  __wt_cell_pack_value (rle=0, size=5, rle=0, tw=0x7fffffffbd40, cell=0xdf09f8, session=0xd44720) at ../src/include/cell_inline.h:235
      #7  __wt_rec_cell_build_val (rle=0, rle=0, tw=0x7fffffffbd40, size=<optimized out>, data=<optimized out>, r=0xdf05b0, session=0xd44720) at ../src/include/reconcile_inline.h:374
      #8  __rec_row_leaf_insert (session=session@entry=0xd44720, r=r@entry=0xdf05b0, ins=0xbc7660) at ../src/reconcile/rec_row.c:623
      #9  0x00007ffff5245358 in __wt_rec_row_leaf (session=session@entry=0xd44720, r=r@entry=0xdf05b0, pageref=pageref@entry=0xbb80f0, salvage=salvage@entry=0x0) at ../src/reconcile/rec_row.c:769
      #10 0x00007ffff5254d83 in __reconcile (page_lockedp=<synthetic pointer>, flags=4, salvage=0x0, ref=0xbb80f0, session=0xd44720) at ../src/reconcile/rec_write.c:194
      #11 __wt_reconcile (session=session@entry=0xd44720, ref=0xbb80f0, salvage=salvage@entry=0x0, flags=flags@entry=4) at ../src/reconcile/rec_write.c:99
      #12 0x00007ffff5118913 in __wt_sync_file (session=session@entry=0xd44720, syncop=syncop@entry=WT_SYNC_CHECKPOINT) at ../src/btree/bt_sync.c:657
      #13 0x00007ffff52ab738 in __checkpoint_tree (session=session@entry=0xd44720, is_checkpoint=is_checkpoint@entry=true, cfg=0x7fffffffc5e0) at ../src/txn/txn_ckpt.c:1880
      #14 0x00007ffff52abea0 in __wt_checkpoint (session=session@entry=0xd44720, cfg=cfg@entry=0x7fffffffc5e0) at ../src/txn/txn_ckpt.c:2048
      #15 0x00007ffff52ad1ac in __txn_checkpoint (session=session@entry=0xd44720, cfg=cfg@entry=0x7fffffffc5e0) at ../src/txn/txn_ckpt.c:945
      #16 0x00007ffff52ae3ac in __txn_checkpoint_wrapper (cfg=0x7fffffffc5e0, session=0xd44720) at ../src/txn/txn_ckpt.c:1165
      #17 __wt_txn_checkpoint (session=session@entry=0xd44720, cfg=cfg@entry=0x7fffffffc5e0, waiting=waiting@entry=true) at ../src/txn/txn_ckpt.c:1219
      #18 0x00007ffff527e101 in __session_checkpoint (wt_session=0xd44720, config=0x0) at ../src/session/session_api.c:1878

      The scope of this ticket is to add an assert to detect this case earlier. (during commit_transaction() in transaction 5)

            Assignee:
            siddhartha.mahajan@mongodb.com Sid Mahajan
            Reporter:
            siddhartha.mahajan@mongodb.com Sid Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: