@@ -38,7 +38,7 @@ def get_rs_status(self):
3838 raise Exception , "Could not get output from command: 'replSetGetStatus' after %i retries!" % self .retries , None
3939 return status
4040 except Exception , e :
41- logging .fatal ("Failed to execute command! Error: %s" % e )
41+ logging .fatal ("Failed to execute 'replSetGetStatus' command! Error: %s" % e )
4242 raise e
4343
4444 def find_desirable_secondary (self ):
@@ -49,7 +49,7 @@ def find_desirable_secondary(self):
4949 primary = None
5050 for member in rs_status ['members' ]:
5151 if 'health' in member and member ['health' ] > 0 :
52- logging .info ("Found %s: %s/%s with optime %s" % (
52+ logging .debug ("Found %s: %s/%s with optime %s" % (
5353 member ['stateStr' ],
5454 rs_name ,
5555 member ['name' ],
@@ -75,16 +75,19 @@ def find_desirable_secondary(self):
7575 raise Exception , "Unable to locate a PRIMARY member for replset %s, giving up" % rs_name , None
7676
7777 if secondary is None or (secondary ['count' ] + 1 ) < quorum_count :
78- logging .fatal ("Not enough secondaries in replset %s to safely take backup!" % rs_name )
78+ logging .fatal ("Not enough secondaries in replset %s to take backup! Num replset members: %i, required quorum: %i" % (
79+ rs_name ,
80+ secondary ['count' ] + 1 ,
81+ quorum_count
82+ ))
7983 raise Exception , "Not enough secondaries in replset %s to safely take backup!" % rs_name , None
8084
8185 rep_lag = (mktime (primary ['optime' ].timetuple ()) - mktime (secondary ['optime' ].timetuple ()))
8286 if rep_lag > self .max_lag_secs :
8387 logging .fatal ("No secondary found in replset %s within %s lag time!" % (rs_name , self .max_lag_secs ))
8488 raise Exception , "No secondary found in replset %s within %s lag time!" % (rs_name , self .max_lag_secs ), None
8589
86- logging .info ("Choosing SECONDARY %s for replica set %s" % (secondary ['host' ], rs_name ))
87-
90+ logging .debug ("Choosing SECONDARY %s for replica set %s" % (secondary ['host' ], rs_name ))
8891 return secondary
8992
9093
0 commit comments