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

Erroneous "illegal argument" response for index with value_format=i

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: WT2.5.3, WT2.6.1
    • Fix Version/s: WT2.7.0
    • Labels:
      None
    • # Replies:
      5
    • Last comment by Customer:
      true

      Description

      When inserting a value that is more negative than -64 (e.g. -65, -66, etc) into a table with format "i", iterating or searching for that value always returns "illegal argument" instead of successful responses. This is probably a bug in the variable length encoding, since it doesn't happen with format "l". It only seems to happen when that value is the key of an index, when it is in the primary key or a value it works fine.

      See attached test case.

      It basically corrupts the database since it writes the data just fine, but any subsequent attempts to read past it will return errors.

      1. format_i_bug.c
        2 kB
        Greg Rogers

        Issue Links

          Activity

          Hide
          keith.bostic Keith Bostic added a comment -

          Michael Cahill, I'm not seeing "illegal argument", I'm seeing WT_NOTFOUND, but haven't gotten further.

          Show
          keith.bostic Keith Bostic added a comment - Michael Cahill , I'm not seeing "illegal argument", I'm seeing WT_NOTFOUND , but haven't gotten further.
          Hide
          keith.bostic Keith Bostic added a comment -

          Michael Cahill, I followed this down into the search routine, and we're clearly searching for the wrong key – I'll let this go since you'll be online soon and I don't know the index code at all.

          Show
          keith.bostic Keith Bostic added a comment - Michael Cahill , I followed this down into the search routine, and we're clearly searching for the wrong key – I'll let this go since you'll be online soon and I don't know the index code at all.
          Hide
          alexander.gorrod Alexander Gorrod added a comment -

          Greg Rogers Thanks for the detailed bug report, and excellent reproducing case. I have found the cause of the issue, and pushed a fix for review here:

          https://github.com/wiredtiger/wiredtiger/pull/2032

          I have also created new test code that will catch similar bugs in the future.

          For your information the bug was in decoding the information from the index, specifically in decoding a pair of values from a single buffer (e.g: ii format), where the first value is between -65 and -8256. The data in any underlying tables is correct, this was a bug in our decode logic, not our packing layout.

          Show
          alexander.gorrod Alexander Gorrod added a comment - Greg Rogers Thanks for the detailed bug report, and excellent reproducing case. I have found the cause of the issue, and pushed a fix for review here: https://github.com/wiredtiger/wiredtiger/pull/2032 I have also created new test code that will catch similar bugs in the future. For your information the bug was in decoding the information from the index, specifically in decoding a pair of values from a single buffer (e.g: ii format), where the first value is between -65 and -8256. The data in any underlying tables is correct, this was a bug in our decode logic, not our packing layout.
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexg@wiredtiger.com'}

          Message: WT-1981 Fix a bug in signed integer unpacking.

          Values between -64 and -8190 would consume too much of the packed
          buffer. Leading to incorrect decoding of packed values.
          Branch: develop
          https://github.com/wiredtiger/wiredtiger/commit/14d81ad9b9bd195db7287f937ae82ec183229967

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexg@wiredtiger.com'} Message: WT-1981 Fix a bug in signed integer unpacking. Values between -64 and -8190 would consume too much of the packed buffer. Leading to incorrect decoding of packed values. Branch: develop https://github.com/wiredtiger/wiredtiger/commit/14d81ad9b9bd195db7287f937ae82ec183229967
          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 #2032 from wiredtiger/signed-int-pack-bug

          WT-1981 Fix a signed 32-bit integer unpacking bug
          Branch: develop
          https://github.com/wiredtiger/wiredtiger/commit/1602a4b137c01d22de191b4581d07b155e7980f3

          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 #2032 from wiredtiger/signed-int-pack-bug WT-1981 Fix a signed 32-bit integer unpacking bug Branch: develop https://github.com/wiredtiger/wiredtiger/commit/1602a4b137c01d22de191b4581d07b155e7980f3

            People

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

              Dates

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