Return non empty shell tablet for READ_ALL_COMMITED mode

This commit is contained in:
JiahuaChen
2023-06-27 03:12:28 +00:00
committed by ob-robot
parent 89201c0a86
commit 3c5468522a
5 changed files with 6 additions and 27 deletions

View File

@ -325,7 +325,7 @@ TEST_F(TestTabletStatusCache, get_transfer_out_tablet)
// mode is READ_ALL_COMMITED, snapshot status is transfer out deleted, not allow to get
ret = ObTabletCreateDeleteHelper::check_and_get_tablet(key, tablet_handle, 1 * 1000 * 1000/*timeout_us*/,
ObMDSGetTabletMode::READ_ALL_COMMITED, ObTransVersion::MAX_TRANS_VERSION/*snapshot*/);
ASSERT_EQ(OB_TABLET_NOT_EXIST, ret);
ASSERT_EQ(OB_SUCCESS, ret);
// begin transfer out deleted transaction
user_data.tablet_status_ = ObTabletStatus::DELETED;

View File

@ -5719,27 +5719,6 @@ int ObTablet::check_new_mds_with_cache(
return ret;
}
int ObTablet::check_tablet_status_for_read_all_committed()
{
int ret = OB_SUCCESS;
const ObTabletID &tablet_id = get_tablet_meta().tablet_id_;
const ObLSID &ls_id = get_tablet_meta().ls_id_;
ObTabletCreateDeleteMdsUserData user_data;
if (OB_FAIL(get_tablet_status(share::SCN::max_scn(), user_data, 0/*timeout*/))) {
LOG_WARN("failed to get tablet status", K(ret), K(ls_id), K(tablet_id));
} else if (ObTabletStatus::NORMAL == user_data.tablet_status_
|| ObTabletStatus::TRANSFER_IN == user_data.tablet_status_
|| ObTabletStatus::TRANSFER_OUT == user_data.tablet_status_) {
// do nothing
} else {
ret = OB_TABLET_NOT_EXIST;
LOG_WARN("tablet does not exist", K(ret), K(ls_id), K(tablet_id), K(user_data));
}
return ret;
}
int ObTablet::set_tablet_status(
const ObTabletCreateDeleteMdsUserData &tablet_status,
mds::MdsCtx &ctx)

View File

@ -487,7 +487,6 @@ public:
mds::MdsDumpKV *&kv);
int check_new_mds_with_cache(const int64_t snapshot_version, const int64_t timeout);
int check_tablet_status_for_read_all_committed();
int check_schema_version_with_cache(const int64_t schema_version, const int64_t timeout);
int check_snapshot_readable_with_cache(const int64_t snapshot_version, const int64_t timeout);
int set_tablet_status(

View File

@ -26,8 +26,8 @@ namespace storage
isolation level in a database.
READ_ALL_COMMITED:
Read committed row after transaction committed, except deletion transaction.
Return tablet in NORMAL, TRANSFER_IN, TRANSFER_OUT status.
Read committed row after transaction committed, except empty shell.
Return tablet in NORMAL, TRANSFER_IN, TRANSFER_OUT, DELETED, TRANSFER_OUT_DELETED status.
Not return CREATING and DELETING who was abandoned from 4.2.
In addition, you should NOT pass read timeout under this mode.

View File

@ -114,8 +114,9 @@ int ObTabletCreateDeleteHelper::check_and_get_tablet(
if (OB_UNLIKELY(snapshot_version != ObTransVersion::MAX_TRANS_VERSION)) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("read all committed mode should only pass max scn", K(ret), K(key), K(mode), K(snapshot_version));
} else if (OB_FAIL(tablet->check_tablet_status_for_read_all_committed())) {
LOG_WARN("failed to check tablet status", K(ret), K(key));
} else if (OB_UNLIKELY(tablet->is_empty_shell())) {
ret = OB_TABLET_NOT_EXIST;
LOG_WARN("tablet is empty shell", K(ret), K(tablet->get_tablet_meta()));
}
} else if (ObMDSGetTabletMode::READ_READABLE_COMMITED == mode) {
if (OB_FAIL(tablet->check_new_mds_with_cache(snapshot_version, timeout_us))) {