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

search/remove shouldn't need to check key size

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.7.0
    • Labels:
      None
    • # Replies:
      3
    • Last comment by Customer:
      true

      Description

      The WiredTiger btree cursor search and remove functions check the size of the key to ensure it's not too large. Looking over the code paths, I don't think there's any reason we need to check the size of the key, if it's too large, the search will fail, and that's OK.

        Issue Links

          Activity

          Hide
          keith.bostic Keith Bostic added a comment -

          Michael Cahill, I can't think of any reason we need to check the key size, can you?

          *** bt_cursor.c.orig Sun Sep 27 17:20:12 2015
          --- bt_cursor.c   Thu Oct 22 12:58:08 2015
          ***************
          *** 306,314 ****
                  WT_STAT_FAST_CONN_INCR(session, cursor_search);
                  WT_STAT_FAST_DATA_INCR(session, cursor_search);
           
          -       if (btree->type == BTREE_ROW)
          -               WT_RET(__cursor_size_chk(session, &cursor->key));
          -
                  /*
                   * If we have a page pinned, search it; if we don't have a page pinned,
                   * or the search of the pinned page doesn't find an exact match, search
          --- 306,311 ----
          ***************
          *** 376,384 ****
                  WT_STAT_FAST_CONN_INCR(session, cursor_search_near);
                  WT_STAT_FAST_DATA_INCR(session, cursor_search_near);
           
          -       if (btree->type == BTREE_ROW)
          -               WT_RET(__cursor_size_chk(session, &cursor->key));
          -
                  /*
                   * If we have a row-store page pinned, search it; if we don't have a
                   * page pinned, or the search of the pinned page doesn't find an exact
          --- 373,378 ----
          ***************
          *** 659,667 ****
                  WT_STAT_FAST_DATA_INCR(session, cursor_remove);
                  WT_STAT_FAST_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);
           
           
          -       if (btree->type == BTREE_ROW)
          -               WT_RET(__cursor_size_chk(session, &cursor->key));
          -
            retry:        WT_RET(__cursor_func_init(cbt, true));
           
                  switch (btree->type) {
          --- 653,658 ----
          

          Show
          keith.bostic Keith Bostic added a comment - Michael Cahill , I can't think of any reason we need to check the key size, can you? *** bt_cursor.c.orig Sun Sep 27 17:20:12 2015 --- bt_cursor.c Thu Oct 22 12:58:08 2015 *************** *** 306,314 **** WT_STAT_FAST_CONN_INCR(session, cursor_search); WT_STAT_FAST_DATA_INCR(session, cursor_search);   - if (btree->type == BTREE_ROW) - WT_RET(__cursor_size_chk(session, &cursor->key)); - /* * If we have a page pinned, search it; if we don't have a page pinned, * or the search of the pinned page doesn't find an exact match, search --- 306,311 ---- *************** *** 376,384 **** WT_STAT_FAST_CONN_INCR(session, cursor_search_near); WT_STAT_FAST_DATA_INCR(session, cursor_search_near);   - if (btree->type == BTREE_ROW) - WT_RET(__cursor_size_chk(session, &cursor->key)); - /* * If we have a row-store page pinned, search it; if we don't have a * page pinned, or the search of the pinned page doesn't find an exact --- 373,378 ---- *************** *** 659,667 **** WT_STAT_FAST_DATA_INCR(session, cursor_remove); WT_STAT_FAST_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);     - if (btree->type == BTREE_ROW) - WT_RET(__cursor_size_chk(session, &cursor->key)); - retry: WT_RET(__cursor_func_init(cbt, true));   switch (btree->type) { --- 653,658 ----
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'keithbostic', u'name': u'Keith Bostic', u'email': u'keith@wiredtiger.com'}

          Message: WT-2180: there's no reason for cursor.

          {search,search-near,remove}

          to
          validate the key size, remove those tests.
          Branch: develop
          https://github.com/wiredtiger/wiredtiger/commit/0f56bb1e1bbcf301ff7b7089fd8153cf5de808c8

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'keithbostic', u'name': u'Keith Bostic', u'email': u'keith@wiredtiger.com'} Message: WT-2180 : there's no reason for cursor. {search,search-near,remove} to validate the key size, remove those tests. Branch: develop https://github.com/wiredtiger/wiredtiger/commit/0f56bb1e1bbcf301ff7b7089fd8153cf5de808c8
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'michaelcahill', u'name': u'Michael Cahill', u'email': u'michael.cahill@mongodb.com'}

          Message: Merge pull request #2263 from wiredtiger/wt-2180-remove-key-size-check

          WT-2180: remove cursor.

          {search,search-near,remove}

          key size validation
          Branch: develop
          https://github.com/wiredtiger/wiredtiger/commit/be544dd08106699baa6cb459e5103471c3dd27ba

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'michaelcahill', u'name': u'Michael Cahill', u'email': u'michael.cahill@mongodb.com'} Message: Merge pull request #2263 from wiredtiger/wt-2180-remove-key-size-check WT-2180 : remove cursor. {search,search-near,remove} key size validation Branch: develop https://github.com/wiredtiger/wiredtiger/commit/be544dd08106699baa6cb459e5103471c3dd27ba

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 30 weeks, 3 days ago
                Date of 1st Reply: