Skip to content

Commit

Permalink
CXX-197 Backport server r2.6.0..r2.6.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
acmorrow committed May 5, 2014
1 parent 1361abd commit f50196e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/mongo/base/error_codes.err
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ error_code("RoleDataInconsistent", 80)
error_code("NoClientContext", 81)
error_code("NoProgressMade", 82)
error_code("RemoteResultsUnavailable", 83)
error_code("IndexOptionsConflict", 85 )
error_code("IndexKeySpecsConflict", 86 )

# Non-sequential error codes (for compatibility only)
error_code("NotMaster", 10107) #this comes from assert_util.h
error_code("DuplicateKey", 11000)
error_code("InterruptedAtShutdown", 11600)
error_code("Interrupted", 11601)
error_code("OutOfDiskSpace", 14031 )
error_code("BackgroundOperationInProgressForDatabase", 12586);
error_code("BackgroundOperationInProgressForNamespace", 12587);

error_class("NetworkError", ["HostUnreachable", "HostNotFound"])
error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", "ExceededTimeLimit"])
error_class("IndexCreationError", ["CannotCreateIndex", "IndexOptionsConflict",
"IndexKeySpecsConflict", "IndexAlreadyExists"])
14 changes: 14 additions & 0 deletions src/mongo/logger/rotatable_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "mongo/logger/rotatable_file_writer.h"

#include <boost/filesystem/operations.hpp>
#include <boost/scoped_array.hpp>
#include <cstdio>
#include <fstream>
Expand Down Expand Up @@ -211,6 +212,19 @@ namespace {
Status RotatableFileWriter::Use::rotate(const std::string& renameTarget) {
if (_writer->_stream) {
_writer->_stream->flush();
try {
if (boost::filesystem::exists(renameTarget)) {
return Status(ErrorCodes::FileRenameFailed, mongoutils::str::stream() <<
"Renaming file " << _writer->_fileName << " to " <<
renameTarget << " failed; destination already exists");
}
} catch (const std::exception& e) {
return Status(ErrorCodes::FileRenameFailed, mongoutils::str::stream() <<
"Renaming file " << _writer->_fileName << " to " <<
renameTarget << " failed; Cannot verify whether destination "
"already exists: " << e.what());
}

if (0 != renameFile(_writer->_fileName, renameTarget)) {
return Status(ErrorCodes::FileRenameFailed, mongoutils::str::stream() <<
"Failed to rename \"" << _writer->_fileName << "\" to \"" <<
Expand Down
1 change: 0 additions & 1 deletion src/mongo/util/assert_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace mongo {
NotMasterOrSecondaryCode = 13436, // uassert( 13436 )
NotMasterNoSlaveOkCode = 13435, // uassert( 13435 )
NotMaster = 10107, // uassert( 10107 )
IndexOptionsDiffer = 17427 // uassert( 17427 )
};

class MONGO_CLIENT_API AssertionCount {
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/util/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ namespace mongo {
RotatableFileManager* manager = logger::globalRotatableFileManager();
RotatableFileManager::FileNameStatusPairVector result(
manager->rotateAll("." + terseCurrentTime(false)));
for (RotatableFileManager::FileNameStatusPairVector::iterator it = result.begin();
it != result.end(); it++) {
warning() << "Rotating log file " << it->first << " failed: " << it->second.toString()
<< endl;
}
return result.empty();
}

Expand Down
2 changes: 1 addition & 1 deletion src/mongo/util/net/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace mongo {
/**
* Maximum accepted message size on the wire protocol.
*/
const int MaxMessageSizeBytes = 48 * 1000 * 1000;
const size_t MaxMessageSizeBytes = 48 * 1000 * 1000;

class Message;
class MessagingPort;
Expand Down
3 changes: 2 additions & 1 deletion src/mongo/util/net/message_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ namespace mongo {
sslGlobalParams.sslMode.load() != SSLGlobalParams::SSLMode_requireSSL);
#endif // MONGO_SSL
}
else if ( len < static_cast<int>(sizeof(MSGHEADER)) || len > MaxMessageSizeBytes ) {
if ( static_cast<size_t>(len) < sizeof(MSGHEADER) ||
static_cast<size_t>(len) > MaxMessageSizeBytes ) {
LOG(0) << "recv(): message len " << len << " is invalid. "
<< "Min " << sizeof(MSGHEADER) << " Max: " << MaxMessageSizeBytes << endl;
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/mongo/util/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace mongo {
* 1.2.3-rc4-pre-
* If you really need to do something else you'll need to fix _versionArray()
*/
const char versionString[] = "2.6.0";
const char versionString[] = "2.6.1";

// See unit test for example outputs
BSONArray toVersionArray(const char* version){
Expand Down

0 comments on commit f50196e

Please sign in to comment.