mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
Merge branch 'master' of github.com:mongodb/mongo
This commit is contained in:
commit
35d8abd1c4
19
db/repl.cpp
19
db/repl.cpp
@ -53,7 +53,8 @@ namespace mongo {
|
|||||||
void ensureHaveIdIndex(const char *ns);
|
void ensureHaveIdIndex(const char *ns);
|
||||||
|
|
||||||
/* if 1 sync() is running */
|
/* if 1 sync() is running */
|
||||||
int syncing = 0;
|
volatile int syncing = 0;
|
||||||
|
static volatile int relinquishSyncingSome = 0;
|
||||||
|
|
||||||
/* if true replace our peer in a replication pair -- don't worry about if his
|
/* if true replace our peer in a replication pair -- don't worry about if his
|
||||||
local.oplog.$main is empty.
|
local.oplog.$main is empty.
|
||||||
@ -157,11 +158,12 @@ namespace mongo {
|
|||||||
}
|
}
|
||||||
Timer t;
|
Timer t;
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
if ( syncing == 0 || t.millis() > 20000 )
|
if ( syncing == 0 || t.millis() > 30000 )
|
||||||
break;
|
break;
|
||||||
{
|
{
|
||||||
dbtemprelease t;
|
dbtemprelease t;
|
||||||
sleepmillis(10);
|
relinquishSyncingSome = 1;
|
||||||
|
sleepmillis(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( syncing ) {
|
if ( syncing ) {
|
||||||
@ -246,11 +248,12 @@ namespace mongo {
|
|||||||
// reloaded with new saved state on next pass.
|
// reloaded with new saved state on next pass.
|
||||||
Timer t;
|
Timer t;
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
if ( syncing == 0 || t.millis() > 20000 )
|
if ( syncing == 0 || t.millis() > 30000 )
|
||||||
break;
|
break;
|
||||||
{
|
{
|
||||||
dbtemprelease t;
|
dbtemprelease t;
|
||||||
sleepmillis(10);
|
relinquishSyncingSome = 1;
|
||||||
|
sleepmillis(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( syncing ) {
|
if ( syncing ) {
|
||||||
@ -1713,6 +1716,12 @@ namespace mongo {
|
|||||||
assert( syncing == 1 );
|
assert( syncing == 1 );
|
||||||
syncing--;
|
syncing--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( relinquishSyncingSome ) {
|
||||||
|
relinquishSyncingSome = 0;
|
||||||
|
s = 1; // sleep before going back in to syncing=1
|
||||||
|
}
|
||||||
|
|
||||||
if ( s ) {
|
if ( s ) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "repl: sleep " << s << "sec before next pass";
|
ss << "repl: sleep " << s << "sec before next pass";
|
||||||
|
@ -89,3 +89,5 @@ doTest = function( signal ) {
|
|||||||
|
|
||||||
doTest( 15 ); // SIGTERM
|
doTest( 15 ); // SIGTERM
|
||||||
doTest( 9 ); // SIGKILL
|
doTest( 9 ); // SIGKILL
|
||||||
|
|
||||||
|
print("replace2Peer finishes");
|
||||||
|
Loading…
Reference in New Issue
Block a user