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

LSM --with-spinlock=gcc failure.

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

      I ran the test suite with --with-spinlock=gcc configured and saw a failure today.

      Here's the stack:

      Breakpoint 3, __lsm_discard_handle (session=0x805d7e630, 
          uri=0x806c07100 "file:test_backup.2-000009.lsm", checkpoint=0x0)
          at ../src/lsm/lsm_worker.c:506
      506		WT_TRET(__wt_session_release_btree(session));
      (gdb) where
      #0  __lsm_discard_handle (session=0x805d7e630, 
          uri=0x806c07100 "file:test_backup.2-000009.lsm", checkpoint=0x0)
          at ../src/lsm/lsm_worker.c:506
      WT-1  0x00000008036fc574 in __wt_lsm_checkpoint_worker (arg=0x801632100)
          at ../src/lsm/lsm_worker.c:296
      

      *lsm_discard_handle returns any error from *wt_spin_trylock:

      locked = 0;
      if ((ret =
          __wt_spin_trylock(session, &S2C(session)->checkpoint_lock)) == 0) {
              locked = 1;
              F_SET(session->dhandle, WT_DHANDLE_DISCARD);
      }
      WT_TRET(__wt_session_release_btree(session));
      if (locked)
              __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
      
      return (ret);
      

      and __wt_lsm_checkpoint_worker checks that return for EBUSY:

      /*
       * If the chunk is already checkpointed, make sure it
       * is also evicted.  Either way, there is no point
       * trying to checkpoint it again.
       */
      if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) {
              if (F_ISSET(chunk, WT_LSM_CHUNK_EVICTED))
                      continue;
               
              if ((ret = __lsm_discard_handle(
                  session, chunk->uri, NULL)) == 0)
                      F_SET(chunk, WT_LSM_CHUNK_EVICTED);
              else if (ret == EBUSY)
                      ret = 0;
              else
                      WT_ERR_MSG(session, ret,
                          "discard handle");
              continue;
      }
      

      EBUSY is what pthread_mutex_trylock returns, but the gcc spinlock implementation of __wt_spin_trylock returns 0/1.

      Maybe wiredtiger-spinlock-gcc should have it's own test test-unit downstream project?

            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: