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

update can ignore page generations in a few cases

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

      Michael, I was looking at your changes to speed up the insert path when a page write generation number changes underfoot, and I think we can do a similar test in the case of updating an existing key/value pair.

      Basically, if we're the first update on an update list, or the transaction isn't a snapshot transaction, there's no reason we can't proceed even if the page's write generation number has changed, in other words, there are cases where there is either no update on the list or we don't care what updates are on the list, and the test is cheap enough to do in the serialized function.

      If you agree, here's the change.

      @ -454,6 +454,7 @@
       int
       __wt_update_serial_func(WT_SESSION_IMPL *session, void *args)
       {
      +  WT_DECL_RET;
         WT_PAGE *page;
         WT_UPDATE **new_upd, *upd, **upd_entry, **upd_obsolete;
         uint32_t write_gen;
      @@ -461,8 +462,18 @@
         __wt_update_unpack(
             args, &page, &write_gen, &upd_entry, &new_upd, &upd, &upd_obsolete);
       
      -  /* Check the page's write-generation. */
      -  WT_RET(__wt_page_write_gen_check(session, page, write_gen));
      +  /*
      +   * We may not be able to apply the update if the entry changed.  Check
      +   * the page's write generation (it's a fast check), but if that fails,
      +   * see if it's the only update for the slot or the transaction is not
      +   * in TXN_ISO_SNAPSHOT mode, those cases can ignore page generations.
      +   */
      +  if ((ret = __wt_page_write_gen_check(session, page, write_gen)) != 0) {
      +    if (*upd_entry != NULL &&
      +        session->txn.isolation == TXN_ISO_SNAPSHOT)
      +      return (ret);
      +    ret = 0;
      +  }
       
         upd->next = *upd_entry;
         /*
      

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

              Created:
              Updated:
              Resolved: