Avoid null checking collator each time when compare keys

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines
    • StorEng - Defined Pipeline
    • None

      /*
       * __wt_compare_skip --
       *     The same as __wt_lex_compare_skip, but using the application's collator function when
       *     configured.
       */
      static WT_INLINE int
      __wt_compare_skip(WT_SESSION_IMPL *session, WT_COLLATOR *collator, const WT_ITEM *user_item,
        const WT_ITEM *tree_item, int *cmpp, size_t *matchp)
      {
          if (collator == NULL) {
              *cmpp = __wt_lex_compare_skip(session, user_item, tree_item, matchp);
              return (0);
          }
          return (collator->compare(collator, &session->iface, user_item, tree_item, cmpp));
      }
      

      We use this code to compare the keys based on whether we have a collator or not. We do this each time when we compare the two keys. Ideally, we should be able to set on the btree that which function we should use when we open the btree. We can then avoid calling this code for each comparison.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: