avoid deep copy when construct the tablet_to_ls map
This commit is contained in:
@ -672,6 +672,7 @@ int ObBackupSetTaskMgr::do_check_inc_tablets_(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObAddr dst_server;
|
||||
const int64_t batch_size = 2048;
|
||||
if (!ls_id.is_valid() || inc_tablets.empty()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("[DATA_BACKUP]invalid argument", K(ret), K(ls_id), K(inc_tablets));
|
||||
@ -682,14 +683,19 @@ int ObBackupSetTaskMgr::do_check_inc_tablets_(
|
||||
arg.tenant_id_ = set_task_attr_.tenant_id_;
|
||||
arg.ls_id_ = ls_id;
|
||||
arg.backup_scn_ = backup_scn;
|
||||
if (OB_FAIL(append(arg.tablet_ids_, inc_tablets))) {
|
||||
LOG_WARN("[DATA_BACKUP]append inc tablets", K(ret), K(inc_tablets));
|
||||
} else if (OB_FAIL(rpc_proxy_->to(dst_server).check_not_backup_tablet_create_scn(arg))) {
|
||||
ARRAY_FOREACH(inc_tablets, i) {
|
||||
arg.tablet_ids_.reset();
|
||||
if (OB_FAIL(arg.tablet_ids_.push_back(inc_tablets.at(i)))) {
|
||||
LOG_WARN("failed to push back", K(ret));
|
||||
} else if (arg.tablet_ids_.count() == batch_size || inc_tablets.count() - 1 == i) {
|
||||
if (OB_FAIL(rpc_proxy_->to(dst_server).check_not_backup_tablet_create_scn(arg))) {
|
||||
LOG_WARN("[DATA_BACKUP]fail to send backup check tablet rpc", K(ret), K(arg), K(dst_server));
|
||||
} else {
|
||||
FLOG_INFO("[DATA_BACKUP]succeed send backup check tablet rpc", K(arg), K(dst_server));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1068,25 +1068,22 @@ int ObBackupTabletToLSOperator::do_parse_tablet_ls_pairs_(const ObIArray<share::
|
||||
common::hash::ObHashMap<ObLSID, ObArray<ObTabletID>> &tablet_to_ls, ObTabletID &max_tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArray<ObTabletID> tablet_ids;
|
||||
ObTabletID tmp_max_tablet_id(ObTabletID::MIN_USER_TABLET_ID);
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tablet_ls_pairs.count(); ++i) {
|
||||
tablet_ids.reset();
|
||||
const ObTabletLSPair &tablet_ls_pair = tablet_ls_pairs.at(i);
|
||||
ObLSID ls_id = tablet_ls_pair.get_ls_id();
|
||||
tmp_max_tablet_id = std::max(tmp_max_tablet_id.id(), tablet_ls_pair.get_tablet_id().id());
|
||||
if (OB_FAIL(tablet_to_ls.get_refactored(tablet_ls_pair.get_ls_id(), tablet_ids))) {
|
||||
if (ret == OB_HASH_NOT_EXIST) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get ls id", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(tablet_ids.push_back(tablet_ls_pair.get_tablet_id()))) {
|
||||
LOG_WARN("fail to append tablet ids", K(ret));
|
||||
} else if (OB_FAIL(tablet_to_ls.set_refactored(tablet_ls_pair.get_ls_id(), tablet_ids, 1))) {
|
||||
ObArray<ObTabletID> *tablet_ids = nullptr;
|
||||
if (OB_ISNULL(tablet_ids = tablet_to_ls.get(ls_id))) {
|
||||
ObArray<ObTabletID> cur_tablet_ids;
|
||||
if (OB_FAIL(cur_tablet_ids.push_back(tablet_ls_pair.get_tablet_id()))) {
|
||||
LOG_WARN("failed to push back tablet ls pair", K(ret));
|
||||
} else if (OB_FAIL(tablet_to_ls.set_refactored(tablet_ls_pair.get_ls_id(), cur_tablet_ids, 1))) {
|
||||
LOG_WARN("failed to set ls id", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(tablet_ids->push_back(tablet_ls_pair.get_tablet_id()))) {
|
||||
LOG_WARN("fail to append tablet ids", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
max_tablet_id = tmp_max_tablet_id;
|
||||
|
Reference in New Issue
Block a user