mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
librados: add inconsistent_obj_t
types
which present the inconsistent objects found in scrub Fixes: #13505 Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
4c3270692e
commit
b43d480938
@ -1,11 +1,13 @@
|
||||
#ifndef CEPH_RADOS_TYPES_HPP
|
||||
#define CEPH_RADOS_TYPES_HPP
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include "buffer.h"
|
||||
#include "rados_types.h"
|
||||
|
||||
namespace librados {
|
||||
@ -31,6 +33,91 @@ struct snap_set_t {
|
||||
snap_set_t() : seq(0) {}
|
||||
};
|
||||
|
||||
struct object_id_t {
|
||||
std::string name;
|
||||
std::string nspace;
|
||||
std::string locator;
|
||||
snap_t snap = 0;
|
||||
object_id_t() = default;
|
||||
object_id_t(const std::string& name,
|
||||
const std::string& nspace,
|
||||
const std::string& locator,
|
||||
snap_t snap)
|
||||
: name(name),
|
||||
nspace(nspace),
|
||||
locator(locator),
|
||||
snap(snap)
|
||||
{}
|
||||
};
|
||||
|
||||
struct err_t {
|
||||
enum {
|
||||
SHARD_MISSING = 1 << 1,
|
||||
SHARD_STAT_ERR = 1 << 2,
|
||||
SHARD_READ_ERR = 1 << 3,
|
||||
DATA_DIGEST_MISMATCH = 1 << 4,
|
||||
OMAP_DIGEST_MISMATCH = 1 << 5,
|
||||
SIZE_MISMATCH = 1 << 6,
|
||||
ATTR_MISMATCH = 1 << 7,
|
||||
SNAPSET_MISSING = 1 << 8,
|
||||
DATA_DIGEST_MISMATCH_OI = 1 << 9,
|
||||
OMAP_DIGEST_MISMATCH_OI = 1 << 10,
|
||||
SIZE_MISMATCH_OI = 1 << 11,
|
||||
};
|
||||
uint64_t errors = 0;
|
||||
bool has_shard_missing() const {
|
||||
return errors & SHARD_MISSING;
|
||||
}
|
||||
bool has_stat_error() const {
|
||||
return errors & SHARD_STAT_ERR;
|
||||
}
|
||||
bool has_read_error() const {
|
||||
return errors & SHARD_READ_ERR;
|
||||
}
|
||||
bool has_data_digest_mismatch() const {
|
||||
return errors & DATA_DIGEST_MISMATCH;
|
||||
}
|
||||
bool has_omap_digest_mismatch() const {
|
||||
return errors & OMAP_DIGEST_MISMATCH;
|
||||
}
|
||||
// deep error
|
||||
bool has_data_digest_mismatch_oi() const {
|
||||
return errors & DATA_DIGEST_MISMATCH_OI;
|
||||
}
|
||||
// deep error
|
||||
bool has_omap_digest_mismatch_oi() const {
|
||||
return errors & OMAP_DIGEST_MISMATCH_OI;
|
||||
}
|
||||
bool has_size_mismatch() const {
|
||||
return errors & SIZE_MISMATCH;
|
||||
}
|
||||
bool has_size_mismatch_oi() const {
|
||||
return errors & SIZE_MISMATCH_OI;
|
||||
}
|
||||
bool has_attr_mismatch() const {
|
||||
return errors & ATTR_MISMATCH;
|
||||
}
|
||||
};
|
||||
|
||||
struct shard_info_t : err_t {
|
||||
std::map<std::string, bufferlist> attrs;
|
||||
uint64_t size = -1;
|
||||
bool omap_digest_present = false;
|
||||
uint32_t omap_digest = 0;
|
||||
bool data_digest_present = false;
|
||||
uint32_t data_digest = 0;
|
||||
};
|
||||
|
||||
struct inconsistent_obj_t : err_t {
|
||||
inconsistent_obj_t() = default;
|
||||
inconsistent_obj_t(const object_id_t& object)
|
||||
: object{object}
|
||||
{}
|
||||
object_id_t object;
|
||||
// osd => shard_info
|
||||
std::map<int32_t, shard_info_t> shards;
|
||||
};
|
||||
|
||||
/**
|
||||
* @var all_nspaces
|
||||
* Pass as nspace argument to IoCtx::set_namespace()
|
||||
|
Loading…
Reference in New Issue
Block a user