File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
jstests/libs/override_methods Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,31 @@ ReplSetTest = function ReplSetTestWithContinuousPrimaryStepdown() {
4141
4242 print ( '*** Continuous stepdown thread running with seed node ' + seedNode ) ;
4343
44+ // The config primary may unexpectedly step down during startup if under heavy load and
45+ // too slowly processing heartbeats. When it steps down, it closes all of its connections.
46+ // This can happen during the call to new ReplSetTest, so in order to account for this and
47+ // make the tests stable, retry discovery of the replica set's configuration once
48+ // (SERVER-22794).
49+ var replSet ;
50+ var networkErrorRetries = 1 ;
51+ while ( networkErrorRetries >= 0 ) {
52+ try {
53+ replSet = new ReplSetTest ( seedNode ) ;
54+ break ;
55+ } catch ( e ) {
56+ if ( ( ( networkErrorRetries -- ) > 0 ) &&
57+ ( e . toString ( ) . indexOf ( "network error" ) > - 1 ) ) {
58+ print ( "Error: " + e . toString ( ) + "\nStacktrace: " + e . stack ) ;
59+ print ( "Stepdown thread's config server connection was closed, retrying." ) ;
60+ } else {
61+ print ( '*** Continuous stepdown thread failed to connect to the ' +
62+ 'config server: ' + tojson ( e ) ) ;
63+ return { ok : 0 , error : e . toString ( ) , stack : e . stack } ;
64+ }
65+ }
66+ }
67+
4468 try {
45- var replSet = new ReplSetTest ( seedNode ) ;
4669 var primary = replSet . getPrimary ( ) ;
4770
4871 while ( stopCounter . getCount ( ) > 0 ) {
You can’t perform that action at this time.
0 commit comments