Skip to content

Commit 7e2ef26

Browse files
committed
Merge pull request #16 from acmorrow/CXX-77
CXX-77 Backport relevant server repo changes applied between rc0 and rc1
2 parents b9f932b + f8a99ea commit 7e2ef26

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

SConstruct

+5-5
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ add_option( "cxx-use-shell-environment", "use $CXX from shell for C++ compiler"
210210
add_option( "ld", "linker to use" , 1 , True )
211211
add_option( "c++11", "enable c++11 support (experimental)", 0, True )
212212

213-
add_option( "cpppath", "Include path if you have headers in a nonstandard directory" , 1 , True )
214-
add_option( "libpath", "Library path if you have libraries in a nonstandard directory" , 1 , True )
213+
add_option( "cpppath", "Include path if you have headers in a nonstandard directory" , 1 , False )
214+
add_option( "libpath", "Library path if you have libraries in a nonstandard directory" , 1 , False )
215215

216-
add_option( "extrapath", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" , 1 , True )
217-
add_option( "extrapathdyn", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , True )
218-
add_option( "extralib", "comma separated list of libraries (--extralib js_static,readline" , 1 , True )
216+
add_option( "extrapath", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" , 1 , False )
217+
add_option( "extrapathdyn", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , False )
218+
add_option( "extralib", "comma separated list of libraries (--extralib js_static,readline" , 1 , False )
219219

220220
add_option( "no-glibc-check" , "don't check for new versions of glibc" , 0 , False )
221221

src/mongo/base/error_codes.err

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ error_code("NoClientContext", 81)
8484
error_code("NoProgressMade", 82)
8585

8686
# Non-sequential error codes (for compatibility only)
87-
error_code("DuplicateKey", 11000)
8887
error_code("NotMaster", 10107) #this comes from assert_util.h
88+
error_code("DuplicateKey", 11000)
89+
error_code("InterruptedAtShutdown", 11600)
8990
error_code("Interrupted", 11601)
9091
error_code("OutOfDiskSpace", 14031 )
9192

9293
error_class("NetworkError", ["HostUnreachable", "HostNotFound"])
94+
error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", "ExceededTimeLimit"])

src/mongo/base/generate_error_codes.py

+18-13
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ def generate_error_class_predicate_definition(class_name, code_names):
158158
159159
#pragma once
160160
161+
#include <string>
162+
161163
#include "mongo/base/string_data.h"
162164
#include "mongo/client/export_macros.h"
163165
@@ -177,19 +179,19 @@ class MONGO_CLIENT_API ErrorCodes {
177179
MaxError
178180
};
179181
180-
static const char* errorString(Error err);
182+
static std::string errorString(Error err);
181183
182184
/**
183-
* Parse an Error from its "name". Returns UnknownError if "name" is unrecognized.
185+
* Parses an Error from its "name". Returns UnknownError if "name" is unrecognized.
184186
*
185187
* NOTE: Also returns UnknownError for the string "UnknownError".
186188
*/
187189
static Error fromString(const StringData& name);
188190
189191
/**
190-
* Parse an Error from its "code". Returns UnknownError if "code" is unrecognized.
191-
*
192-
* NOTE: Also returns UnknownError for the integer code for UnknownError.
192+
* Casts an integer "code" to an Error. Unrecognized codes are preserved, meaning
193+
* that the result of a call to fromInt() may not be one of the values in the
194+
* Error enumeration.
193195
*/
194196
static Error fromInt(int code);
195197
@@ -218,13 +220,16 @@ class MONGO_CLIENT_API ErrorCodes {
218220
219221
#include "mongo/base/error_codes.h"
220222
221-
#include <cstring>
223+
#include <boost/static_assert.hpp>
224+
225+
#include "mongo/util/mongoutils/str.h"
222226
223227
namespace mongo {
224-
const char* ErrorCodes::errorString(Error err) {
228+
229+
std::string ErrorCodes::errorString(Error err) {
225230
switch (err) {
226231
%(symbol_to_string_cases)s;
227-
default: return "Unknown error code";
232+
default: return mongoutils::str::stream() << "Location" << err;
228233
}
229234
}
230235
@@ -234,14 +239,14 @@ class MONGO_CLIENT_API ErrorCodes {
234239
}
235240
236241
ErrorCodes::Error ErrorCodes::fromInt(int code) {
237-
switch (code) {
238-
%(int_to_symbol_cases)s;
239-
default:
240-
return UnknownError;
241-
}
242+
return static_cast<Error>(code);
242243
}
243244
244245
%(error_code_class_predicate_definitions)s
246+
247+
namespace {
248+
BOOST_STATIC_ASSERT(sizeof(ErrorCodes::Error) == sizeof(int));
249+
} // namespace
245250
} // namespace mongo
246251
'''
247252

src/mongo/base/status-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace mongo {
4545
return _error ? _error->code : ErrorCodes::OK;
4646
}
4747

48-
inline const char* Status::codeString() const {
48+
inline std::string Status::codeString() const {
4949
return ErrorCodes::errorString(code());
5050
}
5151

src/mongo/base/status.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace mongo {
8989

9090
inline ErrorCodes::Error code() const;
9191

92-
inline const char* codeString() const;
92+
inline std::string codeString() const;
9393

9494
inline std::string reason() const;
9595

src/mongo/util/assert_util.h

-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ namespace mongo {
3131
enum CommonErrorCodes {
3232
OkCode = 0,
3333
DatabaseDifferCaseCode = 13297 , // uassert( 13297 )
34-
InterruptedAtShutdown = 11600 , // uassert( 11600 )
3534
SendStaleConfigCode = 13388 , // uassert( 13388 )
3635
RecvStaleConfigCode = 9996, // uassert( 9996 )
3736
PrepareConfigsFailedCode = 13104, // uassert( 13104 )
@@ -144,12 +143,6 @@ namespace mongo {
144143

145144
virtual bool severe() const { return true; }
146145
virtual bool isUserAssertion() const { return false; }
147-
148-
/* true if an interrupted exception - see KillCurrentOp */
149-
bool interrupted() {
150-
return _ei.code == InterruptedAtShutdown || _ei.code == 11601 ||
151-
_ei.code == ErrorCodes::ExceededTimeLimit;
152-
}
153146
};
154147

155148
/* UserExceptions are valid errors that a user can cause, like out of disk space or duplicate key */

src/mongo/util/version.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace mongo {
3131
* 1.2.3-rc4-pre-
3232
* If you really need to do something else you'll need to fix _versionArray()
3333
*/
34-
const char versionString[] = "2.6.0-rc0";
34+
const char versionString[] = "2.6.0-rc1";
3535

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

0 commit comments

Comments
 (0)