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

Use oldest unstable timestamp to clean history store when no stable updates are on chain

    • 8
    • Storage Engines - 2022-09-19, Storage Engines - 2022-10-03, Storage Engines - 2022-10-17, Storage Engines - 2022-10-31, Storage Engines - 2022-11-14
    • v6.1

      MongoDB test hits a scenario where the same timestamped update gets inserted twice into the history store leading to an assert failure. The inserting update and the existing history store update both are having the same timestamp but with different transaction ids.

      Call stack:

      (gdb) bt
      #0  0x00007f95ef75593f in raise () from /lib64/libc.so.6
      #1  0x00007f95ef73fc95 in abort () from /lib64/libc.so.6
      #2  0x00007f95e290481b in __wt_abort (session=session@entry=0x7f95da453b90) at src/third_party/wiredtiger/src/os_common/os_abort.c:30
      #3  0x00007f95e28fc3fa in __hs_delete_reinsert_from_pos (session=0x7f95da453b90, hs_cursor=0x7f95d761c520, btree_id=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, key=0x7f95b6e021c0, ts=7140503328554745873, reinsert=true, no_ts_tombstone=false, error_on_ts_ordering=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, counter=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, upd_tw=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/txn_inline.h:980
      #4  0x00007f95e2a21845 in __hs_insert_record (session=0x7f95da453b90, cursor=0x7f95d761c520, btree=0x7f95c168d820, key=0x7f95b6e021c0, type=<optimized out>, hs_value=0x7f95d823e6a0, tw=0x7f95def597e0, error_on_ts_ordering=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/txn_inline.h:278
      #5  0x00007f95e2a23529 in __wt_hs_insert_updates (session=session@entry=0x7f95da453b90, r=r@entry=0x7f95c1768c20, multi=multi@entry=0x7f95c189da20) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/txn_inline.h:766
      #6  0x00007f95e2a7c6bd in __rec_hs_wrapup (r=0x7f95c1768c20, r@entry=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, session=0x7f95da453b90, session@entry=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at src/third_party/wiredtiger/src/reconcile/rec_write.c:2678
      #7  __rec_write_wrapup (session=0x7f95da453b90, r=0x7f95c1768c20, page=0x7f95c1ac2f20) at src/third_party/wiredtiger/src/reconcile/rec_write.c:2415
      #8  0x00007f95e2a7e6cb in __reconcile (page_lockedp=0x7f95def59fbf, flags=68, salvage=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, ref=0x7f95b3cfbc60, session=0x7f95da453b90) at src/third_party/wiredtiger/src/reconcile/rec_write.c:304
      #9  __wt_reconcile (session=session@entry=0x7f95da453b90, ref=0x7f95b3cfbc60, salvage=salvage@entry=0x0, flags=flags@entry=68) at src/third_party/wiredtiger/src/reconcile/rec_write.c:98
      #10 0x00007f95e297bac7 in __wt_sync_file (session=session@entry=0x7f95da453b90, syncop=syncop@entry=WT_SYNC_CHECKPOINT) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/intpack_inline.h:629
      #11 0x00007f95e2acecca in __checkpoint_tree (session=0x7f95da453b90, is_checkpoint=<optimized out>, cfg=<optimized out>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:2089
      #12 0x00007f95e2ad0221 in __checkpoint_tree_helper (cfg=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, session=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:2202
      #13 __checkpoint_apply_to_dhandles (op=<optimized out>, cfg=<optimized out>, session=<optimized out>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:201
      #14 __txn_checkpoint (cfg=0x7f95def5a430, session=0x7f95da453b90, session@entry=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:1017
      #15 __txn_checkpoint_wrapper (session=0x7f95da453b90, cfg=0x7f95def5a430) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:1289
      #16 0x00007f95e2ad13e3 in __wt_txn_checkpoint (session=0x7f95da453b90, cfg=cfg@entry=0x7f95def5a430, waiting=waiting@entry=true) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:1352
      #17 0x00007f95e2aca96a in __wt_txn_global_shutdown (session=session@entry=0x7f95da451020, cfg=cfg@entry=0x7f95def5a4e0) at /data/mci/8ddd4aaa9b0b12bc795b711bb603d7f2/src/cache_inline.h:2443
      #18 0x00007f95e2996dd5 in __conn_close (wt_conn=0x7f95df05d020, config=<optimized out>) at src/third_party/wiredtiger/src/conn/conn_api.c:1169
      

      Inserting update:

      (gdb) p *tw
      $28 = {
        durable_start_ts = 7140503328554745872, 
        start_ts = 7140503328554745872, 
        start_txn = 5144, 
        durable_stop_ts = 7140503328554745874, 
        stop_ts = 7140503328554745874, 
        stop_txn = 5145, 
        prepare = 0 '\000'
      } 
      

      Existing history store update:

      (gdb) p *twp
      $27 = {
        durable_start_ts = 7140503328554745872, 
        start_ts = 7140503328554745872, 
        start_txn = 4920, 
        durable_stop_ts = 7140503328554745874, 
        stop_ts = 7140503328554745874, 
        stop_txn = 4921, 
        prepare = 0 '\000'
      }
      

            Assignee:
            andrew.morton@mongodb.com Andrew Morton
            Reporter:
            haribabu.kommi@mongodb.com Haribabu Kommi
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: