[SERVER-6473] Calling replSetSyncFrom on a primary should raise a warning or error Created: 16/Jul/12  Updated: 10/Dec/14  Resolved: 19/Aug/14

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

Type: Bug Priority: Minor - P4
Reporter: Bernie Hackett Assignee: Unassigned
Resolution: Done Votes: 0
Labels: neweng, sync
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Operating System: ALL
Participants:

 Description   

This is a pretty minor usability issue. This is the result of running replSetSyncFrom on a primary:

foo:PRIMARY> rs.syncFrom("behackett-dt:27019")
{ "syncFromRequested" : "behackett-dt:27019", "ok" : 1 }
foo:PRIMARY> 
foo:PRIMARY> db.runCommand({replSetSyncFrom: 'behackett-dt:27019'})
{ "syncFromRequested" : "behackett-dt:27019", "ok" : 1 }
foo:PRIMARY> 

There is no log message that I could see (even at log level 5).

This should really raise an exception or at least warn the user that what they are doing doesn't make any sense.



 Comments   
Comment by Spencer Brody (Inactive) [ 19/Aug/14 ]

Seems to work as expected in 2.6.3:

> db.version()
2.6.3
> rs.syncFrom('ubuntu:20003')
{
	"syncFromRequested": "ubuntu:20003",
	"ok": 0,
	"errmsg": "primaries don't sync"
}

Comment by Eric Milkie [ 17/Mar/14 ]

The code in replSetSyncFrom already attempts to do this correctly, so perhaps there is a logic error somewhere?

Comment by Bernie Hackett [ 17/Jul/12 ]

This is also kind of strange:

foo:PRIMARY> rs.syncFrom('behackett-dt:27020')
{
	"syncFromRequested" : "behackett-dt:27020",
	"errmsg" : "I cannot sync from an arbiter",
	"ok" : 0
}

It should really say "primaries don't sync", similar to the arbiter message "arbiters don't sync".

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