diff options
author | Louis Williams <louis.williams@mongodb.com> | 2020-07-20 13:18:32 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-20 17:55:45 +0000 |
commit | d0e0220787fa127e0fae9d0c9f691316bd1eb6db (patch) | |
tree | adab33ae9ef947dd01acb79a31f113ed2609e028 /src/mongo/db/repair.h | |
parent | f8ab75fa4fb28e466cca62b8849ad65485fdae0a (diff) | |
download | mongo-d0e0220787fa127e0fae9d0c9f691316bd1eb6db.tar.gz |
SERVER-48050 FCV should be initialized before attempting to restart in-progress index builds
* Refactored repairDatabaseAndCheckVersion by moving FCV logic into
the FeatureCompatibilityVersion class
* Refactored repairDatabaseAndCheckVersion by separating procedures of
regular recovery, read-only mode, and repair
* Renamed repairDatabaseAndCheckVersion to repairAndRecoverDatabases
* Moved startup recovery/repair free function into a 'startup_recovery' namespace
* Moved repair free functions into a 'repair' namespace.
renamed: src/mongo/db/repair_database_and_check_version.cpp -> src/mongo/db/startup_recovery.cpp
renamed: src/mongo/db/repair_database_and_check_version.h -> src/mongo/db/startup_recovery.h
renamed: src/mongo/db/repair_database.cpp -> src/mongo/db/repair.cpp
renamed: src/mongo/db/repair_database.h -> src/mongo/db/repair.h
Diffstat (limited to 'src/mongo/db/repair.h')
-rw-r--r-- | src/mongo/db/repair.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/mongo/db/repair.h b/src/mongo/db/repair.h new file mode 100644 index 00000000000..719b11c57a3 --- /dev/null +++ b/src/mongo/db/repair.h @@ -0,0 +1,63 @@ +/** + * Copyright (C) 2020-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * 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 + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#pragma once + +#include <functional> +#include <string> + +#include "mongo/bson/bsonobj.h" +#include "mongo/db/record_id.h" + +namespace mongo { +class StorageEngine; +class NamespaceString; +class OperationContext; +class Status; + +namespace repair { + +/** + * Repairs a database using a storage engine-specific, best-effort process. Some data may be lost or + * modified in the process but the result will be readable collections consistent with their indexes + * on a successful return. + * + * It is expected that the local database will be repaired first when running in repair mode. + */ +Status repairDatabase(OperationContext* opCtx, StorageEngine* engine, const std::string& dbName); + +/** + * Repairs a collection using a storage engine-specific, best-effort process. + * Some data may be lost or modified in the process but the result will be a readable collection + * consistent with its indexes on a successful return. + */ +Status repairCollection(OperationContext* opCtx, StorageEngine* engine, const NamespaceString& nss); + +} // namespace repair +} // namespace mongo |