[FEAT MERGE][CP]SQL Query Interface enhancements 423
Co-authored-by: yaojing624 <jingfeng.jf@oceanbase.com> Co-authored-by: GongYusen <986957406@qq.com>
This commit is contained in:
parent
c82c2fbef7
commit
90894fc6ba
3
deps/oblib/src/lib/ob_name_def.h
vendored
3
deps/oblib/src/lib/ob_name_def.h
vendored
@ -1122,6 +1122,9 @@
|
||||
#define N_ST_SYMDIFFERENCE "st_symdifference"
|
||||
#define N_PRIV_ST_ASMVTGEOM "_st_asmvtgeom"
|
||||
#define N_PRIV_ST_MAKEVALID "_st_makevalid"
|
||||
#define N_DECODE_TRACE_ID "decode_trace_id"
|
||||
#define N_PRIV_ST_GEOHASH "_st_geohash"
|
||||
#define N_PRIV_ST_MAKEPOINT "_st_makepoint"
|
||||
#define N_CAN_ACCESS_TRIGGER "can_access_trigger"
|
||||
#define N_SDO_RELATE "sdo_relate"
|
||||
#define N_INNER_TABLE_OPTION_PRINTER "inner_table_option_printer"
|
||||
|
@ -104,6 +104,8 @@ ob_set_subtarget(ob_server mysql
|
||||
mysql/obsm_utils.cpp
|
||||
mysql/obmp_set_option.cpp
|
||||
mysql/ob_feedback_proxy_utils.cpp
|
||||
mysql/ob_dl_queue.cpp
|
||||
mysql/ob_construct_queue.cpp
|
||||
)
|
||||
|
||||
ob_set_subtarget(ob_server net
|
||||
@ -444,6 +446,7 @@ ob_set_subtarget(ob_server virtual_table
|
||||
virtual_table/ob_all_virtual_sys_variable_default_value.cpp
|
||||
virtual_table/ob_all_virtual_tenant_scheduler_running_job.cpp
|
||||
virtual_table/ob_all_virtual_compatibility_control.cpp
|
||||
virtual_table/ob_all_virtual_session_ps_info.cpp
|
||||
)
|
||||
|
||||
ob_server_add_target(ob_server)
|
||||
|
67
src/observer/mysql/ob_construct_queue.cpp
Normal file
67
src/observer/mysql/ob_construct_queue.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SERVER
|
||||
|
||||
#include "ob_eliminate_task.h"
|
||||
#include "ob_mysql_request_manager.h"
|
||||
#include "ob_construct_queue.h"
|
||||
|
||||
using namespace oceanbase::obmysql;
|
||||
|
||||
ObConstructQueueTask::ObConstructQueueTask()
|
||||
:request_manager_(NULL),
|
||||
is_tp_trigger_(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ObConstructQueueTask::~ObConstructQueueTask()
|
||||
{
|
||||
request_manager_ = NULL;
|
||||
is_tp_trigger_ = false;
|
||||
}
|
||||
|
||||
int ObConstructQueueTask::init(const ObMySQLRequestManager *request_manager)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(request_manager)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(request_manager_), K(ret));
|
||||
} else {
|
||||
request_manager_ = const_cast<ObMySQLRequestManager*>(request_manager);
|
||||
disable_timeout_check();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObConstructQueueTask::runTimerTask()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
// for testing hung scene
|
||||
int64_t code = 0;
|
||||
code = OB_E(EventTable::EN_SQL_AUDIT_CONSTRUCT_BACK_THREAD_STUCK) OB_SUCCESS;
|
||||
if (OB_UNLIKELY(OB_SUCCESS != code && is_tp_trigger_)) {
|
||||
sleep(abs(code));
|
||||
LOG_INFO("Construct sleep", K(abs(code)));
|
||||
is_tp_trigger_ = false;
|
||||
} else if (OB_SUCCESS == code) {
|
||||
is_tp_trigger_ = true;
|
||||
}
|
||||
|
||||
if (OB_ISNULL(request_manager_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(request_manager_), K(ret));
|
||||
} else if (OB_FAIL(request_manager_->get_queue().prepare_alloc_queue())) {
|
||||
LOG_WARN("fail to prepare alloc queue", K(ret));
|
||||
}
|
||||
}
|
41
src/observer/mysql/ob_construct_queue.h
Normal file
41
src/observer/mysql/ob_construct_queue.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OB_CONSTRUCT_QUEUE_
|
||||
#define OB_CONSTRUCT_QUEUE_
|
||||
|
||||
#include "lib/task/ob_timer.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace obmysql
|
||||
{
|
||||
|
||||
class ObMySQLRequestManager;
|
||||
|
||||
class ObConstructQueueTask : public common::ObTimerTask
|
||||
{
|
||||
public:
|
||||
ObConstructQueueTask();
|
||||
virtual ~ObConstructQueueTask();
|
||||
|
||||
void runTimerTask();
|
||||
int init(const ObMySQLRequestManager *request_manager);
|
||||
|
||||
private:
|
||||
ObMySQLRequestManager *request_manager_;
|
||||
bool is_tp_trigger_;
|
||||
};
|
||||
|
||||
} // end of namespace obmysql
|
||||
} // end of namespace oceanbase
|
||||
#endif /* OB_CONSTRUCT_QUEUE_ */
|
327
src/observer/mysql/ob_dl_queue.cpp
Normal file
327
src/observer/mysql/ob_dl_queue.cpp
Normal file
@ -0,0 +1,327 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SERVER
|
||||
|
||||
#include "ob_dl_queue.h"
|
||||
#include "ob_mysql_request_manager.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
|
||||
int ObDlQueue::init(const char *label, uint64_t tenant_id) {
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(rq_.init(label, ROOT_QUEUE_SIZE, tenant_id))) {
|
||||
LOG_WARN("fail to init root queue", K(tenant_id));
|
||||
} else {
|
||||
rq_cur_idx_ = 0;
|
||||
start_idx_ = 0;
|
||||
end_idx_ = 0;
|
||||
tenant_id_ = tenant_id;
|
||||
}
|
||||
|
||||
// construct default leaf queue
|
||||
if (OB_FAIL(ret)) {
|
||||
} else {
|
||||
for (int64_t i = 0; i < DEFAULT_IDLE_LEAF_QUEUE_NUM && OB_SUCC(ret); i++) {
|
||||
if (OB_FAIL(construct_leaf_queue())) {
|
||||
LOG_WARN("fail to construct leaf queue", K(i), K(tenant_id_));
|
||||
} else {
|
||||
LOG_INFO("construct leaf queue idx succ", K(rq_.get_push_idx()), K(tenant_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDlQueue::prepare_alloc_queue() {
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t construct_num = DEFAULT_IDLE_LEAF_QUEUE_NUM -
|
||||
(get_push_idx() - get_cur_idx());
|
||||
LOG_INFO("Construct Queue Num", K(construct_num),
|
||||
K(get_push_idx()), K(get_cur_idx()), K(get_pop_idx()));
|
||||
for (int64_t i = 0; i < construct_num && OB_SUCC(ret); i++) {
|
||||
if (OB_FAIL(construct_leaf_queue())) {
|
||||
LOG_WARN("fail to construct leaf queue", K(i), K(tenant_id_));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDlQueue::construct_leaf_queue() {
|
||||
int ret = OB_SUCCESS;
|
||||
void** lf_queue = NULL;
|
||||
ObLeafQueue *cur_lf_queue = NULL;
|
||||
ObMemAttr mem_attr;
|
||||
mem_attr.label_ = ObModIds::OB_MYSQL_REQUEST_RECORD;
|
||||
mem_attr.tenant_id_ = tenant_id_;
|
||||
int64_t root_push_idx = 0;
|
||||
void *buf = NULL;
|
||||
if (OB_ISNULL(buf = ob_malloc(sizeof(ObLeafQueue), mem_attr))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate memory", K(ret));
|
||||
} else if (OB_ISNULL(cur_lf_queue = new(buf) ObLeafQueue())) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate memory", K(ret));
|
||||
} else if (OB_FAIL(cur_lf_queue->init(ObModIds::OB_MYSQL_REQUEST_RECORD, LEAF_QUEUE_SIZE, tenant_id_))) {
|
||||
cur_lf_queue->destroy();
|
||||
cur_lf_queue = NULL;
|
||||
LOG_WARN("fail to init leaf queue", K(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(rq_.push_with_imme_seq(cur_lf_queue, root_push_idx))) {
|
||||
SERVER_LOG(WARN, "Failed to push leaf queue", K(ret));
|
||||
cur_lf_queue->destroy();
|
||||
cur_lf_queue = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDlQueue::push(void* p, int64_t& seq) {
|
||||
int ret = OB_SUCCESS;
|
||||
bool need_retry = false;
|
||||
uint64_t retry_times = 0;
|
||||
do {
|
||||
need_retry = false;
|
||||
Root_Ref tmp_ref;
|
||||
int64_t root_queue_cur_idx = ATOMIC_LOAD(&rq_cur_idx_);
|
||||
ObLeafQueue *leaf_rec = NULL;
|
||||
int64_t leaf_queue_cur_idx = INT_MIN64;
|
||||
if (OB_FAIL(get_leaf_queue(root_queue_cur_idx, leaf_rec, &tmp_ref))) {
|
||||
if (ret == OB_SIZE_OVERFLOW) {
|
||||
SERVER_LOG(WARN, "queue is full",
|
||||
K(root_queue_cur_idx), K(ret));
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
retry_times++; // retry 3 times
|
||||
if (retry_times > RETRY_TIMES) {
|
||||
need_retry = false;
|
||||
ret = OB_SIZE_OVERFLOW;
|
||||
} else {
|
||||
need_retry = true;
|
||||
}
|
||||
}
|
||||
} else if (leaf_rec == NULL) {
|
||||
} else if (OB_FAIL(leaf_rec->push(p, leaf_queue_cur_idx,
|
||||
root_queue_cur_idx, seq))) {
|
||||
//When the sql audit secondary slot is full
|
||||
// the push will fail and needs to be retried.
|
||||
if (root_queue_cur_idx < (rq_.get_push_idx() - 1)) {
|
||||
ret = OB_SUCCESS;
|
||||
retry_times++; // retry 3 times
|
||||
if (retry_times > RETRY_TIMES) {
|
||||
need_retry = false;
|
||||
ret = OB_SIZE_OVERFLOW;
|
||||
} else {
|
||||
need_retry = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// set_end_idx(seq); Performance optimization
|
||||
|
||||
// Push is successfully used to control the first-level offset
|
||||
if (leaf_queue_cur_idx == LEAF_QUEUE_SIZE - 1) {
|
||||
(void)ATOMIC_AAF(&rq_cur_idx_, 1);
|
||||
}
|
||||
}
|
||||
revert_leaf_queue(&tmp_ref, leaf_rec);
|
||||
} while (need_retry);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDlQueue::get_leaf_queue(const int64_t idx, ObLeafQueue *&leaf_queue, Root_Ref* ref)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
// defense construct & get scene.
|
||||
if (OB_FAIL(rq_.is_null_leaf(idx))) {
|
||||
ret = OB_SIZE_OVERFLOW;
|
||||
SERVER_LOG(WARN, "is null leaf",
|
||||
K(idx), K(ret), K(rq_cur_idx_), K(get_pop_idx()), K(get_push_idx()));
|
||||
} else if (NULL == (leaf_queue = reinterpret_cast<ObLeafQueue*>(rq_.get(idx, ref)))) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
SERVER_LOG(WARN, "get_leaf_queue",
|
||||
K(idx), K(ret), K(rq_cur_idx_), K(get_pop_idx()), K(get_push_idx()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObDlQueue::revert_leaf_queue(Root_Ref* ref, ObLeafQueue *&leaf_queue) {
|
||||
if (leaf_queue != NULL) {
|
||||
rq_.revert(ref);
|
||||
leaf_queue = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ObLeafQueue* ObDlQueue::pop() {
|
||||
ObLeafQueue* p = NULL;
|
||||
p = reinterpret_cast<ObLeafQueue*>(rq_.pop());
|
||||
return p;
|
||||
}
|
||||
|
||||
void* ObDlQueue::get(uint64_t seq, DlRef* ref) {
|
||||
int ret = OB_SUCCESS;
|
||||
void* record = NULL;
|
||||
int64_t root_queue_cur_idx = (seq / LEAF_QUEUE_SIZE) % ROOT_QUEUE_SIZE;
|
||||
int64_t leaf_queue_cur_idx = seq % LEAF_QUEUE_SIZE;
|
||||
ObLeafQueue *leaf_rec = NULL;
|
||||
if (OB_FAIL(get_leaf_queue(root_queue_cur_idx, leaf_rec, &ref->root_ref_))) {
|
||||
SERVER_LOG(WARN, "fail to get leaf queue pointer",
|
||||
K(root_queue_cur_idx), K(ret));
|
||||
} else if (NULL == (record = leaf_rec->get(leaf_queue_cur_idx, &ref->leaf_ref_))) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
SERVER_LOG(WARN, "fail to get record", K(root_queue_cur_idx), K(leaf_queue_cur_idx));
|
||||
revert_leaf_queue(&ref->root_ref_, leaf_rec);
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
int ObLeafQueue::push(void* p, int64_t& leaf_idx, int64_t root_idx, int64_t& seq) {
|
||||
int ret = OB_SUCCESS;
|
||||
if (NULL == array_) {
|
||||
ret = OB_NOT_INIT;
|
||||
} else if (NULL == p) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
} else {
|
||||
uint64_t push_limit = capacity_;
|
||||
uint64_t push_idx = faa_bounded(&push_, &push_limit, push_limit);
|
||||
if (push_idx < push_limit) {
|
||||
void** addr = get_addr(push_idx);
|
||||
leaf_idx = push_idx;
|
||||
// request_id
|
||||
seq = root_idx * ObDlQueue::LEAF_QUEUE_SIZE + leaf_idx;
|
||||
while(!ATOMIC_BCAS(addr, NULL, p))
|
||||
;
|
||||
} else {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObDlQueue::revert(DlRef* ref) {
|
||||
if (NULL != ref) {
|
||||
int64_t root_queue_cur_idx = ref->root_ref_.idx_;
|
||||
ObLeafQueue* ret = NULL;
|
||||
if (NULL != rq_.get_root_array()) {
|
||||
ObLeafQueue** addr = reinterpret_cast<ObLeafQueue**>(rq_.get_addr(root_queue_cur_idx));
|
||||
ATOMIC_STORE(&ret, *addr);
|
||||
ret->revert(&ref->leaf_ref_);
|
||||
revert_leaf_queue(&ref->root_ref_, ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObDlQueue::destroy() {
|
||||
while (rq_.get_pop_idx() < rq_.get_push_idx()) {
|
||||
ObLeafQueue** addr = reinterpret_cast<ObLeafQueue**>(rq_.get_addr(rq_.get_pop_idx()));
|
||||
ObLeafQueue* second_queue = *addr;
|
||||
if (NULL != second_queue) {
|
||||
second_queue->destroy();
|
||||
ob_free(second_queue);
|
||||
second_queue = NULL;
|
||||
}
|
||||
rq_.pop();
|
||||
}
|
||||
rq_.destroy();
|
||||
rq_cur_idx_ = 0;
|
||||
start_idx_ = 0;
|
||||
end_idx_ = 0;
|
||||
tenant_id_ = 0;
|
||||
release_wait_times_ = 0;
|
||||
}
|
||||
|
||||
int64_t ObDlQueue::get_end_idx() {
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t idx = INT64_MAX;
|
||||
ObLeafQueue *leaf_rec = NULL;
|
||||
Root_Ref tmp_ref;
|
||||
int64_t leaf_idx = -1;
|
||||
if (OB_FAIL(get_leaf_queue(rq_cur_idx_, leaf_rec, &tmp_ref))) {
|
||||
// rq_cur_idx_ == push_idx_ scene
|
||||
idx = (int64_t)rq_cur_idx_ * LEAF_QUEUE_SIZE;
|
||||
} else {
|
||||
leaf_idx = leaf_rec->get_push_idx();
|
||||
revert_leaf_queue(&tmp_ref, leaf_rec);
|
||||
idx = (int64_t)rq_cur_idx_ * LEAF_QUEUE_SIZE + leaf_idx;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
int64_t ObDlQueue::get_capacity() {
|
||||
return (rq_.get_push_idx() - rq_.get_pop_idx()) * LEAF_QUEUE_SIZE;
|
||||
}
|
||||
|
||||
int64_t ObDlQueue::get_size_used() {
|
||||
return (rq_cur_idx_ - rq_.get_pop_idx()) * LEAF_QUEUE_SIZE;
|
||||
}
|
||||
|
||||
int ObDlQueue::get_leaf_size_used(int64_t idx, int64_t &size) {
|
||||
int ret = OB_SUCCESS;
|
||||
ObLeafQueue *leaf_rec = NULL;
|
||||
Root_Ref tmp_ref;
|
||||
if (OB_FAIL(get_leaf_queue(idx, leaf_rec, &tmp_ref))) {
|
||||
LOG_WARN("fail to get second level queue pointer",K(idx));
|
||||
} else {
|
||||
size = leaf_rec->get_pop_idx();
|
||||
revert_leaf_queue(&tmp_ref, leaf_rec);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDlQueue::release_record(int64_t release_cnt, oceanbase::obmysql::ObMySQLRequestManager*&& pointer) {
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t rq_release_idx = get_pop_idx();
|
||||
int64_t rq_push_idx = get_push_idx();
|
||||
if (rq_release_idx == rq_push_idx) {
|
||||
SERVER_LOG(INFO, "no need release record", K(rq_release_idx), K(rq_push_idx));
|
||||
} else {
|
||||
int64_t size = 0;
|
||||
if (OB_FAIL(clear_leaf_queue(rq_release_idx, release_cnt,
|
||||
std::bind(&oceanbase::obmysql::ObMySQLRequestManager::freeCallback,
|
||||
pointer, std::placeholders::_1)))) {
|
||||
SERVER_LOG(WARN, "fail to clear leaf queue",
|
||||
K(rq_release_idx), K(ret));
|
||||
} else if (OB_FAIL(get_leaf_size_used(rq_release_idx, size))) {
|
||||
SERVER_LOG(WARN, "fail to get second level size used",
|
||||
K(rq_release_idx), K(ret));
|
||||
} else {
|
||||
if (size == ObDlQueue::LEAF_QUEUE_SIZE) {
|
||||
release_wait_times_++;
|
||||
ObLeafQueue *leaf_queue = NULL;
|
||||
// delay pop for performance.
|
||||
if (release_wait_times_ >= RELEASE_WAIT_TIMES) {
|
||||
leaf_queue = pop();
|
||||
if (leaf_queue != NULL) {
|
||||
leaf_queue->destroy();
|
||||
ob_free(leaf_queue);
|
||||
}
|
||||
SERVER_LOG(INFO, "release ref is 0",
|
||||
K(rq_release_idx), K(ret));
|
||||
release_wait_times_ = 0;
|
||||
} else {
|
||||
SERVER_LOG(INFO, "release ref is not 0 or release_wait_times < 3",
|
||||
K(rq_release_idx), K(ret), K(release_wait_times_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}; // end namespace common
|
||||
}; // end namespace oceanbase
|
253
src/observer/mysql/ob_dl_queue.h
Normal file
253
src/observer/mysql/ob_dl_queue.h
Normal file
@ -0,0 +1,253 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_MYSQL_OB_DL_QUEUE_H_
|
||||
#define OCEANBASE_MYSQL_OB_DL_QUEUE_H_
|
||||
|
||||
#include "lib/allocator/ob_allocator.h"
|
||||
#include "share/ob_define.h"
|
||||
#include "ob_ra_queue.h"
|
||||
#include "lib/lock/ob_rwlock.h"
|
||||
#include "lib/function/ob_function.h"
|
||||
#include "ob_mysql_request_manager.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace obmysql
|
||||
{
|
||||
class ObMySQLRequestManager;
|
||||
}
|
||||
namespace common
|
||||
{
|
||||
using Ref = ObRaQueue::Ref;
|
||||
class ObLeafQueue : public ObRaQueue
|
||||
{
|
||||
public:
|
||||
enum { N_LEAF_REF = 128 * 1024 };
|
||||
ObLeafQueue() : ObRaQueue()
|
||||
{
|
||||
memset(ref_, 0, sizeof(ref_));
|
||||
}
|
||||
~ObLeafQueue() { memset(ref_, 0, sizeof(ref_)); }
|
||||
int push(void* p, int64_t& leaf_idx, int64_t root_idx, int64_t& seq);
|
||||
|
||||
private:
|
||||
void wait_ref_clear(int64_t seq) {
|
||||
while(0 != ATOMIC_LOAD(ref_ + seq % N_LEAF_REF)) {
|
||||
ob_usleep(1000);
|
||||
}
|
||||
}
|
||||
int64_t xref(int64_t seq, int64_t x) {
|
||||
return ATOMIC_AAF(ref_ + seq % N_LEAF_REF, x);
|
||||
}
|
||||
int64_t ref_[N_LEAF_REF] CACHE_ALIGNED;
|
||||
};
|
||||
|
||||
using ObRWLock = obsys::ObRWLock;
|
||||
class ObRootQueue : public ObRaQueue
|
||||
{
|
||||
public:
|
||||
enum { N_ROOT_SIZE = 16 * 1024};
|
||||
ObRootQueue() : ObRaQueue()
|
||||
{
|
||||
for (int64_t i=0; i<N_ROOT_SIZE; i++) {
|
||||
new(&SlotLock_[i]) ObRWLock(obsys::WRITE_PRIORITY);
|
||||
}
|
||||
}
|
||||
~ObRootQueue()
|
||||
{
|
||||
for (int64_t i=0; i<N_ROOT_SIZE; i++) {
|
||||
SlotLock_[i].~ObRWLock();
|
||||
}
|
||||
}
|
||||
ObLeafQueue** get_root_array() {
|
||||
return reinterpret_cast<ObLeafQueue**>(array_);
|
||||
}
|
||||
|
||||
void* get(uint64_t seq, Ref* ref) {
|
||||
void* ret = NULL;
|
||||
if (NULL != array_) {
|
||||
void** addr = get_addr(seq);
|
||||
SlotLock_[seq % N_ROOT_SIZE].rlock()->lock();
|
||||
ATOMIC_STORE(&ret, *addr);
|
||||
if (NULL == ret) {
|
||||
ATOMIC_STORE(addr, NULL);
|
||||
} else {
|
||||
ref->set(seq, ret);
|
||||
}
|
||||
}
|
||||
if (NULL != ret) {
|
||||
// xref(seq, 1);
|
||||
ATOMIC_STORE(get_addr(seq), ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
void revert(Ref* ref) {
|
||||
if (NULL != ref) {
|
||||
uint64_t idx = ref->idx_;
|
||||
ref->reset();
|
||||
if (NULL != array_) {
|
||||
SlotLock_[idx % N_ROOT_SIZE].rlock()->unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
void* pop() {
|
||||
void* p = NULL;
|
||||
if (NULL == array_) {
|
||||
// ret = OB_NOT_INIT;
|
||||
} else {
|
||||
uint64_t pop_limit = 0;
|
||||
bool lock_succ = !SlotLock_[pop_ % N_ROOT_SIZE].wlock()->trylock();
|
||||
if (lock_succ) {
|
||||
uint64_t pop_idx = faa_bounded(&pop_, &push_, pop_limit);
|
||||
if (pop_idx < pop_limit) {
|
||||
void** addr = get_addr(pop_idx);
|
||||
while(NULL == (p = ATOMIC_LOAD(addr)) || !ATOMIC_BCAS(addr, p, NULL));
|
||||
} else {
|
||||
// ret = OB_SIZE_OVERFLOW;
|
||||
}
|
||||
SlotLock_[pop_idx % N_ROOT_SIZE].wlock()->unlock();
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
bool is_null_leaf(int64_t seq) {
|
||||
void* ret = NULL;
|
||||
bool is_null = true;
|
||||
if (NULL != array_) {
|
||||
void** addr = get_addr(seq);
|
||||
ATOMIC_STORE(&ret, *addr);
|
||||
if (ret == NULL) {
|
||||
is_null = true;
|
||||
} else {
|
||||
is_null = false;
|
||||
}
|
||||
}
|
||||
return is_null;
|
||||
}
|
||||
|
||||
private:
|
||||
ObRWLock SlotLock_[N_ROOT_SIZE];
|
||||
};
|
||||
|
||||
using Leaf_Ref = ObRaQueue::Ref;
|
||||
using Root_Ref = ObRaQueue::Ref;
|
||||
class ObDlQueue
|
||||
{
|
||||
public:
|
||||
static const int64_t ROOT_QUEUE_SIZE = 16 * 1024; // 16k
|
||||
static const int64_t LEAF_QUEUE_SIZE = 64 * 1024; // 64k
|
||||
static const int64_t DEFAULT_IDLE_LEAF_QUEUE_NUM = 8;
|
||||
static const int64_t RETRY_TIMES = 3; // push retry 3 times
|
||||
static const uint64_t RELEASE_WAIT_TIMES = 3; //3
|
||||
struct DlRef
|
||||
{
|
||||
DlRef(): root_ref_(), leaf_ref_()
|
||||
{}
|
||||
~DlRef()
|
||||
{
|
||||
root_ref_.reset();
|
||||
leaf_ref_.reset();
|
||||
}
|
||||
void reset() {
|
||||
root_ref_.reset();
|
||||
leaf_ref_.reset();
|
||||
}
|
||||
bool is_not_null() {
|
||||
bool is_not_null = false;
|
||||
if (root_ref_.idx_ != -1 || leaf_ref_.idx_ != -1) {
|
||||
is_not_null = true;
|
||||
}
|
||||
return is_not_null;
|
||||
}
|
||||
Root_Ref root_ref_;
|
||||
Leaf_Ref leaf_ref_;
|
||||
};
|
||||
ObDlQueue() :
|
||||
rq_()
|
||||
{
|
||||
rq_cur_idx_ = 0;
|
||||
start_idx_ = 0;
|
||||
end_idx_ = 0;
|
||||
tenant_id_ = 0;
|
||||
release_wait_times_ = 0;
|
||||
}
|
||||
~ObDlQueue()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
int init(const char *label, uint64_t tenant_id);
|
||||
int prepare_alloc_queue();
|
||||
|
||||
template <typename Callback>
|
||||
int clear_leaf_queue(int64_t idx, int64_t size, Callback freeCallback)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
void* req = NULL;
|
||||
int64_t count = 0;
|
||||
ObLeafQueue* leaf_rec = NULL;
|
||||
Root_Ref tmp_ref;
|
||||
|
||||
if (OB_FAIL(get_leaf_queue(idx, leaf_rec, &tmp_ref))) {
|
||||
SERVER_LOG(WARN, "failed to get second level queue pointer", K(idx), K(ret));
|
||||
} else if (leaf_rec == NULL) {
|
||||
// do nothing
|
||||
} else {
|
||||
while (count++ < size && NULL != (req = leaf_rec->pop())) {
|
||||
// Call the callback function to release memory
|
||||
freeCallback(req);
|
||||
}
|
||||
int64_t start_idx = idx * ObDlQueue::LEAF_QUEUE_SIZE + leaf_rec->get_pop_idx();
|
||||
set_start_idx(start_idx);
|
||||
}
|
||||
|
||||
revert_leaf_queue(&tmp_ref, leaf_rec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int push(void* p, int64_t& seq);
|
||||
ObLeafQueue* pop();
|
||||
void* get(uint64_t seq, DlRef* ref);
|
||||
void revert(DlRef* ref);
|
||||
void destroy();
|
||||
uint64_t get_push_idx() const { return rq_.get_push_idx(); }
|
||||
uint64_t get_pop_idx() const { return rq_.get_pop_idx(); }
|
||||
uint64_t get_cur_idx() const { return rq_cur_idx_; }
|
||||
void set_start_idx(int64_t idx) { ATOMIC_STORE(&start_idx_, idx);}
|
||||
void set_end_idx(int64_t idx) { ATOMIC_STORE(&end_idx_, idx);}
|
||||
int64_t get_start_idx() const { return start_idx_; }
|
||||
int64_t get_end_idx();
|
||||
int64_t get_capacity();
|
||||
int64_t get_size_used();
|
||||
|
||||
int get_leaf_size_used(int64_t idx, int64_t &size);
|
||||
int release_record(int64_t release_cnt, oceanbase::obmysql::ObMySQLRequestManager*&& pointer);
|
||||
|
||||
private:
|
||||
int construct_leaf_queue();
|
||||
int get_leaf_queue(const int64_t idx, ObLeafQueue *&leaf_queue, Root_Ref* ref);
|
||||
void revert_leaf_queue(Root_Ref* ref, ObLeafQueue *&leaf_queue);
|
||||
|
||||
volatile uint64_t rq_cur_idx_ CACHE_ALIGNED;
|
||||
volatile int64_t start_idx_ CACHE_ALIGNED;
|
||||
volatile int64_t end_idx_ CACHE_ALIGNED;
|
||||
uint64_t tenant_id_ CACHE_ALIGNED;
|
||||
ObRootQueue rq_;
|
||||
uint64_t release_wait_times_;
|
||||
};
|
||||
|
||||
}; // end namespace common
|
||||
}; // end namespace oceanbase
|
||||
|
||||
#endif /* OCEANBASE_MYSQL_OB_DL_QUEUE_H_ */
|
@ -19,7 +19,8 @@ using namespace oceanbase::obmysql;
|
||||
|
||||
ObEliminateTask::ObEliminateTask()
|
||||
:request_manager_(NULL),
|
||||
config_mem_limit_(0)
|
||||
config_mem_limit_(0),
|
||||
is_tp_trigger_(false)
|
||||
{
|
||||
|
||||
}
|
||||
@ -184,8 +185,22 @@ void ObEliminateTask::runTimerTask()
|
||||
"size_used",request_manager_->get_size_used(),
|
||||
"mem_used", allocator->allocated());
|
||||
int64_t last_time_allocated = allocator->allocated();
|
||||
while (evict_low_mem_level < allocator->allocated()) {
|
||||
request_manager_->release_old(release_cnt);
|
||||
// for testing hung scene
|
||||
int64_t code = 0;
|
||||
code = OB_E(EventTable::EN_SQL_AUDIT_RELEASE_BACK_THREAD_STUCK) OB_SUCCESS;
|
||||
if (OB_UNLIKELY(OB_SUCCESS != code && is_tp_trigger_)) {
|
||||
sleep(abs(code));
|
||||
LOG_INFO("eliminate sleep", K(abs(code)));
|
||||
is_tp_trigger_ = false;
|
||||
} else if (OB_SUCCESS == code) {
|
||||
is_tp_trigger_ = true;
|
||||
}
|
||||
|
||||
while (evict_low_mem_level < allocator->allocated() && OB_SUCC(ret)) {
|
||||
if (OB_FAIL(request_manager_->release_record(release_cnt))) {
|
||||
LOG_WARN("fail to release record", K(ret),
|
||||
K(request_manager_->get_queue().get_pop_idx()));
|
||||
}
|
||||
evict_batch_count++;
|
||||
if ((evict_low_mem_level < allocator->allocated()) && (last_time_allocated == allocator->allocated())) {
|
||||
LOG_INFO("release old cannot free more memory");
|
||||
@ -194,19 +209,7 @@ void ObEliminateTask::runTimerTask()
|
||||
last_time_allocated = allocator->allocated();
|
||||
}
|
||||
}
|
||||
//按记录数淘汰
|
||||
if (request_manager_->get_size_used() > evict_high_size_level) {
|
||||
evict_batch_count = (request_manager_->get_size_used() - evict_low_size_level) / release_cnt;
|
||||
LOG_INFO("sql audit evict record start",
|
||||
K(request_manager_->get_tenant_id()),
|
||||
K(evict_high_size_level),
|
||||
K(evict_low_size_level),
|
||||
"size_used",request_manager_->get_size_used(),
|
||||
"mem_used", allocator->allocated());
|
||||
for (int i = 0; i < evict_batch_count; i++) {
|
||||
request_manager_->release_old(release_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
//如果sql_audit_memory_limit改变, 则需要将ObConcurrentFIFOAllocator中total_limit_更新;
|
||||
if (true == is_change) {
|
||||
allocator->set_total_limit(config_mem_limit_);
|
||||
|
@ -38,6 +38,7 @@ private:
|
||||
ObMySQLRequestManager *request_manager_;
|
||||
int64_t config_mem_limit_;
|
||||
sql::ObFLTSpanMgr* flt_mgr_;
|
||||
bool is_tp_trigger_;
|
||||
};
|
||||
|
||||
} // end of namespace obmysql
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "sql/plan_cache/ob_plan_cache_value.h"
|
||||
#include "sql/session/ob_basic_session_info.h"
|
||||
#include "observer/mysql/ob_query_response_time.h"
|
||||
#include "ob_dl_queue.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -49,7 +50,9 @@ const int64_t ObMySQLRequestManager::EVICT_INTERVAL;
|
||||
ObMySQLRequestManager::ObMySQLRequestManager()
|
||||
: inited_(false), destroyed_(false), request_id_(0), mem_limit_(0),
|
||||
allocator_(), queue_(), task_(),
|
||||
tenant_id_(OB_INVALID_TENANT_ID), tg_id_(-1), stop_flag_(true)
|
||||
tenant_id_(OB_INVALID_TENANT_ID), tg_id_(-1), stop_flag_(true),
|
||||
destroy_second_level_mutex_(common::ObLatchIds::SQL_AUDIT),
|
||||
construct_task_()
|
||||
{
|
||||
}
|
||||
|
||||
@ -67,7 +70,7 @@ int ObMySQLRequestManager::init(uint64_t tenant_id,
|
||||
int ret = OB_SUCCESS;
|
||||
if (inited_) {
|
||||
ret = OB_INIT_TWICE;
|
||||
} else if (OB_FAIL(queue_.init(ObModIds::OB_MYSQL_REQUEST_RECORD, queue_size, tenant_id))) {
|
||||
} else if (OB_FAIL(queue_.init(ObModIds::OB_MYSQL_REQUEST_RECORD, tenant_id))) {
|
||||
SERVER_LOG(WARN, "Failed to init ObMySQLRequestQueue", K(ret));
|
||||
} else if (OB_FAIL(allocator_.init(SQL_AUDIT_PAGE_SIZE,
|
||||
ObModIds::OB_MYSQL_REQUEST_RECORD,
|
||||
@ -78,6 +81,8 @@ int ObMySQLRequestManager::init(uint64_t tenant_id,
|
||||
//check FIFO mem used and sql audit records every 1 seconds
|
||||
if (OB_FAIL(task_.init(this))) {
|
||||
SERVER_LOG(WARN, "fail to init sql audit time tast", K(ret));
|
||||
} else if (OB_FAIL(construct_task_.init(this))) {
|
||||
SERVER_LOG(WARN, "fail to init sql audit construct time tast", K(ret));
|
||||
} else {
|
||||
mem_limit_ = max_mem_size;
|
||||
tenant_id_ = tenant_id;
|
||||
@ -103,6 +108,8 @@ int ObMySQLRequestManager::start()
|
||||
SERVER_LOG(WARN, "init timer fail", K(ret));
|
||||
} else if (OB_FAIL(TG_SCHEDULE(tg_id_, task_, EVICT_INTERVAL, true))) {
|
||||
SERVER_LOG(WARN, "start eliminate task failed", K(ret));
|
||||
} else if (OB_FAIL(TG_SCHEDULE(tg_id_, construct_task_, CONSTRUCT_EVICT_INTERVAL, true))) {
|
||||
SERVER_LOG(WARN, "start construct task failed", K(ret));
|
||||
} else {
|
||||
stop_flag_ = false;
|
||||
}
|
||||
@ -113,6 +120,8 @@ void ObMySQLRequestManager::stop()
|
||||
{
|
||||
if (inited_ && !stop_flag_) {
|
||||
TG_STOP(tg_id_);
|
||||
TG_CANCEL(tg_id_, task_);
|
||||
TG_CANCEL(tg_id_, construct_task_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +193,7 @@ int ObMySQLRequestManager::record_request(const ObAuditRecordData &audit_record,
|
||||
record->data_ = audit_record;
|
||||
//deep copy sql
|
||||
if ((audit_record.sql_len_ > 0) && (NULL != audit_record.sql_)) {
|
||||
int64_t stmt_len = min(audit_record.sql_len_, OB_MAX_SQL_LENGTH);
|
||||
int64_t stmt_len = min(audit_record.sql_len_, ObSQLUtils::get_query_record_size_limit(get_tenant_id()));
|
||||
MEMCPY(buf + pos, audit_record.sql_, stmt_len);
|
||||
record->data_.sql_ = buf + pos;
|
||||
pos += stmt_len;
|
||||
@ -249,7 +258,7 @@ int ObMySQLRequestManager::record_request(const ObAuditRecordData &audit_record,
|
||||
if (is_sensitive) {
|
||||
free(record);
|
||||
record = NULL;
|
||||
} else if (OB_FAIL(queue_.push_with_imme_seq(record, record->data_.request_id_))) {
|
||||
} else if (OB_FAIL(queue_.push(record, record->data_.request_id_))) {
|
||||
//sql audit槽位已满时会push失败, 依赖后台线程进行淘汰获得可用槽位
|
||||
if (REACH_TIME_INTERVAL(2 * 1000 * 1000)) {
|
||||
SERVER_LOG(WARN, "push into queue failed", K(ret));
|
||||
@ -294,6 +303,44 @@ int ObMySQLRequestManager::get_mem_limit(uint64_t tenant_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMySQLRequestManager::release_record(int64_t release_cnt) {
|
||||
int ret = OB_SUCCESS;
|
||||
LockGuard lock_guard(destroy_second_level_mutex_);
|
||||
if (OB_FAIL(queue_.release_record(release_cnt, std::move(this)))) {
|
||||
SERVER_LOG(WARN, "fail to release record",
|
||||
K(release_cnt), K(ret));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObMySQLRequestManager::freeCallback(void* ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
int ObMySQLRequestManager::clear_leaf_queue(int64_t idx, int64_t size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
queue_.clear_leaf_queue(idx, size, std::bind(&ObMySQLRequestManager::freeCallback, this, std::placeholders::_1));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObMySQLRequestManager::get_start_idx() {
|
||||
return queue_.get_start_idx();
|
||||
}
|
||||
|
||||
int64_t ObMySQLRequestManager::get_end_idx() {
|
||||
return queue_.get_end_idx();
|
||||
}
|
||||
|
||||
int64_t ObMySQLRequestManager::get_capacity() {
|
||||
return queue_.get_capacity();
|
||||
}
|
||||
|
||||
int64_t ObMySQLRequestManager::get_size_used() {
|
||||
return queue_.get_size_used();
|
||||
}
|
||||
|
||||
int ObMySQLRequestManager::mtl_new(ObMySQLRequestManager* &req_mgr)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -25,12 +25,15 @@
|
||||
#include "sql/ob_result_set.h"
|
||||
#include "ob_eliminate_task.h"
|
||||
#include "ob_ra_queue.h"
|
||||
#include "ob_dl_queue.h"
|
||||
#include "ob_construct_queue.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace conmmon
|
||||
{
|
||||
class ObConcurrentFIFOAllocator;
|
||||
class ObDlQueue;
|
||||
}
|
||||
|
||||
namespace obmysql
|
||||
@ -82,11 +85,13 @@ public:
|
||||
static constexpr float HIGH_LEVEL_EVICT_PERCENTAGE = 0.9; // 90%
|
||||
static constexpr float LOW_LEVEL_EVICT_PERCENTAGE = 0.8; // 80%
|
||||
//每进行一次release_old操作删除的sql_audit百分比
|
||||
static const int64_t BATCH_RELEASE_SIZE = 50000; //5w
|
||||
static const int64_t MINI_MODE_BATCH_RELEASE_SIZE = 5000; //5k
|
||||
static const int64_t BATCH_RELEASE_SIZE = 64 * 1024; //32k
|
||||
static const int64_t MINI_MODE_BATCH_RELEASE_SIZE = 4 * 1024; //4k
|
||||
static const int64_t CONSTRUCT_EVICT_INTERVAL = 500000; //0.5s
|
||||
//启动淘汰检查的时间间隔
|
||||
static const int64_t EVICT_INTERVAL = 1000000; //1s
|
||||
typedef common::ObRaQueue::Ref Ref;
|
||||
static const int64_t EVICT_INTERVAL = 500000; //1s
|
||||
typedef common::ObDlQueue::DlRef DlRef;
|
||||
typedef lib::ObLockGuard<common::ObRecursiveMutex> LockGuard;
|
||||
public:
|
||||
ObMySQLRequestManager();
|
||||
virtual ~ObMySQLRequestManager();
|
||||
@ -110,12 +115,13 @@ public:
|
||||
int record_request(const ObAuditRecordData &audit_record,
|
||||
const bool enable_query_response_time_stats,
|
||||
bool is_sensitive = false);
|
||||
|
||||
int64_t get_start_idx() const { return (int64_t)queue_.get_pop_idx(); }
|
||||
int64_t get_end_idx() const { return (int64_t)queue_.get_push_idx(); }
|
||||
int64_t get_capacity() const { return (int64_t)queue_.get_capacity(); }
|
||||
int64_t get_size_used() const { return (int64_t)queue_.get_size(); }
|
||||
int get(const int64_t idx, void *&record, Ref* ref)
|
||||
int64_t get_start_idx();
|
||||
int64_t get_end_idx();
|
||||
int64_t get_capacity();
|
||||
int64_t get_size_used();
|
||||
common::ObRecursiveMutex &get_destroy_second_queue_lock() { return destroy_second_level_mutex_; }
|
||||
common::ObDlQueue &get_queue() { return queue_; }
|
||||
int get(const int64_t idx, void *&record, DlRef* ref)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (NULL == (record = queue_.get(idx, ref))) {
|
||||
@ -124,7 +130,7 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int revert(Ref* ref)
|
||||
int revert(DlRef* ref)
|
||||
{
|
||||
queue_.revert(ref);
|
||||
return common::OB_SUCCESS;
|
||||
@ -143,6 +149,11 @@ public:
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
|
||||
int release_record(int64_t release_cnt);
|
||||
|
||||
int clear_leaf_queue(int64_t idx, int64_t size);
|
||||
void freeCallback(void* ptr);
|
||||
|
||||
void* alloc(const int64_t size)
|
||||
{
|
||||
void * ret = allocator_.alloc(size);
|
||||
@ -153,7 +164,10 @@ public:
|
||||
|
||||
void clear_queue()
|
||||
{
|
||||
(void)release_old(INT64_MAX);
|
||||
while (queue_.get_pop_idx() < queue_.get_cur_idx()) {
|
||||
(void)release_record(INT64_MAX);
|
||||
}
|
||||
(void)release_record(INT64_MAX);
|
||||
allocator_.purge();
|
||||
}
|
||||
|
||||
@ -178,13 +192,16 @@ private:
|
||||
uint64_t request_id_;
|
||||
int64_t mem_limit_;
|
||||
common::ObConcurrentFIFOAllocator allocator_;//alloc mem for string buf
|
||||
common::ObRaQueue queue_;
|
||||
common::ObDlQueue queue_;
|
||||
ObEliminateTask task_;
|
||||
|
||||
// tenant id of this request manager
|
||||
uint64_t tenant_id_;
|
||||
int tg_id_;
|
||||
volatile bool stop_flag_;
|
||||
//Control concurrency when destroying the secondary queue.
|
||||
common::ObRecursiveMutex destroy_second_level_mutex_;
|
||||
ObConstructQueueTask construct_task_;
|
||||
};
|
||||
|
||||
} // end of namespace obmysql
|
||||
|
@ -67,7 +67,10 @@ public:
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
} else {
|
||||
MEMSET(array_, 0, sizeof(void*) * size);
|
||||
push_ = 0;
|
||||
pop_ = 0;
|
||||
capacity_ = size;
|
||||
memset(ref_, 0, sizeof(ref_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -76,6 +79,10 @@ public:
|
||||
ob_free(array_);
|
||||
array_ = NULL;
|
||||
}
|
||||
push_ = 0;
|
||||
pop_ = 0;
|
||||
capacity_ = 0;
|
||||
MEMSET(ref_, 0, sizeof(ref_));
|
||||
}
|
||||
uint64_t get_push_idx() const { return ATOMIC_LOAD(&push_); }
|
||||
uint64_t get_pop_idx() const { return ATOMIC_LOAD(&pop_); }
|
||||
@ -167,21 +174,16 @@ public:
|
||||
ref->reset();
|
||||
}
|
||||
}
|
||||
private:
|
||||
void wait_ref_clear(int64_t seq) {
|
||||
void** get_addr(uint64_t x) { return array_ + idx(x); }
|
||||
protected:
|
||||
virtual void wait_ref_clear(int64_t seq) {
|
||||
while(0 != ATOMIC_LOAD(ref_ + seq % N_REF)) {
|
||||
ob_usleep(1000);
|
||||
}
|
||||
}
|
||||
int64_t xref(int64_t seq, int64_t x) {
|
||||
virtual int64_t xref(int64_t seq, int64_t x) {
|
||||
return ATOMIC_AAF(ref_ + seq % N_REF, x);
|
||||
}
|
||||
void do_revert(uint64_t seq, void* p) {
|
||||
if (NULL != array_ && NULL != p) {
|
||||
void** addr = get_addr(seq);
|
||||
ATOMIC_STORE(addr, p);
|
||||
}
|
||||
}
|
||||
static uint64_t faa_bounded(uint64_t* addr, uint64_t* limit_addr, uint64_t& limit) {
|
||||
uint64_t val = ATOMIC_LOAD(addr);
|
||||
uint64_t ov = 0;
|
||||
@ -192,9 +194,8 @@ private:
|
||||
}
|
||||
return val;
|
||||
}
|
||||
void** get_addr(uint64_t x) { return array_ + idx(x); }
|
||||
uint64_t idx(uint64_t x) { return x % capacity_; }
|
||||
private:
|
||||
protected:
|
||||
uint64_t push_ CACHE_ALIGNED;
|
||||
uint64_t pop_ CACHE_ALIGNED;
|
||||
uint64_t capacity_ CACHE_ALIGNED;
|
||||
|
@ -76,6 +76,34 @@ inline int ObPSAnalysisChecker::detection(const int64_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObPsSessionInfoParamsCleaner::operator()(
|
||||
common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry) {
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_NOT_NULL(entry.second)) {
|
||||
ObPsSessionInfo *ps_session_info =
|
||||
static_cast<ObPsSessionInfo *>(entry.second);
|
||||
ps_session_info->get_param_types().reuse();
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "ps session info pointer is NULL", K(ret));
|
||||
}
|
||||
ret_ = ret;
|
||||
}
|
||||
|
||||
void ObPsSessionInfoParamsAssignment::operator()(
|
||||
common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry) {
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_NOT_NULL(entry.second)) {
|
||||
ObPsSessionInfo *ps_session_info =
|
||||
static_cast<ObPsSessionInfo *>(entry.second);
|
||||
ps_session_info->get_param_types().assign(param_types_);
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "ps session info pointer is NULL", K(ret));
|
||||
}
|
||||
ret_ = ret;
|
||||
}
|
||||
|
||||
ObMPStmtExecute::ObMPStmtExecute(const ObGlobalContext &gctx)
|
||||
: ObMPBase(gctx),
|
||||
retry_ctrl_(/*ctx_.retry_info_*/),
|
||||
@ -887,7 +915,13 @@ int ObMPStmtExecute::request_params(ObSQLSessionInfo *session,
|
||||
// Step2: 获取new_param_bound_flag字段
|
||||
ObMySQLUtil::get_int1(pos, new_param_bound_flag);
|
||||
if (new_param_bound_flag == 1) {
|
||||
param_types.reuse();
|
||||
// reset param_types
|
||||
ObPsSessionInfoParamsCleaner cleaner;
|
||||
if (OB_FAIL(session->update_ps_session_info_safety(stmt_id_, cleaner))) {
|
||||
LOG_WARN("failed to reset param_types", K(ret), K(stmt_id_));
|
||||
} else if (OB_FAIL(cleaner.ret_)) {
|
||||
LOG_WARN("failed to reset param_types", K(ret), K(stmt_id_));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -916,16 +950,37 @@ int ObMPStmtExecute::request_params(ObSQLSessionInfo *session,
|
||||
}
|
||||
|
||||
// Step3: 获取type信息
|
||||
if (OB_SUCC(ret) && OB_FAIL(parse_request_type(pos,
|
||||
input_param_num,
|
||||
new_param_bound_flag,
|
||||
cs_conn,
|
||||
cs_server,
|
||||
param_types,
|
||||
param_type_infos))) {
|
||||
LOG_WARN("fail to parse input params type", K(ret));
|
||||
} else if (is_contain_complex_element(param_types)) {
|
||||
analysis_checker_.need_check_ = false;
|
||||
if (OB_SUCC(ret)) {
|
||||
if (1 == new_param_bound_flag) {
|
||||
ParamTypeArray tmp_param_types;
|
||||
ObPsSessionInfoParamsAssignment assignment(tmp_param_types);
|
||||
if (OB_FAIL(parse_request_type(pos,
|
||||
input_param_num,
|
||||
new_param_bound_flag,
|
||||
cs_conn,
|
||||
cs_server,
|
||||
tmp_param_types,
|
||||
param_type_infos))) {
|
||||
LOG_WARN("fail to parse input params type from packet", K(ret));
|
||||
} else if (OB_FAIL(session->update_ps_session_info_safety(stmt_id_, assignment))) {
|
||||
LOG_WARN("fail to update params type of PsSessionInfo", K(ret));
|
||||
} else if (OB_FAIL(assignment.ret_)) {
|
||||
LOG_WARN("fail to update params type of PsSessionInfo", K(ret));
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(parse_request_type(pos,
|
||||
input_param_num,
|
||||
new_param_bound_flag,
|
||||
cs_conn,
|
||||
cs_server,
|
||||
param_types,
|
||||
param_type_infos))) {
|
||||
LOG_WARN("fail to parse input params type", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && is_contain_complex_element(param_types)) {
|
||||
analysis_checker_.need_check_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Step3-2: 获取returning into params type信息
|
||||
|
@ -83,6 +83,24 @@ public:
|
||||
LOG_WARN("memory access out of bounds", K(ret)); \
|
||||
} else
|
||||
|
||||
struct ObPsSessionInfoParamsCleaner
|
||||
{
|
||||
public:
|
||||
ObPsSessionInfoParamsCleaner(): ret_(OB_SUCCESS) {}
|
||||
void operator() (common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry);
|
||||
int ret_;
|
||||
};
|
||||
|
||||
struct ObPsSessionInfoParamsAssignment
|
||||
{
|
||||
public:
|
||||
ObPsSessionInfoParamsAssignment(sql::ParamTypeArray ¶m_types):
|
||||
ret_(OB_SUCCESS), param_types_(param_types) {}
|
||||
void operator() (common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry);
|
||||
int ret_;
|
||||
sql::ParamTypeArray ¶m_types_;
|
||||
};
|
||||
|
||||
class ObMPStmtExecute : public ObMPBase
|
||||
{
|
||||
public:
|
||||
|
@ -600,7 +600,7 @@ int ObInnerSQLConnection::process_audit_record(sql::ObResultSet &result_set,
|
||||
audit_record.ps_inner_stmt_id_ = ps_stmt_id;
|
||||
if (ps_sql.length() != 0) {
|
||||
audit_record.sql_ = const_cast<char *>(ps_sql.ptr());
|
||||
audit_record.sql_len_ = min(ps_sql.length(), OB_MAX_SQL_LENGTH);
|
||||
audit_record.sql_len_ = min(ps_sql.length(), ObSQLUtils::get_query_record_size_limit(session.get_effective_tenant_id()));
|
||||
}
|
||||
MEMCPY(audit_record.sql_id_, sql_ctx.sql_id_, (int32_t)sizeof(audit_record.sql_id_));
|
||||
audit_record.affected_rows_ = result_set.get_affected_rows();
|
||||
|
442
src/observer/virtual_table/ob_all_virtual_session_ps_info.cpp
Normal file
442
src/observer/virtual_table/ob_all_virtual_session_ps_info.cpp
Normal file
@ -0,0 +1,442 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "observer/virtual_table/ob_all_virtual_session_ps_info.h"
|
||||
|
||||
#include "sql/plan_cache/ob_plan_cache.h"
|
||||
#include "sql/plan_cache/ob_ps_cache.h"
|
||||
#include "sql/plan_cache/ob_ps_sql_utils.h"
|
||||
#include "sql/resolver/ob_resolver_utils.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
|
||||
#include "observer/ob_server_struct.h"
|
||||
#include "observer/ob_server_utils.h"
|
||||
#include "share/inner_table/ob_inner_table_schema.h"
|
||||
|
||||
using namespace oceanbase;
|
||||
using namespace sql;
|
||||
using namespace observer;
|
||||
using namespace common;
|
||||
|
||||
int ObAllVirtualSessionPsInfo::inner_get_next_row()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_filled = false;
|
||||
ObSQLSessionInfo *sess_info = nullptr;
|
||||
if (is_iter_end_) {
|
||||
ret = OB_ITER_END;
|
||||
} else {
|
||||
for (; tenant_id_array_idx_ < tenant_id_array_.count() &&
|
||||
is_filled == false && OB_SUCC(ret);) {
|
||||
int64_t tenant_id = tenant_id_array_.at(tenant_id_array_idx_);
|
||||
MTL_SWITCH(tenant_id) {
|
||||
if (OB_FAIL(get_next_row_from_specified_tenant(tenant_id, is_filled))) {
|
||||
if (ret == OB_ITER_END) {
|
||||
if (tenant_id_array_idx_ < tenant_id_array_.count() - 1) {
|
||||
++tenant_id_array_idx_;
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
SERVER_LOG(WARN, "get_rows_from_specified_tenant failed", K(ret),
|
||||
K(tenant_id));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// failed to switch
|
||||
ret = OB_SUCCESS;
|
||||
++tenant_id_array_idx_;
|
||||
if (tenant_id_array_idx_ == tenant_id_array_.count()) {
|
||||
is_iter_end_ = true;
|
||||
ret = OB_ITER_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret == OB_ITER_END && !is_iter_end_) {
|
||||
is_iter_end_ = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::inner_open()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ps_client_stmt_ids_.set_tenant_id(effective_tenant_id_);
|
||||
fetcher_.set_tenant_id(effective_tenant_id_);
|
||||
|
||||
ObMemAttr attr(effective_tenant_id_, lib::ObLabel("BucketAlloc"));
|
||||
if (OB_FAIL(tenant_session_id_map_.create(BUCKET_COUNT,
|
||||
attr,
|
||||
attr))) {
|
||||
SERVER_LOG(WARN, "failed to init tenant_session_id_map_", K(ret));
|
||||
} else if (is_sys_tenant(effective_tenant_id_)) {
|
||||
// sys tenant show all tenant infos
|
||||
if (OB_ISNULL(GCTX.omt_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.omt_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.omt_->get_mtl_tenant_ids(tenant_id_array_))) {
|
||||
SERVER_LOG(WARN, "failed to add tenant id", K(ret));
|
||||
}
|
||||
} else {
|
||||
// user tenant show self tenant info
|
||||
if (OB_FAIL(tenant_id_array_.push_back(effective_tenant_id_))) {
|
||||
SERVER_LOG(WARN, "tenant id array fail to push back", KR(ret),
|
||||
K(effective_tenant_id_));
|
||||
}
|
||||
}
|
||||
for (int64_t idx = 0; OB_SUCC(ret) && idx < tenant_id_array_.count();
|
||||
++idx) {
|
||||
ObArray<SessionID> *tenant_sessions = nullptr;
|
||||
if (OB_ISNULL(tenant_sessions =
|
||||
OB_NEWx(ObArray<SessionID>, allocator_))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN,
|
||||
"failed to init tenant_session_id_map_, allocate memory failed",
|
||||
K(ret));
|
||||
} else if (OB_FAIL(tenant_session_id_map_.set_refactored(tenant_id_array_.at(idx),
|
||||
*tenant_sessions))) {
|
||||
SERVER_LOG(WARN,
|
||||
"failed to add item to tenant_session_id_map_",
|
||||
K(ret), K(tenant_id_array_.at(idx)));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_ISNULL(GCTX.session_mgr_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.session_mgr_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.session_mgr_->for_each_session(all_sql_session_iterator_))) {
|
||||
SERVER_LOG(WARN, "failed to read each session", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int format_param_types(const ObIArray<obmysql::EMySQLFieldType> ¶m_types,
|
||||
ObIAllocator *allocator, const char *&ptr,
|
||||
uint64_t &len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ptr = nullptr;
|
||||
len = 0;
|
||||
ObStringBuffer str_buf(allocator);
|
||||
for (int64_t idx = 0; OB_SUCC(ret) && idx < param_types.count(); ++idx) {
|
||||
std::string str = std::to_string(param_types.at(idx));
|
||||
const char *charPtr = str.c_str();
|
||||
if (OB_FAIL(str_buf.append(charPtr))) {
|
||||
SERVER_LOG(WARN, "failed to format param_types", K(ret));
|
||||
} else if (idx < param_types.count()-1 && OB_FAIL(str_buf.append(", "))) {
|
||||
SERVER_LOG(WARN, "failed to format param_types", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
ptr = str_buf.ptr();
|
||||
len = str_buf.length();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::fill_cells(uint64_t tenant_id,
|
||||
ObPsStmtId ps_client_stmt_id,
|
||||
bool &is_filled)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t col_count = output_column_ids_.count();
|
||||
is_filled = false;
|
||||
fetcher_.reuse();
|
||||
ObObj *cells = cur_row_.cells_;
|
||||
if (OB_ISNULL(cells)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "cells pointer is NULL", K(ret));
|
||||
} else {
|
||||
if (OB_ISNULL(cur_session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "cur_session_info_ pointer is NULL", K(ret));
|
||||
} else if (OB_FAIL(cur_session_info_->visit_ps_session_info(ps_client_stmt_id,
|
||||
fetcher_))) {
|
||||
if (ret == OB_EER_UNKNOWN_STMT_HANDLER) {
|
||||
SERVER_LOG(DEBUG, "can not find the ps_session_info, may be released",
|
||||
K(ret), K(ps_client_stmt_id));
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
SERVER_LOG(WARN, "cannot get ps_session_info", K(ret),
|
||||
K(ps_client_stmt_id));
|
||||
}
|
||||
} else if (OB_FAIL(fetcher_.get_error_code())) {
|
||||
SERVER_LOG(WARN, "failed to deep copy ps session info", K(ret));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) {
|
||||
uint64_t col_id = output_column_ids_.at(i);
|
||||
switch (col_id) {
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::TENANT_ID: {
|
||||
cells[i].set_int(tenant_id);
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::PROXY_SESSION_ID: {
|
||||
cells[i].set_uint64(cur_session_info_->get_proxy_sessid());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::SESSION_ID: {
|
||||
cells[i].set_uint64(cur_session_info_->get_sessid());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::PS_CLIENT_STMT_ID: {
|
||||
cells[i].set_int(ps_client_stmt_id);
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::PS_INNER_STMT_ID: {
|
||||
cells[i].set_int(fetcher_.get_inner_stmt_id());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::SVR_IP: {
|
||||
ObString ipstr;
|
||||
if (OB_FAIL(ObServerUtils::get_server_ip(allocator_, ipstr))) {
|
||||
SERVER_LOG(WARN, "get server ip failed", K(ret));
|
||||
} else {
|
||||
cells[i].set_varchar(ipstr);
|
||||
cells[i].set_collation_type(ObCharset::get_default_collation(
|
||||
ObCharset::get_default_charset()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::SVR_PORT: {
|
||||
cells[i].set_int(GCTX.self_addr().get_port());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::STMT_TYPE: {
|
||||
ObString stmt_type_str;
|
||||
ObString stmt_type_tmp =
|
||||
ObResolverUtils::get_stmt_type_string(fetcher_.get_stmt_type());
|
||||
if (OB_FAIL(
|
||||
ob_write_string(*allocator_, stmt_type_tmp, stmt_type_str))) {
|
||||
SERVER_LOG(WARN, "ob write string failed", K(ret));
|
||||
} else {
|
||||
cells[i].set_varchar(stmt_type_str);
|
||||
cells[i].set_collation_type(ObCharset::get_default_collation(
|
||||
ObCharset::get_default_charset()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::PARAM_COUNT: {
|
||||
cells[i].set_int(fetcher_.get_param_count());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::PARAM_TYPES: {
|
||||
const char *types_str = nullptr;
|
||||
uint64_t len = 0;
|
||||
if (OB_FAIL(format_param_types(fetcher_.get_param_types(),
|
||||
allocator_, types_str, len))) {
|
||||
SERVER_LOG(WARN, "format_param_types failed", K(ret),
|
||||
K(fetcher_.get_param_types()));
|
||||
} else {
|
||||
cells[i].set_lob_value(ObLongTextType, types_str,
|
||||
static_cast<int32_t>(len));
|
||||
cells[i].set_collation_type(ObCharset::get_default_collation(
|
||||
ObCharset::get_default_charset()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::REF_COUNT: {
|
||||
cells[i].set_int(fetcher_.get_ref_count());
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_SESSION_PS_INFO_CDE::CHECKSUM: {
|
||||
cells[i].set_int(fetcher_.get_ps_stmt_checksum());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "invalid column id", K(ret), K(i),
|
||||
K(output_column_ids_), K(col_id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
is_filled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::get_next_row_from_specified_tenant(
|
||||
uint64_t tenant_id, bool &is_filled)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
is_filled = false;
|
||||
do {
|
||||
if (ps_client_stmt_ids_.count() == 0) {
|
||||
if (OB_FAIL(all_sql_session_iterator_.next(tenant_id, cur_session_info_))) {
|
||||
if (ret == OB_ITER_END) {
|
||||
// do nothing
|
||||
} else {
|
||||
SERVER_LOG(WARN, "get next session failed", K(ret), K(tenant_id));
|
||||
}
|
||||
} else {
|
||||
if (OB_NOT_NULL(cur_session_info_)) {
|
||||
if (OB_FAIL(cur_session_info_->for_each_ps_session_info(*this))) {
|
||||
SERVER_LOG(WARN, "failed to read each ps session info", K(ret), K(tenant_id));
|
||||
}
|
||||
} else {
|
||||
SERVER_LOG(WARN, "cur_session_info_ is nullptr", K(ret), K(tenant_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
ObPsStmtId ps_client_stmt_id = 0;
|
||||
if (ps_client_stmt_ids_.count() == 0) {
|
||||
} else if (OB_FAIL(ps_client_stmt_ids_.pop_back(ps_client_stmt_id))) {
|
||||
SERVER_LOG(WARN, "get client stmt id failed", K(ret));
|
||||
} else if (OB_FAIL(fill_cells(tenant_id, ps_client_stmt_id,
|
||||
is_filled))) {
|
||||
SERVER_LOG(WARN, "fill cells failed", K(ret));
|
||||
}
|
||||
}
|
||||
} while (!is_filled && OB_SUCC(ret));
|
||||
if (ret != OB_SUCCESS && ret != OB_ITER_END) {
|
||||
SERVER_LOG(WARN, "generate rows failed", K(ret), K(tenant_id),
|
||||
K(output_column_ids_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObAllVirtualSessionPsInfo::reset()
|
||||
{
|
||||
ObAllPlanCacheBase::reset();
|
||||
fetcher_.reset();
|
||||
tenant_session_id_map_.reuse();
|
||||
all_sql_session_iterator_.reset();
|
||||
cur_session_info_ = nullptr;
|
||||
tenant_id_array_idx_ = 0;
|
||||
ps_client_stmt_ids_.reset();
|
||||
is_iter_end_ = false;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::operator()(
|
||||
common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry)
|
||||
{
|
||||
ObPsStmtId ps_client_stmt_id = entry.first;
|
||||
return ps_client_stmt_ids_.push_back(ps_client_stmt_id);
|
||||
}
|
||||
|
||||
bool ObAllVirtualSessionPsInfo::ObTenantSessionInfoIterator::operator()(
|
||||
ObSQLSessionMgr::Key key, ObSQLSessionInfo *sess_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(sess_info)) {
|
||||
ret = OB_ERR_UNDEFINED;
|
||||
SERVER_LOG(WARN, "sess_info is NULL", K(ret));
|
||||
} else {
|
||||
if (sess_info->is_shadow()) {
|
||||
} else {
|
||||
ObArray<SessionID> *session_id_list =
|
||||
const_cast<ObArray<SessionID> *>(
|
||||
tenant_session_id_map_.get(sess_info->get_priv_tenant_id()));
|
||||
if (OB_ISNULL(session_id_list)) {
|
||||
} else if (OB_FAIL(session_id_list->push_back(sess_info->get_sessid()))) {
|
||||
SERVER_LOG(WARN, "failed to push session id into session_id_list", K(ret),
|
||||
K(sess_info->get_sessid()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret == OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::ObTenantSessionInfoIterator::next(
|
||||
uint64_t tenant_id, ObSQLSessionInfo *&sess_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
sess_info = nullptr;
|
||||
SessionID session_id = 0;
|
||||
if (OB_NOT_NULL(last_attach_session_info_)) {
|
||||
if (OB_ISNULL(GCTX.session_mgr_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.session_mgr_ is NULL", K(ret));
|
||||
} else {
|
||||
GCTX.session_mgr_->revert_session(last_attach_session_info_);
|
||||
last_attach_session_info_ = nullptr;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && (OB_ISNULL(cur_session_id_list_) || tenant_id != cur_tenant_id_)) {
|
||||
cur_session_id_list_ = tenant_session_id_map_.get(tenant_id);
|
||||
if (OB_NOT_NULL(cur_session_id_list_)) {
|
||||
cur_tenant_id_ = tenant_id;
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
do {
|
||||
if (0 == cur_session_id_list_->count()) {
|
||||
cur_session_id_list_ = nullptr;
|
||||
ret = OB_ITER_END;
|
||||
} else {
|
||||
if (OB_FAIL(cur_session_id_list_->pop_back(session_id))) {
|
||||
SERVER_LOG(WARN, "failed to get session id", K(ret));
|
||||
} else {
|
||||
if (OB_ISNULL(GCTX.session_mgr_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.session_mgr_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.session_mgr_->get_session(session_id, sess_info))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
last_attach_session_info_ = sess_info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (OB_SUCC(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObAllVirtualSessionPsInfo::ObTenantSessionInfoIterator::reset()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_NOT_NULL(last_attach_session_info_)) {
|
||||
if (OB_ISNULL(GCTX.session_mgr_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.session_mgr_ is NULL", K(ret));
|
||||
} else {
|
||||
GCTX.session_mgr_->revert_session(last_attach_session_info_);
|
||||
last_attach_session_info_ = nullptr;
|
||||
}
|
||||
}
|
||||
cur_session_id_list_ = nullptr;
|
||||
cur_tenant_id_ = 0;
|
||||
}
|
||||
|
||||
int ObAllVirtualSessionPsInfo::ObPsSessionInfoFetcher::operator()(
|
||||
common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_NOT_NULL(entry.second)) {
|
||||
ObPsSessionInfo *ps_session_info =
|
||||
static_cast<ObPsSessionInfo *>(entry.second);
|
||||
inner_stmt_id_ = ps_session_info->get_inner_stmt_id();
|
||||
stmt_type_ = ps_session_info->get_stmt_type();
|
||||
param_count_ = ps_session_info->get_param_count();
|
||||
ref_count_ = ps_session_info->get_ref_cnt();
|
||||
checksum_ = ps_session_info->get_ps_stmt_checksum();
|
||||
if (OB_FAIL(param_types_.assign(ps_session_info->get_param_types()))) {
|
||||
SERVER_LOG(WARN, "failed to copy param types", K(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "ps session info pointer is NULL", K(ret));
|
||||
}
|
||||
error_code_ = ret;
|
||||
return ret;
|
||||
}
|
119
src/observer/virtual_table/ob_all_virtual_session_ps_info.h
Normal file
119
src/observer/virtual_table/ob_all_virtual_session_ps_info.h
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SESSION_PS_INFO_
|
||||
#define OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SESSION_PS_INFO_ 1
|
||||
|
||||
#include "observer/virtual_table/ob_all_plan_cache_stat.h"
|
||||
#include "sql/plan_cache/ob_prepare_stmt_struct.h"
|
||||
#include "sql/session/ob_sql_session_mgr.h"
|
||||
|
||||
namespace oceanbase {
|
||||
using common::ObPsStmtId;
|
||||
namespace observer {
|
||||
class ObAllVirtualSessionPsInfo : public ObAllPlanCacheBase {
|
||||
public:
|
||||
static const int64_t BUCKET_COUNT = 128;
|
||||
using SessionID = uint32_t;
|
||||
class ObTenantSessionInfoIterator {
|
||||
public:
|
||||
ObTenantSessionInfoIterator(
|
||||
common::hash::ObHashMap<uint64_t, common::ObArray<SessionID>> &tenant_session_map)
|
||||
: last_attach_session_info_(nullptr),
|
||||
tenant_session_id_map_(tenant_session_map),
|
||||
cur_tenant_id_(OB_INVALID_TENANT_ID), cur_session_id_list_(nullptr) {}
|
||||
bool operator()(sql::ObSQLSessionMgr::Key key, sql::ObSQLSessionInfo *sess_info);
|
||||
int next(uint64_t tenant_id, sql::ObSQLSessionInfo *&sess_info);
|
||||
void reset();
|
||||
private:
|
||||
ObSQLSessionInfo *last_attach_session_info_;
|
||||
common::hash::ObHashMap<uint64_t, common::ObArray<SessionID>> &tenant_session_id_map_;
|
||||
uint64_t cur_tenant_id_;
|
||||
common::ObArray<SessionID> *cur_session_id_list_;
|
||||
};
|
||||
|
||||
class ObPsSessionInfoFetcher {
|
||||
public:
|
||||
ObPsSessionInfoFetcher():
|
||||
inner_stmt_id_(OB_INVALID_ID),
|
||||
stmt_type_(stmt::T_NONE),
|
||||
param_count_(-1),
|
||||
ref_count_(-1),
|
||||
checksum_(0),
|
||||
param_types_(),
|
||||
error_code_(OB_SUCCESS)
|
||||
{}
|
||||
// deep copy ObPsSessionInfo obj
|
||||
int operator() (common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry);
|
||||
inline ObPsStmtId get_inner_stmt_id() const { return inner_stmt_id_; }
|
||||
inline stmt::StmtType get_stmt_type() const { return stmt_type_; }
|
||||
inline int64_t get_param_count() const { return param_count_; }
|
||||
inline int64_t get_ref_count() const { return ref_count_; }
|
||||
inline uint64_t get_ps_stmt_checksum() const { return checksum_; }
|
||||
inline int get_error_code() const { return error_code_; }
|
||||
inline common::ObArray<obmysql::EMySQLFieldType> get_param_types() const { return param_types_; }
|
||||
void set_tenant_id(uint64_t tenant_id) {
|
||||
param_types_.set_tenant_id(tenant_id);
|
||||
}
|
||||
void reuse() {
|
||||
inner_stmt_id_ = OB_INVALID_ID;
|
||||
stmt_type_ = stmt::T_NONE;
|
||||
param_count_ = -1;
|
||||
ref_count_ = -1;
|
||||
checksum_ = 0;
|
||||
error_code_ = OB_SUCCESS;
|
||||
param_types_.reuse();
|
||||
}
|
||||
void reset() {
|
||||
reuse();
|
||||
}
|
||||
|
||||
private:
|
||||
ObPsStmtId inner_stmt_id_;
|
||||
stmt::StmtType stmt_type_;
|
||||
int64_t param_count_;
|
||||
int64_t ref_count_;
|
||||
uint64_t checksum_;
|
||||
common::ObArray<obmysql::EMySQLFieldType> param_types_;
|
||||
int error_code_;
|
||||
};
|
||||
|
||||
ObAllVirtualSessionPsInfo()
|
||||
: ObAllPlanCacheBase(),
|
||||
fetcher_(),
|
||||
tenant_session_id_map_(),
|
||||
all_sql_session_iterator_(tenant_session_id_map_),
|
||||
cur_session_info_(nullptr),
|
||||
ps_client_stmt_ids_(),
|
||||
is_iter_end_(false) {}
|
||||
virtual ~ObAllVirtualSessionPsInfo() { reset(); }
|
||||
virtual int inner_get_next_row() override;
|
||||
virtual int inner_open() override;
|
||||
virtual void reset() override;
|
||||
int operator()(common::hash::HashMapPair<uint64_t, ObPsSessionInfo *> &entry);
|
||||
private:
|
||||
int fill_cells(uint64_t tenant_id, ObPsStmtId ps_client_stmt_id,
|
||||
bool &is_filled);
|
||||
int get_next_row_from_specified_tenant(uint64_t tenant_id, bool &is_filled);
|
||||
DISALLOW_COPY_AND_ASSIGN(ObAllVirtualSessionPsInfo);
|
||||
private:
|
||||
ObPsSessionInfoFetcher fetcher_;
|
||||
common::hash::ObHashMap<uint64_t, common::ObArray<SessionID>>
|
||||
tenant_session_id_map_;
|
||||
ObTenantSessionInfoIterator all_sql_session_iterator_;
|
||||
ObSQLSessionInfo *cur_session_info_;
|
||||
common::ObArray<ObPsStmtId> ps_client_stmt_ids_;
|
||||
bool is_iter_end_;
|
||||
};
|
||||
} // namespace observer
|
||||
} // namespace oceanbase
|
||||
#endif /* OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SESSION_PS_INFO_ */
|
@ -57,7 +57,7 @@ ObGvSqlAudit::~ObGvSqlAudit() {
|
||||
void ObGvSqlAudit::reset()
|
||||
{
|
||||
if (with_tenant_ctx_ != nullptr && allocator_ != nullptr) {
|
||||
if (cur_mysql_req_mgr_ != nullptr && ref_.idx_ != -1) {
|
||||
if (cur_mysql_req_mgr_ != nullptr && ref_.is_not_null()) {
|
||||
cur_mysql_req_mgr_->revert(&ref_);
|
||||
}
|
||||
with_tenant_ctx_->~ObTenantSpaceFetcher();
|
||||
@ -211,7 +211,7 @@ int ObGvSqlAudit::inner_get_next_row(common::ObNewRow *&row)
|
||||
// inc ref count by 1
|
||||
if (with_tenant_ctx_ != nullptr) { // free old memory
|
||||
// before freeing tenant ctx, we must release ref_ if possible
|
||||
if (nullptr != prev_req_mgr && ref_.idx_ != -1) {
|
||||
if (nullptr != prev_req_mgr && ref_.is_not_null()) {
|
||||
prev_req_mgr->revert(&ref_);
|
||||
}
|
||||
with_tenant_ctx_->~ObTenantSpaceFetcher();
|
||||
@ -275,7 +275,7 @@ int ObGvSqlAudit::inner_get_next_row(common::ObNewRow *&row)
|
||||
if (OB_ITER_END == ret) {
|
||||
// release last tenant's ctx
|
||||
if (with_tenant_ctx_ != nullptr) {
|
||||
if (prev_req_mgr != nullptr && ref_.idx_ != -1) {
|
||||
if (prev_req_mgr != nullptr && ref_.is_not_null()) {
|
||||
prev_req_mgr->revert(&ref_);
|
||||
}
|
||||
with_tenant_ctx_->~ObTenantSpaceFetcher();
|
||||
@ -288,7 +288,7 @@ int ObGvSqlAudit::inner_get_next_row(common::ObNewRow *&row)
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
void *rec = NULL;
|
||||
if (ref_.idx_ != -1) {
|
||||
if (ref_.is_not_null()) {
|
||||
cur_mysql_req_mgr_->revert(&ref_);
|
||||
}
|
||||
do {
|
||||
@ -688,7 +688,7 @@ int ObGvSqlAudit::fill_cells(obmysql::ObMySQLRequestRecord &record)
|
||||
case QUERY_SQL: {
|
||||
ObCollationType src_cs_type = ObCharset::is_valid_collation(record.data_.sql_cs_type_) ?
|
||||
record.data_.sql_cs_type_ : ObCharset::get_system_collation();
|
||||
ObString src_string(static_cast<int32_t>(record.data_.sql_len_), record.data_.sql_);
|
||||
ObString src_string(static_cast<int64_t>(record.data_.sql_len_), record.data_.sql_);
|
||||
ObString dst_string;
|
||||
if (OB_FAIL(ObCharset::charset_convert(row_calc_buf_,
|
||||
src_string,
|
||||
@ -1066,7 +1066,14 @@ int ObGvSqlAudit::fill_cells(obmysql::ObMySQLRequestRecord &record)
|
||||
cells[cell_idx].set_null();
|
||||
} break;
|
||||
case STMT_TYPE: {
|
||||
cells[cell_idx].set_null();
|
||||
ObString stmt_type_name;
|
||||
ObString tmp_type_name = ObResolverUtils::get_stmt_type_string(record.data_.stmt_type_);
|
||||
if (!tmp_type_name.empty()) {
|
||||
stmt_type_name = tmp_type_name.make_string(tmp_type_name.ptr() + 2);
|
||||
} else {
|
||||
stmt_type_name = tmp_type_name;
|
||||
}
|
||||
cells[cell_idx].set_varchar(stmt_type_name);
|
||||
cells[cell_idx].set_default_collation_type();
|
||||
} break;
|
||||
case SEQ_NUM: {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "share/ob_virtual_table_scanner_iterator.h"
|
||||
#include "common/ob_range.h"
|
||||
#include "observer/mysql/ob_ra_queue.h"
|
||||
#include "observer/mysql/ob_dl_queue.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -195,7 +196,7 @@ private:
|
||||
int64_t start_id_;
|
||||
int64_t end_id_;
|
||||
int64_t cur_id_;
|
||||
common::ObRaQueue::Ref ref_;
|
||||
common::ObDlQueue::DlRef ref_;
|
||||
common::ObAddr *addr_;
|
||||
common::ObString ipstr_;
|
||||
int32_t port_;
|
||||
|
@ -41,9 +41,6 @@ int ObExpVisitor::add_row(const Op &cur_op)
|
||||
if (OB_ISNULL(cells = cur_row_.cells_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "cur row cell is NULL", K(ret));
|
||||
} else if (OB_UNLIKELY(col_count < 1)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "column count error ", K(ret), K(col_count));
|
||||
} else {
|
||||
ObString ipstr;
|
||||
common::ObAddr addr;
|
||||
@ -57,7 +54,7 @@ int ObExpVisitor::add_row(const Op &cur_op)
|
||||
}
|
||||
case ObPlanCachePlanExplain::IP_COL: {
|
||||
ipstr.reset();
|
||||
if (OB_FAIL(ObServerUtils::get_server_ip(allocator_, ipstr))) {
|
||||
if (OB_FAIL(ObServerUtils::get_server_ip(&allocator_, ipstr))) {
|
||||
SERVER_LOG(ERROR, "get server ip failed", K(ret));
|
||||
} else {
|
||||
cells[i].set_varchar(ipstr);
|
||||
@ -80,7 +77,7 @@ int ObExpVisitor::add_row(const Op &cur_op)
|
||||
char *buf = NULL;
|
||||
int64_t buf_len = cur_op.get_plan_depth() + strlen(cur_op.get_name()) + 1;
|
||||
int64_t pos = 0;
|
||||
if (OB_ISNULL(buf = static_cast<char *> (allocator_->alloc(buf_len)))) {
|
||||
if (OB_ISNULL(buf = static_cast<char *> (allocator_.alloc(buf_len)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
} else {
|
||||
int64_t j = cur_op.get_plan_depth();
|
||||
@ -148,8 +145,12 @@ int ObExpVisitor::add_row(const Op &cur_op)
|
||||
}
|
||||
} // end for
|
||||
if (OB_SUCC(ret)) {
|
||||
// deep copy row
|
||||
if (OB_FAIL(scanner_.add_row(cur_row_))) {
|
||||
SERVER_LOG(WARN, "fail to add row", K(ret), K(cur_row_));
|
||||
} else {
|
||||
// free memory
|
||||
allocator_.reuse();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,7 +169,7 @@ int ObExpVisitor::get_table_name<ObOpSpec>(const ObOpSpec &cur_op, ObString &tab
|
||||
char *buffer = NULL;
|
||||
ObString index_name;
|
||||
ObString tmp_table_name;
|
||||
if (OB_ISNULL(buffer = static_cast<char *>(allocator_->alloc(OB_MAX_PLAN_EXPLAIN_NAME_LENGTH)))) {
|
||||
if (OB_ISNULL(buffer = static_cast<char *>(allocator_.alloc(OB_MAX_PLAN_EXPLAIN_NAME_LENGTH)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
SERVER_LOG(WARN, "failed to allocate memory", K(ret));
|
||||
} else if (PHY_TABLE_SCAN == cur_op.get_type()) {
|
||||
@ -194,7 +195,7 @@ int ObExpVisitor::get_table_access_desc(bool is_idx_access, const ObQueryFlag &s
|
||||
char *buffer = NULL;
|
||||
int64_t tmp_pos = 0;
|
||||
|
||||
if (OB_ISNULL(buffer = static_cast<char *>(allocator_->alloc(OB_MAX_PLAN_EXPLAIN_NAME_LENGTH)))) {
|
||||
if (OB_ISNULL(buffer = static_cast<char *>(allocator_.alloc(OB_MAX_PLAN_EXPLAIN_NAME_LENGTH)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
SERVER_LOG(WARN, "failed to allocate memory", K(ret));
|
||||
} else {
|
||||
@ -241,7 +242,7 @@ int ObExpVisitor::get_property<ObOpSpec>(const ObOpSpec &cur_op,
|
||||
int ret = OB_SUCCESS;
|
||||
char *buf = NULL;
|
||||
int64_t pos = 0;
|
||||
if (OB_ISNULL(buf = static_cast<char *> (allocator_->alloc(OB_MAX_OPERATOR_PROPERTY_LENGTH)))) {
|
||||
if (OB_ISNULL(buf = static_cast<char *> (allocator_.alloc(OB_MAX_OPERATOR_PROPERTY_LENGTH)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
SERVER_LOG(WARN, "failed to allocate memory", K(ret));
|
||||
} else {
|
||||
@ -265,6 +266,67 @@ int ObExpVisitor::get_property<ObOpSpec>(const ObOpSpec &cur_op,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCacheObjIterator::operator()(common::hash::HashMapPair<ObCacheObjID, ObILibCacheObject *> &entry)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(entry.second)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "HashMapPair second element is NULL", K(ret));
|
||||
} else if (ObLibCacheNameSpace::NS_CRSR != entry.second->get_ns()) {
|
||||
} else if (OB_FAIL(plan_id_array_.push_back(entry.first))){
|
||||
SERVER_LOG(WARN, "fail to push plan id into plan_id_array_", K(ret), K(entry.first));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCacheObjIterator::next(int64_t &tenant_id, ObCacheObjGuard &guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
do {
|
||||
if (plan_id_array_.count() == 0) {
|
||||
if (tenant_id_array_idx_ < tenant_id_array_.count() - 1) {
|
||||
++tenant_id_array_idx_;
|
||||
tenant_id = tenant_id_array_.at(tenant_id_array_idx_);
|
||||
MTL_SWITCH(tenant_id) {
|
||||
cur_plan_cache_ = MTL(ObPlanCache*);
|
||||
if (OB_ISNULL(cur_plan_cache_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "cur_plan_cache_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(cur_plan_cache_->foreach_cache_obj(*this))) {
|
||||
SERVER_LOG(WARN, "fail to traverse plan cache obj", K(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
SERVER_LOG(INFO, "fail to switch tenant, may be deleted", K(ret), K(tenant_id));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ITER_END;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (plan_id_array_.count() == 0) {
|
||||
} else {
|
||||
uint64_t plan_id = 0;
|
||||
if (OB_FAIL(plan_id_array_.pop_back(plan_id))) {
|
||||
SERVER_LOG(WARN, "failed to pop back plan id", K(ret));
|
||||
} else if (OB_ISNULL(cur_plan_cache_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "cur_plan_cache_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(cur_plan_cache_->ref_cache_obj(plan_id, guard))) {
|
||||
if (ret == OB_HASH_NOT_EXIST) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
SERVER_LOG(WARN, "fail to ref physical plan", K(ret));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (OB_SUCC(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPlanCachePlanExplain::set_tenant_plan_id(const common::ObIArray<common::ObNewRange> &ranges)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -272,6 +334,7 @@ int ObPlanCachePlanExplain::set_tenant_plan_id(const common::ObIArray<common::Ob
|
||||
if (ranges.count() == 1 && ranges.at(0).is_single_rowkey()) {
|
||||
ObRowkey start_key = ranges.at(0).start_key_;
|
||||
const ObObj *start_key_obj_ptr = start_key.get_obj_ptr();
|
||||
scan_all_plan_ = false;
|
||||
if (OB_ISNULL(start_key_obj_ptr)
|
||||
|| start_key.get_obj_cnt() != 4) /* (tenant_id, svr_ip, svr_port, plan_id) */ {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -284,6 +347,8 @@ int ObPlanCachePlanExplain::set_tenant_plan_id(const common::ObIArray<common::Ob
|
||||
tenant_id_ = start_key_obj_ptr[0].get_int();
|
||||
plan_id_ = start_key_obj_ptr[3].get_int();
|
||||
}
|
||||
} else {
|
||||
scan_all_plan_ = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -292,43 +357,62 @@ int ObPlanCachePlanExplain::inner_open()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObPhysicalPlan *plan = NULL;
|
||||
// !!!引用plan cache资源之前必须加ObReqTimeGuard
|
||||
ObReqTimeGuard req_timeinfo_guard;
|
||||
static_engine_exp_visitor_.set_effective_tenant_id(effective_tenant_id_);
|
||||
if (OB_FAIL(set_tenant_plan_id(key_ranges_))) {
|
||||
LOG_WARN("set tenant id and plan id failed", K(ret));
|
||||
} else if (!is_sys_tenant(effective_tenant_id_) && tenant_id_ != effective_tenant_id_) {
|
||||
// user tenant can only show self tenant infos
|
||||
// return nothing
|
||||
LOG_INFO("non-sys tenant can only show self tenant plan cache plan explain infos",
|
||||
K(effective_tenant_id_), K(tenant_id_), K(plan_id_));
|
||||
} else if (OB_INVALID_INDEX != tenant_id_ && OB_INVALID_INDEX != plan_id_) {
|
||||
} else if (!scan_all_plan_) {
|
||||
ObPlanCache *plan_cache = NULL;
|
||||
// !!!引用plan cache资源之前必须加ObReqTimeGuard
|
||||
ObReqTimeGuard req_timeinfo_guard;
|
||||
ObCacheObjGuard guard(PLAN_EXPLAIN_HANDLE);
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
|
||||
MTL_SWITCH(tenant_id_) {
|
||||
plan_cache = MTL(ObPlanCache*);
|
||||
if (OB_SUCCESS != (tmp_ret = plan_cache->ref_plan(plan_id_, guard))) {
|
||||
// should not panic
|
||||
} else if (FALSE_IT(plan = static_cast<ObPhysicalPlan*>(guard.get_cache_obj()))) {
|
||||
// do nothing
|
||||
} else if (OB_ISNULL(plan)) {
|
||||
// maybe pl object, do nothing
|
||||
} else if (OB_NOT_NULL(plan->get_root_op_spec())) {
|
||||
if (OB_FAIL(static_engine_exp_visitor_.init(tenant_id_, plan_id_, allocator_))) {
|
||||
SERVER_LOG(WARN, "failed to init visitor", K(ret));
|
||||
} else if (OB_FAIL(plan->get_root_op_spec()->accept(static_engine_exp_visitor_))) {
|
||||
SERVER_LOG(WARN, "fail to traverse physical plan", K(ret));
|
||||
if (!is_sys_tenant(effective_tenant_id_) && tenant_id_ != effective_tenant_id_) {
|
||||
// user tenant can only show self tenant infos
|
||||
// return nothing
|
||||
LOG_INFO("non-sys tenant can only show self tenant plan cache plan explain infos",
|
||||
K(effective_tenant_id_), K(tenant_id_), K(plan_id_));
|
||||
} else {
|
||||
MTL_SWITCH(tenant_id_) {
|
||||
plan_cache = MTL(ObPlanCache*);
|
||||
if (OB_SUCCESS != (tmp_ret = plan_cache->ref_plan(plan_id_, guard))) {
|
||||
// should not panic
|
||||
} else if (FALSE_IT(plan = static_cast<ObPhysicalPlan*>(guard.get_cache_obj()))) {
|
||||
// do nothing
|
||||
} else if (OB_ISNULL(plan)) {
|
||||
// maybe pl object, do nothing
|
||||
} else if (OB_NOT_NULL(plan->get_root_op_spec())) {
|
||||
if (OB_FAIL(static_engine_exp_visitor_.init(tenant_id_, plan_id_))) {
|
||||
SERVER_LOG(WARN, "failed to init visitor", K(ret));
|
||||
} else if (OB_FAIL(plan->get_root_op_spec()->accept(static_engine_exp_visitor_))) {
|
||||
SERVER_LOG(WARN, "fail to traverse physical plan", K(ret));
|
||||
}
|
||||
} else {
|
||||
// done
|
||||
}
|
||||
} else {
|
||||
// done
|
||||
// failed to switch tenant
|
||||
ret = OB_SUCCESS;
|
||||
SERVER_LOG(INFO, "fail to switch tenant, may be deleted", K(ret), K(tenant_id_));
|
||||
}
|
||||
} // mtl switch ends
|
||||
}
|
||||
} else {
|
||||
SERVER_LOG(DEBUG, "invalid tenant_id or plan_id", K_(tenant_id), K_(plan_id));
|
||||
// scan all plan
|
||||
if (is_sys_tenant(effective_tenant_id_)) {
|
||||
if (OB_ISNULL(GCTX.omt_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "GCTX.omt_ is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.omt_->get_mtl_tenant_ids(tenant_id_array_))) {
|
||||
SERVER_LOG(WARN, "failed to get all tenant id", K(ret));
|
||||
}
|
||||
} else {
|
||||
// user tenant show self tenant info
|
||||
if (OB_FAIL(tenant_id_array_.push_back(effective_tenant_id_))) {
|
||||
SERVER_LOG(WARN, "failed to push back tenant id", K(ret),
|
||||
K(effective_tenant_id_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// data is ready
|
||||
if (OB_SUCC(ret)) {
|
||||
scanner_it_ = scanner_.begin();
|
||||
}
|
||||
@ -339,14 +423,42 @@ int ObPlanCachePlanExplain::inner_open()
|
||||
int ObPlanCachePlanExplain::inner_get_next_row(common::ObNewRow *&row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(scanner_it_.get_next_row(cur_row_))) {
|
||||
if (OB_ITER_END != ret) {
|
||||
SERVER_LOG(WARN, "fail to get next row", K(ret));
|
||||
}
|
||||
if (iter_end_) {
|
||||
ret = OB_ITER_END;
|
||||
} else {
|
||||
row = &cur_row_;
|
||||
do {
|
||||
if (OB_FAIL(scanner_it_.get_next_row(cur_row_))) {
|
||||
if (OB_ITER_END != ret) {
|
||||
SERVER_LOG(WARN, "fail to get next row", K(ret));
|
||||
} else {
|
||||
if (scan_all_plan_) {
|
||||
ret = OB_SUCCESS;
|
||||
ObReqTimeGuard req_timeinfo_guard;
|
||||
ObCacheObjGuard guard(PLAN_EXPLAIN_HANDLE);
|
||||
if (OB_FAIL(cache_obj_iterator_.next(tenant_id_, guard))) {
|
||||
if (OB_ITER_END == ret) {
|
||||
iter_end_ = true;
|
||||
} else {
|
||||
SERVER_LOG(WARN, "fail to get next physical plan", K(ret));
|
||||
}
|
||||
} else {
|
||||
ObPhysicalPlan *plan = static_cast<ObPhysicalPlan*>(guard.get_cache_obj());
|
||||
if (OB_FAIL(static_engine_exp_visitor_.init(tenant_id_, plan->get_plan_id()))) {
|
||||
SERVER_LOG(WARN, "failed to init visitor", K(ret));
|
||||
} else if (OB_FAIL(plan->get_root_op_spec()->accept(static_engine_exp_visitor_))) {
|
||||
SERVER_LOG(WARN, "fail to traverse physical plan", K(ret));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iter_end_ = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
row = &cur_row_;
|
||||
break;
|
||||
}
|
||||
} while (OB_SUCC(ret));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -355,4 +467,4 @@ ObPlanCachePlanExplain::~ObPlanCachePlanExplain()
|
||||
}
|
||||
|
||||
} // end namespace observr
|
||||
} // end namespace oceanbase
|
||||
} // end namespace oceanbase
|
@ -21,7 +21,6 @@ namespace oceanbase
|
||||
{
|
||||
namespace observer
|
||||
{
|
||||
|
||||
class ObExpVisitor
|
||||
{
|
||||
public:
|
||||
@ -33,7 +32,7 @@ public:
|
||||
scanner_(scanner),
|
||||
tenant_id_(common::OB_INVALID_ID),
|
||||
plan_id_(common::OB_INVALID_ID),
|
||||
allocator_(NULL) {}
|
||||
allocator_() {}
|
||||
|
||||
template<class Op>
|
||||
int add_row(const Op &cur_op);
|
||||
@ -44,19 +43,17 @@ public:
|
||||
template<class Op>
|
||||
int get_property(const Op &cur_op, common::ObString &property);
|
||||
|
||||
int init(const uint64_t tenant_id,
|
||||
const uint64_t plan_id,
|
||||
common::ObIAllocator *allocator)
|
||||
void set_effective_tenant_id(int64_t effective_tenant_id)
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
if (OB_ISNULL(allocator)) {
|
||||
ret = common::OB_ERR_UNEXPECTED;
|
||||
} else {
|
||||
tenant_id_ = tenant_id;
|
||||
plan_id_ = plan_id;
|
||||
allocator_ = allocator;
|
||||
}
|
||||
return ret;
|
||||
allocator_.set_attr(lib::ObMemAttr(effective_tenant_id, lib::ObLabel("RowMemAlloc")));
|
||||
}
|
||||
|
||||
int init(const uint64_t tenant_id,
|
||||
const uint64_t plan_id)
|
||||
{
|
||||
tenant_id_ = tenant_id;
|
||||
plan_id_ = plan_id;
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
private:
|
||||
int get_table_access_desc(bool is_idx_access, const ObQueryFlag &scan_flag, ObString &tab_name,
|
||||
@ -67,7 +64,7 @@ protected:
|
||||
common::ObScanner &scanner_;
|
||||
int64_t tenant_id_;
|
||||
int64_t plan_id_;
|
||||
common::ObIAllocator *allocator_;
|
||||
common::ObArenaAllocator allocator_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExpVisitor);
|
||||
};
|
||||
|
||||
@ -80,10 +77,9 @@ public:
|
||||
: ObExpVisitor(output_column_ids, cur_row, scanner) {}
|
||||
virtual ~ObOpSpecExpVisitor() {}
|
||||
int init(const uint64_t tenant_id,
|
||||
const uint64_t plan_id,
|
||||
common::ObIAllocator *allocator)
|
||||
const uint64_t plan_id)
|
||||
{
|
||||
return ObExpVisitor::init(tenant_id, plan_id, allocator);
|
||||
return ObExpVisitor::init(tenant_id, plan_id);
|
||||
}
|
||||
int add_row(const sql::ObOpSpec &spec);
|
||||
virtual int pre_visit(const sql::ObOpSpec &spec) override
|
||||
@ -99,6 +95,26 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObOpSpecExpVisitor);
|
||||
};
|
||||
|
||||
class ObCacheObjIterator
|
||||
{
|
||||
public:
|
||||
ObCacheObjIterator(common::ObSEArray<uint64_t, 16> &tenant_id_array):
|
||||
tenant_id_array_(tenant_id_array),
|
||||
tenant_id_array_idx_(-1),
|
||||
plan_id_array_(),
|
||||
cur_plan_cache_(nullptr)
|
||||
{}
|
||||
|
||||
int operator()(common::hash::HashMapPair<ObCacheObjID, ObILibCacheObject *> &entry);
|
||||
|
||||
int next(int64_t &tenant_id, ObCacheObjGuard &guard);
|
||||
|
||||
common::ObSEArray<uint64_t, 16> &tenant_id_array_;
|
||||
int64_t tenant_id_array_idx_;
|
||||
common::ObSEArray<uint64_t, 16> plan_id_array_;
|
||||
ObPlanCache *cur_plan_cache_;
|
||||
};
|
||||
|
||||
class ObPlanCachePlanExplain : public common::ObVirtualTableScannerIterator
|
||||
{
|
||||
public:
|
||||
@ -118,6 +134,11 @@ public:
|
||||
ObPlanCachePlanExplain()
|
||||
: tenant_id_(common::OB_INVALID_INDEX),
|
||||
plan_id_(common::OB_INVALID_INDEX),
|
||||
scan_all_plan_(true),
|
||||
tenant_id_array_(),
|
||||
tenant_id_array_idx_(0),
|
||||
cache_obj_iterator_(tenant_id_array_),
|
||||
iter_end_(false),
|
||||
static_engine_exp_visitor_(output_column_ids_,
|
||||
cur_row_,
|
||||
scanner_)
|
||||
@ -129,6 +150,11 @@ private:
|
||||
int set_tenant_plan_id(const common::ObIArray<common::ObNewRange> &ranges);
|
||||
int64_t tenant_id_;
|
||||
int64_t plan_id_;
|
||||
bool scan_all_plan_;
|
||||
common::ObSEArray<uint64_t, 16> tenant_id_array_;
|
||||
int64_t tenant_id_array_idx_;
|
||||
ObCacheObjIterator cache_obj_iterator_;
|
||||
bool iter_end_;
|
||||
ObOpSpecExpVisitor static_engine_exp_visitor_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObPlanCachePlanExplain);
|
||||
};
|
||||
|
@ -229,6 +229,7 @@
|
||||
#include "observer/virtual_table/ob_all_virtual_tracepoint_info.h"
|
||||
#include "observer/virtual_table/ob_all_virtual_nic_info.h"
|
||||
#include "observer/virtual_table/ob_all_virtual_sys_variable_default_value.h"
|
||||
#include "observer/virtual_table/ob_all_virtual_session_ps_info.h"
|
||||
#include "observer/virtual_table/ob_information_schema_enable_roles_table.h"
|
||||
#include "observer/virtual_table/ob_all_virtual_tenant_scheduler_running_job.h"
|
||||
#include "observer/virtual_table/ob_all_virtual_compatibility_control.h"
|
||||
@ -1080,6 +1081,19 @@ int ObVTIterCreator::create_vt_iter(ObVTableScanParam ¶ms,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_VIRTUAL_SESSION_PS_INFO_TID: {
|
||||
ObAllVirtualSessionPsInfo *session_ps_info = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObAllVirtualSessionPsInfo, session_ps_info))) {
|
||||
SERVER_LOG(ERROR, "ObAllVirtualSessionPsInfo construct failed", K(ret));
|
||||
} else if (OB_ISNULL(session_ps_info)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "session_ps_info init failed", K(ret));
|
||||
} else {
|
||||
// init code
|
||||
vt_iter = static_cast<ObAllVirtualSessionPsInfo *>(session_ps_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_VIRTUAL_PROXY_PARTITION_INFO_TID: {
|
||||
ObAllVirtualProxyPartitionInfo *pi = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObAllVirtualProxyPartitionInfo, pi))) {
|
||||
|
@ -2295,6 +2295,240 @@ int ObInnerTableSchema::enabled_roles_schema(ObTableSchema &table_schema)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_session_ps_info_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_VIRTUAL_SESSION_PS_INFO_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(VIRTUAL_TABLE);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_ALL_VIRTUAL_SESSION_PS_INFO_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("svr_ip", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
1, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
MAX_IP_ADDR_LENGTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("svr_port", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
2, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("tenant_id", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("proxy_session_id", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt64Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("session_id", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt64Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("ps_client_stmt_id", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("ps_inner_stmt_id", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("stmt_type", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
256, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("param_count", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("param_types", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObLongTextType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("ref_count", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("checksum", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObIntType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(int64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
table_schema.get_part_option().set_part_num(1);
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ONE);
|
||||
table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_LIST_COLUMNS);
|
||||
if (OB_FAIL(table_schema.get_part_option().set_part_expr("svr_ip, svr_port"))) {
|
||||
LOG_WARN("set_part_expr failed", K(ret));
|
||||
} else if (OB_FAIL(table_schema.mock_list_partition_array())) {
|
||||
LOG_WARN("mock list partition array failed", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_HASH);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_tracepoint_info_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -6780,6 +6780,240 @@ int ObInnerTableSchema::all_virtual_index_usage_info_real_agent_ora_schema(ObTab
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_session_ps_info_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(VIRTUAL_TABLE);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCollationType::CS_TYPE_UTF8MB4_BIN);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("SVR_IP", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
1, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_UTF8MB4_BIN, //column_collation_type
|
||||
MAX_IP_ADDR_LENGTH, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("SVR_PORT", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
2, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("TENANT_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("PROXY_SESSION_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("SESSION_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("PS_CLIENT_STMT_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("PS_INNER_STMT_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("STMT_TYPE", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_UTF8MB4_BIN, //column_collation_type
|
||||
256, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("PARAM_COUNT", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("PARAM_TYPES", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObLongTextType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("REF_COUNT", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("CHECKSUM", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
table_schema.get_part_option().set_part_num(1);
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ONE);
|
||||
table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_LIST);
|
||||
if (OB_FAIL(table_schema.get_part_option().set_part_expr("SVR_IP, SVR_PORT"))) {
|
||||
LOG_WARN("set_part_expr failed", K(ret));
|
||||
} else if (OB_FAIL(table_schema.mock_list_partition_array())) {
|
||||
LOG_WARN("mock list partition array failed", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_HASH);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_tracepoint_info_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1525,6 +1525,106 @@ int ObInnerTableSchema::dba_mvref_stmt_stats_schema(ObTableSchema &table_schema)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_ob_session_ps_info_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_GV_OB_SESSION_PS_INFO_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_VIEW);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_GV_OB_SESSION_PS_INFO_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT SVR_IP, SVR_PORT, TENANT_ID, PROXY_SESSION_ID, SESSION_ID, PS_CLIENT_STMT_ID, PS_INNER_STMT_ID, STMT_TYPE, PARAM_COUNT, PARAM_TYPES, REF_COUNT, CHECKSUM FROM oceanbase.__all_virtual_session_ps_info )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::v_ob_session_ps_info_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_V_OB_SESSION_PS_INFO_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_VIEW);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_V_OB_SESSION_PS_INFO_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT SVR_IP, SVR_PORT, TENANT_ID, PROXY_SESSION_ID, SESSION_ID, PS_CLIENT_STMT_ID, PS_INNER_STMT_ID, STMT_TYPE, PARAM_COUNT, PARAM_TYPES, REF_COUNT, CHECKSUM FROM oceanbase.GV$OB_SESSION_PS_INFO WHERE svr_ip=HOST_IP() AND svr_port=RPC_PORT() )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_ob_tracepoint_info_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
File diff suppressed because one or more lines are too long
@ -375,6 +375,106 @@ int ObInnerTableSchema::v_ob_ls_snapshots_ora_schema(ObTableSchema &table_schema
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_ob_session_ps_info_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_GV_OB_SESSION_PS_INFO_ORA_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_VIEW);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_GV_OB_SESSION_PS_INFO_ORA_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT SVR_IP, SVR_PORT, TENANT_ID, PROXY_SESSION_ID, SESSION_ID, PS_CLIENT_STMT_ID, PS_INNER_STMT_ID, STMT_TYPE, PARAM_COUNT, PARAM_TYPES, REF_COUNT, CHECKSUM FROM SYS.ALL_VIRTUAL_SESSION_PS_INFO; )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::v_ob_session_ps_info_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_V_OB_SESSION_PS_INFO_ORA_TID);
|
||||
table_schema.set_rowkey_split_pos(0);
|
||||
table_schema.set_is_use_bloomfilter(false);
|
||||
table_schema.set_progressive_merge_num(0);
|
||||
table_schema.set_rowkey_column_num(0);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_VIEW);
|
||||
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_V_OB_SESSION_PS_INFO_ORA_TNAME))) {
|
||||
LOG_ERROR("fail to set table_name", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
|
||||
LOG_ERROR("fail to set compress_func_name", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
|
||||
table_schema.set_charset_type(ObCharset::get_default_charset());
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT SVR_IP, SVR_PORT, TENANT_ID, PROXY_SESSION_ID, SESSION_ID, PS_CLIENT_STMT_ID, PS_INNER_STMT_ID, STMT_TYPE, PARAM_COUNT, PARAM_TYPES, REF_COUNT, CHECKSUM FROM SYS.GV$OB_SESSION_PS_INFO WHERE svr_ip=HOST_IP() AND svr_port=RPC_PORT() )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
table_schema.set_tablet_id(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_ob_tracepoint_info_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -159,6 +159,24 @@ struct ALL_VIRTUAL_PS_ITEM_INFO_CDE {
|
||||
};
|
||||
|
||||
|
||||
struct ALL_VIRTUAL_SESSION_PS_INFO_CDE {
|
||||
enum {
|
||||
SVR_IP = common::OB_APP_MIN_COLUMN_ID,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct ALL_VIRTUAL_PLAN_STAT_ORA_CDE {
|
||||
enum {
|
||||
TENANT_ID = common::OB_APP_MIN_COLUMN_ID,
|
||||
@ -287,6 +305,24 @@ struct ALL_VIRTUAL_TENANT_PARAMETER_STAT_ORA_CDE {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct ALL_VIRTUAL_SESSION_PS_INFO_ORA_CDE {
|
||||
enum {
|
||||
SVR_IP = common::OB_APP_MIN_COLUMN_ID,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
};
|
||||
};
|
||||
|
||||
class ObInnerTableSchema
|
||||
{
|
||||
|
||||
@ -1034,6 +1070,7 @@ public:
|
||||
static int all_virtual_column_privilege_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tenant_snapshot_ls_replica_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int enabled_roles_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_session_ps_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tracepoint_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_compatibility_control_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_user_proxy_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1310,6 +1347,7 @@ public:
|
||||
static int all_virtual_transfer_partition_task_history_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_ls_snapshot_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_index_usage_info_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_session_ps_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tracepoint_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_user_proxy_info_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_user_proxy_role_info_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1730,6 +1768,8 @@ public:
|
||||
static int dba_mvref_change_stats_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_mvref_stmt_stats_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_mvref_stmt_stats_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_session_ps_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_session_ps_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_tracepoint_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_tracepoint_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_compatibility_control_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -2217,6 +2257,8 @@ public:
|
||||
static int dba_index_usage_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_ls_snapshots_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_ls_snapshots_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_session_ps_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_session_ps_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_tracepoint_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_tracepoint_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_tenant_resource_limit_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -3788,6 +3830,7 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_column_privilege_history_schema,
|
||||
ObInnerTableSchema::all_virtual_tenant_snapshot_ls_replica_history_schema,
|
||||
ObInnerTableSchema::enabled_roles_schema,
|
||||
ObInnerTableSchema::all_virtual_session_ps_info_schema,
|
||||
ObInnerTableSchema::all_virtual_tracepoint_info_schema,
|
||||
ObInnerTableSchema::all_virtual_compatibility_control_schema,
|
||||
ObInnerTableSchema::all_virtual_user_proxy_info_schema,
|
||||
@ -4074,6 +4117,7 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_transfer_partition_task_history_real_agent_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_ls_snapshot_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_index_usage_info_real_agent_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_session_ps_info_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_tracepoint_info_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_user_proxy_info_real_agent_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_user_proxy_role_info_real_agent_ora_schema,
|
||||
@ -4581,6 +4625,8 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::dba_mvref_change_stats_schema,
|
||||
ObInnerTableSchema::cdb_mvref_stmt_stats_schema,
|
||||
ObInnerTableSchema::dba_mvref_stmt_stats_schema,
|
||||
ObInnerTableSchema::gv_ob_session_ps_info_schema,
|
||||
ObInnerTableSchema::v_ob_session_ps_info_schema,
|
||||
ObInnerTableSchema::gv_ob_tracepoint_info_schema,
|
||||
ObInnerTableSchema::v_ob_tracepoint_info_schema,
|
||||
ObInnerTableSchema::v_ob_compatibility_control_schema,
|
||||
@ -5068,6 +5114,8 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::dba_index_usage_ora_schema,
|
||||
ObInnerTableSchema::gv_ob_ls_snapshots_ora_schema,
|
||||
ObInnerTableSchema::v_ob_ls_snapshots_ora_schema,
|
||||
ObInnerTableSchema::gv_ob_session_ps_info_ora_schema,
|
||||
ObInnerTableSchema::v_ob_session_ps_info_ora_schema,
|
||||
ObInnerTableSchema::gv_ob_tracepoint_info_ora_schema,
|
||||
ObInnerTableSchema::v_ob_tracepoint_info_ora_schema,
|
||||
ObInnerTableSchema::gv_ob_tenant_resource_limit_ora_schema,
|
||||
@ -5705,6 +5753,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TID,
|
||||
OB_ENABLED_ROLES_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_TID,
|
||||
OB_ALL_VIRTUAL_COMPATIBILITY_CONTROL_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_TID,
|
||||
@ -5984,6 +6033,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA_TID,
|
||||
@ -6285,6 +6335,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_DBA_MVREF_STATS_TID,
|
||||
OB_DBA_MVREF_CHANGE_STATS_TID,
|
||||
OB_DBA_MVREF_STMT_STATS_TID,
|
||||
OB_GV_OB_SESSION_PS_INFO_TID,
|
||||
OB_V_OB_SESSION_PS_INFO_TID,
|
||||
OB_GV_OB_TRACEPOINT_INFO_TID,
|
||||
OB_V_OB_TRACEPOINT_INFO_TID,
|
||||
OB_V_OB_COMPATIBILITY_CONTROL_TID,
|
||||
@ -6771,6 +6823,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_DBA_INDEX_USAGE_ORA_TID,
|
||||
OB_GV_OB_LS_SNAPSHOTS_ORA_TID,
|
||||
OB_V_OB_LS_SNAPSHOTS_ORA_TID,
|
||||
OB_GV_OB_SESSION_PS_INFO_ORA_TID,
|
||||
OB_V_OB_SESSION_PS_INFO_ORA_TID,
|
||||
OB_GV_OB_TRACEPOINT_INFO_ORA_TID,
|
||||
OB_V_OB_TRACEPOINT_INFO_ORA_TID,
|
||||
OB_GV_OB_TENANT_RESOURCE_LIMIT_ORA_TID,
|
||||
@ -7652,6 +7706,7 @@ const uint64_t all_ora_mapping_virtual_table_org_tables [] = {
|
||||
OB_ALL_VIRTUAL_CGROUP_CONFIG_TID,
|
||||
OB_ALL_VIRTUAL_SYS_VARIABLE_DEFAULT_VALUE_TID,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_DETAIL_TID,
|
||||
@ -7798,6 +7853,7 @@ const uint64_t all_ora_mapping_virtual_tables [] = { OB_ALL_VIRTUAL_SQL_AUDIT_O
|
||||
, OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TID
|
||||
, OB_ALL_VIRTUAL_SYS_VARIABLE_DEFAULT_VALUE_ORA_TID
|
||||
, OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TID
|
||||
, OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID
|
||||
, OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TID
|
||||
, OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_ORA_TID
|
||||
, OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_DETAIL_ORA_TID
|
||||
@ -8319,6 +8375,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_TNAME,
|
||||
OB_ALL_VIRTUAL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TNAME,
|
||||
OB_ENABLED_ROLES_TNAME,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_TNAME,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_TNAME,
|
||||
OB_ALL_VIRTUAL_COMPATIBILITY_CONTROL_TNAME,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_TNAME,
|
||||
@ -8598,6 +8655,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA_TNAME,
|
||||
@ -8899,6 +8957,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_DBA_MVREF_STATS_TNAME,
|
||||
OB_DBA_MVREF_CHANGE_STATS_TNAME,
|
||||
OB_DBA_MVREF_STMT_STATS_TNAME,
|
||||
OB_GV_OB_SESSION_PS_INFO_TNAME,
|
||||
OB_V_OB_SESSION_PS_INFO_TNAME,
|
||||
OB_GV_OB_TRACEPOINT_INFO_TNAME,
|
||||
OB_V_OB_TRACEPOINT_INFO_TNAME,
|
||||
OB_V_OB_COMPATIBILITY_CONTROL_TNAME,
|
||||
@ -9385,6 +9445,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_DBA_INDEX_USAGE_ORA_TNAME,
|
||||
OB_GV_OB_LS_SNAPSHOTS_ORA_TNAME,
|
||||
OB_V_OB_LS_SNAPSHOTS_ORA_TNAME,
|
||||
OB_GV_OB_SESSION_PS_INFO_ORA_TNAME,
|
||||
OB_V_OB_SESSION_PS_INFO_ORA_TNAME,
|
||||
OB_GV_OB_TRACEPOINT_INFO_ORA_TNAME,
|
||||
OB_V_OB_TRACEPOINT_INFO_ORA_TNAME,
|
||||
OB_GV_OB_TENANT_RESOURCE_LIMIT_ORA_TNAME,
|
||||
@ -10276,6 +10338,7 @@ const uint64_t tenant_distributed_vtables [] = {
|
||||
OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_CHECKPOINT_UNIT_INFO_TID,
|
||||
OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_INFO_TID,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_DETAIL_TID,
|
||||
@ -10350,6 +10413,7 @@ const uint64_t tenant_distributed_vtables [] = {
|
||||
OB_ALL_VIRTUAL_LS_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TID,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_RESOURCE_LIMIT_DETAIL_ORA_TID,
|
||||
@ -10478,6 +10542,7 @@ const uint64_t restrict_access_virtual_tables[] = {
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA_TID,
|
||||
@ -13061,11 +13126,11 @@ static inline int get_sys_table_lob_aux_schema(const uint64_t tid,
|
||||
|
||||
const int64_t OB_CORE_TABLE_COUNT = 4;
|
||||
const int64_t OB_SYS_TABLE_COUNT = 296;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 821;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 908;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 2030;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 823;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 912;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 2036;
|
||||
const int64_t OB_CORE_SCHEMA_VERSION = 1;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 2033;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 2039;
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -770,6 +770,7 @@ const uint64_t OB_ALL_VIRTUAL_COLUMN_PRIVILEGE_TID = 12462; // "__all_virtual_co
|
||||
const uint64_t OB_ALL_VIRTUAL_COLUMN_PRIVILEGE_HISTORY_TID = 12463; // "__all_virtual_column_privilege_history"
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TID = 12464; // "__all_virtual_tenant_snapshot_ls_replica_history"
|
||||
const uint64_t OB_ENABLED_ROLES_TID = 12466; // "ENABLED_ROLES"
|
||||
const uint64_t OB_ALL_VIRTUAL_SESSION_PS_INFO_TID = 12468; // "__all_virtual_session_ps_info"
|
||||
const uint64_t OB_ALL_VIRTUAL_TRACEPOINT_INFO_TID = 12469; // "__all_virtual_tracepoint_info"
|
||||
const uint64_t OB_ALL_VIRTUAL_COMPATIBILITY_CONTROL_TID = 12473; // "__all_virtual_compatibility_control"
|
||||
const uint64_t OB_ALL_VIRTUAL_USER_PROXY_INFO_TID = 12474; // "__all_virtual_user_proxy_info"
|
||||
@ -1046,6 +1047,7 @@ const uint64_t OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TID = 15430
|
||||
const uint64_t OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TID = 15431; // "ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TID = 15439; // "ALL_VIRTUAL_LS_SNAPSHOT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA_TID = 15440; // "ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TID = 15444; // "ALL_VIRTUAL_SESSION_PS_INFO_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TID = 15445; // "ALL_VIRTUAL_TRACEPOINT_INFO_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA_TID = 15446; // "ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA_TID = 15447; // "ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA"
|
||||
@ -1466,6 +1468,8 @@ const uint64_t OB_CDB_MVREF_CHANGE_STATS_TID = 21537; // "CDB_MVREF_CHANGE_STATS
|
||||
const uint64_t OB_DBA_MVREF_CHANGE_STATS_TID = 21538; // "DBA_MVREF_CHANGE_STATS"
|
||||
const uint64_t OB_CDB_MVREF_STMT_STATS_TID = 21539; // "CDB_MVREF_STMT_STATS"
|
||||
const uint64_t OB_DBA_MVREF_STMT_STATS_TID = 21540; // "DBA_MVREF_STMT_STATS"
|
||||
const uint64_t OB_GV_OB_SESSION_PS_INFO_TID = 21541; // "GV$OB_SESSION_PS_INFO"
|
||||
const uint64_t OB_V_OB_SESSION_PS_INFO_TID = 21542; // "V$OB_SESSION_PS_INFO"
|
||||
const uint64_t OB_GV_OB_TRACEPOINT_INFO_TID = 21543; // "GV$OB_TRACEPOINT_INFO"
|
||||
const uint64_t OB_V_OB_TRACEPOINT_INFO_TID = 21544; // "V$OB_TRACEPOINT_INFO"
|
||||
const uint64_t OB_V_OB_COMPATIBILITY_CONTROL_TID = 21545; // "V$OB_COMPATIBILITY_CONTROL"
|
||||
@ -1953,6 +1957,8 @@ const uint64_t OB_DBA_OB_SYS_VARIABLES_ORA_TID = 28211; // "DBA_OB_SYS_VARIABLES
|
||||
const uint64_t OB_DBA_INDEX_USAGE_ORA_TID = 28214; // "DBA_INDEX_USAGE_ORA"
|
||||
const uint64_t OB_GV_OB_LS_SNAPSHOTS_ORA_TID = 28215; // "GV$OB_LS_SNAPSHOTS_ORA"
|
||||
const uint64_t OB_V_OB_LS_SNAPSHOTS_ORA_TID = 28216; // "V$OB_LS_SNAPSHOTS_ORA"
|
||||
const uint64_t OB_GV_OB_SESSION_PS_INFO_ORA_TID = 28219; // "GV$OB_SESSION_PS_INFO_ORA"
|
||||
const uint64_t OB_V_OB_SESSION_PS_INFO_ORA_TID = 28220; // "V$OB_SESSION_PS_INFO_ORA"
|
||||
const uint64_t OB_GV_OB_TRACEPOINT_INFO_ORA_TID = 28221; // "GV$OB_TRACEPOINT_INFO_ORA"
|
||||
const uint64_t OB_V_OB_TRACEPOINT_INFO_ORA_TID = 28222; // "V$OB_TRACEPOINT_INFO_ORA"
|
||||
const uint64_t OB_GV_OB_TENANT_RESOURCE_LIMIT_ORA_TID = 28224; // "GV$OB_TENANT_RESOURCE_LIMIT_ORA"
|
||||
@ -3508,6 +3514,7 @@ const char *const OB_ALL_VIRTUAL_COLUMN_PRIVILEGE_TNAME = "__all_virtual_column_
|
||||
const char *const OB_ALL_VIRTUAL_COLUMN_PRIVILEGE_HISTORY_TNAME = "__all_virtual_column_privilege_history";
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TNAME = "__all_virtual_tenant_snapshot_ls_replica_history";
|
||||
const char *const OB_ENABLED_ROLES_TNAME = "ENABLED_ROLES";
|
||||
const char *const OB_ALL_VIRTUAL_SESSION_PS_INFO_TNAME = "__all_virtual_session_ps_info";
|
||||
const char *const OB_ALL_VIRTUAL_TRACEPOINT_INFO_TNAME = "__all_virtual_tracepoint_info";
|
||||
const char *const OB_ALL_VIRTUAL_COMPATIBILITY_CONTROL_TNAME = "__all_virtual_compatibility_control";
|
||||
const char *const OB_ALL_VIRTUAL_USER_PROXY_INFO_TNAME = "__all_virtual_user_proxy_info";
|
||||
@ -3784,6 +3791,7 @@ const char *const OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TNAME =
|
||||
const char *const OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT";
|
||||
const char *const OB_ALL_VIRTUAL_LS_SNAPSHOT_ORA_TNAME = "ALL_VIRTUAL_LS_SNAPSHOT";
|
||||
const char *const OB_ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT";
|
||||
const char *const OB_ALL_VIRTUAL_SESSION_PS_INFO_ORA_TNAME = "ALL_VIRTUAL_SESSION_PS_INFO";
|
||||
const char *const OB_ALL_VIRTUAL_TRACEPOINT_INFO_ORA_TNAME = "ALL_VIRTUAL_TRACEPOINT_INFO";
|
||||
const char *const OB_ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT";
|
||||
const char *const OB_ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_USER_PROXY_ROLE_INFO_REAL_AGENT";
|
||||
@ -4204,6 +4212,8 @@ const char *const OB_CDB_MVREF_CHANGE_STATS_TNAME = "CDB_MVREF_CHANGE_STATS";
|
||||
const char *const OB_DBA_MVREF_CHANGE_STATS_TNAME = "DBA_MVREF_CHANGE_STATS";
|
||||
const char *const OB_CDB_MVREF_STMT_STATS_TNAME = "CDB_MVREF_STMT_STATS";
|
||||
const char *const OB_DBA_MVREF_STMT_STATS_TNAME = "DBA_MVREF_STMT_STATS";
|
||||
const char *const OB_GV_OB_SESSION_PS_INFO_TNAME = "GV$OB_SESSION_PS_INFO";
|
||||
const char *const OB_V_OB_SESSION_PS_INFO_TNAME = "V$OB_SESSION_PS_INFO";
|
||||
const char *const OB_GV_OB_TRACEPOINT_INFO_TNAME = "GV$OB_TRACEPOINT_INFO";
|
||||
const char *const OB_V_OB_TRACEPOINT_INFO_TNAME = "V$OB_TRACEPOINT_INFO";
|
||||
const char *const OB_V_OB_COMPATIBILITY_CONTROL_TNAME = "V$OB_COMPATIBILITY_CONTROL";
|
||||
@ -4691,6 +4701,8 @@ const char *const OB_DBA_OB_SYS_VARIABLES_ORA_TNAME = "DBA_OB_SYS_VARIABLES";
|
||||
const char *const OB_DBA_INDEX_USAGE_ORA_TNAME = "DBA_INDEX_USAGE";
|
||||
const char *const OB_GV_OB_LS_SNAPSHOTS_ORA_TNAME = "GV$OB_LS_SNAPSHOTS";
|
||||
const char *const OB_V_OB_LS_SNAPSHOTS_ORA_TNAME = "V$OB_LS_SNAPSHOTS";
|
||||
const char *const OB_GV_OB_SESSION_PS_INFO_ORA_TNAME = "GV$OB_SESSION_PS_INFO";
|
||||
const char *const OB_V_OB_SESSION_PS_INFO_ORA_TNAME = "V$OB_SESSION_PS_INFO";
|
||||
const char *const OB_GV_OB_TRACEPOINT_INFO_ORA_TNAME = "GV$OB_TRACEPOINT_INFO";
|
||||
const char *const OB_V_OB_TRACEPOINT_INFO_ORA_TNAME = "V$OB_TRACEPOINT_INFO";
|
||||
const char *const OB_GV_OB_TENANT_RESOURCE_LIMIT_ORA_TNAME = "GV$OB_TENANT_RESOURCE_LIMIT";
|
||||
|
@ -14400,7 +14400,33 @@ def_table_schema(
|
||||
)
|
||||
|
||||
# 12467: __all_virtual_ls_replica_task_history
|
||||
# 12468: __all_virtual_session_ps_info
|
||||
def_table_schema(
|
||||
owner = 'gongyusen.gys',
|
||||
table_name = '__all_virtual_session_ps_info',
|
||||
table_id = '12468',
|
||||
table_type = 'VIRTUAL_TABLE',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
enable_column_def_enum = True,
|
||||
in_tenant_space = True,
|
||||
normal_columns = [
|
||||
('svr_ip', 'varchar:MAX_IP_ADDR_LENGTH'),
|
||||
('svr_port', 'int'),
|
||||
('tenant_id', 'int'),
|
||||
('proxy_session_id', 'uint'),
|
||||
('session_id', 'uint'),
|
||||
('ps_client_stmt_id', 'int'),
|
||||
('ps_inner_stmt_id', 'int'),
|
||||
('stmt_type', 'varchar:256'),
|
||||
('param_count', 'int'),
|
||||
('param_types', 'longtext'),
|
||||
('ref_count', 'int'),
|
||||
('checksum', 'int')
|
||||
],
|
||||
partition_columns = ['svr_ip', 'svr_port'],
|
||||
vtable_route_policy = 'distributed',
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'fy373789',
|
||||
tablegroup_id = 'OB_INVALID_ID',
|
||||
@ -15025,7 +15051,7 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('1
|
||||
# 15438: abandoned
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15439', all_def_keywords['__all_virtual_ls_snapshot'])))
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('15440', all_def_keywords['__all_index_usage_info'])))
|
||||
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15444', all_def_keywords['__all_virtual_session_ps_info'])))
|
||||
# 余留位置
|
||||
|
||||
# 15441: __all_virtual_shared_storage_quota
|
||||
@ -16538,6 +16564,7 @@ def_table_schema(
|
||||
flt_trace_id as FLT_TRACE_ID,
|
||||
pl_trace_id as PL_TRACE_ID,
|
||||
plsql_exec_time as PLSQL_EXEC_TIME,
|
||||
stmt_type as STMT_TYPE,
|
||||
total_memstore_read_row_count as TOTAL_MEMSTORE_READ_ROW_COUNT,
|
||||
total_ssstore_read_row_count as TOTAL_SSSTORE_READ_ROW_COUNT,
|
||||
proxy_user as PROXY_USER
|
||||
@ -16947,6 +16974,7 @@ def_table_schema(
|
||||
FLT_TRACE_ID,
|
||||
PL_TRACE_ID,
|
||||
PLSQL_EXEC_TIME,
|
||||
stmt_type as STMT_TYPE,
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT,
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT,
|
||||
PROXY_USER
|
||||
@ -34501,8 +34529,64 @@ def_table_schema(
|
||||
""".replace("\n", " ")
|
||||
)
|
||||
|
||||
# 21541: GV$OB_SESSION_PS_INFO
|
||||
# 21542: V$OB_SESSION_PS_INFO
|
||||
def_table_schema(
|
||||
owner = 'gongyusen.gys',
|
||||
table_name = 'GV$OB_SESSION_PS_INFO',
|
||||
table_id = '21541',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
in_tenant_space = True,
|
||||
rowkey_columns = [],
|
||||
view_definition = """
|
||||
SELECT
|
||||
SVR_IP,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
FROM
|
||||
oceanbase.__all_virtual_session_ps_info
|
||||
""".replace("\n", " "),
|
||||
normal_columns = [
|
||||
],
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'gongyusen.gys',
|
||||
table_name = 'V$OB_SESSION_PS_INFO',
|
||||
table_id = '21542',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
in_tenant_space = True,
|
||||
rowkey_columns = [],
|
||||
view_definition = """
|
||||
SELECT
|
||||
SVR_IP,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
FROM oceanbase.GV$OB_SESSION_PS_INFO
|
||||
WHERE svr_ip=HOST_IP() AND svr_port=RPC_PORT()
|
||||
""".replace("\n", " "),
|
||||
normal_columns = [
|
||||
],
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'fy373789',
|
||||
table_name = 'GV$OB_TRACEPOINT_INFO',
|
||||
@ -55810,6 +55894,7 @@ def_table_schema(
|
||||
flt_trace_id as FLT_TRACE_ID,
|
||||
pl_trace_id as PL_TRACE_ID,
|
||||
plsql_exec_time as PLSQL_EXEC_TIME,
|
||||
stmt_type as STMT_TYPE,
|
||||
total_memstore_read_row_count as TOTAL_MEMSTORE_READ_ROW_COUNT,
|
||||
total_ssstore_read_row_count as TOTAL_SSSTORE_READ_ROW_COUNT,
|
||||
proxy_user as PROXY_USER
|
||||
@ -55923,6 +56008,7 @@ TX_STATE_VERSION,
|
||||
FLT_TRACE_ID,
|
||||
PL_TRACE_ID,
|
||||
PLSQL_EXEC_TIME,
|
||||
STMT_TYPE,
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT,
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT,
|
||||
PROXY_USER FROM SYS.GV$OB_SQL_AUDIT WHERE SVR_IP=HOST_IP() AND SVR_PORT=RPC_PORT()
|
||||
@ -63062,8 +63148,68 @@ def_table_schema(
|
||||
|
||||
# 28217: GV$OB_SHARED_STORAGE_QUOTA
|
||||
# 28218: V$OB_SHARED_STORAGE_QUOTA
|
||||
# 28219: GV$OB_SESSION_PS_INFO
|
||||
# 28220: V$OB_SESSION_PS_INFO
|
||||
def_table_schema(
|
||||
owner = 'gongyusen.gys',
|
||||
table_name = 'GV$OB_SESSION_PS_INFO',
|
||||
name_postfix = '_ORA',
|
||||
database_id = 'OB_ORA_SYS_DATABASE_ID',
|
||||
table_id = '28219',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
in_tenant_space = True,
|
||||
rowkey_columns = [],
|
||||
view_definition = """
|
||||
SELECT
|
||||
SVR_IP,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
FROM
|
||||
SYS.ALL_VIRTUAL_SESSION_PS_INFO;
|
||||
""".replace("\n", " "),
|
||||
normal_columns = [
|
||||
],
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'gongyusen.gys',
|
||||
table_name = 'V$OB_SESSION_PS_INFO',
|
||||
name_postfix = '_ORA',
|
||||
database_id = 'OB_ORA_SYS_DATABASE_ID',
|
||||
table_id = '28220',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
in_tenant_space = True,
|
||||
rowkey_columns = [],
|
||||
view_definition = """
|
||||
SELECT
|
||||
SVR_IP,
|
||||
SVR_PORT,
|
||||
TENANT_ID,
|
||||
PROXY_SESSION_ID,
|
||||
SESSION_ID,
|
||||
PS_CLIENT_STMT_ID,
|
||||
PS_INNER_STMT_ID,
|
||||
STMT_TYPE,
|
||||
PARAM_COUNT,
|
||||
PARAM_TYPES,
|
||||
REF_COUNT,
|
||||
CHECKSUM
|
||||
FROM SYS.GV$OB_SESSION_PS_INFO
|
||||
WHERE svr_ip=HOST_IP() AND svr_port=RPC_PORT()
|
||||
""".replace("\n", " "),
|
||||
normal_columns = [
|
||||
],
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'fy373789',
|
||||
table_name = 'GV$OB_TRACEPOINT_INFO',
|
||||
|
@ -1105,6 +1105,7 @@
|
||||
# 12464: __all_virtual_tenant_snapshot_ls_replica_history
|
||||
# 12464: __all_tenant_snapshot_ls_replica_history # BASE_TABLE_NAME
|
||||
# 12466: ENABLED_ROLES
|
||||
# 12468: __all_virtual_session_ps_info
|
||||
# 12469: __all_virtual_tracepoint_info
|
||||
# 12473: __all_virtual_compatibility_control
|
||||
# 12474: __all_virtual_user_proxy_info
|
||||
@ -1711,6 +1712,8 @@
|
||||
# 15439: __all_virtual_ls_snapshot # BASE_TABLE_NAME
|
||||
# 15440: ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT
|
||||
# 15440: __all_index_usage_info # BASE_TABLE_NAME
|
||||
# 15444: ALL_VIRTUAL_SESSION_PS_INFO
|
||||
# 15444: __all_virtual_session_ps_info # BASE_TABLE_NAME
|
||||
# 15445: ALL_VIRTUAL_TRACEPOINT_INFO
|
||||
# 15445: __all_virtual_tracepoint_info # BASE_TABLE_NAME
|
||||
# 15446: ALL_VIRTUAL_USER_PROXY_INFO_REAL_AGENT
|
||||
@ -2139,6 +2142,8 @@
|
||||
# 21538: DBA_MVREF_CHANGE_STATS
|
||||
# 21539: CDB_MVREF_STMT_STATS
|
||||
# 21540: DBA_MVREF_STMT_STATS
|
||||
# 21541: GV$OB_SESSION_PS_INFO
|
||||
# 21542: V$OB_SESSION_PS_INFO
|
||||
# 21543: GV$OB_TRACEPOINT_INFO
|
||||
# 21544: V$OB_TRACEPOINT_INFO
|
||||
# 21545: V$OB_COMPATIBILITY_CONTROL
|
||||
@ -2626,6 +2631,8 @@
|
||||
# 28214: DBA_INDEX_USAGE
|
||||
# 28215: GV$OB_LS_SNAPSHOTS
|
||||
# 28216: V$OB_LS_SNAPSHOTS
|
||||
# 28219: GV$OB_SESSION_PS_INFO
|
||||
# 28220: V$OB_SESSION_PS_INFO
|
||||
# 28221: GV$OB_TRACEPOINT_INFO
|
||||
# 28222: V$OB_TRACEPOINT_INFO
|
||||
# 28224: GV$OB_TENANT_RESOURCE_LIMIT
|
||||
|
@ -1974,6 +1974,9 @@ DEF_STR_WITH_CHECKER(choose_migration_source_policy, OB_TENANT_PARAMETER, "regio
|
||||
"the policy of choose source in migration and add replica. 'idc' means firstly choose follower replica of the same idc as source, "
|
||||
"'region' means firstly choose follower replica of the same region as source",
|
||||
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_INT(_query_record_size_limit, OB_TENANT_PARAMETER, "65536", "[0, 67108864] in integer",
|
||||
"set sql_audit and plan stat query sql size. Range: [0,67108864] in integer in integer.",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_BOOL(_enable_choose_migration_source_policy, OB_TENANT_PARAMETER, "True",
|
||||
"Control whether to use chose_migration_source_policy. "
|
||||
"If the value of configure is false, it will not use chose_migration_source_policy and choose replica with the largest checkpoint scn as the source.",
|
||||
|
@ -764,6 +764,7 @@ ob_set_subtarget(ob_sql engine_expr
|
||||
engine/expr/ob_expr_rb_calc.cpp
|
||||
engine/expr/ob_expr_rb_to_string.cpp
|
||||
engine/expr/ob_expr_rb_from_string.cpp
|
||||
engine/expr/ob_expr_decode_trace_id.cpp
|
||||
)
|
||||
|
||||
ob_set_subtarget(ob_sql engine_join
|
||||
|
125
src/sql/engine/expr/ob_expr_decode_trace_id.cpp
Normal file
125
src/sql/engine/expr/ob_expr_decode_trace_id.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SQL_EXE
|
||||
#include "ob_expr_decode_trace_id.h"
|
||||
#include "lib/allocator/ob_allocator.h"
|
||||
#include "lib/ob_name_def.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
#include "sql/engine/ob_exec_context.h"
|
||||
#include "sql/engine/expr/ob_expr_util.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
namespace sql
|
||||
{
|
||||
ObExprDecodeTraceId::ObExprDecodeTraceId(ObIAllocator &alloc)
|
||||
: ObFuncExprOperator(alloc, T_FUN_SYS_DECODE_TRACE_ID, N_DECODE_TRACE_ID, 1,
|
||||
ObValidForGeneratedColFlag::VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION)
|
||||
{
|
||||
}
|
||||
ObExprDecodeTraceId::~ObExprDecodeTraceId()
|
||||
{
|
||||
}
|
||||
int ObExprDecodeTraceId::calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &trace_id,
|
||||
ObExprTypeCtx &type_ctx) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
UNUSED(type_ctx);
|
||||
if (!trace_id.is_null() && !trace_id.is_string_type()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument type", K(ret));
|
||||
} else {
|
||||
trace_id.set_calc_type_default_varchar();
|
||||
trace_id.set_calc_collation_level(CS_LEVEL_SYSCONST);
|
||||
trace_id.set_calc_length(OB_MAX_DATABASE_NAME_LENGTH);
|
||||
type.set_varchar();
|
||||
type.set_default_collation_type();
|
||||
type.set_collation_level(CS_LEVEL_SYSCONST);
|
||||
type.set_length(MAX_DECODE_TRACE_ID_RES_LEN);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObExprDecodeTraceId::calc_decode_trace_id_expr(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
ObDatum &res_datum)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDatum *trace_id_datum = nullptr;
|
||||
if (OB_FAIL(expr.args_[0]->eval(ctx, trace_id_datum))) {
|
||||
LOG_WARN("eval trace_id failed", K(ret));
|
||||
} else if (OB_ISNULL(trace_id_datum)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("param datum is null pointer", K(ret));
|
||||
} else if (trace_id_datum->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else if (OB_FAIL(calc_one_row(expr, ctx, *trace_id_datum, res_datum))) {
|
||||
LOG_WARN("calc trace_id failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObExprDecodeTraceId::calc_decode_trace_id_expr_batch(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
const ObBitVector &skip,
|
||||
const int64_t batch_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDatum *results = nullptr;
|
||||
ObDatum *trace_id_datum_array = nullptr;
|
||||
ObBitVector &eval_flags = expr.get_evaluated_flags(ctx);
|
||||
if (OB_FAIL(expr.args_[0]->eval_batch(ctx, skip, batch_size))) {
|
||||
LOG_WARN("batch eval trace_id failed", K(ret));
|
||||
} else if (OB_ISNULL(results = expr.locate_batch_datums(ctx))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("results datum is null pointer", K(ret));
|
||||
} else if (OB_ISNULL(trace_id_datum_array = expr.args_[0]->locate_batch_datums(ctx))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("param datum is null pointer", K(ret));
|
||||
} else {
|
||||
ObEvalCtx::BatchInfoScopeGuard guard(ctx);
|
||||
guard.set_batch_size(batch_size);
|
||||
for (int64_t idx = 0; OB_SUCC(ret) && idx < batch_size; ++idx) {
|
||||
guard.set_batch_idx(idx);
|
||||
if (skip.at(idx) || eval_flags.at(idx)) {
|
||||
continue;
|
||||
} else if (trace_id_datum_array[idx].is_null()) {
|
||||
results[idx].set_null();
|
||||
eval_flags.set(idx);
|
||||
} else if (OB_FAIL(calc_one_row(expr, ctx, trace_id_datum_array[idx], results[idx]))) {
|
||||
LOG_WARN("calc trace_id failed", K(ret));
|
||||
} else {
|
||||
eval_flags.set(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprDecodeTraceId::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
UNUSED(expr_cg_ctx);
|
||||
UNUSED(raw_expr);
|
||||
int ret = OB_SUCCESS;
|
||||
if (rt_expr.arg_cnt_ != 1) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("extract expr should have 1 params", K(ret), K(rt_expr.arg_cnt_));
|
||||
} else if (OB_ISNULL(rt_expr.args_) || OB_ISNULL(rt_expr.args_[0])) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("children of extract expr is null", K(ret), K(rt_expr.args_));
|
||||
} else {
|
||||
rt_expr.eval_func_ = ObExprDecodeTraceId::calc_decode_trace_id_expr;
|
||||
rt_expr.eval_batch_func_ = ObExprDecodeTraceId::calc_decode_trace_id_expr_batch;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
} // namespace oceanbase
|
61
src/sql/engine/expr/ob_expr_decode_trace_id.h
Normal file
61
src/sql/engine/expr/ob_expr_decode_trace_id.h
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_SQL_ENGINE_DECODE_TRACE_ID_
|
||||
#define OCEANBASE_SQL_ENGINE_DECODE_TRACE_ID_
|
||||
#include "sql/engine/expr/ob_expr_operator.h"
|
||||
#define MAX_DECODE_TRACE_ID_RES_LEN 128 // max string buffer length
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObExprDecodeTraceId : public ObFuncExprOperator {
|
||||
public:
|
||||
explicit ObExprDecodeTraceId(common::ObIAllocator &alloc);
|
||||
virtual ~ObExprDecodeTraceId();
|
||||
virtual int calc_result_type1(ObExprResType &type, ObExprResType &trace_id,
|
||||
common::ObExprTypeCtx &type_ctx) const;
|
||||
static int calc_decode_trace_id_expr(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
ObDatum &res_datum);
|
||||
static int calc_decode_trace_id_expr_batch(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
const ObBitVector &skip,
|
||||
const int64_t batch_size);
|
||||
|
||||
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override;
|
||||
template <typename T>
|
||||
static int calc_one_row(const ObExpr &expr, ObEvalCtx &ctx, const T ¶m, T &res)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObCurTraceId::TraceId trace_id;
|
||||
int32_t len = 0;
|
||||
char *buf = expr.get_str_res_mem(ctx, MAX_DECODE_TRACE_ID_RES_LEN);
|
||||
ObString trace_id_str = param.get_string();
|
||||
if (OB_ISNULL(buf)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("allocate string res buf failed", K(ret));
|
||||
} else if (trace_id_str.empty()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid trace id string", K(ret));
|
||||
} else if (OB_FAIL(trace_id.parse_from_buf(trace_id_str.ptr()))) {
|
||||
LOG_WARN("parse trace_id failed", K(ret));
|
||||
} else if (OB_FAIL(trace_id.get_addr().addr_to_buffer(buf, MAX_DECODE_TRACE_ID_RES_LEN, len))) {
|
||||
SQL_ENG_LOG(WARN, "fail to databuff_printf", K(ret));
|
||||
} else {
|
||||
res.set_string(buf, len);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprDecodeTraceId);
|
||||
};
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
#endif /* OCEANBASE_SQL_ENGINE_DECODE_TRACE_ID_ */
|
@ -380,6 +380,7 @@
|
||||
#include "ob_expr_sdo_relate.h"
|
||||
#include "ob_expr_inner_table_option_printer.h"
|
||||
#include "ob_expr_password.h"
|
||||
#include "ob_expr_decode_trace_id.h"
|
||||
#include "ob_expr_rb_build_empty.h"
|
||||
#include "ob_expr_rb_is_empty.h"
|
||||
#include "ob_expr_rb_build_varbinary.h"
|
||||
@ -1163,7 +1164,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
|
||||
ObExprTransactionId::eval_transaction_id, /* 670 */
|
||||
ObExprInnerTableOptionPrinter::eval_inner_table_option_printer, /* 671 */
|
||||
ObExprInnerTableSequenceGetter::eval_inner_table_sequence_getter, /* 672 */
|
||||
NULL, //ObExprDecodeTraceId::calc_decode_trace_id_expr, /* 673 */
|
||||
ObExprDecodeTraceId::calc_decode_trace_id_expr, /* 673 */
|
||||
ObExprInnerRowCmpVal::eval_inner_row_cmp_val, /* 674 */
|
||||
ObExprIs::json_is_true, /* 675 */
|
||||
ObExprIs::json_is_false, /* 676 */
|
||||
@ -1372,7 +1373,7 @@ static ObExpr::EvalBatchFunc g_expr_eval_batch_functions[] = {
|
||||
ObBatchCast::implicit_batch_cast<ObDecimalIntTC, ObUIntTC>, /* 126 */
|
||||
ObBatchCast::explicit_batch_cast<ObDecimalIntTC, ObNumberTC>, /* 127 */
|
||||
ObBatchCast::implicit_batch_cast<ObDecimalIntTC, ObNumberTC>, /* 128 */
|
||||
NULL,//ObExprDecodeTraceId::calc_decode_trace_id_expr_batch, /* 129 */
|
||||
ObExprDecodeTraceId::calc_decode_trace_id_expr_batch, /* 129 */
|
||||
ObExprTopNFilter::eval_topn_filter_batch, /* 130 */
|
||||
NULL,//ObRelationalExprOperator::eval_batch_min_max_compare, /* 131 */
|
||||
NULL,//ObExprBM25::eval_batch_bm25_relevance_expr, /* 132 */
|
||||
|
@ -452,6 +452,7 @@
|
||||
#include "sql/engine/expr/ob_expr_rb_from_string.h"
|
||||
|
||||
#include "sql/engine/expr/ob_expr_lock_func.h"
|
||||
#include "sql/engine/expr/ob_expr_decode_trace_id.h"
|
||||
#include "sql/engine/expr/ob_expr_topn_filter.h"
|
||||
#include "sql/engine/expr/ob_expr_get_path.h"
|
||||
|
||||
@ -1116,6 +1117,7 @@ void ObExprOperatorFactory::register_expr_operators()
|
||||
REG_OP(ObExprRbToString);
|
||||
REG_OP(ObExprRbFromString);
|
||||
REG_OP(ObExprGetPath);
|
||||
REG_OP(ObExprDecodeTraceId);
|
||||
}();
|
||||
// 注册oracle系统函数
|
||||
REG_OP_ORCL(ObExprSysConnectByPath);
|
||||
@ -1443,6 +1445,7 @@ void ObExprOperatorFactory::register_expr_operators()
|
||||
// REG_OP_ORCL(ObExprTopNFilter);
|
||||
REG_OP_ORCL(ObExprSdoRelate);
|
||||
REG_OP_ORCL(ObExprGetPath);
|
||||
REG_OP_ORCL(ObExprDecodeTraceId);
|
||||
}
|
||||
|
||||
bool ObExprOperatorFactory::is_expr_op_type_valid(ObExprOperatorType type)
|
||||
|
@ -1219,8 +1219,10 @@ int ObPhysicalPlan::update_cache_obj_stat(ObILibCacheCtx &ctx)
|
||||
stat_.slow_count_ = 0;
|
||||
stat_.slowest_exec_time_ = 0;
|
||||
stat_.slowest_exec_usec_ = 0;
|
||||
int64_t sql_length = ObSQLUtils::get_query_record_size_limit(
|
||||
pc_ctx.sql_ctx_.session_info_->get_effective_tenant_id());
|
||||
if (PC_PS_MODE == pc_ctx.mode_ || PC_PL_MODE == pc_ctx.mode_) {
|
||||
ObTruncatedString trunc_stmt(pc_ctx.raw_sql_, OB_MAX_SQL_LENGTH);
|
||||
ObTruncatedString trunc_stmt(pc_ctx.raw_sql_, sql_length);
|
||||
if (OB_FAIL(ob_write_string(get_allocator(),
|
||||
trunc_stmt.string(),
|
||||
stat_.stmt_))) {
|
||||
@ -1228,7 +1230,7 @@ int ObPhysicalPlan::update_cache_obj_stat(ObILibCacheCtx &ctx)
|
||||
}
|
||||
stat_.ps_stmt_id_ = pc_ctx.fp_result_.pc_key_.key_id_;
|
||||
} else {
|
||||
ObTruncatedString trunc_stmt(pc_ctx.sql_ctx_.spm_ctx_.bl_key_.constructed_sql_, OB_MAX_SQL_LENGTH);
|
||||
ObTruncatedString trunc_stmt(pc_ctx.sql_ctx_.spm_ctx_.bl_key_.constructed_sql_, sql_length);
|
||||
if (OB_FAIL(ob_write_string(get_allocator(),
|
||||
trunc_stmt.string(),
|
||||
stat_.stmt_))) {
|
||||
@ -1241,7 +1243,7 @@ int ObPhysicalPlan::update_cache_obj_stat(ObILibCacheCtx &ctx)
|
||||
stat_.outline_version_ = get_outline_state().outline_version_.version_;
|
||||
stat_.outline_id_ = get_outline_state().outline_version_.object_id_;
|
||||
// Truncate the raw sql to avoid the plan memory being too large due to the long raw sql
|
||||
ObTruncatedString trunc_raw_sql(pc_ctx.raw_sql_, OB_MAX_SQL_LENGTH);
|
||||
ObTruncatedString trunc_raw_sql(pc_ctx.raw_sql_, sql_length);
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(pc_ctx.get_not_param_info_str(get_allocator(), stat_.sp_info_str_))) {
|
||||
SQL_PC_LOG(WARN, "fail to get special param info string", K(ret));
|
||||
|
@ -444,6 +444,7 @@ struct ObAuditRecordData {
|
||||
char snapshot_source_[OB_MAX_SNAPSHOT_SOURCE_LENGTH + 1];
|
||||
ObCurTraceId::TraceId pl_trace_id_;
|
||||
int64_t plsql_exec_time_;
|
||||
stmt::StmtType stmt_type_;
|
||||
uint64_t total_memstore_read_row_count_;
|
||||
uint64_t total_ssstore_read_row_count_;
|
||||
};
|
||||
|
@ -581,7 +581,15 @@ public:
|
||||
const ObExecuteMode exec_mode,
|
||||
ObSQLSessionInfo &session,
|
||||
bool is_sensitive = false);
|
||||
|
||||
static int64_t get_query_record_size_limit(uint64_t tenant_id)
|
||||
{
|
||||
int64_t thredhold = OB_MAX_SQL_LENGTH;
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||
if (tenant_config.is_valid()) {
|
||||
thredhold = tenant_config->_query_record_size_limit;
|
||||
}
|
||||
return thredhold;
|
||||
}
|
||||
// convert escape char from '\\' to '\\\\';
|
||||
static int convert_escape_char(common::ObIAllocator &allocator,
|
||||
const ObString &in,
|
||||
|
@ -395,6 +395,7 @@ public:
|
||||
void inc_ref_count() { ref_cnt_++; }
|
||||
void dec_ref_count() { ref_cnt_--; }
|
||||
bool need_erase() { return 0 == ref_cnt_; }
|
||||
inline int64_t get_ref_cnt() { return ref_cnt_; }
|
||||
|
||||
inline void set_inner_stmt_id(ObPsStmtId id) { inner_stmt_id_ = id; }
|
||||
inline ObPsStmtId get_inner_stmt_id() { return inner_stmt_id_; }
|
||||
|
@ -6201,23 +6201,40 @@ void ObBasicSessionInfo::set_session_sleep()
|
||||
int ObBasicSessionInfo::base_save_session(BaseSavedValue &saved_value, bool skip_cur_stmt_tables)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
OX (saved_value.cur_phy_plan_ = cur_phy_plan_);
|
||||
OX (cur_phy_plan_ = NULL);
|
||||
int len = MIN(thread_data_.cur_query_len_, static_cast<int64_t>(sizeof(saved_value.cur_query_) - 1));
|
||||
if (thread_data_.cur_query_ != nullptr) {
|
||||
OX (MEMCPY(&saved_value.cur_query_, thread_data_.cur_query_, len));
|
||||
OX (thread_data_.cur_query_[0] = 0);
|
||||
saved_value.cur_phy_plan_ = cur_phy_plan_;
|
||||
cur_phy_plan_ = NULL;
|
||||
|
||||
int64_t truncated_len = MIN(MAX_QUERY_STRING_LEN - 1,
|
||||
thread_data_.cur_query_len_);
|
||||
if (saved_value.cur_query_buf_len_ - 1 < truncated_len) {
|
||||
if (saved_value.cur_query_ != nullptr) {
|
||||
ob_free(saved_value.cur_query_);
|
||||
}
|
||||
int64_t len = MAX(MIN_CUR_QUERY_LEN, truncated_len + 1);
|
||||
saved_value.cur_query_ = reinterpret_cast<char*>(ob_malloc(len, ObMemAttr(orig_tenant_id_,
|
||||
ObModIds::OB_SQL_SESSION_QUERY_SQL)));
|
||||
if (OB_ISNULL(saved_value.cur_query_)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
} else {
|
||||
saved_value.cur_query_buf_len_ = len;
|
||||
}
|
||||
}
|
||||
OX (saved_value.cur_query_len_ = len);
|
||||
OX (thread_data_.cur_query_len_ = 0);
|
||||
OZ (saved_value.total_stmt_tables_.assign(total_stmt_tables_));
|
||||
if (!skip_cur_stmt_tables) {
|
||||
OZ (merge_stmt_tables(), total_stmt_tables_, cur_stmt_tables_);
|
||||
if (OB_SUCC(ret)) {
|
||||
if (thread_data_.cur_query_ != nullptr) {
|
||||
OX (MEMCPY(saved_value.cur_query_, thread_data_.cur_query_, truncated_len));
|
||||
OX (thread_data_.cur_query_[0] = 0);
|
||||
}
|
||||
OX (saved_value.cur_query_len_ = truncated_len);
|
||||
OX (thread_data_.cur_query_len_ = 0);
|
||||
OZ (saved_value.total_stmt_tables_.assign(total_stmt_tables_));
|
||||
if (!skip_cur_stmt_tables) {
|
||||
OZ (merge_stmt_tables(), total_stmt_tables_, cur_stmt_tables_);
|
||||
}
|
||||
OZ (saved_value.cur_stmt_tables_.assign(cur_stmt_tables_));
|
||||
OX (cur_stmt_tables_.reset());
|
||||
OX (sys_vars_cache_.get_autocommit_info(saved_value.inc_autocommit_));
|
||||
OX (sys_vars_cache_.set_autocommit_info(false));
|
||||
}
|
||||
OZ (saved_value.cur_stmt_tables_.assign(cur_stmt_tables_));
|
||||
OX (cur_stmt_tables_.reset());
|
||||
OX (sys_vars_cache_.get_autocommit_info(saved_value.inc_autocommit_));
|
||||
OX (sys_vars_cache_.set_autocommit_info(false));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -304,15 +304,23 @@ public:
|
||||
class BaseSavedValue
|
||||
{
|
||||
public:
|
||||
BaseSavedValue()
|
||||
BaseSavedValue() : cur_query_(NULL)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
~BaseSavedValue()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
inline void reset()
|
||||
{
|
||||
if (cur_query_ != nullptr) {
|
||||
ob_free(cur_query_);
|
||||
}
|
||||
cur_phy_plan_ = NULL;
|
||||
cur_query_[0] = 0;
|
||||
cur_query_len_ = 0;
|
||||
cur_query_buf_len_ = 0;
|
||||
cur_query_ = NULL;
|
||||
total_stmt_tables_.reset();
|
||||
cur_stmt_tables_.reset();
|
||||
read_uncommited_ = false;
|
||||
@ -322,7 +330,6 @@ public:
|
||||
public:
|
||||
// 原StmtSavedValue的属性
|
||||
ObPhysicalPlan *cur_phy_plan_;
|
||||
char cur_query_[MAX_QUERY_STRING_LEN];
|
||||
volatile int64_t cur_query_len_;
|
||||
// int64_t cur_query_start_time_; // 用于计算事务超时时间,如果在base_save_session接口中操作
|
||||
// 会导致start_trans报事务超时失败,不放在基类中。
|
||||
@ -332,6 +339,8 @@ public:
|
||||
bool read_uncommited_;
|
||||
bool inc_autocommit_;
|
||||
bool need_serial_exec_;
|
||||
int64_t cur_query_buf_len_;
|
||||
char *cur_query_;
|
||||
public:
|
||||
// 原TransSavedValue的属性
|
||||
// transaction::ObTxDesc trans_desc_; // 两者都有trans_desc,但执行操作完全不同,不放在基类中。
|
||||
@ -347,6 +356,10 @@ public:
|
||||
{
|
||||
reset();
|
||||
}
|
||||
~StmtSavedValue()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
inline void reset()
|
||||
{
|
||||
BaseSavedValue::reset();
|
||||
@ -2433,7 +2446,7 @@ private:
|
||||
inline const common::ObString ObBasicSessionInfo::get_current_query_string() const
|
||||
{
|
||||
common::ObString str_ret;
|
||||
str_ret.assign_ptr(const_cast<char *>(thread_data_.cur_query_), static_cast<int32_t>(thread_data_.cur_query_len_));
|
||||
str_ret.assign_ptr(const_cast<char *>(thread_data_.cur_query_), static_cast<int64_t>(thread_data_.cur_query_len_));
|
||||
return str_ret;
|
||||
}
|
||||
|
||||
|
@ -1978,7 +1978,8 @@ const ObAuditRecordData &ObSQLSessionInfo::get_final_audit_record(
|
||||
audit_record_.request_type_ = mode;
|
||||
audit_record_.session_id_ = get_sessid();
|
||||
audit_record_.proxy_session_id_ = get_proxy_sessid();
|
||||
audit_record_.tenant_id_ = get_priv_tenant_id();
|
||||
// sql audit don't distinguish between two tenant IDs
|
||||
audit_record_.tenant_id_ = get_effective_tenant_id();
|
||||
audit_record_.user_id_ = get_user_id();
|
||||
audit_record_.proxy_user_id_ = get_proxy_user_id();
|
||||
audit_record_.effective_tenant_id_ = get_effective_tenant_id();
|
||||
@ -2018,7 +2019,7 @@ const ObAuditRecordData &ObSQLSessionInfo::get_final_audit_record(
|
||||
} else {
|
||||
ObString sql = get_current_query_string();
|
||||
audit_record_.sql_ = const_cast<char *>(sql.ptr());
|
||||
audit_record_.sql_len_ = min(sql.length(), OB_MAX_SQL_LENGTH);
|
||||
audit_record_.sql_len_ = min(sql.length(), ObSQLUtils::get_query_record_size_limit(get_effective_tenant_id()));
|
||||
audit_record_.sql_cs_type_ = get_local_collation_connection();
|
||||
}
|
||||
|
||||
@ -2049,6 +2050,7 @@ const ObAuditRecordData &ObSQLSessionInfo::get_final_audit_record(
|
||||
// do nothing
|
||||
}
|
||||
audit_record_.flt_trace_id_[pos] = '\0';
|
||||
audit_record_.stmt_type_ = get_stmt_type();
|
||||
return audit_record_;
|
||||
}
|
||||
|
||||
|
@ -592,6 +592,10 @@ public:
|
||||
{
|
||||
reset();
|
||||
}
|
||||
~StmtSavedValue()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
inline void reset()
|
||||
{
|
||||
ObBasicSessionInfo::StmtSavedValue::reset();
|
||||
@ -907,6 +911,37 @@ public:
|
||||
int check_ps_stmt_id_in_use(const ObPsStmtId stmt_id, bool &is_in_use);
|
||||
int add_ps_stmt_id_in_use(const ObPsStmtId stmt_id);
|
||||
int earse_ps_stmt_id_in_use(const ObPsStmtId stmt_id);
|
||||
template <typename Visitor>
|
||||
int visit_ps_session_info(const ObPsStmtId stmt_id,
|
||||
Visitor &visitor)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!ps_session_info_map_.created())) {
|
||||
ret = OB_HASH_NOT_EXIST;
|
||||
SQL_ENG_LOG(WARN, "map not created before insert any element", K(ret));
|
||||
} else if (OB_FAIL(ps_session_info_map_.read_atomic<Visitor>(stmt_id, visitor))) {
|
||||
SQL_ENG_LOG(WARN, "get ps session info failed", K(ret), K(stmt_id), K(get_sessid()));
|
||||
if (ret == OB_HASH_NOT_EXIST) {
|
||||
ret = OB_EER_UNKNOWN_STMT_HANDLER;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
template <typename T>
|
||||
int update_ps_session_info_safety(const ObPsStmtId stmt_id, T &update)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!ps_session_info_map_.created())) {
|
||||
ret = OB_HASH_NOT_EXIST;
|
||||
SQL_ENG_LOG(WARN, "map not created before insert any element", K(ret));
|
||||
} else if (OB_FAIL(ps_session_info_map_.atomic_refactored<T>(stmt_id, update))) {
|
||||
SQL_ENG_LOG(WARN, "get ps session info failed", K(ret), K(stmt_id), K(get_sessid()));
|
||||
if (ret == OB_HASH_NOT_EXIST) {
|
||||
ret = OB_EER_UNKNOWN_STMT_HANDLER;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int64_t get_ps_session_info_size() const { return ps_session_info_map_.size(); }
|
||||
inline pl::ObPL *get_pl_engine() const { return GCTX.pl_engine_; }
|
||||
|
||||
@ -1361,6 +1396,17 @@ public:
|
||||
share::schema::ObUserLoginInfo get_login_info () { return login_info_; }
|
||||
int set_login_info(const share::schema::ObUserLoginInfo &login_info);
|
||||
int set_login_auth_data(const ObString &auth_data);
|
||||
template <typename Function>
|
||||
int for_each_ps_session_info(Function &fn)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!ps_session_info_map_.created())) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(ps_session_info_map_.foreach_refactored(fn))) {
|
||||
SQL_ENG_LOG(WARN, "failed to read each ps session info", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
void set_load_data_exec_session(bool v) { is_load_data_exec_session_ = v; }
|
||||
bool is_load_data_exec_session() const { return is_load_data_exec_session_; }
|
||||
inline ObSqlString &get_pl_exact_err_msg() { return pl_exact_err_msg_; }
|
||||
@ -1434,7 +1480,7 @@ private:
|
||||
// 2.2版本之后,不再使用该变量
|
||||
bool is_max_availability_mode_;
|
||||
typedef common::hash::ObHashMap<ObPsStmtId, ObPsSessionInfo *,
|
||||
common::hash::NoPthreadDefendMode> PsSessionInfoMap;
|
||||
common::hash::SpinReadWriteDefendMode> PsSessionInfoMap;
|
||||
PsSessionInfoMap ps_session_info_map_;
|
||||
inline int try_create_ps_session_info_map()
|
||||
{
|
||||
|
@ -419,6 +419,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | GV$OB_RPC_OUTGOING | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SERVER_SCHEMA_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SESSION | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SESSION_PS_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_AUDIT | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_PLAN | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_WORKAREA_MEMORY_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -490,6 +491,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | V$OB_RPC_OUTGOING | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SERVER_SCHEMA_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SESSION | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SESSION_PS_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_AUDIT | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_PLAN | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_WORKAREA_MEMORY_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -845,6 +847,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | __all_virtual_server_schema_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_event | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_ps_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_wait | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_wait_history | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_sesstat | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -1922,6 +1925,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | GV$OB_RPC_OUTGOING | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SERVER_SCHEMA_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SESSION | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SESSION_PS_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_AUDIT | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_PLAN | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | GV$OB_SQL_WORKAREA_MEMORY_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -1993,6 +1997,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | V$OB_RPC_OUTGOING | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SERVER_SCHEMA_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SESSION | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SESSION_PS_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_AUDIT | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_PLAN | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | V$OB_SQL_WORKAREA_MEMORY_INFO | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -2348,6 +2353,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | __all_virtual_server_schema_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_event | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_ps_info | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_wait | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_session_wait_history | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_virtual_sesstat | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
|
@ -426,6 +426,7 @@ _px_max_message_pool_pct
|
||||
_px_max_pipeline_depth
|
||||
_px_message_compression
|
||||
_px_object_sampling
|
||||
_query_record_size_limit
|
||||
_rebuild_replica_log_lag_threshold
|
||||
_recyclebin_object_purge_frequency
|
||||
_resource_limit_max_session_num
|
||||
|
@ -668,6 +668,7 @@ TX_STATE_VERSION bigint(20) unsigned NO NULL
|
||||
FLT_TRACE_ID varchar(1024) NO NULL
|
||||
PL_TRACE_ID varchar(128) YES NULL
|
||||
PLSQL_EXEC_TIME bigint(20) NO NULL
|
||||
STMT_TYPE varchar(128) YES NULL
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT bigint(20) NO NULL
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT bigint(20) NO NULL
|
||||
PROXY_USER varchar(128) YES NULL
|
||||
@ -986,6 +987,7 @@ TX_STATE_VERSION bigint(20) unsigned NO
|
||||
FLT_TRACE_ID varchar(1024) NO
|
||||
PL_TRACE_ID varchar(128) NO
|
||||
PLSQL_EXEC_TIME bigint(20) NO
|
||||
STMT_TYPE varchar(128) NO
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT bigint(20) NO
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT bigint(20) NO
|
||||
PROXY_USER varchar(128) NO
|
||||
@ -6169,6 +6171,40 @@ EXECUTION_PLAN longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_MVREF_STMT_STATS limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.GV$OB_SESSION_PS_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO NULL
|
||||
SVR_PORT bigint(20) NO NULL
|
||||
TENANT_ID bigint(20) NO NULL
|
||||
PROXY_SESSION_ID bigint(20) unsigned NO NULL
|
||||
SESSION_ID bigint(20) unsigned NO NULL
|
||||
PS_CLIENT_STMT_ID bigint(20) NO NULL
|
||||
PS_INNER_STMT_ID bigint(20) NO NULL
|
||||
STMT_TYPE varchar(256) NO NULL
|
||||
PARAM_COUNT bigint(20) NO NULL
|
||||
PARAM_TYPES longtext NO NULL
|
||||
REF_COUNT bigint(20) NO NULL
|
||||
CHECKSUM bigint(20) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.GV$OB_SESSION_PS_INFO limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.V$OB_SESSION_PS_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO
|
||||
SVR_PORT bigint(20) NO
|
||||
TENANT_ID bigint(20) NO
|
||||
PROXY_SESSION_ID bigint(20) unsigned NO
|
||||
SESSION_ID bigint(20) unsigned NO
|
||||
PS_CLIENT_STMT_ID bigint(20) NO
|
||||
PS_INNER_STMT_ID bigint(20) NO
|
||||
STMT_TYPE varchar(256) NO
|
||||
PARAM_COUNT bigint(20) NO
|
||||
PARAM_TYPES longtext NO
|
||||
REF_COUNT bigint(20) NO
|
||||
CHECKSUM bigint(20) NO
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.V$OB_SESSION_PS_INFO limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.GV$OB_TRACEPOINT_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO NULL
|
||||
|
@ -669,6 +669,7 @@ TX_STATE_VERSION bigint(20) unsigned NO NULL
|
||||
FLT_TRACE_ID varchar(1024) NO NULL
|
||||
PL_TRACE_ID varchar(128) YES NULL
|
||||
PLSQL_EXEC_TIME bigint(20) NO NULL
|
||||
STMT_TYPE varchar(128) YES NULL
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT bigint(20) NO NULL
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT bigint(20) NO NULL
|
||||
PROXY_USER varchar(128) YES NULL
|
||||
@ -987,6 +988,7 @@ TX_STATE_VERSION bigint(20) unsigned NO
|
||||
FLT_TRACE_ID varchar(1024) NO
|
||||
PL_TRACE_ID varchar(128) NO
|
||||
PLSQL_EXEC_TIME bigint(20) NO
|
||||
STMT_TYPE varchar(128) NO
|
||||
TOTAL_MEMSTORE_READ_ROW_COUNT bigint(20) NO
|
||||
TOTAL_SSSTORE_READ_ROW_COUNT bigint(20) NO
|
||||
PROXY_USER varchar(128) NO
|
||||
@ -8924,6 +8926,40 @@ EXECUTION_PLAN longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_MVREF_STMT_STATS limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.GV$OB_SESSION_PS_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO NULL
|
||||
SVR_PORT bigint(20) NO NULL
|
||||
TENANT_ID bigint(20) NO NULL
|
||||
PROXY_SESSION_ID bigint(20) unsigned NO NULL
|
||||
SESSION_ID bigint(20) unsigned NO NULL
|
||||
PS_CLIENT_STMT_ID bigint(20) NO NULL
|
||||
PS_INNER_STMT_ID bigint(20) NO NULL
|
||||
STMT_TYPE varchar(256) NO NULL
|
||||
PARAM_COUNT bigint(20) NO NULL
|
||||
PARAM_TYPES longtext NO NULL
|
||||
REF_COUNT bigint(20) NO NULL
|
||||
CHECKSUM bigint(20) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.GV$OB_SESSION_PS_INFO limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.V$OB_SESSION_PS_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO
|
||||
SVR_PORT bigint(20) NO
|
||||
TENANT_ID bigint(20) NO
|
||||
PROXY_SESSION_ID bigint(20) unsigned NO
|
||||
SESSION_ID bigint(20) unsigned NO
|
||||
PS_CLIENT_STMT_ID bigint(20) NO
|
||||
PS_INNER_STMT_ID bigint(20) NO
|
||||
STMT_TYPE varchar(256) NO
|
||||
PARAM_COUNT bigint(20) NO
|
||||
PARAM_TYPES longtext NO
|
||||
REF_COUNT bigint(20) NO
|
||||
CHECKSUM bigint(20) NO
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.V$OB_SESSION_PS_INFO limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.GV$OB_TRACEPOINT_INFO;
|
||||
Field Type Null Key Default Extra
|
||||
SVR_IP varchar(46) NO NULL
|
||||
|
@ -4889,6 +4889,26 @@ IS_MANDATORY varchar(1024) NO
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from information_schema.ENABLED_ROLES;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_session_ps_info;
|
||||
Field Type Null Key Default Extra
|
||||
svr_ip varchar(46) NO NULL
|
||||
svr_port bigint(20) NO NULL
|
||||
tenant_id bigint(20) NO NULL
|
||||
proxy_session_id bigint(20) unsigned NO NULL
|
||||
session_id bigint(20) unsigned NO NULL
|
||||
ps_client_stmt_id bigint(20) NO NULL
|
||||
ps_inner_stmt_id bigint(20) NO NULL
|
||||
stmt_type varchar(256) NO NULL
|
||||
param_count bigint(20) NO NULL
|
||||
param_types longtext NO NULL
|
||||
ref_count bigint(20) NO NULL
|
||||
checksum bigint(20) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_session_ps_info;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
"oceanbase.__all_virtual_session_ps_info runs in single server"
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_tracepoint_info;
|
||||
Field Type Null Key Default Extra
|
||||
svr_ip varchar(46) NO NULL
|
||||
|
@ -9469,6 +9469,26 @@ IS_MANDATORY varchar(1024) NO
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from information_schema.ENABLED_ROLES;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_session_ps_info;
|
||||
Field Type Null Key Default Extra
|
||||
svr_ip varchar(46) NO NULL
|
||||
svr_port bigint(20) NO NULL
|
||||
tenant_id bigint(20) NO NULL
|
||||
proxy_session_id bigint(20) unsigned NO NULL
|
||||
session_id bigint(20) unsigned NO NULL
|
||||
ps_client_stmt_id bigint(20) NO NULL
|
||||
ps_inner_stmt_id bigint(20) NO NULL
|
||||
stmt_type varchar(256) NO NULL
|
||||
param_count bigint(20) NO NULL
|
||||
param_types longtext NO NULL
|
||||
ref_count bigint(20) NO NULL
|
||||
checksum bigint(20) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_session_ps_info;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
"oceanbase.__all_virtual_session_ps_info runs in single server"
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_tracepoint_info;
|
||||
Field Type Null Key Default Extra
|
||||
svr_ip varchar(46) NO NULL
|
||||
|
@ -742,6 +742,7 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
12463 __all_virtual_column_privilege_history 2 201001 1
|
||||
12464 __all_virtual_tenant_snapshot_ls_replica_history 2 201001 1
|
||||
12466 ENABLED_ROLES 2 201002 1
|
||||
12468 __all_virtual_session_ps_info 2 201001 1
|
||||
12469 __all_virtual_tracepoint_info 2 201001 1
|
||||
12473 __all_virtual_compatibility_control 2 201001 1
|
||||
12474 __all_virtual_user_proxy_info 2 201001 1
|
||||
@ -1165,6 +1166,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
21538 DBA_MVREF_CHANGE_STATS 1 201001 1
|
||||
21539 CDB_MVREF_STMT_STATS 1 201001 1
|
||||
21540 DBA_MVREF_STMT_STATS 1 201001 1
|
||||
21541 GV$OB_SESSION_PS_INFO 1 201001 1
|
||||
21542 V$OB_SESSION_PS_INFO 1 201001 1
|
||||
21543 GV$OB_TRACEPOINT_INFO 1 201001 1
|
||||
21544 V$OB_TRACEPOINT_INFO 1 201001 1
|
||||
21545 V$OB_COMPATIBILITY_CONTROL 1 201001 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user