summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-10-20 17:11:31 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2017-10-20 17:11:31 -0400
commit0bd0f206459cc34e6d118a72f659440e13b611f5 (patch)
treedac3a22918a4baa8843835e087e549df1a42867f
parent02ecda9fcdc70eec55cf3ba80d22404fc681c0b1 (diff)
downloadmongo-0bd0f206459cc34e6d118a72f659440e13b611f5.tar.gz
SERVER-17414 Fix unreferenced local variable in catch exception specifiers
-rw-r--r--src/mongo/client/dbclient.cpp2
-rw-r--r--src/mongo/client/embedded/libmongodbcapi.cpp8
-rw-r--r--src/mongo/db/auth/sasl_plain_server_conversation.cpp2
-rw-r--r--src/mongo/db/catalog/capped_utils.cpp4
-rw-r--r--src/mongo/db/catalog/database_impl.cpp2
-rw-r--r--src/mongo/db/catalog/index_create_impl.cpp7
-rw-r--r--src/mongo/db/commands.cpp2
-rw-r--r--src/mongo/db/commands/dbcommands.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp2
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp2
-rw-r--r--src/mongo/db/repl/bgsync.cpp2
-rw-r--r--src/mongo/db/repl/databases_cloner.cpp2
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp2
-rw-r--r--src/mongo/db/s/shard_metadata_util_test.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp4
-rw-r--r--src/mongo/db/ttl.cpp2
-rw-r--r--src/mongo/s/commands/cluster_aggregate.cpp2
-rw-r--r--src/mongo/s/query/cluster_find.cpp2
-rw-r--r--src/mongo/util/net/cidr.cpp4
-rw-r--r--src/mongo/util/options_parser/options_parser_test.cpp2
23 files changed, 36 insertions, 35 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp
index 2ce3628e7de..e3869b773df 100644
--- a/src/mongo/client/dbclient.cpp
+++ b/src/mongo/client/dbclient.cpp
@@ -1432,7 +1432,7 @@ bool DBClientConnection::call(Message& toSend,
if (response.operation() == dbCompressed) {
response = uassertStatusOK(_compressorManager.decompressMessage(response));
}
- } catch (const DBException& ex) {
+ } catch (const DBException&) {
_failed = true;
_port->shutdown();
throw;
diff --git a/src/mongo/client/embedded/libmongodbcapi.cpp b/src/mongo/client/embedded/libmongodbcapi.cpp
index fd8dae0342d..045777e9e4a 100644
--- a/src/mongo/client/embedded/libmongodbcapi.cpp
+++ b/src/mongo/client/embedded/libmongodbcapi.cpp
@@ -132,7 +132,7 @@ libmongodbcapi_db* db_new(int argc, const char** argv, const char** envp) noexce
global_db->transportLayer = stdx::make_unique<transport::TransportLayerMock>();
return global_db;
-} catch (const std::exception& e) {
+} catch (const std::exception&) {
last_error = LIBMONGODB_CAPI_ERROR_UNKNOWN;
return nullptr;
}
@@ -148,7 +148,7 @@ void db_destroy(libmongodbcapi_db* db) noexcept {
int db_pump(libmongodbcapi_db* db) noexcept try {
return LIBMONGODB_CAPI_ERROR_SUCCESS;
-} catch (const std::exception& e) {
+} catch (const std::exception&) {
return LIBMONGODB_CAPI_ERROR_UNKNOWN;
}
@@ -162,7 +162,7 @@ libmongodbcapi_client* client_new(libmongodbcapi_db* db) noexcept try {
last_error = LIBMONGODB_CAPI_ERROR_SUCCESS;
return rv;
-} catch (const std::exception& e) {
+} catch (const std::exception&) {
last_error = LIBMONGODB_CAPI_ERROR_UNKNOWN;
return nullptr;
}
@@ -196,7 +196,7 @@ int client_wire_protocol_rpc(libmongodbcapi_client* client,
*output = (void*)client->response.response.buf();
return LIBMONGODB_CAPI_ERROR_SUCCESS;
-} catch (const std::exception& e) {
+} catch (const std::exception&) {
return LIBMONGODB_CAPI_ERROR_UNKNOWN;
}
diff --git a/src/mongo/db/auth/sasl_plain_server_conversation.cpp b/src/mongo/db/auth/sasl_plain_server_conversation.cpp
index ecd24a4ac98..416e70ad739 100644
--- a/src/mongo/db/auth/sasl_plain_server_conversation.cpp
+++ b/src/mongo/db/auth/sasl_plain_server_conversation.cpp
@@ -84,7 +84,7 @@ StatusWith<bool> SaslPLAINServerConversation::step(StringData inputData, std::st
str::stream()
<< "Incorrectly formatted PLAIN client message, empty password");
}
- } catch (std::out_of_range& exception) {
+ } catch (std::out_of_range&) {
return Status(ErrorCodes::AuthenticationFailed,
mongoutils::str::stream() << "Incorrectly formatted PLAIN client message");
}
diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp
index f70dd9649fc..cc5c82ac2fc 100644
--- a/src/mongo/db/catalog/capped_utils.cpp
+++ b/src/mongo/db/catalog/capped_utils.cpp
@@ -227,10 +227,10 @@ mongo::Status mongo::cloneCollectionAsCapped(OperationContext* opCtx,
// Go to the next document
retries = 0;
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
CurOp::get(opCtx)->debug().writeConflicts++;
retries++; // logAndBackoff expects this to be 1 on first call.
- wce.logAndBackoff(retries, "cloneCollectionAsCapped", fromNss.ns());
+ WriteConflictException::logAndBackoff(retries, "cloneCollectionAsCapped", fromNss.ns());
// Can't use writeConflictRetry since we need to save/restore exec around call to
// abandonSnapshot.
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index 528169b4298..47ee32c4158 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -311,7 +311,7 @@ void DatabaseImpl::clearTmpCollections(OperationContext* opCtx) {
}
wunit.commit();
- } catch (const WriteConflictException& exp) {
+ } catch (const WriteConflictException&) {
warning() << "could not drop temp collection '" << ns << "' due to "
"WriteConflictException";
opCtx->recoveryUnit()->abandonSnapshot();
diff --git a/src/mongo/db/catalog/index_create_impl.cpp b/src/mongo/db/catalog/index_create_impl.cpp
index 95b7a90f358..638b75765f5 100644
--- a/src/mongo/db/catalog/index_create_impl.cpp
+++ b/src/mongo/db/catalog/index_create_impl.cpp
@@ -156,7 +156,7 @@ MultiIndexBlockImpl::~MultiIndexBlockImpl() {
}
wunit.commit();
return;
- } catch (const WriteConflictException& e) {
+ } catch (const WriteConflictException&) {
continue;
} catch (const DBException& e) {
if (e.toStatus() == ErrorCodes::ExceededMemoryLimit)
@@ -361,10 +361,11 @@ Status MultiIndexBlockImpl::insertAllDocumentsInCollection(std::set<RecordId>* d
progress->hit();
n++;
retries = 0;
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
CurOp::get(_opCtx)->debug().writeConflicts++;
retries++; // logAndBackoff expects this to be 1 on first call.
- wce.logAndBackoff(retries, "index creation", _collection->ns().ns());
+ WriteConflictException::logAndBackoff(
+ retries, "index creation", _collection->ns().ns());
// Can't use writeConflictRetry since we need to save/restore exec around call to
// abandonSnapshot.
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index 6d4d318b638..a32f3060ec2 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -217,7 +217,7 @@ BSONObj Command::runCommandDirectly(OperationContext* opCtx, const OpMsgRequest&
try {
bool ok = command->publicRun(opCtx, request, out);
appendCommandStatus(out, ok);
- } catch (const StaleConfigException& ex) {
+ } catch (const StaleConfigException&) {
// These exceptions are intended to be handled at a higher level and cannot losslessly
// round-trip through Status.
throw;
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 5510cdba35f..15b1841b580 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -687,7 +687,7 @@ public:
try {
// RELOCKED
ctx.reset(new AutoGetCollectionForReadCommand(opCtx, nss));
- } catch (const StaleConfigException& ex) {
+ } catch (const StaleConfigException&) {
LOG(1) << "chunk metadata changed during filemd5, will retarget and continue";
break;
}
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 0634c8d81f1..3a347cb47ef 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -442,7 +442,7 @@ public:
nextBatch->append(obj);
(*numResults)++;
}
- } catch (const CloseChangeStreamException& ex) {
+ } catch (const CloseChangeStreamException&) {
// FAILURE state will make getMore command close the cursor even if it's tailable.
*state = PlanExecutor::FAILURE;
return Status::OK();
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index ec7de29ec27..5b9280a772c 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -104,7 +104,7 @@ bool handleCursorCommand(OperationContext* opCtx,
try {
state = cursor->getExecutor()->getNext(&next, nullptr);
- } catch (const CloseChangeStreamException& ex) {
+ } catch (const CloseChangeStreamException&) {
// This exception is thrown when a $changeStream stage encounters an event
// that invalidates the cursor. We should close the cursor and return without
// error.
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index f2c369ea0bd..3e7147c1ba0 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -482,7 +482,7 @@ void BackgroundSync::_produce() {
}
_oplogFetcher = std::move(oplogFetcherPtr);
oplogFetcher = _oplogFetcher.get();
- } catch (const mongo::DBException& ex) {
+ } catch (const mongo::DBException&) {
fassertFailedWithStatus(34440, exceptionToStatus());
}
diff --git a/src/mongo/db/repl/databases_cloner.cpp b/src/mongo/db/repl/databases_cloner.cpp
index 507f39e5d31..886ccf753c3 100644
--- a/src/mongo/db/repl/databases_cloner.cpp
+++ b/src/mongo/db/repl/databases_cloner.cpp
@@ -248,7 +248,7 @@ StatusWith<std::vector<BSONElement>> DatabasesCloner::_parseListDatabasesRespons
BSONElement response = dbResponse["databases"];
try {
return response.Array();
- } catch (const AssertionException& e) {
+ } catch (const AssertionException&) {
return Status(ErrorCodes::BadValue,
"The 'listDatabases' response is unable to be transformed into an array.");
}
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index f04dcee2753..036cb89cb75 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -645,7 +645,7 @@ void Balancer::_splitOrMarkJumbo(OperationContext* opCtx,
cm->getVersion(),
ChunkRange(chunk->getMin(), chunk->getMax()),
splitPoints));
- } catch (const DBException& ex) {
+ } catch (const DBException&) {
log() << "Marking chunk " << redact(chunk->toString()) << " as jumbo.";
chunk->markAsJumbo();
diff --git a/src/mongo/db/s/shard_metadata_util_test.cpp b/src/mongo/db/s/shard_metadata_util_test.cpp
index 26fc2d57c7f..251d8f06cd9 100644
--- a/src/mongo/db/s/shard_metadata_util_test.cpp
+++ b/src/mongo/db/s/shard_metadata_util_test.cpp
@@ -126,7 +126,7 @@ struct ShardMetadataUtilTest : public ShardServerTestFixture {
try {
DBDirectClient client(operationContext());
ASSERT_EQUALS(client.count(nss.ns()), 0ULL);
- } catch (const DBException& ex) {
+ } catch (const DBException&) {
ASSERT(false);
}
}
@@ -156,7 +156,7 @@ struct ShardMetadataUtilTest : public ShardServerTestFixture {
ASSERT_EQUALS(chunk.getShard(), foundChunk.getShard());
ASSERT_EQUALS(chunk.getVersion(), foundChunk.getVersion());
}
- } catch (const DBException& ex) {
+ } catch (const DBException&) {
ASSERT(false);
}
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index 3c06ffd1241..68e0728dc75 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -791,7 +791,7 @@ public:
try {
if (_cursor)
_cursor->reset();
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
// Ignore since this is only called when we are about to kill our transaction
// anyway.
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 5df5779ee11..1f5c11e1aa0 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -201,7 +201,7 @@ public:
_sessionCache->waitUntilDurable(forceCheckpoint, stableCheckpoint);
}
}
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
// Temporary: remove this after WT-3483
warning() << "Checkpoint encountered a write conflict exception.";
} catch (const AssertionException& exc) {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index d5dfa4b88f6..27bdb4e9c30 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -506,7 +506,7 @@ public:
if (_cursor && !wt_keeptxnopen()) {
try {
_cursor->reset(_cursor);
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
// Ignore since this is only called when we are about to kill our transaction
// anyway.
}
@@ -1020,7 +1020,7 @@ int64_t WiredTigerRecordStore::cappedDeleteAsNeeded_inlock(OperationContext* opC
_cappedFirstRecord = firstRemainingId;
}
}
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
delete opCtx->releaseRecoveryUnit();
opCtx->setRecoveryUnit(realRecoveryUnit, realRUstate);
log() << "got conflict truncating capped, ignoring";
@@ -1095,7 +1095,7 @@ void WiredTigerRecordStore::reclaimOplog(OperationContext* opCtx) {
// Stash the truncate point for next time to cleanly skip over tombstones, etc.
_oplogStones->firstRecord = stone->lastRecord;
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
LOG(1) << "Caught WriteConflictException while truncating oplog entries, retrying";
}
}
@@ -1772,7 +1772,7 @@ void WiredTigerRecordStoreCursorBase::save() {
try {
if (_cursor)
_cursor->reset();
- } catch (const WriteConflictException& wce) {
+ } catch (const WriteConflictException&) {
// Ignore since this is only called when we are about to kill our transaction
// anyway.
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
index dfeb547094e..230d1fc28b6 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
@@ -143,7 +143,7 @@ TEST(WiredTigerRecordStoreTest, Isolation1) {
// this should fail
rs->updateRecord(t2.get(), id1, "c", 2, false, NULL).transitional_ignore();
ASSERT(0);
- } catch (WriteConflictException& dle) {
+ } catch (WriteConflictException&) {
w2.reset(NULL);
t2.reset(NULL);
}
@@ -198,7 +198,7 @@ TEST(WiredTigerRecordStoreTest, Isolation2) {
// this should fail as our version of id1 is too old
rs->updateRecord(t2.get(), id1, "c", 2, false, NULL).transitional_ignore();
ASSERT(0);
- } catch (WriteConflictException& dle) {
+ } catch (WriteConflictException&) {
}
}
}
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index 8f4bb4ae246..0eb5d8ebaeb 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -109,7 +109,7 @@ public:
try {
doTTLPass();
- } catch (const WriteConflictException& e) {
+ } catch (const WriteConflictException&) {
LOG(1) << "got WriteConflictException";
}
}
diff --git a/src/mongo/s/commands/cluster_aggregate.cpp b/src/mongo/s/commands/cluster_aggregate.cpp
index 5f6df076b5f..602e3dac6b8 100644
--- a/src/mongo/s/commands/cluster_aggregate.cpp
+++ b/src/mongo/s/commands/cluster_aggregate.cpp
@@ -631,7 +631,7 @@ BSONObj establishMergingMongosCursor(
ClusterQueryResult next;
try {
next = uassertStatusOK(ccc->next(RouterExecStage::ExecContext::kInitialFind));
- } catch (const CloseChangeStreamException& ex) {
+ } catch (const CloseChangeStreamException&) {
// This exception is thrown when a $changeStream stage encounters an event
// that invalidates the cursor. We should close the cursor and return without
// error.
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index 4d25910ae65..7e503024d13 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -461,7 +461,7 @@ StatusWith<CursorResponse> ClusterFind::runGetMore(OperationContext* opCtx,
Status{ErrorCodes::InternalError, "uninitialized cluster query result"};
try {
next = pinnedCursor.getValue().next(context);
- } catch (const CloseChangeStreamException& ex) {
+ } catch (const CloseChangeStreamException&) {
// This exception is thrown when a $changeStream stage encounters an event
// that invalidates the cursor. We should close the cursor and return without
// error.
diff --git a/src/mongo/util/net/cidr.cpp b/src/mongo/util/net/cidr.cpp
index 11de75bb7de..a23718e9ebd 100644
--- a/src/mongo/util/net/cidr.cpp
+++ b/src/mongo/util/net/cidr.cpp
@@ -124,9 +124,9 @@ CIDR::CIDR(StringData s) try {
(len >= 0) && (len <= _len));
_len = len;
-} catch (const std::invalid_argument& e) {
+} catch (const std::invalid_argument&) {
uasserted(ErrorCodes::UnsupportedFormat, "Non-numeric length in CIDR string");
-} catch (const std::out_of_range& e) {
+} catch (const std::out_of_range&) {
uasserted(ErrorCodes::UnsupportedFormat, "Invalid length in CIDR string");
}
diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp
index c6cdebdd291..bf2548af07b 100644
--- a/src/mongo/util/options_parser/options_parser_test.cpp
+++ b/src/mongo/util/options_parser/options_parser_test.cpp
@@ -2323,7 +2323,7 @@ TEST(LegacyInterface, BadType) {
try {
port = environment["port"].as<std::string>();
FAIL("Expected exception trying to convert int to type string");
- } catch (std::exception& e) {
+ } catch (std::exception&) {
}
}