From bec67e3d4095484970ad3376a9b2613d07a6606f Mon Sep 17 00:00:00 2001 From: David Zafman Date: Thu, 15 Mar 2018 14:29:54 -0700 Subject: [PATCH] osd rados command: Rename ss_attr_missing/ss_attr_corrupted to snapset_missing/snapset_corrupted Signed-off-by: David Zafman --- doc/rados/command/list-inconsistent-obj.json | 8 +++--- doc/rados/command/list-inconsistent-snap.json | 4 +-- qa/standalone/scrub/osd-scrub-repair.sh | 16 +++++------ qa/standalone/scrub/osd-scrub-snaps.sh | 4 +-- src/common/scrub_types.cc | 4 +-- src/common/scrub_types.h | 12 ++++---- src/include/rados/rados_types.hpp | 28 ++++++++++++++----- src/osd/PGBackend.cc | 8 +++--- src/osd/PrimaryLogPG.cc | 4 +-- src/tools/rados/rados.cc | 22 +++++++-------- 10 files changed, 62 insertions(+), 48 deletions(-) diff --git a/doc/rados/command/list-inconsistent-obj.json b/doc/rados/command/list-inconsistent-obj.json index ec2ed0fd17026..ba915b118092b 100644 --- a/doc/rados/command/list-inconsistent-obj.json +++ b/doc/rados/command/list-inconsistent-obj.json @@ -68,8 +68,8 @@ "oi_attr_missing", "oi_attr_corrupted", "obj_size_oi_mismatch", - "ss_attr_missing", - "ss_attr_corrupted", + "snapset_missing", + "snapset_corrupted", "hinfo_missing", "hinfo_corrupted" ] @@ -141,8 +141,8 @@ "oi_attr_missing", "oi_attr_corrupted", "obj_size_oi_mismatch", - "ss_attr_missing", - "ss_attr_corrupted", + "snapset_missing", + "snapset_corrupted", "hinfo_missing", "hinfo_corrupted" ] diff --git a/doc/rados/command/list-inconsistent-snap.json b/doc/rados/command/list-inconsistent-snap.json index 0da6b0f9b5a5a..30416c91b7774 100644 --- a/doc/rados/command/list-inconsistent-snap.json +++ b/doc/rados/command/list-inconsistent-snap.json @@ -40,8 +40,8 @@ "type": "array", "items": { "enum": [ - "ss_attr_missing", - "ss_attr_corrupted", + "snapset_missing", + "snapset_corrupted", "oi_attr_missing", "oi_attr_corrupted", "snapset_mismatch", diff --git a/qa/standalone/scrub/osd-scrub-repair.sh b/qa/standalone/scrub/osd-scrub-repair.sh index e33445c984789..592f0da1eae46 100755 --- a/qa/standalone/scrub/osd-scrub-repair.sh +++ b/qa/standalone/scrub/osd-scrub-repair.sh @@ -842,7 +842,7 @@ function TEST_corrupt_scrub_replicated() { } ], "errors": [ - "ss_attr_missing" + "snapset_missing" ], "osd": 0, "primary": false, @@ -862,7 +862,7 @@ function TEST_corrupt_scrub_replicated() { } ], "errors": [ - "ss_attr_corrupted" + "snapset_corrupted" ], "osd": 1, "primary": true, @@ -870,8 +870,8 @@ function TEST_corrupt_scrub_replicated() { } ], "union_shard_errors": [ - "ss_attr_missing", - "ss_attr_corrupted" + "snapset_missing", + "snapset_corrupted" ] }, { @@ -1324,7 +1324,7 @@ EOF ], "data_digest": "0x2ddbf8f5", "errors": [ - "ss_attr_missing" + "snapset_missing" ], "omap_digest": "0x8b699207", "osd": 0, @@ -1346,7 +1346,7 @@ EOF ], "data_digest": "0x2ddbf8f5", "errors": [ - "ss_attr_corrupted" + "snapset_corrupted" ], "omap_digest": "0x8b699207", "osd": 1, @@ -1355,8 +1355,8 @@ EOF } ], "union_shard_errors": [ - "ss_attr_missing", - "ss_attr_corrupted" + "snapset_missing", + "snapset_corrupted" ] }, { diff --git a/qa/standalone/scrub/osd-scrub-snaps.sh b/qa/standalone/scrub/osd-scrub-snaps.sh index 13bdb05e07838..ff0293e5b4fd0 100755 --- a/qa/standalone/scrub/osd-scrub-snaps.sh +++ b/qa/standalone/scrub/osd-scrub-snaps.sh @@ -293,7 +293,7 @@ function TEST_scrub_snaps() { }, { "errors": [ - "ss_attr_corrupted" + "snapset_corrupted" ], "snap": "head", "locator": "", @@ -306,7 +306,7 @@ function TEST_scrub_snaps() { 4 ], "errors": [ - "ss_attr_missing", + "snapset_missing", "extra_clones" ], "snap": "head", diff --git a/src/common/scrub_types.cc b/src/common/scrub_types.cc index fc59c38b8ce78..9198009176110 100644 --- a/src/common/scrub_types.cc +++ b/src/common/scrub_types.cc @@ -185,7 +185,7 @@ void inconsistent_snapset_wrapper::set_headless() errors |= inc_snapset_t::HEADLESS_CLONE; } -void inconsistent_snapset_wrapper::set_ss_attr_missing() +void inconsistent_snapset_wrapper::set_snapset_missing() { errors |= inc_snapset_t::SNAPSET_MISSING; } @@ -195,7 +195,7 @@ void inconsistent_snapset_wrapper::set_oi_attr_missing() errors |= inc_snapset_t::OI_MISSING; } -void inconsistent_snapset_wrapper::set_ss_attr_corrupted() +void inconsistent_snapset_wrapper::set_snapset_corrupted() { errors |= inc_snapset_t::SNAPSET_CORRUPTED; } diff --git a/src/common/scrub_types.h b/src/common/scrub_types.h index 4285c4637e56d..e7c4ad97c219b 100644 --- a/src/common/scrub_types.h +++ b/src/common/scrub_types.h @@ -74,11 +74,11 @@ public: void set_oi_attr_corrupted() { errors |= err_t::OI_ATTR_CORRUPTED; } - void set_ss_attr_missing() { - errors |= err_t::SS_ATTR_MISSING; + void set_snapset_missing() { + errors |= err_t::SNAPSET_MISSING; } - void set_ss_attr_corrupted() { - errors |= err_t::SS_ATTR_CORRUPTED; + void set_snapset_corrupted() { + errors |= err_t::SNAPSET_CORRUPTED; } void set_obj_size_oi_mismatch() { errors |= err_t::OBJ_SIZE_OI_MISMATCH; @@ -153,9 +153,9 @@ struct inconsistent_snapset_wrapper : public librados::inconsistent_snapset_t { void set_headless(); // soid claims that it is a head or a snapdir, but its SS_ATTR // is missing. - void set_ss_attr_missing(); + void set_snapset_missing(); void set_oi_attr_missing(); - void set_ss_attr_corrupted(); + void set_snapset_corrupted(); void set_oi_attr_corrupted(); // snapset with missing clone void set_clone_missing(snapid_t); diff --git a/src/include/rados/rados_types.hpp b/src/include/rados/rados_types.hpp index 7d8d075e1ff93..f5d89e5f1e67d 100644 --- a/src/include/rados/rados_types.hpp +++ b/src/include/rados/rados_types.hpp @@ -62,15 +62,17 @@ struct err_t { SHARD_EC_SIZE_MISMATCH = 1 << 13, OI_ATTR_MISSING = 1 << 14, OI_ATTR_CORRUPTED = 1 << 15, - SS_ATTR_MISSING = 1 << 16, - SS_ATTR_CORRUPTED = 1 << 17, + SS_ATTR_MISSING = 1 << 16, // Old + SNAPSET_MISSING = 1 << 16, + SS_ATTR_CORRUPTED = 1 << 17, // Old + SNAPSET_CORRUPTED = 1 << 17, OBJ_SIZE_OI_MISMATCH = 1 << 18, HINFO_MISSING = 1 << 19, HINFO_CORRUPTED = 1 << 20 // When adding more here add to either SHALLOW_ERRORS or DEEP_ERRORS }; uint64_t errors = 0; - static constexpr uint64_t SHALLOW_ERRORS = SHARD_MISSING|SHARD_STAT_ERR|SIZE_MISMATCH_OI|OI_ATTR_MISSING|OI_ATTR_CORRUPTED|SS_ATTR_MISSING|SS_ATTR_CORRUPTED|OBJ_SIZE_OI_MISMATCH|HINFO_MISSING|HINFO_CORRUPTED; + static constexpr uint64_t SHALLOW_ERRORS = SHARD_MISSING|SHARD_STAT_ERR|SIZE_MISMATCH_OI|OI_ATTR_MISSING|OI_ATTR_CORRUPTED|SNAPSET_MISSING|SNAPSET_CORRUPTED|OBJ_SIZE_OI_MISMATCH|HINFO_MISSING|HINFO_CORRUPTED; static constexpr uint64_t DEEP_ERRORS = SHARD_READ_ERR|DATA_DIGEST_MISMATCH_OI|OMAP_DIGEST_MISMATCH_OI|SHARD_EC_HASH_MISMATCH|SHARD_EC_SIZE_MISMATCH; bool has_shard_missing() const { return errors & SHARD_MISSING; @@ -102,12 +104,18 @@ struct err_t { bool has_oi_attr_corrupted() const { return errors & OI_ATTR_CORRUPTED; } - bool has_ss_attr_missing() const { + bool has_ss_attr_missing() const { // Compatibility return errors & SS_ATTR_MISSING; } - bool has_ss_attr_corrupted() const { + bool has_snapset_missing() const { + return errors & SNAPSET_MISSING; + } + bool has_ss_attr_corrupted() const { // Compatibility return errors & SS_ATTR_CORRUPTED; } + bool has_snapset_corrupted() const { + return errors & SNAPSET_CORRUPTED; + } bool has_shallow_errors() const { return errors & SHALLOW_ERRORS; } @@ -232,10 +240,16 @@ struct inconsistent_snapset_t { std::vector clones; std::vector missing; - bool ss_attr_missing() const { + bool ss_attr_missing() const { // Compatibility return errors & SNAPSET_MISSING; } - bool ss_attr_corrupted() const { + bool snapset_missing() const { + return errors & SNAPSET_MISSING; + } + bool ss_attr_corrupted() const { // Compatibility + return errors & SNAPSET_CORRUPTED; + } + bool snapset_corrupted() const { return errors & SNAPSET_CORRUPTED; } bool clone_missing() const { diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index dde1f3965d85d..ff262c574421f 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -817,8 +817,8 @@ map::const_iterator if (obj.is_head()) { k = i->second.attrs.find(SS_ATTR); if (k == i->second.attrs.end()) { - shard_info.set_ss_attr_missing(); - error_string += " ss_attr_missing"; + shard_info.set_snapset_missing(); + error_string += " snapset_missing"; } else { ss_bl.push_back(k->second); try { @@ -832,8 +832,8 @@ map::const_iterator } } catch (...) { // invalid snapset, probably corrupt - shard_info.set_ss_attr_corrupted(); - error_string += " ss_attr_corrupted"; + shard_info.set_snapset_corrupted(); + error_string += " snapset_corrupted"; } } } diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 639944b00188a..911863d4e3ac4 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -14524,7 +14524,7 @@ void PrimaryLogPG::scrub_snapshot_metadata( << " no '" << SS_ATTR << "' attr"; ++scrubber.shallow_errors; snapset = boost::none; - head_error.set_ss_attr_missing(); + head_error.set_snapset_missing(); } else { bufferlist bl; bl.push_back(p->second.attrs[SS_ATTR]); @@ -14537,7 +14537,7 @@ void PrimaryLogPG::scrub_snapshot_metadata( osd->clog->error() << mode << " " << info.pgid << " " << soid << " can't decode '" << SS_ATTR << "' attr " << e.what(); ++scrubber.shallow_errors; - head_error.set_ss_attr_corrupted(); + head_error.set_snapset_corrupted(); } } diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index a9ebc4efea8b4..16e00a48acef7 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -1346,10 +1346,10 @@ static void dump_errors(const err_t &err, Formatter &f, const char *name) f.dump_string("error", "oi_attr_corrupted"); if (err.has_obj_size_oi_mismatch()) f.dump_string("error", "obj_size_oi_mismatch"); - if (err.has_ss_attr_missing()) - f.dump_string("error", "ss_attr_missing"); - if (err.has_ss_attr_corrupted()) - f.dump_string("error", "ss_attr_corrupted"); + if (err.has_snapset_missing()) + f.dump_string("error", "snapset_missing"); + if (err.has_snapset_corrupted()) + f.dump_string("error", "snapset_corrupted"); if (err.has_hinfo_missing()) f.dump_string("error", "hinfo_missing"); if (err.has_hinfo_corrupted()) @@ -1385,7 +1385,7 @@ static void dump_shard(const shard_info_t& shard, decode(oi, bliter); // Can't be corrupted f.dump_stream("object_info") << oi; } - if (!shard.has_ss_attr_missing() && !shard.has_ss_attr_corrupted() && + if (!shard.has_snapset_missing() && !shard.has_snapset_corrupted() && inc.has_snapset_inconsistency()) { SnapSet ss; bufferlist bl; @@ -1408,8 +1408,8 @@ static void dump_shard(const shard_info_t& shard, if (inc.has_attr_name_mismatch() || inc.has_attr_value_mismatch() || inc.union_shards.has_oi_attr_missing() || inc.union_shards.has_oi_attr_corrupted() - || inc.union_shards.has_ss_attr_missing() - || inc.union_shards.has_ss_attr_corrupted() + || inc.union_shards.has_snapset_missing() + || inc.union_shards.has_snapset_corrupted() || inc.union_shards.has_hinfo_missing() || inc.union_shards.has_hinfo_corrupted()) { f.open_array_section("attrs"); @@ -1510,10 +1510,10 @@ static void dump_inconsistent(const inconsistent_snapset_t& inc, dump_object_id(inc.object, f); f.open_array_section("errors"); - if (inc.ss_attr_missing()) - f.dump_string("error", "ss_attr_missing"); - if (inc.ss_attr_corrupted()) - f.dump_string("error", "ss_attr_corrupted"); + if (inc.snapset_missing()) + f.dump_string("error", "snapset_missing"); + if (inc.snapset_corrupted()) + f.dump_string("error", "snapset_corrupted"); if (inc.oi_attr_missing()) f.dump_string("error", "oi_attr_missing"); if (inc.oi_attr_corrupted()) -- 2.39.5