Skip to content

Commit

Permalink
set Stale shard data on late errors
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Jul 22, 2010
1 parent c09bd3b commit 852eb9b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion db/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace mongo {
{
string errmsg;
if ( ! shardVersionOk( _ns , errmsg ) ){
msgasserted( 13388 , (string)"shard version not ok in Client::Context: " + errmsg );
msgasserted( StaleConfigInContextCode , (string)"shard version not ok in Client::Context: " + errmsg );
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions db/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ namespace mongo {
b.decouple();
QueryResult *qr = msgdata;
qr->_resultFlags() = ResultFlag_ErrSet;
if ( e.getCode() == StaleConfigInContextCode )
qr->_resultFlags() |= ResultFlag_ShardConfigStale;
qr->len = b.len();
qr->setOperation(opReply);
qr->cursorId = 0;
Expand Down
2 changes: 1 addition & 1 deletion db/repl/rs_initialsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace mongo {
if( !expr ) {
string m = str::stream() << "initial sync " << msg;
theReplSet->sethbmsg(m, 0);
uasserted(13388, m);
uasserted(13404, m);
}
}

Expand Down
4 changes: 2 additions & 2 deletions s/commands_public.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace mongo {
return true;
}

if ( temp["code"].numberInt() != 13388 ){
if ( temp["code"].numberInt() != StaleConfigInContextCode ){
errmsg = temp["errmsg"].String();
result.appendElements( temp );
return false;
Expand Down Expand Up @@ -278,7 +278,7 @@ namespace mongo {
continue;
}

if ( 13388 == temp["code"].numberInt() ){
if ( StaleConfigInContextCode == temp["code"].numberInt() ){
// my version is old
total = 0;
shardCounts.clear();
Expand Down
1 change: 1 addition & 0 deletions s/shard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,5 @@ namespace mongo {
}


const int StaleConfigInContextCode = 13388;
}
2 changes: 2 additions & 0 deletions s/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
*/

namespace mongo {

extern const int StaleConfigInContextCode;

struct ShardChunkVersion {
union {
Expand Down

0 comments on commit 852eb9b

Please sign in to comment.