//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
IDebugEvent::Message PlatformEvent::error_description() const {
Q_ASSERT(is_error());
const edb::address_t fault_address = reinterpret_cast<edb::address_t>(fault_address_);
switch(code()) {
case SIGSEGV:
return Message(
tr("Illegal Access Fault"),
tr(
"<p>The debugged application encountered a segmentation fault.<br />The address <strong>0x%1</strong> could not be accessed.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>").arg(edb::v1::format_pointer(fault_address))
);
case SIGILL:
return Message(
tr("Illegal Instruction Fault"),
tr(
"<p>The debugged application attempted to execute an illegal instruction.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
case SIGFPE:
switch(fault_code_) {
case FPE_INTDIV:
return Message(
tr("Divide By Zero"),
tr(
"<p>The debugged application tried to divide an integer value by an integer divisor of zero.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
default:
return Message(
tr("Floating Point Exception"),
tr(
"<p>The debugged application encountered a floating-point exception.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
}
case SIGABRT:
return Message(
tr("Application Aborted"),
tr(
"<p>The debugged application has aborted.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
case SIGBUS:
return Message(
tr("Bus Error"),
tr(
"<p>The debugged application tried to read or write data that is misaligned.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
#ifdef SIGSTKFLT
case SIGSTKFLT:
return Message(
tr("Stack Fault"),
tr(
"<p>The debugged application encountered a stack fault.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
#endif
case SIGPIPE:
return Message(
tr("Broken Pipe Fault"),
tr(
"<p>The debugged application encountered a broken pipe fault.</p>"
"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
);
default:
return Message();
}
}
//.........这里部分代码省略.........
}
const repl::ReplSettings& replSettings =
repl::ReplicationCoordinator::get(opCtx)->getSettings();
// On replica set members we only clear temp collections on DBs other than "local" during
// promotion to primary. On pure slaves, they are only cleared when the oplog tells them
// to. The local DB is special because it is not replicated. See SERVER-10927 for more
// details.
const bool shouldClearNonLocalTmpCollections =
!(hasReplSetConfigDoc(opCtx) || replSettings.usingReplSets());
// To check whether a featureCompatibilityVersion document exists.
bool fcvDocumentExists = false;
// To check whether we have databases other than local.
bool nonLocalDatabases = false;
// Refresh list of database names to include newly-created admin, if it exists.
dbNames = storageEngine->listDatabases();
for (const auto& dbName : dbNames) {
if (dbName != "local") {
nonLocalDatabases = true;
}
LOG(1) << " Recovering database: " << dbName;
auto db = databaseHolder->openDb(opCtx, dbName);
invariant(db);
// First thing after opening the database is to check for file compatibility,
// otherwise we might crash if this is a deprecated format.
auto status = storageEngine->currentFilesCompatible(opCtx);
if (!status.isOK()) {
if (status.code() == ErrorCodes::CanRepairToDowngrade) {
// Convert CanRepairToDowngrade statuses to MustUpgrade statuses to avoid logging a
// potentially confusing and inaccurate message.
//
// TODO SERVER-24097: Log a message informing the user that they can start the
// current version of mongod with --repair and then proceed with normal startup.
status = {ErrorCodes::MustUpgrade, status.reason()};
}
severe() << "Unable to start mongod due to an incompatibility with the data files and"
" this version of mongod: "
<< redact(status);
severe() << "Please consult our documentation when trying to downgrade to a previous"
" major release";
quickExit(EXIT_NEED_UPGRADE);
MONGO_UNREACHABLE;
}
// If the server configuration collection already contains a valid
// featureCompatibilityVersion document, cache it in-memory as a server parameter.
if (dbName == "admin") {
if (Collection* versionColl =
db->getCollection(opCtx, NamespaceString::kServerConfigurationNamespace)) {
BSONObj featureCompatibilityVersion;
if (Helpers::findOne(
opCtx,
versionColl,
BSON("_id" << FeatureCompatibilityVersionParser::kParameterName),
featureCompatibilityVersion)) {
auto swVersion =
FeatureCompatibilityVersionParser::parse(featureCompatibilityVersion);
// Note this error path captures all cases of an FCV document existing,
// but with any value other than "4.0" or "4.2". This includes unexpected
//! Assign bit value at given square
//! @param sq square to assign value at
//! @param val boolean value to assign
void set(Square sq, bool val) {
if (val)
data_ |= data_type(1) << code(sq);
else
data_ &= ~(data_type(1) << code(sq));
}
开发者ID:blooto,项目名称:blooto,代码行数:9,代码来源:bitboard.hpp
示例7: assert
// Inform CodeBuffer that incoming code and relocation will be code
// Should not be called if start_a_stub() returned NULL
void AbstractAssembler::end_a_stub() {
assert(_code_section == code()->stubs(), "not in stubs?");
sync();
set_code_section(code()->insts());
}
StatusWith<ShardType> ShardingCatalogManagerImpl::_validateHostAsShard(
OperationContext* txn,
std::shared_ptr<RemoteCommandTargeter> targeter,
const std::string* shardProposedName,
const ConnectionString& connectionString) {
// Check whether any host in the connection is already part of the cluster.
Grid::get(txn)->shardRegistry()->reload(txn);
for (const auto& hostAndPort : connectionString.getServers()) {
std::shared_ptr<Shard> shard;
shard = Grid::get(txn)->shardRegistry()->getShardNoReload(hostAndPort.toString());
if (shard) {
return {ErrorCodes::OperationFailed,
str::stream() << "'" << hostAndPort.toString() << "' "
<< "is already a member of the existing shard '"
<< shard->getConnString().toString()
<< "' ("
<< shard->getId()
<< ")."};
}
}
// Check for mongos and older version mongod connections, and whether the hosts
// can be found for the user specified replset.
auto swCommandResponse =
_runCommandForAddShard(txn, targeter.get(), "admin", BSON("isMaster" << 1));
if (!swCommandResponse.isOK()) {
if (swCommandResponse.getStatus() == ErrorCodes::RPCProtocolNegotiationFailed) {
// Mongos to mongos commands are no longer supported in the wire protocol
// (because mongos does not support OP_COMMAND), similarly for a new mongos
// and an old mongod. So the call will fail in such cases.
// TODO: If/When mongos ever supports opCommands, this logic will break because
// cmdStatus will be OK.
return {ErrorCodes::RPCProtocolNegotiationFailed,
str::stream() << targeter->connectionString().toString()
<< " does not recognize the RPC protocol being used. This is"
<< " likely because it contains a node that is a mongos or an old"
<< " version of mongod."};
} else {
return swCommandResponse.getStatus();
}
}
// Check for a command response error
auto resIsMasterStatus = std::move(swCommandResponse.getValue().commandStatus);
if (!resIsMasterStatus.isOK()) {
return {resIsMasterStatus.code(),
str::stream() << "Error running isMaster against "
<< targeter->connectionString().toString()
<< ": "
<< causedBy(resIsMasterStatus)};
}
auto resIsMaster = std::move(swCommandResponse.getValue().response);
// Check whether there is a master. If there isn't, the replica set may not have been
// initiated. If the connection is a standalone, it will return true for isMaster.
bool isMaster;
Status status = bsonExtractBooleanField(resIsMaster, "ismaster", &isMaster);
if (!status.isOK()) {
return Status(status.code(),
str::stream() << "isMaster returned invalid 'ismaster' "
<< "field when attempting to add "
<< connectionString.toString()
<< " as a shard: "
<< status.reason());
}
if (!isMaster) {
return {ErrorCodes::NotMaster,
str::stream()
<< connectionString.toString()
<< " does not have a master. If this is a replica set, ensure that it has a"
<< " healthy primary and that the set has been properly initiated."};
}
const string providedSetName = connectionString.getSetName();
const string foundSetName = resIsMaster["setName"].str();
// Make sure the specified replica set name (if any) matches the actual shard's replica set
if (providedSetName.empty() && !foundSetName.empty()) {
return {ErrorCodes::OperationFailed,
str::stream() << "host is part of set " << foundSetName << "; "
<< "use replica set url format "
<< "<setname>/<server1>,<server2>, ..."};
}
if (!providedSetName.empty() && foundSetName.empty()) {
return {ErrorCodes::OperationFailed,
str::stream() << "host did not return a set name; "
<< "is the replica set still initializing? "
<< resIsMaster};
}
// Make sure the set name specified in the connection string matches the one where its hosts
// belong into
if (!providedSetName.empty() && (providedSetName != foundSetName)) {
return {ErrorCodes::OperationFailed,
str::stream() << "the provided connection string (" << connectionString.toString()
<< ") does not match the actual set name "
<< foundSetName};
}
//.........这里部分代码省略.........
请发表评论