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