summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2017-01-15 15:43:06 -0500
committerAndy Schwerin <schwerin@mongodb.com>2017-01-15 15:44:49 -0500
commita7e74d56036e94c3e4ed11ceeb4cd43e95209aa5 (patch)
treee90d6b26cb5f1bb26ebf95a36aa93ddf60f8c45c /src/mongo/db
parentbe58d599fd9df085c94be3c22051f04aa3df5c13 (diff)
downloadmongo-a7e74d56036e94c3e4ed11ceeb4cd43e95209aa5.tar.gz
SERVER-27603 Rename mongo::inShutdown() to mongo::globalInShutdownDeprecated() for clarity.
Calling this function is deprecated because modules that consult it cannot engage in an orderly, coordinated shutdown. Instead, such modules tend to just stop working at some point after mongo::shutdown() is invoked, without regard to whether modules that depend on them have already shut down. As such, for clarity, this patch renames the function from mongo::inShutdown() to mongo::globalInShutdownDeprecated(). This also helps disambiguate calls to this function from calls to individual components' similarly named functions. Also, remove uncalled mongo::inShutdownStrict().
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.cpp4
-rw-r--r--src/mongo/db/catalog/cursor_manager.cpp2
-rw-r--r--src/mongo/db/clientcursor.cpp2
-rw-r--r--src/mongo/db/range_deleter.cpp2
-rw-r--r--src/mongo/db/repl/initial_sync.cpp4
-rw-r--r--src/mongo/db/repl/rs_initialsync.cpp8
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp2
-rw-r--r--src/mongo/db/stats/snapshots.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file_sync.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp2
-rw-r--r--src/mongo/db/ttl.cpp2
13 files changed, 21 insertions, 19 deletions
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp
index 4e5c113c664..a9198b52fe9 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.cpp
+++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp
@@ -112,7 +112,7 @@ UserCacheInvalidator::UserCacheInvalidator(AuthorizationManager* authzManager)
: _authzManager(authzManager) {}
UserCacheInvalidator::~UserCacheInvalidator() {
- invariant(inShutdown());
+ invariant(globalInShutdownDeprecated());
// Wait to stop running.
wait();
}
@@ -153,7 +153,7 @@ void UserCacheInvalidator::run() {
lastInvalidationTime = now;
lock.unlock();
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
break;
}
diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/catalog/cursor_manager.cpp
index 8640229faa9..f6f1cf21474 100644
--- a/src/mongo/db/catalog/cursor_manager.cpp
+++ b/src/mongo/db/catalog/cursor_manager.cpp
@@ -297,7 +297,7 @@ int CursorManager::eraseCursorGlobalIfAuthorized(OperationContext* txn, int n, c
for (int i = 0; i < n; i++) {
if (eraseCursorGlobalIfAuthorized(txn, ids.readAndAdvance<LittleEndian<int64_t>>()))
numDeleted++;
- if (inShutdown())
+ if (globalInShutdownDeprecated())
break;
}
return numDeleted;
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp
index c2f5c487d97..5dc6196b904 100644
--- a/src/mongo/db/clientcursor.cpp
+++ b/src/mongo/db/clientcursor.cpp
@@ -266,7 +266,7 @@ public:
void run() {
Client::initThread("clientcursormon");
Timer t;
- while (!inShutdown()) {
+ while (!globalInShutdownDeprecated()) {
{
const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
OperationContext& txn = *txnPtr;
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp
index 6f574293e21..dc6e48e038d 100644
--- a/src/mongo/db/range_deleter.cpp
+++ b/src/mongo/db/range_deleter.cpp
@@ -415,7 +415,7 @@ void RangeDeleter::doWork() {
Client::initThreadIfNotAlready("RangeDeleter");
Client* client = &cc();
- while (!inShutdown() && !stopRequested()) {
+ while (!globalInShutdownDeprecated() && !stopRequested()) {
string errMsg;
RangeDeleteEntry* nextTask = NULL;
diff --git a/src/mongo/db/repl/initial_sync.cpp b/src/mongo/db/repl/initial_sync.cpp
index ae4421997f6..7c138a6f96c 100644
--- a/src/mongo/db/repl/initial_sync.cpp
+++ b/src/mongo/db/repl/initial_sync.cpp
@@ -72,7 +72,7 @@ void InitialSync::_applyOplogUntil(OperationContext* txn, const OpTime& endOpTim
auto replCoord = repl::ReplicationCoordinator::get(txn);
while (!tryPopAndWaitForMore(txn, &ops, BatchLimits{})) {
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return;
}
@@ -113,7 +113,7 @@ void InitialSync::_applyOplogUntil(OperationContext* txn, const OpTime& endOpTim
replCoord->setMyLastAppliedOpTime(lastOpTime);
setNewTimestamp(lastOpTime.getTimestamp());
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return;
}
diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp
index 990f9dd8fdf..508edcb1ade 100644
--- a/src/mongo/db/repl/rs_initialsync.cpp
+++ b/src/mongo/db/repl/rs_initialsync.cpp
@@ -223,7 +223,7 @@ bool _initialSyncApplyOplog(OperationContext* txn,
LOG(2) << "Applying oplog entries from " << startOpTime << " until " << stopOpTime;
syncer->oplogApplication(txn, stopOpTime);
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return false;
}
} catch (const DBException&) {
@@ -289,7 +289,7 @@ Status _initialSync(OperationContext* txn, BackgroundSync* bgsync) {
sleepsecs(1);
}
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return Status(ErrorCodes::ShutdownInProgress, "shutting down");
}
}
@@ -552,12 +552,12 @@ void syncDoInitialSync(OperationContext* txn,
} catch (const DBException& e) {
error() << redact(e);
// Return if in shutdown
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return;
}
}
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
return;
}
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index 3cca0606180..a66e6d63e72 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -359,7 +359,7 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* txn
if ((ErrorCodes::isInterruption(status.code()) ||
ErrorCodes::isShutdownError(status.code()) ||
status == ErrorCodes::CallbackCanceled) &&
- inShutdown()) {
+ globalInShutdownDeprecated()) {
// Since the server is already doing a clean shutdown, this call will just join the
// previous shutdown call
shutdown(waitForShutdown());
diff --git a/src/mongo/db/stats/snapshots.cpp b/src/mongo/db/stats/snapshots.cpp
index c1088f4d12f..8e62134e86e 100644
--- a/src/mongo/db/stats/snapshots.cpp
+++ b/src/mongo/db/stats/snapshots.cpp
@@ -106,7 +106,7 @@ StatusWith<SnapshotDiff> Snapshots::computeDelta() {
void StatsSnapshotThread::run() {
Client::initThread("statsSnapshot");
- while (!inShutdown()) {
+ while (!globalInShutdownDeprecated()) {
try {
statsSnapshots.takeSnapshot();
} catch (std::exception& e) {
diff --git a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
index 51a091dd7f2..24be15045f0 100644
--- a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
@@ -64,7 +64,7 @@ void DataFileSync::run() {
LOG(1) << "--syncdelay " << storageGlobalParams.syncdelay.load() << endl;
}
int time_flushing = 0;
- while (!inShutdown()) {
+ while (!globalInShutdownDeprecated()) {
_diaglog.flush();
if (storageGlobalParams.syncdelay == 0) {
// in case at some point we add an option to change at runtime
@@ -75,7 +75,7 @@ void DataFileSync::run() {
sleepmillis(
(long long)std::max(0.0, (storageGlobalParams.syncdelay * 1000) - time_flushing));
- if (inShutdown()) {
+ if (globalInShutdownDeprecated()) {
// occasional issue trying to flush during shutdown when sleep interrupted
break;
}
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index 2d8e7b02fa6..e7de8b5967f 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -725,7 +725,7 @@ void Journal::removeUnneededJournalFiles() {
}
void Journal::_rotate(unsigned long long lsnOfCurrentJournalEntry) {
- if (inShutdown() || !_curLogFile)
+ if (globalInShutdownDeprecated() || !_curLogFile)
return;
j.updateLSNFile(lsnOfCurrentJournalEntry);
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
index 835264ec864..ec6b945455e 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
@@ -526,7 +526,9 @@ bool RecoveryJob::processFileBuffer(const void* p, unsigned len) {
processSection((const JSectHeader*)hdr, data, dataLen, (const JSectFooter*)footer);
// ctrl c check
- uassert(ErrorCodes::Interrupted, "interrupted during journal recovery", !inShutdown());
+ uassert(ErrorCodes::Interrupted,
+ "interrupted during journal recovery",
+ !globalInShutdownDeprecated());
}
} catch (const BufReader::eof&) {
if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalDumpJournal)
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
index 2d4e5d25759..1d0606ee9de 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
@@ -117,7 +117,7 @@ public:
virtual void run() {
Client::initThread(_name.c_str());
- while (!inShutdown()) {
+ while (!globalInShutdownDeprecated()) {
if (!_deleteExcessDocuments()) {
sleepmillis(1000); // Back off in case there were problems deleting.
}
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index 6f1bf84b872..5c9c743b021 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -86,7 +86,7 @@ public:
Client::initThread(name().c_str());
AuthorizationSession::get(cc())->grantInternalAuthorization();
- while (!inShutdown()) {
+ while (!globalInShutdownDeprecated()) {
sleepsecs(ttlMonitorSleepSecs.load());
LOG(3) << "thread awake";