[CP] fix mds replay issue
This commit is contained in:
@ -2872,6 +2872,41 @@ TEST_F(TestTabletCreateDeleteHelper, migrate_lob_tablets)
|
|||||||
ASSERT_EQ(102, binding_info.lob_piece_tablet_id_.id());
|
ASSERT_EQ(102, binding_info.lob_piece_tablet_id_.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(TestTabletCreateDeleteHelper, tablet_not_exist_commit)
|
||||||
|
{
|
||||||
|
int ret = OB_SUCCESS;
|
||||||
|
|
||||||
|
ObMulSourceDataNotifyArg trans_flags;
|
||||||
|
trans_flags.for_replay_ = true;
|
||||||
|
trans_flags.tx_id_ = 1;
|
||||||
|
trans_flags.scn_ = share::SCN::minus(share::SCN::max_scn(), 888);
|
||||||
|
|
||||||
|
ObLSHandle ls_handle;
|
||||||
|
ObLSService *ls_svr = MTL(ObLSService*);
|
||||||
|
ret = ls_svr->get_ls(ls_id_, ls_handle, ObLSGetMod::STORAGE_MOD);
|
||||||
|
ASSERT_EQ(OB_SUCCESS, ret);
|
||||||
|
ObLS *ls = ls_handle.get_ls();
|
||||||
|
ObLSTabletService &ls_tablet_service = ls->ls_tablet_svr_;
|
||||||
|
|
||||||
|
// create data tablet
|
||||||
|
{
|
||||||
|
ObSArray<TabletInfo> array;
|
||||||
|
TabletInfo info;
|
||||||
|
info.data_tablet_id_ = 1;
|
||||||
|
info.index_tablet_id_array_.push_back(ObTabletID(2));
|
||||||
|
array.push_back(info);
|
||||||
|
|
||||||
|
ObBatchCreateTabletArg arg;
|
||||||
|
ret = TestTabletCreateDeleteHelper::build_create_mixed_tablet_arg(
|
||||||
|
ls_id_, array, arg);
|
||||||
|
ASSERT_EQ(OB_SUCCESS, ret);
|
||||||
|
|
||||||
|
// skip prepare and redo procedure
|
||||||
|
ret = ls_tablet_service.on_commit_create_tablets(arg, trans_flags);
|
||||||
|
ASSERT_EQ(OB_SUCCESS, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace storage
|
} // namespace storage
|
||||||
} // namespace oceanbase
|
} // namespace oceanbase
|
||||||
|
|
||||||
|
|||||||
@ -562,12 +562,7 @@ int ObTabletCreateDeleteHelper::commit_create_tablets(
|
|||||||
} else {
|
} else {
|
||||||
bool is_valid = true;
|
bool is_valid = true;
|
||||||
ObSArray<ObTabletCreateInfo> tablet_create_info_array;
|
ObSArray<ObTabletCreateInfo> tablet_create_info_array;
|
||||||
if (OB_FAIL(check_tablet_existence(arg, is_valid))) {
|
if (OB_FAIL(ObTabletBindingHelper::modify_tablet_binding_for_create(arg, ls_, trans_flags))) {
|
||||||
LOG_WARN("failed to check tablet existence", K(ret), K(PRINT_CREATE_ARG(arg)));
|
|
||||||
} else if (!is_valid) {
|
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
LOG_WARN("unexpected error, tablet does not exist", K(ret));
|
|
||||||
} else if (OB_FAIL(ObTabletBindingHelper::modify_tablet_binding_for_create(arg, ls_, trans_flags))) {
|
|
||||||
LOG_ERROR("failed to modify tablet binding", K(ret), K(trans_flags));
|
LOG_ERROR("failed to modify tablet binding", K(ret), K(trans_flags));
|
||||||
} else if (OB_FAIL(build_tablet_create_info(arg, tablet_create_info_array))) {
|
} else if (OB_FAIL(build_tablet_create_info(arg, tablet_create_info_array))) {
|
||||||
LOG_WARN("failed to build tablet create info", K(ret), K(PRINT_CREATE_ARG(arg)));
|
LOG_WARN("failed to build tablet create info", K(ret), K(PRINT_CREATE_ARG(arg)));
|
||||||
@ -590,12 +585,27 @@ int ObTabletCreateDeleteHelper::do_commit_create_tablets(
|
|||||||
ObIArray<ObTabletID> &tablet_id_array)
|
ObIArray<ObTabletID> &tablet_id_array)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
ObTabletHandle tablet_handle;
|
||||||
|
ObTabletMapKey key;
|
||||||
|
key.ls_id_ = arg.id_;
|
||||||
|
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); ++i) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); ++i) {
|
||||||
const ObCreateTabletInfo &info = arg.tablets_.at(i);
|
const ObCreateTabletInfo &info = arg.tablets_.at(i);
|
||||||
for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) {
|
for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) {
|
||||||
const ObTabletID &tablet_id = info.tablet_ids_.at(j);
|
const ObTabletID &tablet_id = info.tablet_ids_.at(j);
|
||||||
if (OB_FAIL(do_commit_create_tablet(tablet_id, trans_flags))) {
|
key.tablet_id_ = tablet_id;
|
||||||
|
if (OB_FAIL(get_tablet(key, tablet_handle))) {
|
||||||
|
if (OB_TABLET_NOT_EXIST == ret) {
|
||||||
|
if (trans_flags.for_replay_) {
|
||||||
|
ret = OB_SUCCESS;
|
||||||
|
LOG_INFO("tablet does not exist, maybe already deleted, skip commit", K(ret), K(key));
|
||||||
|
} else {
|
||||||
|
LOG_WARN("unexepected error, tablet does not exist", K(ret), K(key));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG_WARN("failed to get tablet", K(ret), K(key));
|
||||||
|
}
|
||||||
|
} else if (OB_FAIL(do_commit_create_tablet(tablet_id, trans_flags))) {
|
||||||
LOG_WARN("failed to do commit create tablet", K(ret), K(tablet_id), K(trans_flags));
|
LOG_WARN("failed to do commit create tablet", K(ret), K(tablet_id), K(trans_flags));
|
||||||
} else if (OB_FAIL(tablet_id_array.push_back(tablet_id))) {
|
} else if (OB_FAIL(tablet_id_array.push_back(tablet_id))) {
|
||||||
LOG_WARN("failed to push back tablet id", K(ret), K(tablet_id));
|
LOG_WARN("failed to push back tablet id", K(ret), K(tablet_id));
|
||||||
|
|||||||
Reference in New Issue
Block a user