Skip to content

Commit c77d478

Browse files
author
Brendan W. McAdams
committed
Debug trace to track bamboo failures.
1 parent 9573f64 commit c77d478

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/com/mongodb/ReplicaSetStatus.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ public boolean isMaster(ServerAddress srv) {
131131
*/
132132
ServerAddress getASecondary( DBObject tags ){
133133
for ( String key : tags.keySet() ) {
134+
System.err.println( "Searching for a secondary with tag " + key + " = " + tags.get( key ) );
134135
ServerAddress secondary = getASecondary( key, tags.get( key ).toString() );
136+
System.err.println( "Secondary retrieved: " + secondary );
135137
if (secondary != null)
136138
return secondary;
137139
}
@@ -164,9 +166,12 @@ ServerAddress getASecondary( String tagKey, String tagValue ){
164166
Node n = _all.get( ( start + i ) % _all.size() );
165167

166168
if ( ! n.secondary() ){
169+
System.err.println( " not a secondary: " + n );
167170
mybad++;
168171
continue;
169172
} else if (tagKey != null && !n.checkTag( tagKey, tagValue )){
173+
System.err.println( " Doesn't have tag " + tagKey + " = " + tagValue
174+
+ " ... " + n);
170175
mybad++;
171176
continue;
172177
}

src/test/com/mongodb/JavaClientTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ public void testMapReduceInlineSecondary() throws Exception {
532532
ReplicaSetStatus replStatus = mongo.getReplicaSetStatus();
533533
//if it is a replicaset, and there is no master, or master is not the secondary
534534
if(replStatus!= null && ((replStatus.getMaster() == null) || (replStatus.getMaster() != null && !replStatus.getMaster().equals(replStatus.getASecondary()))))
535-
assertTrue( !mongo.getReplicaSetStatus().isMaster( out.getCommandResult().getServerUsed() ), "Had a replicaset but didn't use secondary! replSetStatus : " + mongo.getReplicaSetStatus());
535+
assertTrue( !mongo.getReplicaSetStatus().isMaster( out.getCommandResult().getServerUsed() ), "Had a replicaset but didn't use secondary! replSetStatus : " + mongo.getReplicaSetStatus() + " \n Used: " +
536+
out.getCommandResult().getServerUsed() + " \n ");
536537
}
537538

538539
@Test

0 commit comments

Comments
 (0)