[JAVA-2176] splitVector added as an OBEDIENT_COMMANDS Created: 23/Apr/16  Updated: 11/Sep/19  Resolved: 25/Apr/16

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.2.0
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Ben Smith Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I am using the mongo hadoop connector which uses the splitVector command (https://github.com/mongodb/mongo-hadoop/blob/master/core/src/main/java/com/mongodb/hadoop/splitter/StandaloneMongoSplitter.java#L94). I would like to force this command to be run against a secondary in my replica set but splitVector isn't a member of the "OBEDIENT_COMMANDS" which it looks like it needs to be in order to return my requestedPreference (secondary). Is there any reason why splitVector can't be added to the OBEDIENT_COMMANDS? Maybe there is another way of working this issue? Let me know if I can provide any more information.



 Comments   
Comment by Ben Smith [ 26/Apr/16 ]

Hi Ross,

I opened this ticket https://jira.mongodb.org/browse/SERVER-23917 to ask for the server team to enable spitVector to be run against a secondary. Will draw attention to SERVER-10117 in SERVER-23917.

Thanks,
Ben

Comment by Ross Lawley [ 26/Apr/16 ]

Hi bensmith,

I think its restricted because its an internal command for sharding. There is a server ticket SERVER-10117 regarding exposing the splitVector functionality and it would be great if you could add your feedback there for the server team.

All the best,

Ross

Comment by Ben Smith [ 25/Apr/16 ]

Hi Ross,

Ok that makes sense. Ross, would you know the reasoning behind why you can't run this command against secondary or can you point me towards someone who might know? Being able to run the mongo hadoop connector against secondary machines would be a nice feature for people using a replication.

Ben

Comment by Ross Lawley [ 25/Apr/16 ]

Hi bensmith,

The "splitVector" command must be run on a primary node , running it on a secondary node will result in a "not master" error.

eg:

MongoDB Enterprise test:SECONDARY> db.runCommand({splitVector: "test.testData", "keyPattern": {_id: 1}, maxChunkSize: 1})
{ "ok" : 0, "errmsg" : "not master", "code" : 10107 }

For this reason the read preference is hardcoded in the Hadoop connector when running this command.

All the best,

Ross

Comment by Ben Smith [ 25/Apr/16 ]

Hi Jeff,

I also noticed that as I was working through this problem. If we can get splitVector added to the OBEDIENT_COMMANDS, I am going to make a PR to the mongo hadoop connector project to remove the hard coding of the primary read preference. Unless there is some reason I am missing why we always need to execute this command against the primary, it seems preferable to make the read preference configurable. I would like the splitter to check the configuration passed in to see if a read preference was set and use that or a default.

Ben

Comment by Jeffrey Yemin [ 25/Apr/16 ]

Hi Ben,

How exactly are you planning to force splitVector to run against a secondary? I see here that the read preference is hard-coded to primary anyway, so OBEDIENT_COMMANDS is effectively a no-op.

Generated at Thu Feb 08 08:56:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.