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

Make it possible to store 0 bytes into a 'u' format via Python

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT2.9.3, 3.5.9
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage 2017-05-29

      This test:

      #!/usr/bin/env python
      
      import wiredtiger, wttest
      
      class test_xxx(wttest.WiredTigerTestCase):
          uri = 'file:xxx'
          def test_xxx(self):
              self.session.create(self.uri, 'key_format=S,value_format=u')
      	cursor = self.session.open_cursor(self.uri, None, None)
      	cursor['ABC'] = 'xxx'
      	self.assertEquals(cursor['ABC'], 'xxx')
      	cursor['ABC'] = ''
      	self.assertEquals(cursor['ABC'], '')
      
      if __name__ == '__main__':
          wttest.run()
      

      outputs:

      FERROR in f.test_xxx.test_xxx
      
      ======================================================================
      FAIL: f.test_xxx.test_xxx
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/usr/home/bostic/wt.develop/test/suite/f.py", line 13, in test_xxx
          self.assertEquals(cursor['ABC'], '')
      AssertionError: '\x00' != ''
      
      ----------------------------------------------------------------------
      Ran 1 test in 0.030s
      
      FAILED (failures=1)
      

      And there's a nul byte in the file:

      % wt -h WT_TEST/test_xxx.0 dump file:xxx
      WiredTiger Dump (WiredTiger Version 2.9.2)
      Format=print
      Header
      file:xxx
      access_pattern_hint=none,allocation_size=4KB,app_metadata=,block_allocation=best,block_compressor=,cache_resident=false,checksum=uncompressed,colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,name=),exclusive=false,extractor=,format=btree,huffman_key=,huffman_value=,ignore_in_memory_cache_size=false,immutable=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_max=15,merge_min=0),memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,source=,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,type=file,value_format=u
      Data
      ABC\00
      \00
      

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

              Created:
              Updated:
              Resolved: