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

evicting trees during bulk-loads

    • Type: Icon: Task Task
    • Resolution: Done
    • WT1.3
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Michael says:

      Hi Alex,

      > I came across a crash in eviction while poking at LSM today. The btree->root_page pointer was NULL. Looking a bit further, the WT_BTREE_EXCLUSIVE flag was set on the btree handle.
      >
      > Should a btree handle be eligible for eviction when the exclusive flag is set?

      Probably not. Certainly not if the root is NULL.

      The following patch appears to fix the problem, but I wasn't able to reproduce it reliably so I can't be 100% confident.
      
      --- a/src/btree/bt_evict.c
      +++ b/src/btree/bt_evict.c
      @@ -733,7 +733,8 @@ __evict_walk(WT_SESSION_IMPL *session)
              */
             i = WT_EVICT_WALK_BASE;
             TAILQ_FOREACH(btree, &conn->btqh, q) {
      -               if (F_ISSET(btree, WT_BTREE_NO_EVICTION))
      +               if (F_ISSET(btree, WT_BTREE_NO_EVICTION) ||
      +                   F_ISSET(btree, WT_BTREE_EXCLUSIVE))
                             continue;
                     /* Reference the correct WT_BTREE handle. */
      

      That seems reasonable, but I don't think it's sufficient. We're not holding any lock in eviction at that point that would stop the tree from switching to exclusive during the walk.

      For example, an application thread could create an empty tree, eviction could start walking that tree, then the application thread could start a bulk load. The pages from the empty tree would be free from under eviction.

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

              Created:
              Updated:
              Resolved: