-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.0.6
-
Component/s: Sharding
-
Environment:OS : debian 7.8 64
MongoDB : mongodb-org v3.0.6 via "http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main"
-
Sharding
-
ALL
-
-
QuInt A (10/12/15), QuInt B (11/02/15), QuInt C (11/23/15)
The mongos forwards the createIndexes command to all shards, including ones without any chunks for the sharded collection. This causes the .chunks collection to be implicitly created without any storage engine options on the other shard.
Original description
Hello,
In a sharded cluser with default "blockCompressor" set to "zlib", I created a collection with "block_compressor=snappy".
After sharding this "snappy" collection, the balancer creates the collection on other replica-sets with "zlib" (the config default), and not "snappy" (the explicit block_compressor for this particular collection).
=> It would be nice if the not default block_compressor is preserved across the shards of the same collection.
=> Can I safely manualy create the collection directy on the secondary shards (connecting directy to each replica-set primary) before sharding the collection ?
Best regards,
Clement
Original steps to reproduce
My use case is on a GridFS collection. I dont think it's relevant. But just in case, I let the ".chunks".
The issue probably also exists with default compression left to "snappy", and collection explicitely created with "zlib". But again, here is my use case :
- set the default block compressor to "zlib" :
mongod config file
... storage: dbPath: /var/lib/mongodb directoryPerDB: true engine: wiredTiger wiredTiger: collectionConfig: blockCompressor: zlib ...
- (remove dbPath content and restart mongods)
- Manualy create a collection with "snappy" :
mongos> use myDB mongos> db.createCollection( "myGridfsCollection.chunks", { storageEngine: { wiredTiger: { configString: 'block_compressor=snappy' }}})
- Check the block_compressor :
mongos> use myDB mongos> db.myGridfsCollection.chunks.stats().wiredTiger.creationString
=> must be "block_compressor=snappy"
- Start inserting documents (in my case GridFS files) in this collection.
- Shard the collection :
mongos> use admin mongos> db.runCommand( { shardCollection : "myDB.myGridfsCollection.chunks" , key : { files_id : 1 , n : 1 } } )
- Check the block_compressor again :
mongos> use myDB mongos> db.myGridfsCollection.chunks.stats().wiredTiger.creationString
=> ok nothing - the collection is sharded.
In my case, I have 2 replica-sets "rs0" and "rs1" :
For rs0 :mongos> db.myGridfsCollection.chunks.stats().shards.rs0.wiredTiger.creationString
=> block_compressor=snappy
=> the primary shard of the collection, here "rs0", have the correct block compressor.
For rs1 :
If their is nothing yet. Continue data inserts to trigger the balancer.mongos> db.myGridfsCollection.chunks.stats().shards.rs1.wiredTiger.creationString
=> block_compressor=zlib
=> the other shard of the collection is not in snappy.
- duplicates
-
SERVER-30344 prevent shards from implicitly creating a collection on createIndexes
- Closed
- is related to
-
SERVER-30344 prevent shards from implicitly creating a collection on createIndexes
- Closed