fix blacklist cannot get weak_read_scn and migrate_status
This commit is contained in:
@ -293,25 +293,27 @@ int ObBLService::get_info_from_result_(sqlclient::ObMySQLResult &result, ObBLKey
|
|||||||
int64_t tenant_id = 0;
|
int64_t tenant_id = 0;
|
||||||
int64_t id = ObLSID::INVALID_LS_ID;
|
int64_t id = ObLSID::INVALID_LS_ID;
|
||||||
int64_t ls_role = -1;
|
int64_t ls_role = -1;
|
||||||
uint64_t weak_read_scn_uint = 0;
|
int64_t weak_read_scn = 0;
|
||||||
int64_t migrate_status_int = -1;
|
int64_t migrate_status_int = -1;
|
||||||
|
common::number::ObNumber weak_read_number;
|
||||||
|
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_varchar, "svr_ip", ip);
|
(void)GET_COL_IGNORE_NULL(result.get_varchar, "svr_ip", ip);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_int, "svr_port", port);
|
(void)GET_COL_IGNORE_NULL(result.get_int, "svr_port", port);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_int, "tenant_id", tenant_id);
|
(void)GET_COL_IGNORE_NULL(result.get_int, "tenant_id", tenant_id);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_int, "ls_id", id);
|
(void)GET_COL_IGNORE_NULL(result.get_int, "ls_id", id);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_int, "role", ls_role);
|
(void)GET_COL_IGNORE_NULL(result.get_int, "role", ls_role);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_uint, "weak_read_scn", weak_read_scn_uint);
|
(void)GET_COL_IGNORE_NULL(result.get_number, "weak_read_scn", weak_read_number);
|
||||||
(void)GET_COL_IGNORE_NULL(result.get_int, "migrate_status", migrate_status_int);
|
(void)GET_COL_IGNORE_NULL(result.get_int, "migrate_status", migrate_status_int);
|
||||||
|
|
||||||
ObLSID ls_id(id);
|
ObLSID ls_id(id);
|
||||||
common::ObAddr server;
|
common::ObAddr server;
|
||||||
int64_t weak_read_scn = static_cast<int64_t>(weak_read_scn_uint);
|
|
||||||
ObMigrateStatus migrate_status = ObMigrateStatus(migrate_status_int);
|
ObMigrateStatus migrate_status = ObMigrateStatus(migrate_status_int);
|
||||||
|
|
||||||
if (false == server.set_ip_addr(ip, static_cast<uint32_t>(port))) {
|
if (false == server.set_ip_addr(ip, static_cast<uint32_t>(port))) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
TRANS_LOG(WARN, "invalid server address", K(ip), K(port));
|
TRANS_LOG(WARN, "invalid server address", K(ip), K(port));
|
||||||
|
} else if (OB_FAIL(weak_read_number.cast_to_int64(weak_read_scn))) {
|
||||||
|
TRANS_LOG(WARN, "failed to cast int", K(ret), K(weak_read_number));
|
||||||
} else if (OB_FAIL(bl_key.init(server, tenant_id, ls_id))) {
|
} else if (OB_FAIL(bl_key.init(server, tenant_id, ls_id))) {
|
||||||
TRANS_LOG(WARN, "bl_key init fail", K(server), K(tenant_id), K(ls_id));
|
TRANS_LOG(WARN, "bl_key init fail", K(server), K(tenant_id), K(ls_id));
|
||||||
} else if (OB_FAIL(ls_info.init(ls_role, weak_read_scn, migrate_status))) {
|
} else if (OB_FAIL(ls_info.init(ls_role, weak_read_scn, migrate_status))) {
|
||||||
|
|||||||
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
// 查询 __all_virtual_ls_info 的语句,设置了2s超时时间
|
// 查询 __all_virtual_ls_info 的语句,设置了2s超时时间
|
||||||
#define BLACK_LIST_SELECT_LS_INFO_STMT \
|
#define BLACK_LIST_SELECT_LS_INFO_STMT \
|
||||||
"select /*+query_timeout(2000000)*/ a.svr_ip, a.svr_port, a.tenant_id, a.ls_id, a.role, nvl(b.weak_read_scn, 1), nvl(b.migrate_status, 0) \
|
"select /*+query_timeout(2000000)*/ a.svr_ip, a.svr_port, a.tenant_id, a.ls_id, a.role, \
|
||||||
|
nvl(b.weak_read_scn, 1) as weak_read_scn, nvl(b.migrate_status, 0) as migrate_status \
|
||||||
from oceanbase.__all_virtual_ls_meta_table a left join oceanbase.__all_virtual_ls_info b \
|
from oceanbase.__all_virtual_ls_meta_table a left join oceanbase.__all_virtual_ls_info b \
|
||||||
on a.svr_ip = b.svr_ip and a.svr_port = b.svr_port and a.tenant_id = b.tenant_id and a.ls_id = b.ls_id;"
|
on a.svr_ip = b.svr_ip and a.svr_port = b.svr_port and a.tenant_id = b.tenant_id and a.ls_id = b.ls_id;"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user