remove order by field when get replica ckm in some situation
This commit is contained in:
@ -878,7 +878,8 @@ int ObChecksumValidator::get_replica_ckm(const bool include_larger_than/* = fals
|
|||||||
{
|
{
|
||||||
++statistics_.query_ckm_sql_cnt_;
|
++statistics_.query_ckm_sql_cnt_;
|
||||||
return ObTabletReplicaChecksumOperator::batch_get(tenant_id_, cur_tablet_ls_pair_array_, compaction_scn_,
|
return ObTabletReplicaChecksumOperator::batch_get(tenant_id_, cur_tablet_ls_pair_array_, compaction_scn_,
|
||||||
*sql_proxy_, replica_ckm_items_.array_, replica_ckm_items_.tablet_cnt_, include_larger_than);
|
*sql_proxy_, replica_ckm_items_.array_, replica_ckm_items_.tablet_cnt_, include_larger_than,
|
||||||
|
share::OBCG_DEFAULT, true/*with_order_by_field*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace rootserver
|
} // end namespace rootserver
|
||||||
|
|||||||
@ -475,32 +475,13 @@ int ObTabletReplicaChecksumOperator::get_tablets_replica_checksum(
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
int64_t tablet_items_cnt = 0;
|
int64_t tablet_items_cnt = 0;
|
||||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || pairs.empty())) {
|
tablet_replica_checksum_items.reuse();
|
||||||
|
const int64_t pairs_cnt = pairs.count();
|
||||||
|
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || pairs_cnt <= 0 || NULL == GCTX.sql_proxy_)) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid arguments", KR(ret), K(tenant_id), K(pairs));
|
LOG_WARN("invalid arguments", KR(ret), K(tenant_id), K(pairs), K(GCTX.sql_proxy_));
|
||||||
} else if (OB_FAIL(tablet_replica_checksum_items.reserve(pairs.count()))) {
|
} else if (OB_FAIL(tablet_replica_checksum_items.reserve(pairs.count()))) {
|
||||||
LOG_WARN("failed to reserve array", K(ret), K(pairs.count()));
|
LOG_WARN("failed to reserve array", K(ret), K(pairs.count()));
|
||||||
} else if (OB_FAIL(batch_get(tenant_id, pairs, *GCTX.sql_proxy_, tablet_replica_checksum_items, tablet_items_cnt))) {
|
|
||||||
LOG_WARN("fail to batch get tablet replica checksum items", KR(ret), K(tenant_id));
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObTabletReplicaChecksumOperator::batch_get(
|
|
||||||
const uint64_t tenant_id,
|
|
||||||
const ObIArray<compaction::ObTabletCheckInfo> &pairs,
|
|
||||||
ObISQLClient &sql_proxy,
|
|
||||||
ObIArray<ObTabletReplicaChecksumItem> &items,
|
|
||||||
int64_t &tablet_items_cnt)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
items.reset();
|
|
||||||
tablet_items_cnt = 0;
|
|
||||||
const int64_t pairs_cnt = pairs.count();
|
|
||||||
const int32_t group_id = share::OBCG_DEFAULT;
|
|
||||||
if (OB_UNLIKELY(pairs_cnt < 1 || OB_INVALID_TENANT_ID == tenant_id)) {
|
|
||||||
ret = OB_INVALID_ARGUMENT;
|
|
||||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(pairs_cnt));
|
|
||||||
} else {
|
} else {
|
||||||
int64_t start_idx = 0;
|
int64_t start_idx = 0;
|
||||||
int64_t end_idx = min(MAX_BATCH_COUNT, pairs_cnt);
|
int64_t end_idx = min(MAX_BATCH_COUNT, pairs_cnt);
|
||||||
@ -509,10 +490,14 @@ int ObTabletReplicaChecksumOperator::batch_get(
|
|||||||
int64_t tmp_tablet_items_cnt = 0;
|
int64_t tmp_tablet_items_cnt = 0;
|
||||||
sql.reuse();
|
sql.reuse();
|
||||||
if (OB_FAIL(construct_batch_get_sql_str_(tenant_id, SCN(), pairs, start_idx, end_idx, sql,
|
if (OB_FAIL(construct_batch_get_sql_str_(tenant_id, SCN(), pairs, start_idx, end_idx, sql,
|
||||||
false/*include_larger_than*/, false/*with_compaction_scn*/))) {
|
false/*include_larger_than*/, false/*with_compaction_scn*/,
|
||||||
|
false/*with_order_by_field*/))) {
|
||||||
LOG_WARN("fail to construct batch get sql", KR(ret), K(tenant_id), K(pairs),
|
LOG_WARN("fail to construct batch get sql", KR(ret), K(tenant_id), K(pairs),
|
||||||
K(start_idx), K(end_idx));
|
K(start_idx), K(end_idx));
|
||||||
} else if (OB_FAIL(inner_batch_get_by_sql_(tenant_id, sql, group_id, sql_proxy, items, tmp_tablet_items_cnt))) {
|
} else if (OB_FAIL(inner_batch_get_by_sql_(
|
||||||
|
tenant_id, sql, share::OBCG_DEFAULT /*group_id*/,
|
||||||
|
*GCTX.sql_proxy_, tablet_replica_checksum_items,
|
||||||
|
tmp_tablet_items_cnt))) {
|
||||||
LOG_WARN("fail to inner batch get by sql", KR(ret), K(tenant_id), K(sql));
|
LOG_WARN("fail to inner batch get by sql", KR(ret), K(tenant_id), K(sql));
|
||||||
} else {
|
} else {
|
||||||
start_idx = end_idx;
|
start_idx = end_idx;
|
||||||
@ -520,21 +505,13 @@ int ObTabletReplicaChecksumOperator::batch_get(
|
|||||||
tablet_items_cnt += tmp_tablet_items_cnt;
|
tablet_items_cnt += tmp_tablet_items_cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (OB_SUCC(ret)) {
|
||||||
|
LOG_TRACE("success to get tablet replica checksum items", KR(ret), K(pairs_cnt), K(tablet_items_cnt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObTabletReplicaChecksumOperator::batch_get(
|
|
||||||
const uint64_t tenant_id,
|
|
||||||
const common::ObIArray<ObTabletLSPair> &pairs,
|
|
||||||
const SCN &compaction_scn,
|
|
||||||
common::ObISQLClient &sql_proxy,
|
|
||||||
common::ObIArray<ObTabletReplicaChecksumItem> &items)
|
|
||||||
{
|
|
||||||
int64_t tablet_items_cnt = 0;
|
|
||||||
return batch_get(tenant_id, pairs, compaction_scn, sql_proxy, items, tablet_items_cnt, false/*include_larger_than*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObTabletReplicaChecksumOperator::batch_get(
|
int ObTabletReplicaChecksumOperator::batch_get(
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const ObIArray<ObTabletLSPair> &pairs,
|
const ObIArray<ObTabletLSPair> &pairs,
|
||||||
@ -543,7 +520,8 @@ int ObTabletReplicaChecksumOperator::batch_get(
|
|||||||
ObIArray<ObTabletReplicaChecksumItem> &items,
|
ObIArray<ObTabletReplicaChecksumItem> &items,
|
||||||
int64_t &tablet_items_cnt,
|
int64_t &tablet_items_cnt,
|
||||||
const bool include_larger_than,
|
const bool include_larger_than,
|
||||||
const int32_t group_id)
|
const int32_t group_id,
|
||||||
|
const bool with_order_by_field)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
items.reset();
|
items.reset();
|
||||||
@ -561,7 +539,8 @@ int ObTabletReplicaChecksumOperator::batch_get(
|
|||||||
sql.reuse();
|
sql.reuse();
|
||||||
int64_t tmp_tablet_items_cnt = 0;
|
int64_t tmp_tablet_items_cnt = 0;
|
||||||
if (OB_FAIL(construct_batch_get_sql_str_(tenant_id, compaction_scn, pairs, start_idx, end_idx,
|
if (OB_FAIL(construct_batch_get_sql_str_(tenant_id, compaction_scn, pairs, start_idx, end_idx,
|
||||||
sql, include_larger_than, true/*with_compaction_scn*/))) {
|
sql, include_larger_than, true/*with_compaction_scn*/,
|
||||||
|
with_order_by_field))) {
|
||||||
LOG_WARN("fail to construct batch get sql", KR(ret), K(tenant_id), K(compaction_scn), K(pairs),
|
LOG_WARN("fail to construct batch get sql", KR(ret), K(tenant_id), K(compaction_scn), K(pairs),
|
||||||
K(start_idx), K(end_idx));
|
K(start_idx), K(end_idx));
|
||||||
} else if (OB_FAIL(inner_batch_get_by_sql_(tenant_id, sql, group_id, sql_proxy, items, tmp_tablet_items_cnt))) {
|
} else if (OB_FAIL(inner_batch_get_by_sql_(tenant_id, sql, group_id, sql_proxy, items, tmp_tablet_items_cnt))) {
|
||||||
@ -809,7 +788,8 @@ int ObTabletReplicaChecksumOperator::get_tablet_replica_checksum_items(
|
|||||||
} else {
|
} else {
|
||||||
int64_t tablet_items_cnt = 0;
|
int64_t tablet_items_cnt = 0;
|
||||||
if (OB_FAIL(batch_get(tenant_id, tablet_pairs, compaction_scn,
|
if (OB_FAIL(batch_get(tenant_id, tablet_pairs, compaction_scn,
|
||||||
sql_proxy, items, tablet_items_cnt, false/*include_larger_than*/))) {
|
sql_proxy, items, tablet_items_cnt, false/*include_larger_than*/,
|
||||||
|
share::OBCG_DEFAULT, true/*with_order_by_field*/))) {
|
||||||
LOG_WARN("fail to batch get tablet checksum item", KR(ret), K(tenant_id), K(compaction_scn),
|
LOG_WARN("fail to batch get tablet checksum item", KR(ret), K(tenant_id), K(compaction_scn),
|
||||||
"pairs_count", tablet_pairs.count());
|
"pairs_count", tablet_pairs.count());
|
||||||
} else if (tablet_items_cnt < tablet_pairs.count()) {
|
} else if (tablet_items_cnt < tablet_pairs.count()) {
|
||||||
|
|||||||
@ -115,14 +115,9 @@ public:
|
|||||||
common::ObISQLClient &sql_proxy,
|
common::ObISQLClient &sql_proxy,
|
||||||
common::ObIArray<ObTabletReplicaChecksumItem> &items,
|
common::ObIArray<ObTabletReplicaChecksumItem> &items,
|
||||||
int64_t &tablet_items_cnt,
|
int64_t &tablet_items_cnt,
|
||||||
const bool include_larger_than = false,
|
const bool include_larger_than,
|
||||||
const int32_t group_id = 0);
|
const int32_t group_id,
|
||||||
static int batch_get(
|
const bool with_order_by_field);
|
||||||
const uint64_t tenant_id,
|
|
||||||
const common::ObIArray<ObTabletLSPair> &pairs,
|
|
||||||
const SCN &compaction_scn,
|
|
||||||
common::ObISQLClient &sql_proxy,
|
|
||||||
common::ObIArray<ObTabletReplicaChecksumItem> &items);
|
|
||||||
static int batch_update_with_trans(
|
static int batch_update_with_trans(
|
||||||
common::ObMySQLTransaction &trans,
|
common::ObMySQLTransaction &trans,
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
@ -156,12 +151,6 @@ public:
|
|||||||
common::ObString &column_meta_hex_str);
|
common::ObString &column_meta_hex_str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int batch_get(
|
|
||||||
const uint64_t tenant_id,
|
|
||||||
const ObIArray<compaction::ObTabletCheckInfo> &pairs,
|
|
||||||
ObISQLClient &sql_proxy,
|
|
||||||
ObIArray<ObTabletReplicaChecksumItem> &items,
|
|
||||||
int64_t &tablet_items_cnt);
|
|
||||||
static int batch_insert_or_update_with_trans_(
|
static int batch_insert_or_update_with_trans_(
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const common::ObIArray<ObTabletReplicaChecksumItem> &items,
|
const common::ObIArray<ObTabletReplicaChecksumItem> &items,
|
||||||
@ -200,7 +189,8 @@ private:
|
|||||||
const int64_t end_idx,
|
const int64_t end_idx,
|
||||||
common::ObSqlString &sql,
|
common::ObSqlString &sql,
|
||||||
const bool include_larger_than,
|
const bool include_larger_than,
|
||||||
const bool with_compaction_scn);
|
const bool with_compaction_scn,
|
||||||
|
const bool with_order_by_field);
|
||||||
|
|
||||||
static int construct_tablet_replica_checksum_items_(
|
static int construct_tablet_replica_checksum_items_(
|
||||||
common::sqlclient::ObMySQLResult &res,
|
common::sqlclient::ObMySQLResult &res,
|
||||||
@ -234,7 +224,8 @@ int ObTabletReplicaChecksumOperator::construct_batch_get_sql_str_(
|
|||||||
const int64_t end_idx,
|
const int64_t end_idx,
|
||||||
ObSqlString &sql,
|
ObSqlString &sql,
|
||||||
const bool include_larger_than,
|
const bool include_larger_than,
|
||||||
const bool with_compaction_scn)
|
const bool with_compaction_scn,
|
||||||
|
const bool with_order_by_field)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
const int64_t pairs_cnt = pairs.count();
|
const int64_t pairs_cnt = pairs.count();
|
||||||
@ -271,7 +262,8 @@ int ObTabletReplicaChecksumOperator::construct_batch_get_sql_str_(
|
|||||||
SHARE_LOG(WARN, "fail to assign sql", KR(ret), K(tenant_id), K(compaction_scn));
|
SHARE_LOG(WARN, "fail to assign sql", KR(ret), K(tenant_id), K(compaction_scn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FAILEDx(sql.append_fmt(" ORDER BY FIELD(tablet_id%s)", order_by_sql.string().ptr()))) {
|
if (OB_FAIL(ret) || !with_order_by_field) {
|
||||||
|
} else if (OB_FAIL(sql.append_fmt(" ORDER BY FIELD(tablet_id%s)", order_by_sql.string().ptr()))) {
|
||||||
SHARE_LOG(WARN, "fail to assign sql string", KR(ret), K(tenant_id), K(compaction_scn), K(pairs_cnt));
|
SHARE_LOG(WARN, "fail to assign sql string", KR(ret), K(tenant_id), K(compaction_scn), K(pairs_cnt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1118,7 +1118,6 @@ int ObMediumCompactionScheduleFunc::check_medium_checksum(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ObMediumCompactionScheduleFunc::batch_check_medium_checksum(
|
int ObMediumCompactionScheduleFunc::batch_check_medium_checksum(
|
||||||
const ObIArray<ObTabletCheckInfo> &tablet_ls_infos,
|
|
||||||
const ObIArray<ObTabletReplicaChecksumItem> &checksum_items)
|
const ObIArray<ObTabletReplicaChecksumItem> &checksum_items)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
@ -1126,18 +1125,14 @@ int ObMediumCompactionScheduleFunc::batch_check_medium_checksum(
|
|||||||
int check_ret = OB_SUCCESS;
|
int check_ret = OB_SUCCESS;
|
||||||
int64_t pair_idx = 0;
|
int64_t pair_idx = 0;
|
||||||
int64_t item_idx = 0;
|
int64_t item_idx = 0;
|
||||||
int64_t pairs_cnt = tablet_ls_infos.count();
|
|
||||||
int64_t items_cnt = checksum_items.count();
|
int64_t items_cnt = checksum_items.count();
|
||||||
int64_t affected_rows = 0;
|
int64_t affected_rows = 0;
|
||||||
ObSEArray<ObTabletLSPair, 64> error_pairs;
|
ObSEArray<ObTabletLSPair, 64> error_pairs;
|
||||||
while (OB_SUCC(ret) && pair_idx < pairs_cnt && item_idx < items_cnt) {
|
while (OB_SUCC(ret) && item_idx < items_cnt) {
|
||||||
const ObTabletReplicaChecksumItem &tmp_item = checksum_items.at(item_idx);
|
const ObTabletReplicaChecksumItem &tmp_item = checksum_items.at(item_idx);
|
||||||
const ObTabletID &tablet_id = tablet_ls_infos.at(pair_idx).get_tablet_id();
|
const ObTabletID &tablet_id = tmp_item.tablet_id_;
|
||||||
const ObLSID &ls_id = tablet_ls_infos.at(pair_idx).get_ls_id();
|
const ObLSID &ls_id = tmp_item.ls_id_;
|
||||||
if (tmp_item.tablet_id_ != tablet_id || tmp_item.ls_id_ != ls_id) {
|
if (OB_FAIL(check_medium_checksum(checksum_items, error_pairs, item_idx, check_ret))) {
|
||||||
LOG_TRACE("tablet replica checksum item not exist in tablet replica checksum table",
|
|
||||||
KR(ret), K(tablet_id), K(ls_id));
|
|
||||||
} else if (OB_FAIL(check_medium_checksum(checksum_items, error_pairs, item_idx, check_ret))) {
|
|
||||||
LOG_WARN("failed to check medium checksum", K(ret), K(item_idx));
|
LOG_WARN("failed to check medium checksum", K(ret), K(item_idx));
|
||||||
} else if (OB_SUCCESS == check_ret) {
|
} else if (OB_SUCCESS == check_ret) {
|
||||||
ObLSHandle ls_handle;
|
ObLSHandle ls_handle;
|
||||||
@ -1192,11 +1187,12 @@ int ObMediumCompactionScheduleFunc::batch_check_medium_finish(
|
|||||||
MTL_ID(), finish_tablet_ls_infos, checksum_items))) {
|
MTL_ID(), finish_tablet_ls_infos, checksum_items))) {
|
||||||
LOG_WARN("failed to get tablet checksum", K(ret));
|
LOG_WARN("failed to get tablet checksum", K(ret));
|
||||||
} else if (FALSE_IT(time_guard.click(ObCompactionScheduleTimeGuard::SEARCH_CHECKSUM))) {
|
} else if (FALSE_IT(time_guard.click(ObCompactionScheduleTimeGuard::SEARCH_CHECKSUM))) {
|
||||||
} else if (OB_FAIL(batch_check_medium_checksum(finish_tablet_ls_infos, checksum_items))) {
|
} else if (OB_FAIL(batch_check_medium_checksum(checksum_items))) {
|
||||||
LOG_WARN("failed to check medium tablets checksum", K(ret));
|
LOG_WARN("failed to check medium tablets checksum", K(ret));
|
||||||
} else if (FALSE_IT(time_guard.click(ObCompactionScheduleTimeGuard::CHECK_CHECKSUM))) {
|
} else if (FALSE_IT(time_guard.click(ObCompactionScheduleTimeGuard::CHECK_CHECKSUM))) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO, sort tablet ls pair first
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,6 @@ protected:
|
|||||||
int64_t &item_idx,
|
int64_t &item_idx,
|
||||||
int &check_ret);
|
int &check_ret);
|
||||||
static int batch_check_medium_checksum(
|
static int batch_check_medium_checksum(
|
||||||
const ObIArray<ObTabletCheckInfo> &tablet_ls_infos,
|
|
||||||
const ObIArray<ObTabletReplicaChecksumItem> &checksum_items);
|
const ObIArray<ObTabletReplicaChecksumItem> &checksum_items);
|
||||||
int choose_medium_snapshot(
|
int choose_medium_snapshot(
|
||||||
const int64_t max_sync_medium_scn,
|
const int64_t max_sync_medium_scn,
|
||||||
|
|||||||
@ -196,7 +196,8 @@ int ObStorageHAUtils::check_tablet_replica_checksum_(const uint64_t tenant_id, c
|
|||||||
} else if (OB_FAIL(pairs.push_back(pair))) {
|
} else if (OB_FAIL(pairs.push_back(pair))) {
|
||||||
LOG_WARN("failed to push back", K(ret), K(pair));
|
LOG_WARN("failed to push back", K(ret), K(pair));
|
||||||
} else if (OB_FAIL(ObTabletReplicaChecksumOperator::batch_get(tenant_id, pairs, compaction_scn,
|
} else if (OB_FAIL(ObTabletReplicaChecksumOperator::batch_get(tenant_id, pairs, compaction_scn,
|
||||||
sql_client, items, tablet_items_cnt, false/*include_larger_than*/, share::OBCG_STORAGE/*group_id*/))) {
|
sql_client, items, tablet_items_cnt, false/*include_larger_than*/, share::OBCG_STORAGE/*group_id*/,
|
||||||
|
false/*with_order_by_field*/))) {
|
||||||
LOG_WARN("failed to batch get replica checksum item", K(ret), K(tenant_id), K(pairs), K(compaction_scn));
|
LOG_WARN("failed to batch get replica checksum item", K(ret), K(tenant_id), K(pairs), K(compaction_scn));
|
||||||
} else {
|
} else {
|
||||||
ObArray<share::ObTabletReplicaChecksumItem> filter_items;
|
ObArray<share::ObTabletReplicaChecksumItem> filter_items;
|
||||||
|
|||||||
Reference in New Issue
Block a user