[SERVER-19083] WiredTiger creationString in collstats contains non-collection level options Created: 23/Jun/15  Updated: 05/Feb/16  Resolved: 20/Jul/15

Status: Closed
Project: Core Server
Component/s: WiredTiger
Affects Version/s: 3.0.4
Fix Version/s: 3.1.6

Type: Bug Priority: Critical - P2
Reporter: Cory Mintz Assignee: Max Hirschhorn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on WT-1980 Export metadata for recreating an object Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

backup_test:PRIMARY> use wt_test
switched to db wt_test
backup_test:PRIMARY> db.createCollection("source")
{ "ok" : 1 }
backup_test:PRIMARY> var creationString = db.runCommand({"collstats":"source"})["wiredTiger"]["creationString"]
backup_test:PRIMARY> creationString
allocation_size=4KB,app_metadata=(formatVersion=1),block_allocation=best,block_compressor=snappy,cache_resident=0,checkpoint=,checkpoint_lsn=,checksum=uncompressed,collator=,columns=,dictionary=0,format=btree,huffman_key=,huffman_value=,id=16,internal_item_max=0,internal_key_max=0,internal_key_truncate=,internal_page_max=4KB,key_format=q,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=1MB,memory_page_max=10m,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0,prefix_compression_min=4,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,value_format=u,version=(major=1,minor=1)
backup_test:PRIMARY> db.createCollection("dest", {storageEngine:{wiredTiger:{configString:creationString}}})
{ "errmsg" : "exception: 22: Invalid argument", "code" : 2, "ok" : 0 }

Sprint: Quint Iteration 6
Participants:

 Description   

I would like to be able to create a collection with the same wiredTiger collection options as an existing collection. If I take the wiredTiger.creationString field from the collstats command to pass to the createCollection command it fails with:

Error creating `test.test`: { "serverUsed" : "127.0.0.1:27502" , "errmsg" : "exception: 22: Invalid argument" , "code" : 2 , "ok" : 0.0}

and write the following to the MongoDB log:

session.create: unknown configuration key: 'checkpoint': Invalid argument

It seems that the collstats output contains options that are not valid at the collection level.



 Comments   
Comment by Githook User [ 20/Jul/15 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-19083 Strip out WT internal metadata from creation string.

Ensures that the creation strings returned by the "collStats" command
can be used to construct an identically configured collection or index.
Branch: master
https://github.com/mongodb/mongo/commit/d0dd378bea15f8dd71312cf33f435ab7cbc06b5a

Comment by Githook User [ 13/Jul/15 ]

Author:

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

Message: SERVER-19083 Provide an API to query metadata meaningful to WT_SESSION::create.

Note the connection to WT-1133: this change does not support getting the configuration of connections or sessions, or using a cursor to traverse a config string.
Branch: develop
https://github.com/wiredtiger/wiredtiger/commit/c13266afbb2b3f94468e870e46826b86f50053e9

Comment by Michael Cahill (Inactive) [ 25/Jun/15 ]

There is some tension here from inside WiredTiger: the string that is returned in the statistics is the complete metadata for the table, but all MongoDB wants is a value that can be passed to WT_SESSION::create. The cleanest way to do this would be to extend the metadata cursor interface that MongoDB is using to query this information.

We could actually use the same interface in WiredTiger itself to simplify the wt dump utility, which also has to walk and combine metadata entries.

Let me know if this makes sense and I will get the WiredTiger side of this done.

Generated at Thu Feb 08 03:49:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.