summaryrefslogtreecommitdiffstats
path: root/src/kv
diff options
context:
space:
mode:
authorIgor Fedotov <ifedotov@suse.com>2020-08-27 18:54:05 +0200
committerIgor Fedotov <ifedotov@suse.com>2020-09-03 11:44:27 +0200
commit28c646794e5115350deca48cb4c4aa67e97b2eb7 (patch)
tree98beb78290e959c6cc0be6b5a935b16e5f80077c /src/kv
parentos/bluestore: refactoring/cleanup around DB open/close. (diff)
downloadceph-28c646794e5115350deca48cb4c4aa67e97b2eb7.tar.xz
ceph-28c646794e5115350deca48cb4c4aa67e97b2eb7.zip
kv/RocksDBStore: apply sharding recreate within a repair.
This way we avoid an invalid attempt to apply this in read-only mode. Signed-off-by: Igor Fedotov <ifedotov@suse.com>
Diffstat (limited to 'src/kv')
-rw-r--r--src/kv/RocksDBStore.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index df0a8019b50..b2f8ef01d43 100644
--- a/src/kv/RocksDBStore.cc
+++ b/src/kv/RocksDBStore.cc
@@ -887,6 +887,7 @@ int RocksDBStore::do_open(ostream &out,
&sharding_recreate_text);
bool recreate_mode = status.ok() && sharding_recreate_text == "1";
+ ceph_assert(!recreate_mode || !open_readonly);
if (recreate_mode == false && missing_cfs.size() != 0) {
derr << __func__ << " missing column families: " << missing_cfs_shard << dendl;
return -EIO;
@@ -895,9 +896,9 @@ int RocksDBStore::do_open(ostream &out,
if (existing_cfs.empty()) {
// no column families
if (open_readonly) {
- status = rocksdb::DB::Open(opt, path, &db);
+ status = rocksdb::DB::OpenForReadOnly(opt, path, &db);
} else {
- status = rocksdb::DB::OpenForReadOnly(opt, path, &db);
+ status = rocksdb::DB::Open(opt, path, &db);
}
if (!status.ok()) {
derr << status.ToString() << dendl;
@@ -1075,6 +1076,12 @@ int RocksDBStore::repair(std::ostream &out)
derr << __func__ << " cannot write to " << sharding_recreate << dendl;
return -1;
}
+ // fiinalize sharding recreate
+ if (do_open(out, false, false)) {
+ derr << __func__ << " cannot finalize repair" << dendl;
+ return -1;
+ }
+ close();
}
if (repaired && status.ok()) {