[SERVER-5577] db.cloneDatabase(...) returns poor error with non-master source Created: 11/Apr/12  Updated: 06/Dec/22  Resolved: 14/Jun/18

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Kristina Chodorow (Inactive) Assignee: Backlog - Replication Team
Resolution: Won't Fix Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Replication
Participants:

 Description   

Cloning from a slave always fails with this error:

{ "errmsg" : "query failed test.system.namespaces", "ok" : 0 }

And the source server logs this (since slaveOk is not used on the query):
Wed Apr 11 16:12:31 [conn8579] assertion 13435 not master and slaveok=false ns:test.system.namespaces query:{}



 Comments   
Comment by Spencer Brody (Inactive) [ 14/Jun/18 ]

copydb was deprecated in 4.0

Comment by buck heroux [ 16/Apr/12 ]

Had a similar issue using db.copyDatabase(<from_dbname>,<to_dbname>,<from_host>) where the from_host was a non-authenticated secondary. Switched the from_host to be the primary of that Replica Set and got around the issue.

Output from the failure was

{ "errmsg" : "query failed <from_dbname>.system.namespaces", "ok" : 0 }
Comment by Scott Hernandez (Inactive) [ 11/Apr/12 ]

We should cleanup the error message to be more clear (and state how to do this using copydb), but this can already be done with the copydb command instead, which already has a slaveOk option. http://www.mongodb.org/display/DOCS/Copy+Database+Commands

Maybe want to add a helper javascript option for clonedb to make this more clear, or just deprecate clonedb from the shell and force people to use copyDatabase(...)

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