The following issues were found
src/mongo/db/repl/rollback_checker_test.cpp
1 issues
Line: 77
return _rollbackChecker.get();
}
TEST_F(RollbackCheckerTest, InvalidConstruction) {
HostAndPort syncSource;
// Null executor.
ASSERT_THROWS_CODE(
RollbackChecker(nullptr, syncSource), AssertionException, ErrorCodes::BadValue);
Reported by Cppcheck.
src/mongo/db/repl/rollback_impl_test.cpp
1 issues
Line: 486
ASSERT_EQUALS(ErrorCodes::CollectionIsEmpty, iter->next().getStatus());
}
TEST_F(RollbackImplTest, TestFixtureSetUpInitializesStorageEngine) {
auto serviceContext = getServiceContext();
ASSERT_TRUE(serviceContext);
ASSERT_TRUE(serviceContext->getStorageEngine());
}
Reported by Cppcheck.
src/mongo/db/repl/rollback_source_impl.cpp
1 issues
Line: 69
CWE codes:
758
}
BSONObj RollbackSourceImpl::getLastOperation() const {
const Query query = Query().sort(BSON("$natural" << -1));
return _getConnection()->findOne(_collectionName,
query,
nullptr,
QueryOption_SecondaryOk,
ReadConcernArgs::kImplicitDefault);
Reported by Cppcheck.
src/mongo/db/repl/rs_rollback_test.cpp
1 issues
Line: 2901
// Remove from the middle.
fui.removeAllDocsToRefetchFor(uuid2);
ASSERT((fui.docsToRefetch ==
DocSet{
DocID::minFor(uuid1),
DocID{{}, normalKey, uuid1},
DocID::maxFor(uuid1),
Reported by Cppcheck.
src/mongo/db/repl/scatter_gather_test.cpp
1 issues
Line: 156
// Confirm that deleting both the ScatterGatherTestAlgorithm and ScatterGatherRunner while
// scheduled callbacks still exist will not be unsafe (ASAN builder) after the algorithm has
// completed.
TEST_F(ScatterGatherTest, DeleteAlgorithmAfterItHasCompleted) {
auto sga = std::make_shared<ScatterGatherTestAlgorithm>();
ScatterGatherRunner* sgr = new ScatterGatherRunner(sga, &getExecutor(), "test");
bool ranCompletion = false;
StatusWith<executor::TaskExecutor::EventHandle> status = sgr->start();
ASSERT_OK(getExecutor()
Reported by Cppcheck.
src/mongo/db/repl/speculative_majority_read_info_test.cpp
1 issues
Line: 45
ASSERT_FALSE(readInfo.isSpeculativeRead());
}
DEATH_TEST(SpeculativeMajorityReadInfo,
NonSpeculativeReadCannotRetrieveOpTime,
"Invariant failure") {
SpeculativeMajorityReadInfo readInfo;
ASSERT_FALSE(readInfo.isSpeculativeRead());
readInfo.getSpeculativeReadTimestamp();
Reported by Cppcheck.
src/mongo/db/repl/split_horizon_test.cpp
1 issues
Line: 80
return forwardMapping;
}
TEST(SplitHorizonTesting, determineHorizon) {
struct Input {
SplitHorizon::ForwardMapping forwardMapping; // Will get "__default" added to it.
SplitHorizon::Parameters horizonParameters;
Input(const MappingType& mapping, boost::optional<std::string> sniName)
Reported by Cppcheck.
src/mongo/db/repl/storage_interface_impl_test.cpp
1 issues
Line: 229
ReplicationCoordinatorMock* _replicationCoordinatorMock = nullptr;
};
TEST_F(StorageInterfaceImplTest, ServiceContextDecorator) {
auto serviceContext = getServiceContext();
ASSERT_FALSE(StorageInterface::get(serviceContext));
StorageInterface* storage = new StorageInterfaceImpl();
StorageInterface::set(serviceContext, std::unique_ptr<StorageInterface>(storage));
ASSERT_TRUE(storage == StorageInterface::get(serviceContext));
Reported by Cppcheck.
src/mongo/db/repl/sync_source_resolver_test.cpp
1 issues
Line: 166
return bob.obj();
}
TEST_F(SyncSourceResolverTest, InvalidConstruction) {
SyncSourceSelectorMock selector;
const OpTime lastOpTimeFetched(Timestamp(Seconds(100), 1U), 1LL);
const OpTime requiredOpTime;
auto onCompletion = [](const SyncSourceResolverResponse&) {};
Reported by Cppcheck.
src/mongo/db/repl/task_runner_test.cpp
1 issues
Line: 49
using Task = TaskRunner::Task;
TEST_F(TaskRunnerTest, InvalidConstruction) {
// Null thread pool.
ASSERT_THROWS_CODE_AND_WHAT(
TaskRunner(nullptr), AssertionException, ErrorCodes::BadValue, "null thread pool");
}
Reported by Cppcheck.