diff options
author | Alberto Lerner <alerner@10gen.com> | 2010-11-07 16:31:53 -0500 |
---|---|---|
committer | Alberto Lerner <alerner@10gen.com> | 2010-11-08 10:58:03 -0500 |
commit | 6f827308eb8f2dd59a0fc278bc968835f950a657 (patch) | |
tree | 2dc0166a3df9b7c0516c6818f6ce244e1bde461b | |
parent | ea90c5d3540e6d5cf8759e48eedaad48a425a191 (diff) | |
download | mongo-6f827308eb8f2dd59a0fc278bc968835f950a657.tar.gz |
SERVER-2068 check on the TO side of a chunk migration before applying deletions
-rw-r--r-- | s/d_migrate.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/s/d_migrate.cpp b/s/d_migrate.cpp index 7ae8c745707..3078358c637 100644 --- a/s/d_migrate.cpp +++ b/s/d_migrate.cpp @@ -269,7 +269,7 @@ namespace mongo { } void xfer( list<BSONObj> * l , BSONObjBuilder& b , const char * name , long long& size , bool explode ){ - static long long maxSize = 1024 * 1024; + const long long maxSize = 1024 * 1024; if ( l->size() == 0 || size > maxSize ) return; @@ -843,6 +843,17 @@ namespace mongo { BSONObjIterator i( xfer["deleted"].Obj() ); while ( i.more() ){ BSONObj id = i.next().Obj(); + + // do not apply deletes if they do not belong to the chunk being migrated + BSONObj fullObj; + if ( cmdLine.moveParanoia && Helpers::findById( cc() , ns.c_str() , id, fullObj ) ) { + if ( ! isInRange( fullObj , min , max ) ) { + log() << "not applying out of range deletion: " << fullObj << endl; + + continue; + } + } + Helpers::removeRange( ns , id , id, false , true , cmdLine.moveParanoia ? &rs : 0 ); didAnything = true; } |