get tablet with timeout
This commit is contained in:
committed by
wangzelin.wzl
parent
16fc3d31e2
commit
ed83a15813
@ -32,7 +32,7 @@ public:
|
|||||||
static const int64_t DEFAULT_ITERATOR_TABLET_ID_CNT = 128;
|
static const int64_t DEFAULT_ITERATOR_TABLET_ID_CNT = 128;
|
||||||
static const int64_t BUCKET_LOCK_BUCKET_CNT = 10243L;
|
static const int64_t BUCKET_LOCK_BUCKET_CNT = 10243L;
|
||||||
static const int64_t TABLET_ID_SET_BUCKET_CNT = 10243L;
|
static const int64_t TABLET_ID_SET_BUCKET_CNT = 10243L;
|
||||||
static const int64_t MAX_GET_TABLET_DURATION_US = 1 * 1000 * 1000; // 1s
|
static const int64_t DEFAULT_GET_TABLET_DURATION_US = 1 * 1000 * 1000; // 1s
|
||||||
|
|
||||||
static const int64_t FINAL_TX_ID = 0;
|
static const int64_t FINAL_TX_ID = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1358,7 +1358,10 @@ int ObTabletCreateDeleteHelper::tx_end_remove_tablets(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObTabletCreateDeleteHelper::get_tablet(const ObTabletMapKey &key, ObTabletHandle &handle)
|
int ObTabletCreateDeleteHelper::get_tablet(
|
||||||
|
const ObTabletMapKey &key,
|
||||||
|
ObTabletHandle &handle,
|
||||||
|
const int64_t timeout_us)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
static const int64_t SLEEP_TIME_US = 10;
|
static const int64_t SLEEP_TIME_US = 10;
|
||||||
@ -1376,9 +1379,9 @@ int ObTabletCreateDeleteHelper::get_tablet(const ObTabletMapKey &key, ObTabletHa
|
|||||||
LOG_DEBUG("tablet does not exist", K(ret), K(key));
|
LOG_DEBUG("tablet does not exist", K(ret), K(key));
|
||||||
} else if (OB_ITEM_NOT_SETTED == ret) {
|
} else if (OB_ITEM_NOT_SETTED == ret) {
|
||||||
current_time = ObTimeUtility::current_time();
|
current_time = ObTimeUtility::current_time();
|
||||||
if (current_time - begin_time > ObTabletCommon::MAX_GET_TABLET_DURATION_US) {
|
if (current_time - begin_time > timeout_us) {
|
||||||
LOG_WARN("continuously meet item not set error", K(ret), K(begin_time), K(current_time));
|
ret = OB_TABLET_NOT_EXIST;
|
||||||
break;
|
LOG_WARN("continuously meet item not set error", K(ret), K(begin_time), K(current_time), K(timeout_us));
|
||||||
} else {
|
} else {
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
ob_usleep(SLEEP_TIME_US);
|
ob_usleep(SLEEP_TIME_US);
|
||||||
@ -1406,11 +1409,11 @@ int ObTabletCreateDeleteHelper::check_and_get_tablet(
|
|||||||
ObTimeGuard time_guard(__func__, 5 * 1000 * 1000); // 5s
|
ObTimeGuard time_guard(__func__, 5 * 1000 * 1000); // 5s
|
||||||
|
|
||||||
// TODO(bowen.gbw): optimize this logic, refactor ObTabletStatusChecker
|
// TODO(bowen.gbw): optimize this logic, refactor ObTabletStatusChecker
|
||||||
if (OB_FAIL(get_tablet(key, tablet_handle))) {
|
if (OB_FAIL(get_tablet(key, tablet_handle, timeout_us))) {
|
||||||
if (OB_TABLET_NOT_EXIST == ret) {
|
if (OB_TABLET_NOT_EXIST == ret) {
|
||||||
LOG_DEBUG("tablet does not exist", K(ret), K(key));
|
LOG_DEBUG("tablet does not exist", K(ret), K(key), K(timeout_us));
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("failed to get tablet", K(ret), K(key));
|
LOG_WARN("failed to get tablet", K(ret), K(key), K(timeout_us));
|
||||||
}
|
}
|
||||||
} else if (FALSE_IT(time_guard.click("DirectGet"))) {
|
} else if (FALSE_IT(time_guard.click("DirectGet"))) {
|
||||||
} else if (tablet_handle.get_obj()->is_ls_inner_tablet()) {
|
} else if (tablet_handle.get_obj()->is_ls_inner_tablet()) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "storage/memtable/ob_memtable.h"
|
#include "storage/memtable/ob_memtable.h"
|
||||||
#include "storage/meta_mem/ob_tablet_handle.h"
|
#include "storage/meta_mem/ob_tablet_handle.h"
|
||||||
#include "storage/tablet/ob_tablet_status.h"
|
#include "storage/tablet/ob_tablet_status.h"
|
||||||
|
#include "storage/tablet/ob_tablet_common.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -116,7 +117,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
static int get_tablet(
|
static int get_tablet(
|
||||||
const ObTabletMapKey &key,
|
const ObTabletMapKey &key,
|
||||||
ObTabletHandle &handle);
|
ObTabletHandle &handle,
|
||||||
|
const int64_t timeout_us = ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US);
|
||||||
static int check_and_get_tablet(
|
static int check_and_get_tablet(
|
||||||
const ObTabletMapKey &key,
|
const ObTabletMapKey &key,
|
||||||
ObTabletHandle &handle,
|
ObTabletHandle &handle,
|
||||||
|
|||||||
Reference in New Issue
Block a user