Implement the transfer query test framework

This commit is contained in:
WenJinyu
2023-08-29 06:10:52 +00:00
committed by ob-robot
parent 13326df663
commit 6dae488704
6 changed files with 240 additions and 2 deletions

View File

@ -24,6 +24,118 @@ using namespace oceanbase::share::schema;
using namespace oceanbase::share;
#ifdef ERRSIM
static const char *OB_ERRSIM_POINT_TYPES[] = {
"POINT_NONE",
"START_BACKFILL_BEFORE",
"REPLACE_SWAP_BEFORE",
"REPLACE_AFTER",
};
void ObErrsimBackfillPointType::reset()
{
type_ = ObErrsimBackfillPointType::ERRSIM_POINT_NONE;
}
bool ObErrsimBackfillPointType::is_valid() const
{
return true;
}
bool ObErrsimBackfillPointType::operator == (const ObErrsimBackfillPointType &other) const
{
bool is_same = true;
if (this == &other) {
// same
} else {
is_same = type_ == other.type_;
}
return is_same;
}
int64_t ObErrsimBackfillPointType::hash() const
{
int64_t hash_value = 0;
hash_value = common::murmurhash(
&type_, sizeof(type_), hash_value);
return hash_value;
}
int ObErrsimBackfillPointType::hash(uint64_t &hash_val) const
{
hash_val = hash();
return OB_SUCCESS;
}
OB_SERIALIZE_MEMBER(ObErrsimBackfillPointType, type_);
ObErrsimTransferBackfillPoint::ObErrsimTransferBackfillPoint()
: point_type_(ObErrsimBackfillPointType::ERRSIM_MODULE_MAX),
point_start_time_(0)
{
}
ObErrsimTransferBackfillPoint::~ObErrsimTransferBackfillPoint()
{
}
bool ObErrsimTransferBackfillPoint::is_valid() const
{
return point_type_.is_valid() && point_start_time_ > 0;
}
int ObErrsimTransferBackfillPoint::set_point_type(const ObErrsimBackfillPointType &point_type)
{
int ret = OB_SUCCESS;
if (!point_type.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("point type is invalid", K(ret), K(point_type));
} else if (is_valid()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("The point type is in effect, reset is not allowed", K(ret), K(point_type_), K(point_type));
} else {
point_type_ = point_type;
}
return ret;
}
int ObErrsimTransferBackfillPoint::set_point_start_time(int64_t start_time)
{
int ret = OB_SUCCESS;
if (start_time < 0) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("point type is invalid", K(ret), K(start_time));
} else if (is_valid()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("The point type is in effect, reset is not allowed", K(ret), K(point_start_time_), K(start_time));
} else {
point_start_time_ = start_time;
}
return ret;
}
void ObErrsimTransferBackfillPoint::reset()
{
point_type_.type_ = ObErrsimBackfillPointType::ERRSIM_MODULE_MAX;
point_start_time_ = 0;
}
bool ObErrsimTransferBackfillPoint::is_errsim_point(const ObErrsimBackfillPointType &point_type) const
{
bool is_point = false;
if (!is_valid()) {
is_point = false;
} else if (point_type.type_ == point_type_.type_) {
is_point = true;
} else {
is_point = false;
}
return is_point;
}
#endif
OB_SERIALIZE_MEMBER(ObTabletReportStatus,
merge_snapshot_version_,
cur_report_version_,
@ -330,6 +442,9 @@ bool ObUpdateTableStoreParam::is_valid() const
ObBatchUpdateTableStoreParam::ObBatchUpdateTableStoreParam()
: tables_handle_(),
#ifdef ERRSIM
errsim_point_info_(),
#endif
rebuild_seq_(OB_INVALID_VERSION),
update_logical_minor_sstable_(false),
is_transfer_replace_(false),
@ -377,6 +492,9 @@ int ObBatchUpdateTableStoreParam::assign(
tablet_meta_ = param.tablet_meta_;
update_ddl_sstable_ = param.update_ddl_sstable_;
restore_status_ = param.restore_status_;
#ifdef ERRSIM
errsim_point_info_ = param.errsim_point_info_;
#endif
}
return ret;
}