diff options
author | Kristina <kristina@10gen.com> | 2012-11-12 10:19:43 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-11-12 11:09:37 -0500 |
commit | ab9ff1d3ecc7163fc93188efd997bbacd8fe7406 (patch) | |
tree | 08a235be165b6c0f85d426ad2333274526e58ebb /src/mongo/db/index_rebuilder.h | |
parent | 4ca39159c6c4a18fb1b16063f2ac6b49b58a3167 (diff) | |
download | mongo-ab9ff1d3ecc7163fc93188efd997bbacd8fe7406.tar.gz |
SERVER-2771 Retry index builds on startup
Diffstat (limited to 'src/mongo/db/index_rebuilder.h')
-rw-r--r-- | src/mongo/db/index_rebuilder.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mongo/db/index_rebuilder.h b/src/mongo/db/index_rebuilder.h new file mode 100644 index 00000000000..3fd308f9cc9 --- /dev/null +++ b/src/mongo/db/index_rebuilder.h @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2012 10gen Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "mongo/db/namespace_details.h" +#include "mongo/util/background.h" + +namespace mongo { + + class IndexRebuilder : public BackgroundJob { + public: + IndexRebuilder(); + + std::string name() const; + void run(); + + private: + /** + * Check each collection in a database to see if it has any in-progress index builds that + * need to be retried. If so, calls retryIndexBuild. + */ + void checkDB(const std::string& dbname); + + /** + * Actually retry the index build on a given namespace. + */ + void retryIndexBuild(const std::string& dbName, NamespaceDetails* nsd); + }; + + extern IndexRebuilder indexRebuilder; +} |