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

integer configuration strings take false/true as arguments

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

      Michael, I think this is a bug but I'm not 100% sure.

      You can currently assign "false" and "true" to integer configuration strings, for example, "allocation_size=true" and "dictionary=false" to WT_SESSION::create.

      That fails for allocation_size but for the wrong reason: instead of complaining about a type mismatch, it complains the value is too small because allocation sizes must be larger than 512B

      It succeeds for dictionary because we currently allow a value of 0 as the dictionary value.

      Here's the test program:

      import wiredtiger, wttest
      
      class test_f(wttest.WiredTigerTestCase):
      
          def test_f(self):
              print "test of dictionary == false"
              self.session.create(
                  "file:x", 'key_format=S,value_format=S,dictionary=false')
      
              print "test of allocation_size == true"
              self.session.create(
                  "file:x", 'key_format=S,value_format=S,allocation_size=true')
      
      if __name__ == '__main__':
          wttest.run()
      

      It's these lines in __config_process_value() that worry me:

              if (value->type == ITEM_ID) {
                      if (strncasecmp(value->str, "true", value->len) == 0) {
                              value->type = ITEM_NUM;
                              value->val = 1;
                      } else if (strncasecmp(value->str, "false", value->len) == 0) {
                              value->type = ITEM_NUM;
                              value->val = 0;
                      }
      

      It seems like this conversion should only be done if the underlying type is a boolean?

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

              Created:
              Updated:
              Resolved: