code: boolean compareAndSetLeaf(Page oldPage, Page page)
    {
      if (oldPage == page) {
        return true;
      }
      
      int pid = (int) page.getId();
      
      updateTailPid(pid);
      
      if (oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl) {
        PageLeafImpl oldLeaf = (PageLeafImpl) oldPage;
        PageLeafImpl newLeaf = (PageLeafImpl) page;
        
        if (BlockTree.compareKey(oldLeaf.getMaxKey(), newLeaf.getMaxKey(), 0) < 0) {
          System.err.println(" DERP: " + oldPage + " " + page);
          Thread.dumpStack();
          /*
          throw new IllegalStateException("DERP: old=" + oldPage + " " + page
                                          + " old-dirt:" + oldPage.isDirty());
                                          */
        }
      }
      
      boolean result = _pages.compareAndSet(pid, oldPage, page);
      
      return result;
    }
docs: Updates the leaf to a new page.
  Called only from TableService.