fix verify data checksum
This commit is contained in:
parent
cd098b930a
commit
302b2152ac
@ -780,7 +780,7 @@ int ObTabletReplicaChecksumOperator::construct_tablet_replica_checksum_item_(
|
||||
(void)GET_COL_IGNORE_NULL(res.get_int, "data_checksum", item.data_checksum_);
|
||||
(void)GET_COL_IGNORE_NULL(res.get_varchar, "b_column_checksums", column_meta_hex_str);
|
||||
|
||||
if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, min_data_version))) {
|
||||
if (FAILEDx(GET_MIN_DATA_VERSION(tenant_id, min_data_version))) {
|
||||
LOG_WARN("get tenant data version failed", K(ret), K(tenant_id));
|
||||
} else if (min_data_version < DATA_VERSION_4_3_3_0) {
|
||||
item.data_checksum_type_ = ObDataChecksumType::DATA_CHECKSUM_NORMAL;
|
||||
@ -1494,8 +1494,7 @@ int ObTabletReplicaChecksumOperator::get_min_compaction_scn(
|
||||
|
||||
// ----------------------- ObTabletDataChecksumChecker -----------------------
|
||||
ObTabletDataChecksumChecker::ObTabletDataChecksumChecker()
|
||||
: normal_ckm_item_(nullptr),
|
||||
cs_replica_ckm_item_(nullptr)
|
||||
: normal_ckm_item_(nullptr)
|
||||
{}
|
||||
|
||||
ObTabletDataChecksumChecker::~ObTabletDataChecksumChecker()
|
||||
@ -1506,7 +1505,6 @@ ObTabletDataChecksumChecker::~ObTabletDataChecksumChecker()
|
||||
void ObTabletDataChecksumChecker::reset()
|
||||
{
|
||||
normal_ckm_item_ = nullptr;
|
||||
cs_replica_ckm_item_ = nullptr;
|
||||
}
|
||||
|
||||
int ObTabletDataChecksumChecker::check_data_checksum(const ObTabletReplicaChecksumItem& curr_item)
|
||||
@ -1516,13 +1514,7 @@ int ObTabletDataChecksumChecker::check_data_checksum(const ObTabletReplicaChecks
|
||||
if (OB_FAIL(curr_item.check_data_checksum_type(is_cs_replica))) {
|
||||
LOG_WARN("fail to check data checksum type", KR(ret), K(curr_item));
|
||||
} else if (is_cs_replica) {
|
||||
// if (OB_ISNULL(cs_replica_ckm_item_)) {
|
||||
// cs_replica_ckm_item_ = &curr_item;
|
||||
// } else if (cs_replica_ckm_item_->compaction_scn_ != curr_item.compaction_scn_) {
|
||||
// LOG_INFO("no need to check data checksum", K(curr_item), KPC(this));
|
||||
// } else if (cs_replica_ckm_item_->data_checksum_ != curr_item.data_checksum_) {
|
||||
// ret = OB_CHECKSUM_ERROR;
|
||||
// }
|
||||
// skip checking data checksum between cs replicas
|
||||
} else {
|
||||
if (OB_ISNULL(normal_ckm_item_)) {
|
||||
normal_ckm_item_ = &curr_item;
|
||||
@ -1535,5 +1527,19 @@ int ObTabletDataChecksumChecker::check_data_checksum(const ObTabletReplicaChecks
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletDataChecksumChecker::set_data_checksum(const ObTabletReplicaChecksumItem& curr_item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(normal_ckm_item_)) {
|
||||
bool is_cs_replica = false;
|
||||
if (OB_FAIL(curr_item.check_data_checksum_type(is_cs_replica))) {
|
||||
LOG_WARN("fail to check data checksum type", KR(ret), K(curr_item));
|
||||
} else if (!is_cs_replica) {
|
||||
normal_ckm_item_ = &curr_item;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // share
|
||||
} // oceanbase
|
||||
|
@ -351,11 +351,11 @@ public:
|
||||
ObTabletDataChecksumChecker();
|
||||
~ObTabletDataChecksumChecker();
|
||||
void reset();
|
||||
int set_data_checksum(const ObTabletReplicaChecksumItem& curr_item);
|
||||
int check_data_checksum(const ObTabletReplicaChecksumItem& curr_item);
|
||||
TO_STRING_KV(KPC_(normal_ckm_item), KPC_(cs_replica_ckm_item));
|
||||
TO_STRING_KV(KPC_(normal_ckm_item));
|
||||
private:
|
||||
const ObTabletReplicaChecksumItem *normal_ckm_item_;
|
||||
const ObTabletReplicaChecksumItem *cs_replica_ckm_item_;
|
||||
};
|
||||
|
||||
} // share
|
||||
|
@ -1300,6 +1300,9 @@ int ObMediumCompactionScheduleFunc::check_tablet_checksum(
|
||||
for (int64_t idx = start_idx; OB_SUCC(ret) && idx < end_idx; ++idx) {
|
||||
const ObTabletReplicaChecksumItem &curr_item = checksum_items.at(idx);
|
||||
if (OB_ISNULL(prev_item)) {
|
||||
if (OB_FAIL(data_checksum_checker.set_data_checksum(curr_item))) {
|
||||
LOG_WARN("fail to set data checksum", KR(ret), K(data_checksum_checker), K(curr_item));
|
||||
}
|
||||
} else if (!curr_item.is_same_tablet(*prev_item)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("not continuous same tablet id", K(ret), K(curr_item), KPC(prev_item));
|
||||
|
@ -109,6 +109,7 @@ using namespace palf;
|
||||
|
||||
namespace storage
|
||||
{
|
||||
ERRSIM_POINT_DEF(EN_COMPACTION_DATA_CHECKSUM_ERROR);
|
||||
#define ALLOC_AND_INIT(allocator, addr, args...) \
|
||||
do { \
|
||||
if (OB_SUCC(ret)) { \
|
||||
@ -6610,6 +6611,13 @@ int ObTablet::get_tablet_report_info_by_sstable(
|
||||
tablet_checksum.row_count_ = get_tablet_meta().report_status_.row_count_;
|
||||
tablet_checksum.data_checksum_ = get_tablet_meta().report_status_.data_checksum_;
|
||||
tablet_checksum.data_checksum_type_ = is_cs_replica_compat() ? ObDataChecksumType::DATA_CHECKSUM_COLUMN_STORE : ObDataChecksumType::DATA_CHECKSUM_NORMAL;
|
||||
#ifdef ERRSIM
|
||||
const ObTabletID errsim_tablet_id(-EN_COMPACTION_DATA_CHECKSUM_ERROR);
|
||||
if (get_tablet_id() == errsim_tablet_id) {
|
||||
tablet_checksum.data_checksum_ = get_tablet_meta().report_status_.data_checksum_ + GCTX.get_server_id();
|
||||
LOG_INFO("ERRSIM EN_COMPACTION_DATA_CHECKSUM_ERROR", K(errsim_tablet_id));
|
||||
}
|
||||
#endif
|
||||
LOG_INFO("success to get tablet report info", KR(ret), "tablet_id", get_tablet_id(), "report_status",
|
||||
tablet_meta_.report_status_, K(tablet_checksum));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user