summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2017-07-17 18:51:05 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2017-07-19 10:52:38 -0400
commit57c63852d129681f84c2c35b4078f44e2426f53f (patch)
treeac69bf225b95f1766361614518b93f88d528497a /src/mongo/db
parent9d8bc8dc6c8d1dc92bbf466f27783464ed4f5704 (diff)
downloadmongo-57c63852d129681f84c2c35b4078f44e2426f53f.tar.gz
SERVER-28918 Move rsOplogName to NamespaceString
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/commands/oplog_note.cpp3
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp5
-rw-r--r--src/mongo/db/db.cpp2
-rw-r--r--src/mongo/db/namespace_string.cpp1
-rw-r--r--src/mongo/db/namespace_string.h3
-rw-r--r--src/mongo/db/op_observer_impl_test.cpp2
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/bgsync.cpp28
-rw-r--r--src/mongo/db/repl/noop_writer.cpp14
-rw-r--r--src/mongo/db/repl/oplog.cpp11
-rw-r--r--src/mongo/db/repl/oplog.h1
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp11
-rw-r--r--src/mongo/db/repl/replication_info.cpp2
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp11
-rw-r--r--src/mongo/db/repl/rs_rollback_no_uuid.cpp11
-rw-r--r--src/mongo/db/repl/sync_tail.cpp8
-rw-r--r--src/mongo/db/repl/sync_tail_test.cpp2
-rw-r--r--src/mongo/db/transaction_history_iterator.cpp4
-rw-r--r--src/mongo/db/transaction_history_iterator_test.cpp6
21 files changed, 74 insertions, 56 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 2588c37deb2..57c7cbf9af7 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -1426,9 +1426,9 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/db/dbdirectclient',
'$BUILD_DIR/mongo/db/logical_session_id',
+ '$BUILD_DIR/mongo/db/namespace_string',
'$BUILD_DIR/mongo/db/ops/write_ops',
'$BUILD_DIR/mongo/db/repl/oplog_entry',
- '$BUILD_DIR/mongo/db/repl/oplog',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index 6802f4843c1..b9b25078852 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/curop.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/oplog.h"
@@ -69,7 +70,7 @@ Status _performNoopWrite(OperationContext* opCtx, BSONObj msgObj, StringData not
return {ErrorCodes::NotMaster, "Not a primary"};
}
- writeConflictRetry(opCtx, note, repl::rsOplogName, [&opCtx, &msgObj] {
+ writeConflictRetry(opCtx, note, NamespaceString::kRsOplogNamespace.ns(), [&opCtx, &msgObj] {
WriteUnitOfWork uow(opCtx);
opCtx->getClient()->getServiceContext()->getOpObserver()->onOpMessage(opCtx, msgObj);
uow.commit();
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 1bee5cb5f07..30e948bf246 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/pipeline_proxy.h"
#include "mongo/db/exec/working_set_common.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/pipeline/accumulator.h"
#include "mongo/db/pipeline/document.h"
#include "mongo/db/pipeline/document_source.h"
@@ -295,7 +296,7 @@ Status runAggregate(OperationContext* opCtx,
{
const LiteParsedPipeline liteParsedPipeline(request);
if (liteParsedPipeline.startsWithChangeNotification()) {
- nss = NamespaceString(repl::rsOplogName);
+ nss = NamespaceString::kRsOplogNamespace;
}
const auto& pipelineInvolvedNamespaces = liteParsedPipeline.getInvolvedNamespaces();
@@ -325,7 +326,7 @@ Status runAggregate(OperationContext* opCtx,
// collection. (The lock must be released because recursively acquiring locks on the
// database will prohibit yielding.)
if (ctx && ctx->getView() && !liteParsedPipeline.startsWithCollStats()) {
- invariant(nss != repl::rsOplogName);
+ invariant(nss != NamespaceString::kRsOplogNamespace);
invariant(!nss.isCollectionlessAggregateNS());
// Check that the default collation of 'view' is compatible with the operation's
// collation. The check is skipped if the 'request' has the empty collation, which
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index b6710f91c58..ad2d9422734 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -292,7 +292,7 @@ unsigned long long checkIfReplMissingFromCommandLine(OperationContext* opCtx) {
* Caller must lock DB before calling this function.
*/
void checkForCappedOplog(OperationContext* opCtx, Database* db) {
- const NamespaceString oplogNss(repl::rsOplogName);
+ const NamespaceString oplogNss(NamespaceString::kRsOplogNamespace);
invariant(opCtx->lockState()->isDbLockedForMode(oplogNss.db(), MODE_IS));
Collection* oplogCollection = db->getCollection(opCtx, oplogNss);
if (oplogCollection && !oplogCollection->isCapped()) {
diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp
index eaf1fab39ff..44fbc2fe003 100644
--- a/src/mongo/db/namespace_string.cpp
+++ b/src/mongo/db/namespace_string.cpp
@@ -88,6 +88,7 @@ constexpr StringData NamespaceString::kShardConfigCollectionsCollectionName;
const NamespaceString NamespaceString::kServerConfigurationNamespace(kServerConfiguration);
const NamespaceString NamespaceString::kSessionTransactionsTableNamespace(
NamespaceString::kConfigDb, "transactions");
+const NamespaceString NamespaceString::kRsOplogNamespace(NamespaceString::kLocalDb, "oplog.rs");
bool NamespaceString::isListCollectionsCursorNS() const {
return coll() == listCollectionsCursorCol;
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h
index 5572eaab886..676b540487c 100644
--- a/src/mongo/db/namespace_string.h
+++ b/src/mongo/db/namespace_string.h
@@ -77,6 +77,9 @@ public:
// Namespace for storing the transaction information for each session
static const NamespaceString kSessionTransactionsTableNamespace;
+ // Namespace of the the oplog collection.
+ static const NamespaceString kRsOplogNamespace;
+
/**
* Constructs an empty NamespaceString.
*/
diff --git a/src/mongo/db/op_observer_impl_test.cpp b/src/mongo/db/op_observer_impl_test.cpp
index c29bf92dd8d..0c4b752f575 100644
--- a/src/mongo/db/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer_impl_test.cpp
@@ -65,7 +65,7 @@ private:
protected:
// Assert that oplog only has a single entry and return that oplog entry.
BSONObj getSingleOplogEntry(OperationContext* opCtx) {
- repl::OplogInterfaceLocal oplogInterface(opCtx, repl::rsOplogName);
+ repl::OplogInterfaceLocal oplogInterface(opCtx, NamespaceString::kRsOplogNamespace.ns());
auto oplogIter = oplogInterface.makeIterator();
auto opEntry = unittest::assertGet(oplogIter->next());
ASSERT_EQUALS(ErrorCodes::CollectionIsEmpty, oplogIter->next().getStatus());
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 6d60220c874..3acdd25db3f 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -27,6 +27,7 @@ env.Library(
'$BUILD_DIR/mongo/util/fail_point',
'$BUILD_DIR/mongo/db/ops/write_ops',
'$BUILD_DIR/mongo/db/catalog/catalog_helpers',
+ '$BUILD_DIR/mongo/db/namespace_string',
],
)
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index e0b2e7a9be7..71266c2ce53 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -451,7 +451,7 @@ void BackgroundSync::_produce(OperationContext* opCtx) {
_replicationCoordinatorExternalState->getTaskExecutor(),
OpTimeWithHash(lastHashFetched, lastOpTimeFetched),
source,
- NamespaceString(rsOplogName),
+ NamespaceString::kRsOplogNamespace,
_replCoord->getConfig(),
_replicationCoordinatorExternalState->getOplogFetcherMaxFetcherRestarts(),
syncSourceResp.rbid,
@@ -644,7 +644,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx,
}
}
- OplogInterfaceLocal localOplog(opCtx, rsOplogName);
+ OplogInterfaceLocal localOplog(opCtx, NamespaceString::kRsOplogNamespace.ns());
// TODO: We will have to check what storage engine is being used eventually, since
// "rollback to a checkpoint" only works on certain storage engines that have this
@@ -707,7 +707,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx,
executor,
&localOplog,
source,
- NamespaceString(rsOplogName),
+ NamespaceString::kRsOplogNamespace,
_replicationCoordinatorExternalState->getOplogFetcherMaxFetcherRestarts(),
requiredRBID,
_replCoord,
@@ -758,7 +758,8 @@ void BackgroundSync::_fallBackOnRollbackViaRefetch(OperationContext* opCtx,
return connection->get();
};
- RollbackSourceImpl rollbackSource(getConnection, source, rsOplogName);
+ RollbackSourceImpl rollbackSource(
+ getConnection, source, NamespaceString::kRsOplogNamespace.ns());
if (useUUID) {
rollback(opCtx, *localOplog, rollbackSource, requiredRBID, _replCoord, _replicationProcess);
@@ -837,10 +838,12 @@ void BackgroundSync::clearBuffer(OperationContext* opCtx) {
OpTimeWithHash BackgroundSync::_readLastAppliedOpTimeWithHash(OperationContext* opCtx) {
BSONObj oplogEntry;
try {
- bool success = writeConflictRetry(opCtx, "readLastAppliedHash", rsOplogName, [&] {
- Lock::DBLock lk(opCtx, "local", MODE_X);
- return Helpers::getLast(opCtx, rsOplogName.c_str(), oplogEntry);
- });
+ bool success = writeConflictRetry(
+ opCtx, "readLastAppliedHash", NamespaceString::kRsOplogNamespace.ns(), [&] {
+ Lock::DBLock lk(opCtx, "local", MODE_X);
+ return Helpers::getLast(
+ opCtx, NamespaceString::kRsOplogNamespace.ns().c_str(), oplogEntry);
+ });
if (!success) {
// This can happen when we are to do an initial sync. lastHash will be set
@@ -848,15 +851,16 @@ OpTimeWithHash BackgroundSync::_readLastAppliedOpTimeWithHash(OperationContext*
return OpTimeWithHash(0);
}
} catch (const DBException& ex) {
- severe() << "Problem reading " << rsOplogName << ": " << redact(ex);
+ severe() << "Problem reading " << NamespaceString::kRsOplogNamespace.ns() << ": "
+ << redact(ex);
fassertFailed(18904);
}
long long hash;
auto status = bsonExtractIntegerField(oplogEntry, kHashFieldName, &hash);
if (!status.isOK()) {
- severe() << "Most recent entry in " << rsOplogName << " is missing or has invalid \""
- << kHashFieldName << "\" field. Oplog entry: " << redact(oplogEntry) << ": "
- << redact(status);
+ severe() << "Most recent entry in " << NamespaceString::kRsOplogNamespace.ns()
+ << " is missing or has invalid \"" << kHashFieldName
+ << "\" field. Oplog entry: " << redact(oplogEntry) << ": " << redact(status);
fassertFailed(18902);
}
OplogEntry parsedEntry(oplogEntry);
diff --git a/src/mongo/db/repl/noop_writer.cpp b/src/mongo/db/repl/noop_writer.cpp
index 76603129a83..508e3bb7eee 100644
--- a/src/mongo/db/repl/noop_writer.cpp
+++ b/src/mongo/db/repl/noop_writer.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/curop.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/repl/noop_writer.h"
#include "mongo/db/repl/oplog.h"
@@ -167,12 +168,13 @@ void NoopWriter::_writeNoop(OperationContext* opCtx) {
LOG(logLevel)
<< "Writing noop to oplog as there has been no writes to this replica set in over "
<< _writeInterval;
- writeConflictRetry(opCtx, "writeNoop", rsOplogName, [&opCtx] {
- WriteUnitOfWork uow(opCtx);
- opCtx->getClient()->getServiceContext()->getOpObserver()->onOpMessage(opCtx,
- kMsgObj);
- uow.commit();
- });
+ writeConflictRetry(
+ opCtx, "writeNoop", NamespaceString::kRsOplogNamespace.ns(), [&opCtx] {
+ WriteUnitOfWork uow(opCtx);
+ opCtx->getClient()->getServiceContext()->getOpObserver()->onOpMessage(opCtx,
+ kMsgObj);
+ uow.commit();
+ });
}
}
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index cb9d950a608..b32e1a2af0c 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -109,7 +109,6 @@ using std::vector;
using IndexVersion = IndexDescriptor::IndexVersion;
namespace repl {
-std::string rsOplogName = "local.oplog.rs";
std::string masterSlaveOplogName = "local.oplog.$main";
MONGO_FP_DECLARE(disableSnapshotting);
@@ -228,7 +227,7 @@ private:
void setOplogCollectionName() {
if (getGlobalReplicationCoordinator()->getReplicationMode() ==
ReplicationCoordinator::modeReplSet) {
- _oplogCollectionName = rsOplogName;
+ _oplogCollectionName = NamespaceString::kRsOplogNamespace.ns();
} else {
_oplogCollectionName = masterSlaveOplogName;
}
@@ -296,14 +295,15 @@ OplogDocWriter _logOpWriter(OperationContext* opCtx,
// Truncates the oplog after and including the "truncateTimestamp" entry.
void truncateOplogTo(OperationContext* opCtx, Timestamp truncateTimestamp) {
- const NamespaceString oplogNss(rsOplogName);
+ const NamespaceString oplogNss(NamespaceString::kRsOplogNamespace);
AutoGetDb autoDb(opCtx, oplogNss.db(), MODE_IX);
Lock::CollectionLock oplogCollectionLoc(opCtx->lockState(), oplogNss.ns(), MODE_X);
Collection* oplogCollection = autoDb.getDb()->getCollection(opCtx, oplogNss);
if (!oplogCollection) {
fassertFailedWithStatusNoTrace(
34418,
- Status(ErrorCodes::NamespaceNotFound, str::stream() << "Can't find " << rsOplogName));
+ Status(ErrorCodes::NamespaceNotFound,
+ str::stream() << "Can't find " << NamespaceString::kRsOplogNamespace.ns()));
}
// Scan through oplog in reverse, from latest entry to first, to find the truncateTimestamp.
@@ -1401,7 +1401,8 @@ void SnapshotThread::run() {
auto opTimeOfSnapshot = OpTime();
{
- AutoGetCollectionForReadCommand oplog(opCtx.get(), NamespaceString(rsOplogName));
+ AutoGetCollectionForReadCommand oplog(opCtx.get(),
+ NamespaceString::kRsOplogNamespace);
invariant(oplog.getCollection());
// Read the latest op from the oplog.
auto cursor = oplog.getCollection()->getCursor(opCtx.get(), /*forward*/ false);
diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h
index ae388a5e429..1e4f6a443b9 100644
--- a/src/mongo/db/repl/oplog.h
+++ b/src/mongo/db/repl/oplog.h
@@ -67,7 +67,6 @@ void createOplog(OperationContext* opCtx, const std::string& oplogCollectionName
*/
void createOplog(OperationContext* opCtx);
-extern std::string rsOplogName;
extern std::string masterSlaveOplogName;
extern int OPLOG_VERSION;
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index 3d966b8d1b1..617f35cff2c 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -680,7 +680,7 @@ bool replHasDatabases(OperationContext* opCtx) {
// we have a local database. return true if oplog isn't empty
BSONObj o;
- if (Helpers::getSingleton(opCtx, repl::rsOplogName.c_str(), o)) {
+ if (Helpers::getSingleton(opCtx, NamespaceString::kRsOplogNamespace.ns().c_str(), o)) {
return true;
}
}
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 57f19fe9751..e9bb0a9872a 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -616,7 +616,7 @@ void ReplicationCoordinatorExternalStateImpl::cleanUpLastApplyBatch(OperationCon
<< topOfOplog << " (inclusive).";
DBDirectClient db(opCtx);
- auto cursor = db.query(rsOplogName,
+ auto cursor = db.query(NamespaceString::kRsOplogNamespace.ns(),
QUERY("ts" << BSON("$gte" << appliedThrough.getTimestamp())),
/*batchSize*/ 0,
/*skip*/ 0,
@@ -661,15 +661,16 @@ StatusWith<OpTime> ReplicationCoordinatorExternalStateImpl::loadLastOpTime(
}
BSONObj oplogEntry;
- if (!Helpers::getLast(opCtx, rsOplogName.c_str(), oplogEntry)) {
+ if (!Helpers::getLast(opCtx, NamespaceString::kRsOplogNamespace.ns().c_str(), oplogEntry)) {
return StatusWith<OpTime>(ErrorCodes::NoMatchingDocument,
str::stream() << "Did not find any entries in "
- << rsOplogName);
+ << NamespaceString::kRsOplogNamespace.ns());
}
BSONElement tsElement = oplogEntry[tsFieldName];
if (tsElement.eoo()) {
return StatusWith<OpTime>(ErrorCodes::NoSuchKey,
- str::stream() << "Most recent entry in " << rsOplogName
+ str::stream() << "Most recent entry in "
+ << NamespaceString::kRsOplogNamespace.ns()
<< " missing \""
<< tsFieldName
<< "\" field");
@@ -678,7 +679,7 @@ StatusWith<OpTime> ReplicationCoordinatorExternalStateImpl::loadLastOpTime(
return StatusWith<OpTime>(ErrorCodes::TypeMismatch,
str::stream() << "Expected type of \"" << tsFieldName
<< "\" in most recent "
- << rsOplogName
+ << NamespaceString::kRsOplogNamespace.ns()
<< " entry to have type Timestamp, but found "
<< typeName(tsElement.type()));
}
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index 9717c56d921..3af818ebd15 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -200,7 +200,7 @@ public:
const std::string& oplogNS =
replCoord->getReplicationMode() == ReplicationCoordinator::modeReplSet
- ? rsOplogName
+ ? NamespaceString::kRsOplogNamespace.ns()
: masterSlaveOplogName;
BSONObj o;
uassert(17347,
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 4cc17cbcbf6..0090322e0ef 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -877,15 +877,16 @@ void syncFixUp(OperationContext* opCtx,
// Cleans up the oplog.
{
- const NamespaceString oplogNss(rsOplogName);
+ const NamespaceString oplogNss(NamespaceString::kRsOplogNamespace);
Lock::DBLock oplogDbLock(opCtx, oplogNss.db(), MODE_IX);
Lock::CollectionLock oplogCollectionLoc(opCtx->lockState(), oplogNss.ns(), MODE_X);
- OldClientContext ctx(opCtx, rsOplogName);
+ OldClientContext ctx(opCtx, oplogNss.ns());
Collection* oplogCollection = ctx.db()->getCollection(opCtx, oplogNss);
if (!oplogCollection) {
- fassertFailedWithStatusNoTrace(40495,
- Status(ErrorCodes::UnrecoverableRollbackError,
- str::stream() << "Can't find " << rsOplogName));
+ fassertFailedWithStatusNoTrace(
+ 40495,
+ Status(ErrorCodes::UnrecoverableRollbackError,
+ str::stream() << "Can't find " << NamespaceString::kRsOplogNamespace.ns()));
}
// TODO: fatal error if this throws?
oplogCollection->cappedTruncateAfter(opCtx, fixUpInfo.commonPointOurDiskloc, false);
diff --git a/src/mongo/db/repl/rs_rollback_no_uuid.cpp b/src/mongo/db/repl/rs_rollback_no_uuid.cpp
index 00fb4659bc7..fdf1b124d9d 100644
--- a/src/mongo/db/repl/rs_rollback_no_uuid.cpp
+++ b/src/mongo/db/repl/rs_rollback_no_uuid.cpp
@@ -843,15 +843,16 @@ void syncFixUp(OperationContext* opCtx,
// Cleans up the oplog.
{
- const NamespaceString oplogNss(rsOplogName);
+ const NamespaceString oplogNss(NamespaceString::kRsOplogNamespace);
Lock::DBLock oplogDbLock(opCtx, oplogNss.db(), MODE_IX);
Lock::CollectionLock oplogCollectionLoc(opCtx->lockState(), oplogNss.ns(), MODE_X);
- OldClientContext ctx(opCtx, rsOplogName);
+ OldClientContext ctx(opCtx, oplogNss.ns());
Collection* oplogCollection = ctx.db()->getCollection(opCtx, oplogNss);
if (!oplogCollection) {
- fassertFailedWithStatusNoTrace(13423,
- Status(ErrorCodes::UnrecoverableRollbackError,
- str::stream() << "Can't find " << rsOplogName));
+ fassertFailedWithStatusNoTrace(
+ 13423,
+ Status(ErrorCodes::UnrecoverableRollbackError,
+ str::stream() << "Can't find " << NamespaceString::kRsOplogNamespace.ns()));
}
// TODO: fatal error if this throws?
oplogCollection->cappedTruncateAfter(opCtx, fixUpInfo.commonPointOurDiskloc, false);
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 7ef2b4e9207..9275230ccc6 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -476,7 +476,7 @@ void scheduleWritesToOplog(OperationContext* opCtx,
fassertStatusOK(40141,
StorageInterface::get(opCtx)->insertDocuments(
- opCtx, NamespaceString(rsOplogName), docs));
+ opCtx, NamespaceString::kRsOplogNamespace, docs));
};
};
@@ -684,9 +684,9 @@ private:
OperationContext& opCtx = *opCtxPtr;
const auto replCoord = ReplicationCoordinator::get(&opCtx);
const auto fastClockSource = opCtx.getServiceContext()->getFastClockSource();
- const auto oplogMaxSize = fassertStatusOK(
- 40301,
- StorageInterface::get(&opCtx)->getOplogMaxSize(&opCtx, NamespaceString(rsOplogName)));
+ const auto oplogMaxSize = fassertStatusOK(40301,
+ StorageInterface::get(&opCtx)->getOplogMaxSize(
+ &opCtx, NamespaceString::kRsOplogNamespace));
// Batches are limited to 10% of the oplog.
BatchLimits batchLimits;
diff --git a/src/mongo/db/repl/sync_tail_test.cpp b/src/mongo/db/repl/sync_tail_test.cpp
index 1017c2570a7..f993ff9668f 100644
--- a/src/mongo/db/repl/sync_tail_test.cpp
+++ b/src/mongo/db/repl/sync_tail_test.cpp
@@ -485,7 +485,7 @@ TEST_F(SyncTailTest, MultiApplyAssignsOperationsToWriterThreadsBasedOnNamespaceH
// Check ops in oplog.
stdx::lock_guard<stdx::mutex> lock(mutex);
ASSERT_EQUALS(2U, operationsWrittenToOplog.size());
- ASSERT_EQUALS(NamespaceString(rsOplogName), nssForInsert);
+ ASSERT_EQUALS(NamespaceString::kRsOplogNamespace, nssForInsert);
ASSERT_BSONOBJ_EQ(op1.raw, operationsWrittenToOplog[0].doc);
ASSERT_BSONOBJ_EQ(op2.raw, operationsWrittenToOplog[1].doc);
}
diff --git a/src/mongo/db/transaction_history_iterator.cpp b/src/mongo/db/transaction_history_iterator.cpp
index 00acb8ef199..024204e338f 100644
--- a/src/mongo/db/transaction_history_iterator.cpp
+++ b/src/mongo/db/transaction_history_iterator.cpp
@@ -29,8 +29,8 @@
#include "mongo/platform/basic.h"
#include "mongo/db/dbdirectclient.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/transaction_history_iterator.h"
#include "mongo/logger/redaction.h"
@@ -51,7 +51,7 @@ repl::OplogEntry TransactionHistoryIterator::next(OperationContext* opCtx) {
DBDirectClient client(opCtx);
// TODO: SERVER-29843 oplogReplay option might be needed to activate fast ts search.
auto oplogBSON =
- client.findOne(repl::rsOplogName,
+ client.findOne(NamespaceString::kRsOplogNamespace.ns(),
BSON(repl::OplogEntryBase::kTimestampFieldName << _nextOpTimeTs),
/* fieldsToReturn */ nullptr,
0 /* QueryOption_OplogReplay */);
diff --git a/src/mongo/db/transaction_history_iterator_test.cpp b/src/mongo/db/transaction_history_iterator_test.cpp
index 767d1f03b56..a31b5eb8fa6 100644
--- a/src/mongo/db/transaction_history_iterator_test.cpp
+++ b/src/mongo/db/transaction_history_iterator_test.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_entry.h"
@@ -68,7 +69,8 @@ public:
// Note: internal code does not allow implicit creation of non-capped oplog collection.
DBDirectClient client(opCtx());
- ASSERT_TRUE(client.createCollection(repl::rsOplogName, 1024 * 1024, true));
+ ASSERT_TRUE(
+ client.createCollection(NamespaceString::kRsOplogNamespace.ns(), 1024 * 1024, true));
}
void tearDown() override {
@@ -84,7 +86,7 @@ public:
* fixDocumentForInsert.
*/
void insertOplogEntry(const repl::OplogEntry newOplog) {
- AutoGetCollection autoColl(opCtx(), NamespaceString(repl::rsOplogName), MODE_IX);
+ AutoGetCollection autoColl(opCtx(), NamespaceString::kRsOplogNamespace, MODE_IX);
auto coll = autoColl.getCollection();
ASSERT_TRUE(coll != nullptr);