fix check_ls_readable relay on blacklist
This commit is contained in:
@ -1136,24 +1136,32 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
|
|||||||
bool &can_read)
|
bool &can_read)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
can_read = true;
|
can_read = false;
|
||||||
|
|
||||||
if (!ls_id.is_valid()
|
if (!ls_id.is_valid()
|
||||||
|| !addr.is_valid()
|
|| !addr.is_valid()
|
||||||
|| max_stale_time_ns <= 0) {
|
|| max_stale_time_ns <= 0) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_ns));
|
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_ns));
|
||||||
} else {
|
} else if (observer::ObServer::get_instance().get_self() == addr) {
|
||||||
// distribute plan and check black list
|
storage::ObLSService *ls_svr = MTL(storage::ObLSService *);
|
||||||
ObBLKey blk;
|
storage::ObLSHandle handle;
|
||||||
bool in_black_list = false;
|
ObLS *ls = nullptr;
|
||||||
if (OB_FAIL(blk.init(addr, tenant_id, ls_id))) {
|
|
||||||
LOG_WARN("ObBLKey init error", K(ret), K(addr), K(tenant_id), K(ls_id));
|
if (OB_ISNULL(ls_svr)) {
|
||||||
} else if (OB_FAIL(ObBLService::get_instance().check_in_black_list(blk, in_black_list))) {
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("check in black list error", K(ret), K(blk));
|
LOG_WARN("log stream service is NULL", K(ret));
|
||||||
} else {
|
} else if (OB_FAIL(ls_svr->get_ls(ls_id, handle, ObLSGetMod::TRANS_MOD))) {
|
||||||
can_read = (in_black_list ? false : true);
|
LOG_WARN("get id service log stream failed");
|
||||||
|
} else if (OB_ISNULL(ls = handle.get_ls())) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("id service log stream not exist");
|
||||||
|
} else if (ObTimeUtility::current_time() - max_stale_time_ns / 1000
|
||||||
|
< ls->get_ls_wrs_handler()->get_ls_weak_read_ts().convert_to_ts()) {
|
||||||
|
can_read = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LOG_TRACE("log stream is not local", K(ls_id), K(addr));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#include "storage/ob_storage_struct.h" // ObMigrateStatus
|
#include "storage/ob_storage_struct.h" // ObMigrateStatus
|
||||||
|
|
||||||
// 定期更新黑名单的时间间隔(us)
|
// 定期更新黑名单的时间间隔(us)
|
||||||
#define BLACK_LIST_REFRESH_INTERVAL 5000000 // 5s
|
#define BLACK_LIST_REFRESH_INTERVAL 3000000 // 3s
|
||||||
// 判断时间戳是否赶上/落后的缓冲时间(ns),避免阈值附近的日志流反复加入/移出黑名单
|
// 判断时间戳是否赶上/落后的缓冲时间(ns),避免阈值附近的日志流反复加入/移出黑名单
|
||||||
#define BLACK_LIST_WHITEWASH_INTERVAL_NS 1000000000 // 1s
|
#define BLACK_LIST_WHITEWASH_INTERVAL_NS 1000000000 // 1s
|
||||||
// 黑名单信息打印时间间隔(us)
|
// 黑名单信息打印时间间隔(us)
|
||||||
|
|||||||
Reference in New Issue
Block a user