diff options
author | Dan Pasette <dan@10gen.com> | 2013-12-21 09:30:26 -0500 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2014-01-06 10:29:47 -0500 |
commit | 307fb42c66350981525d64ca8f6a2dbfe6a3d8f4 (patch) | |
tree | 5040beefafe7d046fec9bafac4a87f89bc7abf2e /src/mongo | |
parent | 9c9bbd9eeb0978023c599e714d33e004fa94b5c8 (diff) | |
download | mongo-307fb42c66350981525d64ca8f6a2dbfe6a3d8f4.tar.gz |
SERVER-12146 do not check writebacks if calling gle from wbl
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/s/client_info.cpp | 68 | ||||
-rw-r--r-- | src/mongo/s/writeback_listener.cpp | 3 |
2 files changed, 38 insertions, 33 deletions
diff --git a/src/mongo/s/client_info.cpp b/src/mongo/s/client_info.cpp index 0cbcfe22156..8297a536385 100644 --- a/src/mongo/s/client_info.cpp +++ b/src/mongo/s/client_info.cpp @@ -227,41 +227,39 @@ namespace mongo { } clearSinceLastGetError(); - LOG(4) << "checking " << writebacks.size() << " writebacks for" - << " gle (" << theShard << ")" << endl; - - if ( writebacks.size() ){ - vector<BSONObj> v = _handleWriteBacks( writebacks , fromWriteBackListener ); - if ( v.size() == 0 && fromWriteBackListener ) { - // ok + // We never need to handle writebacks if we're coming from the wbl itself + if ( writebacks.size() && !fromWriteBackListener ){ + + LOG(4) << "checking " << writebacks.size() << " writebacks for" + << " gle (" << theShard << ")" << endl; + + vector<BSONObj> v = _handleWriteBacks( writebacks , false ); + + // this will usually be 1 + // it can be greater than 1 if a write to a different shard + // than the last write op had a writeback + // all we're going to report is the first + // since that's the current write + // but we block for all + verify( v.size() >= 1 ); + + if ( res["writebackSince"].numberInt() > 0 ) { + // got writeback from older op + // ignore the result from it, just needed to wait + result.appendElements( res ); + } + else if ( writebacks[0].fromLastOperation ) { + result.appendElements( v[0] ); + result.appendElementsUnique( res ); + result.append( "writebackGLE" , v[0] ); + result.append( "initialGLEHost" , theShard ); + result.append( "initialGLE", res ); } else { - // this will usually be 1 - // it can be greater than 1 if a write to a different shard - // than the last write op had a writeback - // all we're going to report is the first - // since that's the current write - // but we block for all - verify( v.size() >= 1 ); - - if ( res["writebackSince"].numberInt() > 0 ) { - // got writeback from older op - // ignore the result from it, just needed to wait - result.appendElements( res ); - } - else if ( writebacks[0].fromLastOperation ) { - result.appendElements( v[0] ); - result.appendElementsUnique( res ); - result.append( "writebackGLE" , v[0] ); - result.append( "initialGLEHost" , theShard ); - result.append( "initialGLE", res ); - } - else { - // there was a writeback - // but its from an old operations - // so all that's important is that we block, not that we return stats - result.appendElements( res ); - } + // there was a writeback + // but its from an old operations + // so all that's important is that we block, not that we return stats + result.appendElements( res ); } } else { @@ -365,6 +363,10 @@ namespace mongo { LOG(4) << "checking " << writebacks.size() << " writebacks for" << " gle (" << shards->size() << " shards)" << endl; + // Multi-shard results from the writeback listener implicitly means that: + // A) no versioning was used (multi-update/delete) + // B) internal GLE was used (bulk insert) + if ( errors.size() == 0 ) { result.appendNull( "err" ); _handleWriteBacks( writebacks , fromWriteBackListener ); diff --git a/src/mongo/s/writeback_listener.cpp b/src/mongo/s/writeback_listener.cpp index c7d770ff9bb..21ef607573a 100644 --- a/src/mongo/s/writeback_listener.cpp +++ b/src/mongo/s/writeback_listener.cpp @@ -344,6 +344,9 @@ namespace mongo { gle = b.obj(); } + dassert( !gle.isEmpty() ); + verify( !gle.isEmpty() ); + if ( gle["code"].numberInt() == 9517 ) { log() << "new version change detected, " |