summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-01-09 17:32:12 -0500
committerBilly Donahue <billy.donahue@mongodb.com>2019-01-11 10:50:23 -0500
commitbbf28648de0d8695c502e13922a8d9e5ca1b51e8 (patch)
tree6382810d03fb698d9b2d49f488be90e604324811 /src/mongo/db/commands
parent17514947cc816df2500aa0e919506586d4d56aa0 (diff)
downloadmongo-bbf28648de0d8695c502e13922a8d9e5ca1b51e8.tar.gz
SERVER-30711: scope_guard rewrite, to avoid -Werror=noexcept-type
Macro ON_BLOCK_EXIT(...) now takes a single callable, Some renames: Dismias -> dismiss MakeGuard => makeGuard
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/create_indexes.cpp4
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp4
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp14
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp6
4 files changed, 13 insertions, 15 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index c1bed1a0dd2..f6169d8f858 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -390,7 +390,7 @@ bool runCreateIndexes(OperationContext* opCtx,
dbLock.relockWithMode(MODE_IX);
}
- auto relockOnErrorGuard = MakeGuard([&] {
+ auto relockOnErrorGuard = makeGuard([&] {
// Must have exclusive DB lock before we clean up the index build via the
// destructor of 'indexer'.
if (indexer.getBuildInBackground()) {
@@ -443,7 +443,7 @@ bool runCreateIndexes(OperationContext* opCtx,
MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangAfterIndexBuildSecondDrain);
}
- relockOnErrorGuard.Dismiss();
+ relockOnErrorGuard.dismiss();
// Need to return db lock back to exclusive, to complete the index build.
if (indexer.getBuildInBackground()) {
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index ea669c4a209..8f3eee6d760 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -401,7 +401,7 @@ public:
}
// On early return, get rid of the cursor.
- ScopeGuard cursorFreer = MakeGuard(&ClientCursorPin::deleteUnderlying, &ccPin);
+ auto cursorFreer = makeGuard([&] { ccPin.deleteUnderlying(); });
// We must respect the read concern from the cursor.
applyCursorReadConcern(opCtx, cursor->getReadConcernArgs());
@@ -528,7 +528,7 @@ public:
curOp->debug().nreturned = numResults;
if (respondWithId) {
- cursorFreer.Dismiss();
+ cursorFreer.dismiss();
}
// We're about to unpin or delete the cursor as the ClientCursorPin goes out of scope.
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 501b16d154e..55678fb52ea 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -622,13 +622,11 @@ Status runAggregate(OperationContext* opCtx,
std::vector<ClientCursorPin> pins;
std::vector<ClientCursor*> cursors;
- ScopeGuard cursorFreer = MakeGuard(
- [](std::vector<ClientCursorPin>* pins) {
- for (auto& p : *pins) {
- p.deleteUnderlying();
- }
- },
- &pins);
+ auto cursorFreer = makeGuard([&] {
+ for (auto& p : pins) {
+ p.deleteUnderlying();
+ }
+ });
for (size_t idx = 0; idx < execs.size(); ++idx) {
ClientCursorParams cursorParams(
@@ -660,7 +658,7 @@ Status runAggregate(OperationContext* opCtx,
const bool keepCursor =
handleCursorCommand(opCtx, origNss, std::move(cursors), request, result);
if (keepCursor) {
- cursorFreer.Dismiss();
+ cursorFreer.dismiss();
}
}
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index df1d33ba54f..f1cd1574494 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -1981,7 +1981,7 @@ public:
uassertStatusOK(status);
// From here on, we always want to invalidate the user cache before returning.
- auto invalidateGuard = MakeGuard([&] {
+ auto invalidateGuard = makeGuard([&] {
try {
authzManager->invalidateUserCache(opCtx);
} catch (const DBException& e) {
@@ -2102,7 +2102,7 @@ public:
auto lk = uassertStatusOK(requireWritableAuthSchema28SCRAM(opCtx, authzManager));
// From here on, we always want to invalidate the user cache before returning.
- auto invalidateGuard = MakeGuard([&] {
+ auto invalidateGuard = makeGuard([&] {
try {
authzManager->invalidateUserCache(opCtx);
} catch (const DBException& e) {
@@ -2712,7 +2712,7 @@ public:
auto lk = uassertStatusOK(requireWritableAuthSchema28SCRAM(opCtx, authzManager));
// From here on, we always want to invalidate the user cache before returning.
- auto invalidateGuard = MakeGuard([&] {
+ auto invalidateGuard = makeGuard([&] {
try {
authzManager->invalidateUserCache(opCtx);
} catch (const DBException& e) {