void IndexRebuilder::run() { Client::initThread(name().c_str()); ON_BLOCK_EXIT_OBJ(cc(), &Client::shutdown); cc().getAuthorizationSession()->grantInternalAuthorization(); std::vector<std::string> dbNames; globalStorageEngine->listDatabases( &dbNames ); try { std::list<std::string> collNames; for (std::vector<std::string>::const_iterator dbName = dbNames.begin(); dbName < dbNames.end(); dbName++) { OperationContextImpl txn; Client::ReadContext ctx(&txn, *dbName); Database* db = ctx.ctx().db(); db->getDatabaseCatalogEntry()->getCollectionNamespaces(&collNames); } checkNS(collNames); } catch (const DBException& e) { warning() << "Index rebuilding did not complete: " << e.what() << endl; } boost::unique_lock<boost::mutex> lk(repl::ReplSet::rss.mtx); repl::ReplSet::rss.indexRebuildDone = true; repl::ReplSet::rss.cond.notify_all(); LOG(1) << "checking complete" << endl; }
void IndexRebuilder::run() { Client::initThread(name().c_str()); ON_BLOCK_EXIT_OBJ(cc(), &Client::shutdown); cc().getAuthorizationSession()->grantInternalAuthorization(); std::vector<std::string> dbNames; getDatabaseNames(dbNames); try { std::list<std::string> collNames; for (std::vector<std::string>::const_iterator dbName = dbNames.begin(); dbName < dbNames.end(); dbName++) { Client::ReadContext ctx(*dbName); Database* db = cc().database(); db->namespaceIndex().getNamespaces(collNames, /* onlyCollections */ true); } checkNS(collNames); } catch (const DBException&) { warning() << "index rebuilding did not complete" << endl; } boost::unique_lock<boost::mutex> lk(ReplSet::rss.mtx); ReplSet::rss.indexRebuildDone = true; ReplSet::rss.cond.notify_all(); LOG(1) << "checking complete" << endl; }
void restartInProgressIndexesFromLastShutdown() { OperationContextImpl txn; cc().getAuthorizationSession()->grantInternalAuthorization(); std::vector<std::string> dbNames; StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine(); storageEngine->listDatabases( &dbNames ); try { std::list<std::string> collNames; for (std::vector<std::string>::const_iterator dbName = dbNames.begin(); dbName < dbNames.end(); ++dbName) { Client::ReadContext ctx(&txn, *dbName); Database* db = ctx.ctx().db(); db->getDatabaseCatalogEntry()->getCollectionNamespaces(&collNames); } checkNS(&txn, collNames); } catch (const DBException& e) { error() << "Index rebuilding did not complete: " << e.toString(); log() << "note: restart the server with --noIndexBuildRetry to skip index rebuilds"; fassertFailedNoTrace(18643); } LOG(1) << "checking complete" << endl; }
void restartInProgressIndexesFromLastShutdown(OperationContext* txn) { txn->getClient()->getAuthorizationSession()->grantInternalAuthorization(); std::vector<std::string> dbNames; StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine(); storageEngine->listDatabases( &dbNames ); try { std::list<std::string> collNames; for (std::vector<std::string>::const_iterator dbName = dbNames.begin(); dbName < dbNames.end(); ++dbName) { ScopedTransaction scopedXact(txn, MODE_IS); AutoGetDb autoDb(txn, *dbName, MODE_S); Database* db = autoDb.getDb(); db->getDatabaseCatalogEntry()->getCollectionNamespaces(&collNames); } checkNS(txn, collNames); } catch (const DBException& e) { error() << "Index verification did not complete: " << e.toString(); fassertFailedNoTrace(18643); } LOG(1) << "checking complete" << endl; }