0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-47438 remove unused function RollbackSource::copyCollectionFromRemote()

Last reference was removed in commit 65e6cd5142.
This commit is contained in:
Benety Goh 2020-04-15 13:10:17 -04:00 committed by Evergreen Agent
parent 2bad13a633
commit d7f09737cb
9 changed files with 0 additions and 92 deletions

View File

@ -373,7 +373,6 @@ mongod = env.Program(
'db/catalog/health_log',
'db/catalog/index_key_validate',
'db/client_metadata_propagation_egress_hook',
'db/cloner',
'db/collection_index_usage_tracker',
'db/commands/mongod',
'db/commands/mongod_fcv',

View File

@ -422,7 +422,6 @@ env.Library(
'$BUILD_DIR/mongo/db/catalog/catalog_helpers',
'$BUILD_DIR/mongo/db/catalog/collection_catalog_helper',
'$BUILD_DIR/mongo/db/catalog/index_key_validate',
'$BUILD_DIR/mongo/db/cloner',
'$BUILD_DIR/mongo/db/commands',
'$BUILD_DIR/mongo/db/curop_failpoint_helpers',
'$BUILD_DIR/mongo/db/dbhelpers',

View File

@ -97,7 +97,6 @@ env.Library(
'repl_coordinator_interface',
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/background',
'$BUILD_DIR/mongo/db/cloner',
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/db_raii',
'$BUILD_DIR/mongo/db/dbhelpers',

View File

@ -89,12 +89,6 @@ public:
UUID uuid,
const BSONObj& filter) const = 0;
/**
* Clones a single collection from the sync source.
*/
virtual void copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const = 0;
/**
* Finds and returns collection info using the UUID.
*/

View File

@ -31,8 +31,6 @@
#include "mongo/db/repl/rollback_source_impl.h"
#include "mongo/client/dbclient_connection.h"
#include "mongo/db/cloner.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/read_concern_args.h"
@ -86,23 +84,6 @@ std::pair<BSONObj, NamespaceString> RollbackSourceImpl::findOneByUUID(const std:
return _getConnection()->findOneByUUID(db, uuid, filter, ReadConcernArgs::kImplicitDefault);
}
void RollbackSourceImpl::copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const {
std::string errmsg;
auto tmpConn = std::make_unique<DBClientConnection>();
uassert(15908, errmsg, tmpConn->connect(_source, StringData(), errmsg));
uassertStatusOK(replAuthenticate(tmpConn.get()));
// cloner owns _conn in unique_ptr
Cloner cloner;
cloner.setConnection(std::move(tmpConn));
uassert(15909,
str::stream() << "replSet rollback error resyncing collection " << nss.ns() << ' '
<< errmsg,
cloner.copyCollection(
opCtx, nss.ns(), BSONObj(), errmsg, true, CollectionOptions::parseForStorage));
}
StatusWith<BSONObj> RollbackSourceImpl::getCollectionInfoByUUID(const std::string& db,
const UUID& uuid) const {
std::list<BSONObj> info = _getConnection()->getCollectionInfos(db, BSON("info.uuid" << uuid));

View File

@ -72,9 +72,6 @@ public:
UUID uuid,
const BSONObj& filter) const override;
void copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const override;
StatusWith<BSONObj> getCollectionInfoByUUID(const std::string& db,
const UUID& uuid) const override;

View File

@ -289,9 +289,6 @@ std::pair<BSONObj, NamespaceString> RollbackSourceMock::findOneByUUID(const std:
return {BSONObj(), NamespaceString()};
}
void RollbackSourceMock::copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const {}
StatusWith<BSONObj> RollbackSourceMock::getCollectionInfo(const NamespaceString& nss) const {
return BSON("name" << nss.ns() << "options" << BSONObj());
}

View File

@ -275,8 +275,6 @@ public:
UUID uuid,
const BSONObj& filter) const override;
void copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const override;
StatusWith<BSONObj> getCollectionInfoByUUID(const std::string& db,
const UUID& uuid) const override;
StatusWith<BSONObj> getCollectionInfo(const NamespaceString& nss) const override;

View File

@ -1239,62 +1239,6 @@ TEST_F(RSRollbackTest, RollbackUnknownCommand) {
ASSERT_STRING_CONTAINS(status.reason(), "unable to determine common point");
}
TEST_F(RSRollbackTest, RollbackDropCollectionCommand) {
createOplog(_opCtx.get());
OpTime dropTime = OpTime(Timestamp(2, 0), 5);
auto dpns = NamespaceString("test.t").makeDropPendingNamespace(dropTime);
CollectionOptions options;
options.uuid = UUID::gen();
auto coll = _createCollection(_opCtx.get(), dpns, options);
_dropPendingCollectionReaper->addDropPendingNamespace(_opCtx.get(), dropTime, dpns);
auto commonOperation = makeOpAndRecordId(1);
auto dropCollectionOperation =
std::make_pair(BSON("ts" << dropTime.getTimestamp() << "t" << dropTime.getTerm() << "op"
<< "c"
<< "ui" << coll->uuid() << "ns"
<< "test.t"
<< "wall" << Date_t() << "o"
<< BSON("drop"
<< "t")),
RecordId(2));
class RollbackSourceLocal : public RollbackSourceMock {
public:
RollbackSourceLocal(std::unique_ptr<OplogInterface> oplog)
: RollbackSourceMock(std::move(oplog)), called(false) {}
void copyCollectionFromRemote(OperationContext* opCtx,
const NamespaceString& nss) const override {
called = true;
}
mutable bool called;
};
RollbackSourceLocal rollbackSource(std::unique_ptr<OplogInterface>(new OplogInterfaceMock({
commonOperation,
})));
{
AutoGetCollectionForReadCommand autoCollDropPending(_opCtx.get(), dpns);
ASSERT_TRUE(autoCollDropPending.getCollection());
AutoGetCollectionForReadCommand autoColl(_opCtx.get(), NamespaceString("test.t"));
ASSERT_FALSE(autoColl.getCollection());
}
ASSERT_OK(syncRollback(_opCtx.get(),
OplogInterfaceMock({dropCollectionOperation, commonOperation}),
rollbackSource,
{},
{},
_coordinator,
_replicationProcess.get()));
ASSERT_FALSE(rollbackSource.called);
{
AutoGetCollectionForReadCommand autoCollDropPending(_opCtx.get(), dpns);
ASSERT_FALSE(autoCollDropPending.getCollection());
AutoGetCollectionForReadCommand autoColl(_opCtx.get(), NamespaceString("test.t"));
ASSERT_TRUE(autoColl.getCollection());
}
}
TEST_F(RSRollbackTest, RollbackRenameCollectionInSameDatabaseCommand) {
createOplog(_opCtx.get());
CollectionOptions options;