[SERVER-17749] collMod usePowerOf2Sizes fails on mongos Created: 26/Mar/15  Updated: 18/Sep/15  Resolved: 17/Apr/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.8
Fix Version/s: 2.6.10, 3.0.3, 3.1.1

Type: Bug Priority: Major - P3
Reporter: Ole Langbehn Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-17607 Hook OP_COMMAND/OP_COMMANDREPLY into ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Steps To Reproduce:

1. connect to mongos
2. db.runCommand(

{collMod : "test" , usePowerOf2Sizes : true }

)

Participants:

 Description   

I'm trying to set the usePowerOf2Sizes flag to a collection. I tried
from a mongos:

mongos> db.runCommand(

{collMod : "test" , usePowerOf2Sizes : true }

)
{
"raw" : {
"rs_test/db1-test:27017,db2-test:27017" :

{ "usePowerOf2Sizes_old" : false, "usePowerOf2Sizes_new" : true, "ok" : 0, "errmsg" : "unknown option to collMod: $queryOptions" }

},
"ok" : 0,
"errmsg" : "

{ rs_test/db1-test:27017,db2-test:27017: \"unknown option to collMod: $queryOptions\" }

"
}

On the replicaset master, setting the flag works:

rs_test:PRIMARY> db.runCommand(

{collMod : "deviceInfoView" , usePowerOf2Sizes : false }

)

{ "usePowerOf2Sizes_old" : true, "usePowerOf2Sizes_new" : false, "ok" : 1 }

JFYI: This cluster has been upgraded from 2.4.



 Comments   
Comment by Githook User [ 17/Apr/15 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: SERVER-17749: ignore fields starting with $ in collMod command, to match behavior of aggregation pipeline command.

(cherry picked from commit aa51ce621c39c54c2105eebe2f0961f0dc9c2890)
Branch: v2.6
https://github.com/mongodb/mongo/commit/150d03405122fbb7ffe20a0d99d12199fa3bcb42

Comment by Githook User [ 17/Apr/15 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: SERVER-17749: ignore fields starting with $ in collMod command, to match behavior of aggregation pipeline command.

(cherry picked from commit aa51ce621c39c54c2105eebe2f0961f0dc9c2890)
Branch: v3.0
https://github.com/mongodb/mongo/commit/437125df84156433d08ba70821a981dea8b6c36e

Comment by Githook User [ 01/Apr/15 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: SERVER-17749: ignore fields starting with $ in collMod command, to match behavior of aggregation pipeline command.
Branch: master
https://github.com/mongodb/mongo/commit/aa51ce621c39c54c2105eebe2f0961f0dc9c2890

Comment by Ramon Fernandez Marina [ 31/Mar/15 ]

Thanks for the additional information ole. This looks like a bug: the read preference should be ignored when running collMod, but in the case of usePowerOf2Sizes it isn't. We're looking into it.

Comment by Ole Langbehn [ 30/Mar/15 ]

passing --norc helped.

The culprit was 'db.getMongo().setReadPref("secondary")', though I don't understand why the read preference breaks setting flags.

Comment by Sam Kleinman (Inactive) [ 30/Mar/15 ]

Sorry for this confusion. To help us reproduce this case, could you provide answers to the following

  • Could you check to ensure that all components of the cluster are running the correct version. Including the config servers, mongos instances, and all shards?
  • Can you attempt running this operation while passing the --norc option to mongo?
  • Can you confirm that the collection you're trying to set usePowerOf2Sizes on exists on all shards?
  • Are there cases where you can successfully run collMod via a mongos instance?

Regards,
sam

Comment by Ole Langbehn [ 26/Mar/15 ]

asked on mongo-user list, no answer up to now:

https://groups.google.com/forum/#!topic/mongodb-user/-oz8cu3ZX7U

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