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

Fix a race between internal page child-page eviction checks and cursors in the tree

    • 13
    • Storage Engines 2019-07-19
    • v4.0, v3.6

      I've seen this stack a few times now:

      #0  0x00007fd04c130c37 in __GI_raise (sig=sig@entry=6)
          at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
      #1  0x00007fd04c134028 in __GI_abort () at abort.c:89
      #2  0x000000000045b147 in __wt_abort (session=0x7fd04d307b10)
          at src/os_common/os_abort.c:32
      #3  0x000000000049e02a in __wt_panic (session=0x7fd04d307b10)
          at src/support/err.c:527
      #4  0x000000000049e080 in __wt_illegal_value_func (session=0x7fd04d307b10,
          v=2880154539, func=0x612ba0 <__func__.18057> "__wt_page_in_func", line=840)
          at src/support/err.c:562
      #5  0x00000000004fa7f1 in __wt_page_in_func (session=0x7fd04d307b10,
          ref=0x7fd030626e80, flags=3746,
          func=0x6172d0 <__func__.17987> "__tree_walk_internal", line=527)
          at src/btree/bt_read.c:840
      #6  0x000000000052552b in __wt_page_swap_func (session=0x7fd04d307b10,
          held=0x0, want=0x7fd030626e80, flags=3746,
          func=0x6172d0 <__func__.17987> "__tree_walk_internal", line=527)
          at ./src/include/btree.i:1712
      #7  0x0000000000526092 in __tree_walk_internal (session=0x7fd04d307b10,
          refp=0x7fd0305a4a58, walkcntp=0x0, skip_func=0x0, func_cookie=0x0,
          flags=2690) at src/btree/bt_walk.c:526
      #8  0x00000000005262a5 in __wt_tree_walk (session=0x7fd04d307b10,
          refp=0x7fd0305a4a58, flags=2688) at src/btree/bt_walk.c:597
      #9  0x00000000005d18aa in __wt_btcur_prev (cbt=0x7fd0305a48e0,
          truncating=false) at src/btree/bt_curprev.c:674
      #10 0x00000000005578f0 in __curfile_prev (cursor=0x7fd0305a48e0)
          at src/cursor/cur_file.c:147
      #11 0x0000000000407478 in read_op (cursor=0x7fd0305a48e0, op=PREV, exactp=0x0)
          at format.i:49
      #12 0x000000000040a9d5 in nextprev (tinfo=0x2b477d0, cursor=0x7fd0305a48e0,
          next=false) at ops.c:1265
      (gdb) frame 5
      #5  0x00000000004fa7f1 in __wt_page_in_func (session=0x7fd04d307b10, 
          ref=0x7fd030626e80, flags=3746, 
          func=0x6172d0 <__func__.17987> "__tree_walk_internal", line=527)
          at src/btree/bt_read.c:840
      840			WT_ILLEGAL_VALUE(session, current_state);
      (gdb) p/x current_state
      $11 = 0xabababab
      

      Another version:

      (gdb) where
      #0  0x00007fc47eccec37 in __GI_raise (sig=sig@entry=6)
          at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
      #1  0x00007fc47ecd2028 in __GI_abort () at abort.c:89
      #2  0x000000000045b128 in __wt_abort (session=0x7fc47fea4d00)
          at src/os_common/os_abort.c:32
      #3  0x000000000043e155 in __wt_evict_list_clear_page (session=0x7fc47fea4d00, 
          ref=0x7fc4681e3190) at src/evict/evict_lru.c:176
      #4  0x0000000000447017 in __wt_evict (session=0x7fc47fea4d00, 
          ref=0x7fc4681e3190, previous_state=5, flags=2)
          at src/evict/evict_page.c:171
      #5  0x0000000000446bdb in __wt_page_release_evict (session=0x7fc47fea4d00, 
          ref=0x7fc4681e3190, flags=2690) at src/evict/evict_page.c:93
      #6  0x00000000005253f5 in __wt_page_release (session=0x7fc47fea4d00, 
          ref=0x7fc4681e3190, flags=2690) at ./src/include/btree.i:1530
      #7  0x00000000005261f7 in __tree_walk_internal (session=0x7fc47fea4d00, 
          refp=0x7fc4684d94b8, walkcntp=0x0, skip_func=0x0, func_cookie=0x0, 
          flags=2690) at src/btree/bt_walk.c:585
      #8  0x0000000000526286 in __wt_tree_walk (session=0x7fc47fea4d00, 
          refp=0x7fc4684d94b8, flags=2688) at src/btree/bt_walk.c:597
      #9  0x00000000005d188b in __wt_btcur_prev (cbt=0x7fc4684d9340, 
          truncating=false) at src/btree/bt_curprev.c:674
      #10 0x00000000005578d1 in __curfile_prev (cursor=0x7fc4684d9340)
          at src/cursor/cur_file.c:147
      #11 0x0000000000407478 in read_op (cursor=0x7fc4684d9340, op=PREV, exactp=0x0)
          at format.i:49
      #12 0x000000000040a9b6 in nextprev (tinfo=0x3eb9d10, cursor=0x7fc4684d9340, 
          next=false) at ops.c:1265
      

      SUMMARY:
      This ticket resolves the issue of WiredTiger failure if a thread is cursoring through the tree in a reverse direction at the same time the internal parent page of the child pages the thread is reading, is being evicted. This ticket improves this scenario by detecting that the child pages of the parent are in use, and failing the attempt to evict the parent page.

            Assignee:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: