[FEAT MERGE] [CP] transfer partition && cancel transfer partition
Co-authored-by: linqiucen <lqcgrace@outlook.com>
This commit is contained in:
parent
e69c06c5d4
commit
84c5698b2a
1
deps/oblib/src/lib/ob_errno.h
vendored
1
deps/oblib/src/lib/ob_errno.h
vendored
@ -48,6 +48,7 @@ constexpr int OB_CONFLICT_VALUE = -4021;
|
||||
constexpr int OB_ITEM_NOT_SETTED = -4022;
|
||||
constexpr int OB_EAGAIN = -4023;
|
||||
constexpr int OB_BUF_NOT_ENOUGH = -4024;
|
||||
constexpr int OB_PARTIAL_FAILED = -4025;
|
||||
constexpr int OB_READ_NOTHING = -4026;
|
||||
constexpr int OB_FILE_NOT_EXIST = -4027;
|
||||
constexpr int OB_DISCONTINUOUS_LOG = -4028;
|
||||
|
@ -61,6 +61,7 @@ ob_unittest_observer(test_ob_simple_cluster test_ob_simple_cluster.cpp)
|
||||
ob_unittest_observer(test_ob_partition_balance test_ob_partition_balance.cpp)
|
||||
ob_unittest_observer(test_ls_status_operator test_ls_status_operator.cpp)
|
||||
ob_unittest_observer(test_balance_operator test_tenant_balance_operator.cpp)
|
||||
ob_unittest_observer(test_transfer_partition_task test_transfer_partition_task.cpp)
|
||||
ob_unittest_observer(test_mds_table_checkpoint test_mds_table_checkpoint.cpp)
|
||||
ob_unittest_observer(test_ob_black_list_service test_ob_black_list_service.cpp)
|
||||
ob_unittest_observer(test_ob_minor_freeze test_ob_minor_freeze.cpp)
|
||||
|
@ -256,9 +256,12 @@ int TestTransferHandler::generate_transfer_task(
|
||||
} else if (OB_FAIL(trans.start(&inner_sql_proxy, g_tenant_id))) {
|
||||
LOG_WARN("failed to start trans", K(ret));
|
||||
} else {
|
||||
ObTransferTask transfer_task;
|
||||
if (OB_FAIL(tenant_transfer->generate_transfer_task(trans, src_ls_id, dest_ls_id,
|
||||
g_part_list, ObBalanceTaskID(123), task_id))) {
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task))) {
|
||||
LOG_WARN("failed to generate transfer task", K(ret));
|
||||
} else {
|
||||
task_id = transfer_task.get_task_id();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,10 +216,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1)
|
||||
//title: 1001 ls transfer to 1 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -242,9 +242,11 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1002_with_transfer_finish_with
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObMySQLTransaction trans;
|
||||
ObTransferTask transfer_task;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1002),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -241,10 +241,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1002_with_transfer_finish_with
|
||||
//title: 1001 ls transfer to 1002 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1002),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -241,10 +241,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1_with_transfer_start_with_mds
|
||||
//title: 1001 ls transfer to 1 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -261,10 +261,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1002_with_transfer_doing_witho
|
||||
//title: 1001 ls transfer to 1002 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1002),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -313,10 +313,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1002)
|
||||
//title: 1001 ls transfer to 1002 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1002),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
@ -352,10 +354,12 @@ TEST_F(TestTransferHandler, test_transfer_1002_to_1001)
|
||||
//title: 1002 ls transfer to 1001 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1002), ObLSID(1001),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -242,10 +242,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1_with_transfer_start_without_
|
||||
//title: 1001 ls transfer to 1 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -294,10 +294,12 @@ TEST_F(TestTransferHandler, test_transfer_1001_to_1002)
|
||||
//title: 1001 ls transfer to 1002 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1002),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
@ -333,10 +335,12 @@ TEST_F(TestTransferHandler, test_transfer_1002_to_1001)
|
||||
//title: 1001 ls transfer to 1 ls
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1002), ObLSID(1001),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
@ -180,11 +180,13 @@ TEST_F(TestTabletAutoincMgr, test_lob_tablet_autoinc_location_cache)
|
||||
|
||||
// transfer t1 to other ls
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
const ObLSID src_ls_id(1001);
|
||||
const ObLSID dst_ls_id(1002);
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, src_ls_id, dst_ls_id, g_part_list, ObBalanceTaskID(123), task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, src_ls_id, dst_ls_id, g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ObTransferStatus expected_status(ObTransferStatus::COMPLETED);
|
||||
ObTransferTask task;
|
||||
|
@ -519,7 +519,7 @@ TEST_F(TestBalanceOperator, merge_task)
|
||||
LOG_INFO("testtest7: start set part list");
|
||||
common::ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_merge_ls_part_list(tenant_id, task_id, part_list, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_task_part_list(tenant_id, task_id, part_list, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::start_transfer_task(tenant_id, task_id, transfer_task_id, sql_proxy));
|
||||
ObTransferPartList to_do_part_list;
|
||||
@ -530,7 +530,7 @@ TEST_F(TestBalanceOperator, merge_task)
|
||||
LOG_INFO("testtest8: start set part list");
|
||||
common::ObMySQLTransaction trans1;
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.start(&sql_proxy, tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_merge_ls_part_list(tenant_id, task_id, part_list, trans1));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_task_part_list(tenant_id, task_id, part_list, trans1));
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.end(true));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::start_transfer_task(tenant_id, task_id, transfer_task_id, sql_proxy));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::finish_transfer_task(task, transfer_task_id, part_list, sql_proxy, to_do_part_list, all_part_transferred));
|
||||
@ -539,7 +539,7 @@ TEST_F(TestBalanceOperator, merge_task)
|
||||
LOG_INFO("testtest9: start set part list");
|
||||
common::ObMySQLTransaction trans2;
|
||||
ASSERT_EQ(OB_SUCCESS, trans2.start(&sql_proxy, tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_merge_ls_part_list(tenant_id, task_id, part_list, trans2));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::update_task_part_list(tenant_id, task_id, part_list, trans2));
|
||||
ASSERT_EQ(OB_SUCCESS, trans2.end(true));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::start_transfer_task(tenant_id, task_id, transfer_task_id, sql_proxy));
|
||||
ASSERT_EQ(OB_SUCCESS, ObBalanceTaskTableOperator::finish_transfer_task(task, transfer_task_id, part_list, sql_proxy, to_do_part_list, all_part_transferred));
|
||||
|
@ -164,10 +164,12 @@ TEST_F(TestTenantTransferService, test_service)
|
||||
|
||||
// generate transfer task
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1),
|
||||
g_part_list, ObBalanceTaskID(123), task_id));
|
||||
g_part_list, ObBalanceTaskID(123), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
@ -204,13 +206,14 @@ TEST_F(TestTenantTransferService, test_service)
|
||||
// try cancel transfer task
|
||||
ObTransferTask init_task;
|
||||
ObTransferTask aborted_task;
|
||||
ObTransferTask tmp_task;
|
||||
ObTransferTaskID init_task_id(222);
|
||||
ObTransferTaskID aborted_task_id(333);
|
||||
ASSERT_EQ(OB_SUCCESS, gen_mock_data(init_task_id, ObTransferStatus(ObTransferStatus::INIT), init_task));
|
||||
ASSERT_EQ(OB_SUCCESS, gen_mock_data(aborted_task_id, ObTransferStatus(ObTransferStatus::ABORTED), aborted_task));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferTaskOperator::insert(inner_sql_proxy, g_tenant_id, init_task));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferTaskOperator::insert(inner_sql_proxy, g_tenant_id, aborted_task));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->try_cancel_transfer_task(ObTransferTaskID(555))); // task which does not exist will be canceled successfully
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->try_cancel_transfer_task(ObTransferTaskID(555)));
|
||||
ASSERT_EQ(OB_OP_NOT_ALLOW, tenant_transfer->try_cancel_transfer_task(aborted_task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->try_cancel_transfer_task(init_task_id));
|
||||
ASSERT_EQ(OB_ENTRY_NOT_EXIST, ObTransferTaskOperator::get(inner_sql_proxy, g_tenant_id, init_task_id, false, init_task, 0/*group_id*/));
|
||||
@ -225,9 +228,9 @@ TEST_F(TestTenantTransferService, test_service)
|
||||
|
||||
ObTransferPartList all_part_list;
|
||||
ObTransferPartList finished_part_list;
|
||||
ASSERT_EQ(OB_NEED_RETRY, tenant_transfer->try_clear_transfer_task(aborted_task_id, all_part_list, finished_part_list));
|
||||
ASSERT_EQ(OB_NEED_RETRY, tenant_transfer->try_clear_transfer_task(aborted_task_id, tmp_task, all_part_list, finished_part_list));
|
||||
ASSERT_TRUE(all_part_list.empty() && finished_part_list.empty());
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->try_clear_transfer_task(task_id, all_part_list, finished_part_list));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->try_clear_transfer_task(task_id, tmp_task, all_part_list, finished_part_list));
|
||||
ObString all_part_list_str;
|
||||
ASSERT_TRUE(all_part_list.count() == g_part_list.count());
|
||||
ARRAY_FOREACH(g_part_list, idx) {
|
||||
@ -287,10 +290,12 @@ TEST_F(TestTenantTransferService, test_batch_part_list)
|
||||
|
||||
// generate transfer task in batch
|
||||
ObTransferTaskID batch_task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1001),
|
||||
g_batch_part_list, ObBalanceTaskID(124), batch_task_id));
|
||||
g_batch_part_list, ObBalanceTaskID(124), transfer_task));
|
||||
batch_task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
@ -322,10 +327,12 @@ TEST_F(TestTenantTransferService, test_empty_list)
|
||||
INNER_EXE_SQL("alter system set_tp tp_name = EN_TENANT_TRANSFER_ALL_LIST_EMPTY, error_code = 4016, frequency = 1");
|
||||
// transfer
|
||||
ObTransferTaskID task_id;
|
||||
ObTransferTask transfer_task;
|
||||
ObMySQLTransaction trans;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&inner_sql_proxy, g_tenant_id));
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_transfer->generate_transfer_task(trans, ObLSID(1001), ObLSID(1),
|
||||
g_part_list, ObBalanceTaskID(124), task_id));
|
||||
g_part_list, ObBalanceTaskID(124), transfer_task));
|
||||
task_id = transfer_task.get_task_id();
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp_ret = trans.end(OB_SUCC(ret)))) {
|
||||
|
239
mittest/simple_server/test_transfer_partition_task.cpp
Normal file
239
mittest/simple_server/test_transfer_partition_task.cpp
Normal file
@ -0,0 +1,239 @@
|
||||
/**
|
||||
* 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 SHARE
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include "env/ob_simple_cluster_test_base.h"
|
||||
#include "lib/ob_errno.h"
|
||||
#include "lib/oblog/ob_log.h"
|
||||
#define private public
|
||||
#include "share/balance/ob_transfer_partition_task_table_operator.h"
|
||||
#include "share/transfer/ob_transfer_info.h"
|
||||
#include "share/ob_ls_id.h"
|
||||
#include "share/unit/ob_unit_info.h"
|
||||
#include "share/ls/ob_ls_status_operator.h"
|
||||
#include "share/ls/ob_ls_i_life_manager.h"
|
||||
|
||||
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace unittest;
|
||||
namespace share
|
||||
{
|
||||
using ::testing::_;
|
||||
using ::testing::Invoke;
|
||||
using ::testing::Return;
|
||||
|
||||
using namespace schema;
|
||||
using namespace rootserver;
|
||||
using namespace common;
|
||||
class TestTransferPartition : public unittest::ObSimpleClusterTestBase
|
||||
{
|
||||
public:
|
||||
TestTransferPartition() : unittest::ObSimpleClusterTestBase("test_transfer_partition_task") {}
|
||||
protected:
|
||||
|
||||
uint64_t tenant_id_;
|
||||
};
|
||||
|
||||
TEST_F(TestTransferPartition, TransferPartitionTask)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
// ASSERT_EQ(OB_SUCCESS, create_tenant());
|
||||
//ASSERT_EQ(OB_SUCCESS, get_tenant_id(tenant_id_));
|
||||
tenant_id_ = 1;
|
||||
common::ObMySQLProxy &sql_proxy = get_curr_simple_server().get_observer().get_mysql_proxy();
|
||||
ObTransferPartitionTask task;
|
||||
ObBalanceJobID job_id(1);
|
||||
ObBalanceJobID invalid_job;
|
||||
ObTransferPartInfo part_info(1, 1);
|
||||
ObTransferPartInfo invalid_part;
|
||||
ObLSID invalid_ls;
|
||||
ObLSID ls(1);
|
||||
ObTransferPartitionTaskID invalid_task_id;
|
||||
ObTransferPartitionTaskID task_id(1);
|
||||
ObTransferPartitionTaskStatus status(ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING);
|
||||
ObTransferPartitionTaskStatus invalid_status;
|
||||
ObString comment;
|
||||
// case 1: 验证task的init
|
||||
//simple_init不校验task_id,但是init校验
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, task.simple_init(tenant_id_, invalid_part, ls, task_id));
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, task.simple_init(tenant_id_, part_info, invalid_ls, task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, task.simple_init(tenant_id_, part_info, ls, invalid_task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, task.simple_init(tenant_id_, part_info, ls, task_id));
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, task.init(tenant_id_, part_info, ls, invalid_task_id,
|
||||
job_id, ObTransferTaskID(1), status, comment));
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, task.init(tenant_id_, part_info, ls, task_id,
|
||||
job_id, ObTransferTaskID(1), invalid_status, comment));
|
||||
ASSERT_EQ(OB_SUCCESS, task.init(tenant_id_, part_info, ls, task_id, job_id,
|
||||
ObTransferTaskID(1), status, comment));
|
||||
// case 2: 验证task的插入
|
||||
ObMySQLTransaction trans;
|
||||
ObArray<ObTransferPartitionTask> task_array;
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_SUCCESS, task.simple_init(tenant_id_, part_info, ls, task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info, ls, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(1, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(status, task_array.at(0).get_task_status());
|
||||
|
||||
// case 3: 验证不同的事务,在第一个事务没有提交之前,另外一个事务不能写入
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ObTransferPartitionTask new_task;
|
||||
ObTransferPartInfo part_info2(1, 2);
|
||||
ASSERT_EQ(OB_SUCCESS, new_task.simple_init(tenant_id_, part_info2, ls, task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info2, ls, trans));
|
||||
ObMySQLTransaction trans1;
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.start(&sql_proxy, tenant_id_));
|
||||
ObTransferPartInfo part_info3(1, 3);
|
||||
ASSERT_EQ(OB_SUCCESS, new_task.simple_init(tenant_id_, part_info3, ls, task_id));
|
||||
ASSERT_EQ(OB_TRANS_TIMEOUT, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info3, ls, trans1));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(false));
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.end(false));
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info3, ls, trans1));
|
||||
ASSERT_EQ(OB_SUCCESS, new_task.simple_init(tenant_id_, part_info2, ls, task_id));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info2, ls, trans1));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans1));
|
||||
ASSERT_EQ(3, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(OB_SUCCESS, trans1.end(true));
|
||||
// case 4: 验证table_id,object_id不能重复
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_ERR_PRIMARY_KEY_DUPLICATE, ObTransferPartitionTaskTableOperator::insert_new_task(tenant_id_, part_info, ls, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(false));
|
||||
|
||||
// case 5: 验证使用第一个task_id开始执行
|
||||
ObTransferPartitionTaskID task_id2 = task_array.at(1).get_task_id();
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_ERR_UNEXPECTED, ObTransferPartitionTaskTableOperator::set_all_tasks_schedule(
|
||||
tenant_id_, task_id2, job_id, 1, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(false));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::set_all_tasks_schedule(
|
||||
tenant_id_, task_id2, job_id, 2, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(3, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(1, task_array.at(0).get_balance_job_id().id());
|
||||
ASSERT_EQ(1, task_array.at(1).get_balance_job_id().id());
|
||||
ASSERT_EQ(-1, task_array.at(2).get_balance_job_id().id());
|
||||
|
||||
//case 6: 开始transfer,三个分区放进去会不匹配
|
||||
ObTransferPartList part_list;
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.push_back(part_info));
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.push_back(part_info2));
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.push_back(part_info3));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
//ASSERT_EQ(OB_ERR_UNEXPECTED, ObTransferPartitionTaskTableOperator::start_transfer_task(tenant_id_, part_list, ObTransferTaskID(100), trans));
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.remove(1));
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, ObTransferPartitionTaskTableOperator::start_transfer_task(tenant_id_,
|
||||
invalid_job, part_list, ObTransferTaskID(100), trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(false));
|
||||
ObBalanceJobID tmp_job_id(999);
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::start_transfer_task(tenant_id_,
|
||||
tmp_job_id, part_list, ObTransferTaskID(100), trans));
|
||||
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(3, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(-1, task_array.at(0).get_transfer_task_id().id());
|
||||
ASSERT_EQ(-1, task_array.at(1).get_transfer_task_id().id());
|
||||
ASSERT_EQ(-1, task_array.at(2).get_transfer_task_id().id());
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::start_transfer_task(tenant_id_,
|
||||
job_id, part_list, ObTransferTaskID(100), trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(3, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(100, task_array.at(0).get_transfer_task_id().id());
|
||||
ASSERT_EQ(100, task_array.at(1).get_transfer_task_id().id());
|
||||
ASSERT_EQ(-1, task_array.at(2).get_transfer_task_id().id());
|
||||
|
||||
//case 7: 结束transfer
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.remove(0));
|
||||
ASSERT_EQ(OB_SUCCESS, part_list.push_back(part_info2));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ObTransferPartitionTaskID max_task_id(1000);
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, ObTransferPartitionTaskTableOperator::finish_task(tenant_id_, part_list, max_task_id, status, "", trans));
|
||||
ObTransferPartitionTaskStatus status1(ObTransferPartitionTaskStatus::TRP_TASK_STATUS_FAILED);
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::finish_task(tenant_id_, part_list,max_task_id, status1,"12343453", trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(1, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ObSqlString sql;
|
||||
ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("select *, time_to_usec(create_time) as create_1, time_to_usec(finish_time) as finish from __all_transfer_partition_task_history"));
|
||||
SMART_VAR(ObMySQLProxy::MySQLResult, res) {
|
||||
int64_t start_time = 0;
|
||||
int64_t finish_time = 0;
|
||||
ASSERT_EQ(OB_SUCCESS, sql_proxy.read(res, tenant_id_, sql.ptr()));
|
||||
sqlclient::ObMySQLResult *result = res.get_result();
|
||||
ASSERT_NE(nullptr, result);
|
||||
ASSERT_EQ(OB_SUCCESS, result->next());
|
||||
ObTransferPartitionTask new_task3;
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::fill_cell_(tenant_id_, result, new_task3));
|
||||
ASSERT_EQ(OB_SUCCESS, result->get_int("create_1", start_time));
|
||||
ASSERT_EQ(OB_SUCCESS, result->get_int("finish", finish_time));
|
||||
|
||||
LOG_INFO("[MITTEST]balance_task", K(start_time), K(finish_time), K(new_task3));
|
||||
ASSERT_EQ(OB_SUCCESS, result->next());
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::fill_cell_(tenant_id_, result, new_task3));
|
||||
ASSERT_EQ(OB_SUCCESS, result->get_int("create_1", start_time));
|
||||
ASSERT_EQ(OB_SUCCESS, result->get_int("finish", finish_time));
|
||||
LOG_INFO("[MITTEST]balance_task", K(start_time), K(finish_time), K(new_task3));
|
||||
|
||||
}
|
||||
|
||||
//case 8: 验证rollback
|
||||
ASSERT_EQ(OB_SUCCESS, trans.start(&sql_proxy, tenant_id_));
|
||||
ASSERT_EQ(OB_INVALID_ARGUMENT, ObTransferPartitionTaskTableOperator::rollback_all_to_waitting(
|
||||
tenant_id_, ObBalanceJobID(), trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::rollback_all_to_waitting(
|
||||
tenant_id_, job_id, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, ObTransferPartitionTaskTableOperator::load_all_task(tenant_id_,
|
||||
task_array, trans));
|
||||
ASSERT_EQ(OB_SUCCESS, trans.end(true));
|
||||
ASSERT_EQ(1, task_array.count());
|
||||
LOG_INFO("[MITTEST]new task", K(task_array));
|
||||
ASSERT_EQ(-1, task_array.at(0).get_balance_job_id().id());
|
||||
ASSERT_EQ(-1, task_array.at(0).get_transfer_task_id().id());
|
||||
ASSERT_EQ(status, task_array.at(0).get_task_status());
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace share
|
||||
} // namespace oceanbase
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
oceanbase::unittest::init_log_and_gtest(argc, argv);
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
@ -85,6 +85,7 @@ ob_set_subtarget(ob_rootserver common
|
||||
ob_ls_service_helper.cpp
|
||||
ob_tenant_role_transition_service.cpp
|
||||
ob_tenant_transfer_service.cpp
|
||||
ob_transfer_partition_task.cpp
|
||||
ob_tenant_balance_service.cpp
|
||||
ob_ls_balance_helper.cpp
|
||||
ob_balance_task_execute_service.cpp
|
||||
@ -98,6 +99,7 @@ ob_set_subtarget(ob_rootserver common
|
||||
ob_lob_meta_builder.cpp
|
||||
ob_ls_recovery_stat_handler.cpp
|
||||
ob_shrink_expand_resource_pool_checker.cpp
|
||||
ob_transfer_partition_command.cpp
|
||||
)
|
||||
|
||||
ob_set_subtarget(ob_rootserver balance
|
||||
|
@ -528,7 +528,7 @@ int ObAllBalanceGroupBuilder::build_bg_for_partlevel_zero_(const ObSimpleTableSc
|
||||
bool in_new_pg = true; // in new partition group
|
||||
ObLSID dest_ls_id;
|
||||
const uint64_t table_id = table_schema.get_table_id();
|
||||
ObObjectID part_object_id = 0;
|
||||
ObObjectID part_object_id = table_schema.get_object_id();
|
||||
ObTabletID tablet_id = table_schema.get_tablet_id();
|
||||
const uint64_t part_group_uid = table_id; // each table is an independent partition group
|
||||
|
||||
|
@ -146,7 +146,7 @@ int ObLSAllPartBuilder::build_part_info_(
|
||||
|
||||
// compute part object id based on table schema and tablet id
|
||||
if (PARTITION_LEVEL_ZERO == table_schema->get_part_level()) {
|
||||
part_object_id = 0;
|
||||
part_object_id = table_schema->get_object_id();
|
||||
} else if (OB_FAIL(table_schema->get_part_id_by_tablet(tablet_id, part_id, subpart_id))) {
|
||||
if (OB_TABLET_NOT_EXIST == ret) {
|
||||
LOG_WARN("tablet not exist in table schema, need retry", KR(ret), K(tablet_id), KPC(table_schema));
|
||||
|
@ -19,12 +19,15 @@
|
||||
#include "share/schema/ob_part_mgr_util.h"//ObPartitionSchemaIter
|
||||
#include "share/ob_unit_table_operator.h" //ObUnitTableOperator
|
||||
#include "share/balance/ob_balance_job_table_operator.h"//ObBalanceJob
|
||||
#include "share/balance/ob_transfer_partition_task_table_operator.h"//set transfer
|
||||
#include "share/ob_primary_zone_util.h"//get_primary_zone
|
||||
#include "share/rc/ob_tenant_base.h"//MTL
|
||||
#include "share/ls/ob_ls_operator.h"//ls_op
|
||||
#include "share/ls/ob_ls_status_operator.h"//status_op
|
||||
#include "share/ls/ob_ls_table_operator.h"//lst_operator->get
|
||||
#include "share/location_cache/ob_location_service.h"//get_leader
|
||||
#include "share/rpc/ob_async_rpc_proxy.h"//wait_all
|
||||
#include "share/transfer/ob_transfer_task_operator.h"//get_history_task
|
||||
#include "rootserver/ob_tenant_transfer_service.h"//transfer
|
||||
#include "rootserver/balance/ob_ls_all_part_builder.h" // ObLSAllPartBuilder
|
||||
#include "rootserver/ob_root_utils.h"//get_rs_default_timeout_ctx
|
||||
@ -253,7 +256,8 @@ int ObBalanceTaskExecuteService::update_task_status_(
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::process_current_task_status_(
|
||||
const share::ObBalanceTask &task, ObMySQLTransaction &trans,
|
||||
const share::ObBalanceTask &task, const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans,
|
||||
bool &skip_next_status)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -279,9 +283,8 @@ int ObBalanceTaskExecuteService::process_current_task_status_(
|
||||
} else if (task.get_task_status().is_transfer()) {
|
||||
DEBUG_SYNC(BEFORE_PROCESS_BALANCE_TASK_TRANSFER);
|
||||
bool all_part_transfered = false;
|
||||
if (OB_FAIL(
|
||||
execute_transfer_in_trans_(task, trans, all_part_transfered))) {
|
||||
LOG_WARN("failed to execute transfer in trans", KR(ret), K(task));
|
||||
if (OB_FAIL(execute_transfer_in_trans_(task, job, trans, all_part_transfered))) {
|
||||
LOG_WARN("failed to execute transfer in trans", KR(ret), K(task), K(job));
|
||||
} else if (!all_part_transfered) {
|
||||
skip_next_status = true;
|
||||
} else if (task.get_task_type().is_merge_task()) {
|
||||
@ -349,11 +352,11 @@ int ObBalanceTaskExecuteService::execute_task_()
|
||||
} else if (task_in_trans.get_task_status().is_finish_status()) {
|
||||
} else {
|
||||
if (job.get_job_status().is_doing()) {
|
||||
if (OB_FAIL(process_current_task_status_(task_in_trans, trans, skip_next_status))) {
|
||||
if (OB_FAIL(process_current_task_status_(task_in_trans, job, trans, skip_next_status))) {
|
||||
LOG_WARN("failed to process current task status", KR(ret), K(task_in_trans));
|
||||
}
|
||||
} else if (job.get_job_status().is_canceling()) {
|
||||
if (OB_FAIL(cancel_current_task_status_(task_in_trans, trans, skip_next_status))) {
|
||||
if (OB_FAIL(cancel_current_task_status_(task_in_trans, job, trans, skip_next_status))) {
|
||||
LOG_WARN("failed to cancel current task", KR(ret), K(task_in_trans));
|
||||
}
|
||||
} else {
|
||||
@ -426,7 +429,8 @@ int ObBalanceTaskExecuteService::get_balance_job_task_for_update_(
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::cancel_current_task_status_(
|
||||
const share::ObBalanceTask &task, ObMySQLTransaction &trans, bool &skip_next_status)
|
||||
const share::ObBalanceTask &task, const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans, bool &skip_next_status)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
skip_next_status = false;
|
||||
@ -457,6 +461,17 @@ int ObBalanceTaskExecuteService::cancel_current_task_status_(
|
||||
task.get_current_transfer_task_id().id(), tmp_ret))) {
|
||||
LOG_WARN("failed to assign fmt", KR(ret), KR(tmp_ret), K(task));
|
||||
}
|
||||
} else if (job.get_job_type().is_transfer_partition()) {
|
||||
ObTransferTask transfer_task;
|
||||
int64_t create_time = 0, finish_time = 0;//no use
|
||||
if (OB_FAIL(ObTransferTaskOperator::get_history_task(trans, tenant_id_,
|
||||
task.get_current_transfer_task_id(), transfer_task,
|
||||
create_time, finish_time))) {
|
||||
LOG_WARN("failed to get history task", KR(ret), K(tenant_id_), K(task));
|
||||
} else if (OB_FAIL(finish_transfer_partition_task_(transfer_task, job, trans))) {
|
||||
LOG_WARN("failed to finish transfer partition task", KR(ret),
|
||||
K(transfer_task), K(job));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -526,7 +541,7 @@ int ObBalanceTaskExecuteService::cancel_other_init_task_(
|
||||
LOG_WARN("task parent not empty, must be init", KR(ret), K(other_task));
|
||||
} else {
|
||||
//set task status to failed
|
||||
if (OB_FAIL(comment.assign_fmt("Canceled due to parent task %ld was canceled",
|
||||
if (OB_FAIL(comment.assign_fmt("Canceled due to parent task %ld being canceled",
|
||||
task.get_balance_task_id().id()))) {
|
||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(task), K(other_task));
|
||||
} else if (OB_FAIL(try_update_task_comment_(other_task, comment, trans))) {
|
||||
@ -686,7 +701,8 @@ int ObBalanceTaskExecuteService::wait_alter_ls_(const share::ObBalanceTask &task
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::execute_transfer_in_trans_(const ObBalanceTask &task,
|
||||
int ObBalanceTaskExecuteService::execute_transfer_in_trans_(
|
||||
const ObBalanceTask &task, const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans,
|
||||
bool &all_part_transferred)
|
||||
{
|
||||
@ -697,14 +713,17 @@ int ObBalanceTaskExecuteService::execute_transfer_in_trans_(const ObBalanceTask
|
||||
ObTransferPartList transfer_all_part_list;
|
||||
ObTransferPartList transfer_finished_part_list;
|
||||
ObTransferPartList to_do_part_list;
|
||||
ObTransferTask transfer_task;
|
||||
all_part_transferred = false;
|
||||
|
||||
if (OB_UNLIKELY(!inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (OB_UNLIKELY(!task.is_valid() || !task.get_task_status().is_transfer())) {
|
||||
} else if (OB_UNLIKELY(!task.is_valid()
|
||||
|| !task.get_task_status().is_transfer()
|
||||
|| !job.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("task is invalid", KR(ret), K(task));
|
||||
LOG_WARN("task is invalid", KR(ret), K(task), K(job));
|
||||
} else if (OB_ISNULL(transfer_service)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("transfer service is null", KR(ret));
|
||||
@ -715,9 +734,8 @@ int ObBalanceTaskExecuteService::execute_transfer_in_trans_(const ObBalanceTask
|
||||
// NEED new task when transfer is finished
|
||||
all_part_transferred = (task.get_part_list().count() == 0);
|
||||
} else if (OB_FAIL(transfer_service->try_clear_transfer_task(
|
||||
cur_transfer_task_id,
|
||||
transfer_all_part_list,
|
||||
transfer_finished_part_list))) {
|
||||
cur_transfer_task_id, transfer_task,
|
||||
transfer_all_part_list, transfer_finished_part_list))) {
|
||||
if (OB_NEED_RETRY != ret) {
|
||||
LOG_WARN("failed to clear transfer task", KR(ret), K(task));
|
||||
} else {
|
||||
@ -729,37 +747,45 @@ int ObBalanceTaskExecuteService::execute_transfer_in_trans_(const ObBalanceTask
|
||||
}
|
||||
// Finish current Transfer Task of Balance Task
|
||||
else if (OB_FAIL(ObBalanceTaskTableOperator::finish_transfer_task(
|
||||
task,
|
||||
cur_transfer_task_id,
|
||||
transfer_finished_part_list,
|
||||
trans,
|
||||
to_do_part_list,
|
||||
all_part_transferred))) {
|
||||
task, cur_transfer_task_id, transfer_finished_part_list, trans,
|
||||
to_do_part_list, all_part_transferred))) {
|
||||
LOG_WARN("failed to finish tranfer task", KR(ret),
|
||||
K(task), K(cur_transfer_task_id), K(transfer_finished_part_list));
|
||||
} else if (job.get_job_type().is_transfer_partition()) {
|
||||
if (OB_FAIL(finish_transfer_partition_task_(transfer_task, job, trans))) {
|
||||
LOG_WARN("failed to finish transfer partition task", KR(ret),
|
||||
K(transfer_task), K(job));
|
||||
}
|
||||
}
|
||||
|
||||
// if transfer is not finished and transfer task not executing, generate new task
|
||||
if (OB_SUCC(ret) && !all_part_transferred && !transfer_task_executing) {
|
||||
ObTransferTaskID transfer_id;
|
||||
ObTransferTask transfer_task;
|
||||
if (OB_FAIL(transfer_service->generate_transfer_task(
|
||||
trans,
|
||||
task.get_src_ls_id(),
|
||||
task.get_dest_ls_id(),
|
||||
to_do_part_list,
|
||||
task.get_balance_task_id(),
|
||||
transfer_id))) {
|
||||
transfer_task))) {
|
||||
LOG_WARN("failed to generate task id", KR(ret), K(to_do_part_list), K(task));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::start_transfer_task(
|
||||
tenant_id_,
|
||||
task.get_balance_task_id(),
|
||||
transfer_id,
|
||||
transfer_task.get_task_id(),
|
||||
trans))) {
|
||||
LOG_WARN("failed to generate new transfer task", KR(ret), K(tenant_id_), K(task), K(transfer_id));
|
||||
LOG_WARN("failed to generate new transfer task", KR(ret), K(tenant_id_), K(task), K(transfer_task));
|
||||
} else {
|
||||
transfer_service->wakeup();
|
||||
if (job.get_job_type().is_transfer_partition()) {
|
||||
if (OB_FAIL(try_start_transfer_partition_task_(job, transfer_task.get_part_list(),
|
||||
transfer_task.get_task_id(), task.get_dest_ls_id(), trans))) {
|
||||
LOG_WARN("failed to start transfer partition task", KR(ret),
|
||||
K(to_do_part_list), K(task), K(job), K(transfer_task));
|
||||
}
|
||||
}
|
||||
}
|
||||
ISTAT("generate new transfer task", KR(ret), K(transfer_id), K(to_do_part_list), K(task), K(task_comment_));
|
||||
ISTAT("generate new transfer task", KR(ret), K(transfer_task), K(to_do_part_list), K(task), K(task_comment_));
|
||||
}
|
||||
|
||||
// double check for merge task to make sure that all partitions on src_ls have been transferred
|
||||
@ -829,7 +855,7 @@ int ObBalanceTaskExecuteService::get_and_update_merge_ls_part_list_(
|
||||
all_part_transferred = true;
|
||||
ISTAT("there is no partition on src ls, no need update part list", K(task),
|
||||
K(all_part_transferred), K(part_list));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::update_merge_ls_part_list(
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::update_task_part_list(
|
||||
tenant_id_,
|
||||
task.get_balance_task_id(),
|
||||
part_list,
|
||||
@ -867,7 +893,6 @@ int ObBalanceTaskExecuteService::set_ls_to_dropping_(const ObLSID &ls_id, ObMySQ
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//在一个merge_ls在执行的时候,都保证日志流一定会推到wait_offline状态。
|
||||
//这里的目的不是检查现有的资源是否足够创建日志流,只是为了保证
|
||||
//这一轮job新创建的日志流的create_scn一定会大于上一轮job产生的wait_offline日志流的offline_scn。
|
||||
@ -931,6 +956,64 @@ int ObBalanceTaskExecuteService::wait_can_create_new_ls_(share::SCN &create_scn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//finish transfer partition task 只有在目的端匹配的情况下才可以
|
||||
int ObBalanceTaskExecuteService::finish_transfer_partition_task_(
|
||||
const ObTransferTask &transfer_task, const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (OB_UNLIKELY(!transfer_task.is_valid()
|
||||
|| !transfer_task.get_status().is_finish_status()
|
||||
|| !job.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(transfer_task), K(job));
|
||||
}
|
||||
const ObTransferPartList ¬_exist_list = transfer_task.get_not_exist_part_list();
|
||||
const ObTransferPartList &finish_list = transfer_task.get_part_list();
|
||||
|
||||
if (OB_SUCC(ret) && not_exist_list.count() > 0) {
|
||||
//这里的分区不存在不一定是分区真的不存在,可能仅是不在源端日志流上
|
||||
//这里需要double check
|
||||
ObString comment("Need retry, partition may be dropped or be transferred");
|
||||
ISTAT("Part not exist during transfer, try again", K(not_exist_list));
|
||||
if (OB_FAIL(ObTransferPartitionTaskTableOperator::rollback_from_doing_to_waiting(
|
||||
tenant_id_, job.get_job_id(), not_exist_list, comment, trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(tenant_id_),
|
||||
K(not_exist_list), K(transfer_task), K(job), K(comment));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && transfer_task.get_status().is_completed_status()
|
||||
&& finish_list.count() > 0) {
|
||||
ObString comment("Partition transfer to dest LS");
|
||||
ObTransferPartitionTaskStatus status =
|
||||
ObTransferPartitionTaskStatus::TRP_TASK_STATUS_COMPLETED;
|
||||
ObLSID task_dest_ls;
|
||||
ObTransferPartList new_finish_list;
|
||||
ObTransferPartitionTaskID max_task_id;
|
||||
if (OB_FAIL(load_finish_transfer_part_tasks_(transfer_task, job,
|
||||
new_finish_list, max_task_id, task_dest_ls, trans))) {
|
||||
LOG_WARN("failed to get finish tranfer part task", KR(ret), K(transfer_task), K(job));
|
||||
} else if (0 == new_finish_list.count()) {
|
||||
ISTAT("all transfer partition may be dropped", K(transfer_task));
|
||||
} else if (transfer_task.get_dest_ls() != task_dest_ls) {
|
||||
// 一个transfer partition任务可能会有多次transfer
|
||||
// 任务可以执行成功,一定是transfer到目的端
|
||||
LOG_INFO("dest ls not match, no need finish transfer task", KR(ret),
|
||||
K(task_dest_ls), K(transfer_task));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::finish_task(
|
||||
tenant_id_, new_finish_list, max_task_id, status, comment, trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(tenant_id_),
|
||||
K(new_finish_list), K(max_task_id));
|
||||
}
|
||||
} else {
|
||||
//other status no need finish task
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::get_max_offline_scn_(share::SCN &offline_scn, int64_t &offline_ls_count)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -988,6 +1071,7 @@ int ObBalanceTaskExecuteService::get_max_offline_scn_(share::SCN &offline_scn, i
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::get_ls_offline_scn_by_rpc_(
|
||||
ObGetLSReplayedScnProxy &proxy,
|
||||
int64_t &offline_ls_count,
|
||||
@ -1061,6 +1145,81 @@ int ObBalanceTaskExecuteService::get_ls_offline_scn_by_rpc_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskExecuteService::load_finish_transfer_part_tasks_(
|
||||
const ObTransferTask &transfer_task,
|
||||
const share::ObBalanceJob &job,
|
||||
ObTransferPartList &new_finish_list,
|
||||
ObTransferPartitionTaskID &max_task_id,
|
||||
ObLSID &dest_ls, ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
new_finish_list.reset();
|
||||
max_task_id.reset();
|
||||
dest_ls.reset();
|
||||
ObArray<ObTransferPartitionTask> task_array;
|
||||
const ObTransferPartList &finish_list = transfer_task.get_part_list();
|
||||
if (OB_UNLIKELY(!inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (OB_UNLIKELY(!transfer_task.is_valid()
|
||||
|| !transfer_task.get_status().is_completed_status()
|
||||
|| !job.is_valid() || !job.get_job_type().is_transfer_partition()
|
||||
|| 0 >= finish_list.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(transfer_task), K(job));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::load_part_list_task(
|
||||
tenant_id_, job.get_job_id(), finish_list, task_array, trans))) {
|
||||
LOG_WARN("failed to get part list task", KR(ret), K(tenant_id_),
|
||||
K(finish_list));
|
||||
} else if (0 == task_array.count()) {
|
||||
//可能所有相关的任务的分区都已经被删除,不需要在处理transfer_partition表
|
||||
} else {
|
||||
//检查所有的分区目的端是否一致
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array.at(i);
|
||||
if (dest_ls.is_valid() && task.get_dest_ls() != dest_ls) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task need have same dest ls", KR(ret), K(task),
|
||||
K(dest_ls), K(task_array));
|
||||
} else if (OB_FAIL(new_finish_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
} else {
|
||||
dest_ls = task.get_dest_ls();
|
||||
if (!max_task_id.is_valid() || max_task_id < task.get_task_id()) {
|
||||
max_task_id = task.get_task_id();
|
||||
}
|
||||
}
|
||||
}//end for
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//start可以有多次
|
||||
int ObBalanceTaskExecuteService::try_start_transfer_partition_task_(
|
||||
const share::ObBalanceJob &job,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObTransferTaskID &transfer_id,
|
||||
const ObLSID &dest_ls,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (OB_UNLIKELY(!transfer_id.is_valid() || 0 >= part_list.count()
|
||||
|| !dest_ls.is_valid() || !job.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("transfer task is invalid", KR(ret), K(transfer_id),
|
||||
K(dest_ls), K(part_list), K(job));
|
||||
} else if (OB_FAIL(
|
||||
ObTransferPartitionTaskTableOperator::start_transfer_task(
|
||||
tenant_id_, job.get_job_id(), part_list, transfer_id, trans))) {
|
||||
LOG_WARN("failed to start transfer task", KR(ret), K(tenant_id_),
|
||||
K(part_list), K(transfer_id), K(job));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,14 @@ private:
|
||||
int update_task_status_(const share::ObBalanceTask &task,
|
||||
const share::ObBalanceJobStatus &job_status,
|
||||
ObMySQLTransaction &trans);
|
||||
int process_current_task_status_(const share::ObBalanceTask &task, ObMySQLTransaction &trans,
|
||||
int process_current_task_status_(const share::ObBalanceTask &task,
|
||||
const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans,
|
||||
bool &skip_next_status);
|
||||
int cancel_current_task_status_(const share::ObBalanceTask &task, ObMySQLTransaction &trans, bool &skip_next_status);
|
||||
int cancel_current_task_status_(const share::ObBalanceTask &task,
|
||||
const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans,
|
||||
bool &skip_next_status);
|
||||
int cancel_other_init_task_(const share::ObBalanceTask &task, ObMySQLTransaction &trans);
|
||||
int process_init_task_(const share::ObBalanceTask &task, ObMySQLTransaction &trans,
|
||||
bool &skip_next_status);
|
||||
@ -94,6 +99,7 @@ private:
|
||||
int set_ls_to_merge_(const share::ObBalanceTask &task, ObMySQLTransaction &trans);
|
||||
int set_ls_to_dropping_(const share::ObLSID &ls_id, ObMySQLTransaction &trans);
|
||||
int execute_transfer_in_trans_(const share::ObBalanceTask &task,
|
||||
const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans,
|
||||
bool &all_part_transferred);
|
||||
int get_and_update_merge_ls_part_list_(
|
||||
@ -108,6 +114,21 @@ private:
|
||||
int get_ls_offline_scn_by_rpc_(ObGetLSReplayedScnProxy &proxy,
|
||||
int64_t &offline_ls_count,
|
||||
ObIArray<int> &return_code_array);
|
||||
int finish_transfer_partition_task_(const share::ObTransferTask &transfer_task,
|
||||
const share::ObBalanceJob &job,
|
||||
ObMySQLTransaction &trans);
|
||||
int load_finish_transfer_part_tasks_(const share::ObTransferTask &transfer_task,
|
||||
const share::ObBalanceJob &job,
|
||||
share::ObTransferPartList &new_finish_list,
|
||||
share::ObTransferPartitionTaskID &max_task_id,
|
||||
share::ObLSID &dest_ls,
|
||||
ObMySQLTransaction &trans);
|
||||
int try_start_transfer_partition_task_(
|
||||
const share::ObBalanceJob &job,
|
||||
const share::ObTransferPartList &part_list,
|
||||
const share::ObTransferTaskID &transfer_id,
|
||||
const share::ObLSID &dest_ls,
|
||||
ObMySQLTransaction &trans);
|
||||
private:
|
||||
bool inited_;
|
||||
uint64_t tenant_id_;
|
||||
|
@ -498,7 +498,7 @@ int ObPreBootstrap::check_is_all_server_empty(bool &is_empty)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObBootstrap::TableIdCompare::operator() (const ObTableSchema* left, const ObTableSchema* right)
|
||||
bool ObBootstrap::TableIdCompare::operator() (const ObSimpleTableSchemaV2* left, const ObSimpleTableSchemaV2* right)
|
||||
{
|
||||
bool bret = false;
|
||||
|
||||
|
@ -44,6 +44,7 @@ namespace schema
|
||||
class ObMultiVersionSchemaService;
|
||||
class ObTableSchema;
|
||||
class ObTenantSchema;
|
||||
class ObSimpleTableSchemaV2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,10 +126,10 @@ public:
|
||||
public:
|
||||
TableIdCompare() : ret_(common::OB_SUCCESS) {}
|
||||
~TableIdCompare() {}
|
||||
bool operator() (const share::schema::ObTableSchema* left,
|
||||
const share::schema::ObTableSchema* right);
|
||||
bool operator() (const share::schema::ObSimpleTableSchemaV2* left,
|
||||
const share::schema::ObSimpleTableSchemaV2* right);
|
||||
int get_ret() const { return ret_; }
|
||||
private:
|
||||
private:
|
||||
int ret_;
|
||||
};
|
||||
explicit ObBootstrap(obrpc::ObSrvRpcProxy &rpc_proxy,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "rootserver/ob_ls_service_helper.h"
|
||||
#include "rootserver/ob_partition_balance.h"
|
||||
#include "storage/ob_common_id_utils.h"
|
||||
#include "observer/ob_server_struct.h"//GCTX
|
||||
|
||||
|
||||
namespace oceanbase
|
||||
@ -706,73 +707,82 @@ int ObPartitionBalance::generate_balance_job_from_logical_task_()
|
||||
} else if (OB_ISNULL(src_ls) || OB_ISNULL(dest_ls)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("not find ls", KR(ret), K(src_ls), K(dest_ls));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (src_ls->get_ls_group_id() == dest_ls->get_ls_group_id()) {
|
||||
ObBalanceTask task;
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_TRANSFER);
|
||||
ObBalanceTaskID task_id;
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) {
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(task.simple_init(tenant_id_, balance_job_.get_job_id(), task_id, task_type,
|
||||
dest_ls->get_ls_group_id(), src_ls->get_ls_id(), dest_ls->get_ls_id(), iter->second))) {
|
||||
LOG_WARN("init task fail", KR(ret));
|
||||
} else if (OB_FAIL(balance_tasks_.push_back(task))) {
|
||||
LOG_WARN("push_back fail", KR(ret), K(task));
|
||||
}
|
||||
} else {
|
||||
// split
|
||||
ObLSID tmp_ls_id;
|
||||
const ObTransferPartList empty_part_list;//for alter and merge
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBalanceTask task;
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_SPLIT);
|
||||
ObBalanceTaskID task_id;
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) {
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(ObLSServiceHelper::fetch_new_ls_id(sql_proxy_, tenant_id_, tmp_ls_id))) {
|
||||
LOG_WARN("failed to fetch new ls id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(task.simple_init(tenant_id_, balance_job_.get_job_id(), task_id, task_type,
|
||||
src_ls->get_ls_group_id(), src_ls->get_ls_id(), tmp_ls_id, iter->second))) {
|
||||
LOG_WARN("init task fail", KR(ret));
|
||||
} else if (OB_FAIL(balance_tasks_.push_back(task))) {
|
||||
LOG_WARN("push_back fail", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
// alter
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBalanceTask task;
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_ALTER);
|
||||
ObBalanceTaskID task_id;
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) {
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(task.simple_init(tenant_id_, balance_job_.get_job_id(), task_id, task_type,
|
||||
dest_ls->get_ls_group_id(), tmp_ls_id, tmp_ls_id, empty_part_list))) {
|
||||
LOG_WARN("init task fail", KR(ret));
|
||||
} else if (OB_FAIL(balance_tasks_.push_back(task))) {
|
||||
LOG_WARN("push_back fail", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
// merge
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBalanceTask task;
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_MERGE);
|
||||
ObBalanceTaskID task_id;
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) {
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(task.simple_init(tenant_id_, balance_job_.get_job_id(), task_id, task_type,
|
||||
dest_ls->get_ls_group_id(), tmp_ls_id, dest_ls->get_ls_id(), empty_part_list))) {
|
||||
LOG_WARN("init task fail", KR(ret));
|
||||
} else if (OB_FAIL(balance_tasks_.push_back(task))) {
|
||||
LOG_WARN("push_back fail", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
} else if (OB_FAIL(transfer_logical_task_to_balance_task(tenant_id_,
|
||||
balance_job_.get_job_id(), src_ls->get_ls_id(), dest_ls->get_ls_id(),
|
||||
src_ls->get_ls_group_id(), dest_ls->get_ls_group_id(), iter->second,
|
||||
balance_tasks_))) {
|
||||
LOG_WARN("failed to transfer logical task", KR(ret), K(tenant_id_), K(balance_job_),
|
||||
KPC(src_ls), KPC(dest_ls), K(iter->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define GENERATE_TASK(balance_type, src_ls, dest_ls, ls_group_id, part_list) \
|
||||
do { \
|
||||
if (OB_SUCC(ret)) { \
|
||||
ObBalanceTask task; \
|
||||
ObBalanceTaskID task_id; \
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id, task_id))) { \
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id)); \
|
||||
} else if (OB_FAIL(task.simple_init(tenant_id, balance_job_id, task_id, \
|
||||
balance_type, ls_group_id, src_ls, \
|
||||
dest_ls, part_list))) { \
|
||||
LOG_WARN("init task fail", KR(ret), K(tenant_id), K(balance_job_id), \
|
||||
K(task_id), K(ls_group_id), K(src_ls), K(dest_ls), \
|
||||
K(part_list)); \
|
||||
} else if (OB_FAIL(task_array.push_back(task))) { \
|
||||
LOG_WARN("push_back fail", KR(ret), K(task)); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
int ObPartitionBalance::transfer_logical_task_to_balance_task(
|
||||
const uint64_t tenant_id,
|
||||
const ObBalanceJobID &balance_job_id,
|
||||
const ObLSID &src_ls, const ObLSID &dest_ls,
|
||||
const uint64_t src_ls_group, const uint64_t dest_ls_group,
|
||||
const ObTransferPartList &part_list,
|
||||
ObArray<ObBalanceTask> &task_array)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
//can not reset task array
|
||||
if (OB_UNLIKELY(!balance_job_id.is_valid() || !src_ls.is_valid()
|
||||
|| !dest_ls.is_valid() || OB_INVALID_ID == src_ls_group
|
||||
|| OB_INVALID_ID == dest_ls_group || 0 >= part_list.count()
|
||||
|| src_ls == dest_ls || !is_valid_tenant_id(tenant_id))
|
||||
|| OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(balance_job_id), K(src_ls),
|
||||
K(dest_ls), K(src_ls_group), K(dest_ls_group), K(part_list),
|
||||
K(tenant_id), KP(GCTX.sql_proxy_));
|
||||
} else if (src_ls_group == dest_ls_group) {
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_TRANSFER);
|
||||
GENERATE_TASK(task_type, src_ls, dest_ls, src_ls_group, part_list);
|
||||
} else {
|
||||
ObLSID tmp_ls_id;
|
||||
const ObTransferPartList empty_part_list;//for alter and merge
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_SPLIT);
|
||||
if (OB_FAIL(ObLSServiceHelper::fetch_new_ls_id(GCTX.sql_proxy_, tenant_id, tmp_ls_id))) {
|
||||
LOG_WARN("failed to fetch new ls id", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
GENERATE_TASK(task_type, src_ls, tmp_ls_id, src_ls_group, part_list);
|
||||
}
|
||||
// alter
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_ALTER);
|
||||
GENERATE_TASK(task_type, tmp_ls_id, tmp_ls_id, dest_ls_group, empty_part_list);
|
||||
}
|
||||
// merge
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBalanceTaskType task_type(ObBalanceTaskType::BALANCE_TASK_MERGE);
|
||||
GENERATE_TASK(task_type, tmp_ls_id, dest_ls, dest_ls_group, empty_part_list);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPartitionHelper::check_partition_option(const schema::ObSimpleTableSchemaV2 &t1, const schema::ObSimpleTableSchemaV2 &t2, bool is_subpart, bool &is_matched)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -65,8 +65,13 @@ public:
|
||||
|
||||
ObBalanceJob &get_balance_job() { return balance_job_; }
|
||||
ObArray<ObBalanceTask> &get_balance_task() { return balance_tasks_; }
|
||||
|
||||
|
||||
static int transfer_logical_task_to_balance_task(
|
||||
const uint64_t tenant_id,
|
||||
const ObBalanceJobID &balance_job_id,
|
||||
const ObLSID &src_ls, const ObLSID &dest_ls,
|
||||
const uint64_t src_ls_group, const uint64_t dest_ls_group,
|
||||
const ObTransferPartList &part_list,
|
||||
ObArray<ObBalanceTask> &task_array);
|
||||
// For ObAllBalanceGroupBuilder::NewPartitionCallback
|
||||
// handle new partition of every balance group
|
||||
int on_new_partition(
|
||||
|
@ -1851,7 +1851,7 @@ int ObAdminRefreshIOCalibration::execute(const obrpc::ObAdminRefreshIOCalibratio
|
||||
}
|
||||
if (server_list.count() != succ_count) {
|
||||
ret = OB_PARTIAL_FAILED;
|
||||
LOG_USER_ERROR(OB_PARTIAL_FAILED);
|
||||
LOG_USER_ERROR(OB_PARTIAL_FAILED, "Partial failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "share/rc/ob_tenant_base.h"//MTL
|
||||
#include "rootserver/ob_ls_balance_helper.h"//ObLSBalanceTaskHelper
|
||||
#include "rootserver/ob_ls_service_helper.h"//ObLSServiceHelper
|
||||
#include "rootserver/ob_transfer_partition_task.h"//ObTransferPartitionHelper
|
||||
#include "rootserver/ob_balance_ls_primary_zone.h"//ObBalanceLSPrimaryZone
|
||||
#include "observer/ob_server_struct.h"//GCTX
|
||||
#include "rootserver/ob_partition_balance.h" // partition balance
|
||||
@ -97,15 +98,21 @@ void ObTenantBalanceService::do_work()
|
||||
LOG_WARN("failed to gather stat", KR(ret));
|
||||
} else if (OB_FAIL(try_process_current_job(job_cnt))) {
|
||||
LOG_WARN("failed to process current job", KR(ret));
|
||||
} else if (0 == job_cnt && ObShareUtil::is_tenant_enable_rebalance(tenant_id_)) {
|
||||
//check ls status is match with __all_ls
|
||||
//TODO
|
||||
} else if (0 == job_cnt) {
|
||||
if (OB_FAIL(transfer_partition_(job_cnt))) {
|
||||
LOG_WARN("failed to transfer partition", KR(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && 0 == job_cnt
|
||||
&& ObShareUtil::is_tenant_enable_rebalance(tenant_id_)) {
|
||||
if (ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
||||
if (OB_FAIL(gather_ls_status_stat(tenant_id_, ls_array_))) {
|
||||
LOG_WARN("failed to gather ls status", KR(ret), K(tenant_id_), K(ls_array_));
|
||||
LOG_WARN("failed to gather ls status stat", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(ls_balance_(job_cnt))) {
|
||||
LOG_WARN("failed to do ls balance", KR(ret));
|
||||
} else if (0 == job_cnt) {
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && 0 == job_cnt) {
|
||||
if (OB_FAIL(try_do_partition_balance_(last_partition_balance_time))) {
|
||||
LOG_WARN("try do partition balance failed", KR(ret), K(last_partition_balance_time));
|
||||
}
|
||||
@ -532,7 +539,9 @@ int ObTenantBalanceService::try_finish_current_job_(const share::ObBalanceJob &j
|
||||
ObBalanceJobStatus new_status;
|
||||
can_clean_job = true;
|
||||
ObString comment;
|
||||
if (job.get_job_status().is_doing()) {
|
||||
START_TRANSACTION(GCTX.sql_proxy_, tenant_id_)
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (job.get_job_status().is_doing()) {
|
||||
new_status = ObBalanceJobStatus(share::ObBalanceJobStatus::BALANCE_JOB_STATUS_COMPLETED);
|
||||
} else if (job.get_job_status().is_canceling()) {
|
||||
new_status = ObBalanceJobStatus(share::ObBalanceJobStatus::BALANCE_JOB_STATUS_CANCELED);
|
||||
@ -540,11 +549,18 @@ int ObTenantBalanceService::try_finish_current_job_(const share::ObBalanceJob &j
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("job status not expected", KR(ret), K(job));
|
||||
}
|
||||
if (OB_SUCC(ret) && job.get_job_type().is_transfer_partition()) {
|
||||
//不管job是以什么状态结束的,校验transfer_partition_task没有这个job_id的任务
|
||||
if (OB_FAIL(try_finish_transfer_partition_(job, trans))) {
|
||||
LOG_WARN("try finish transfer partition task", KR(ret), K(job));
|
||||
}
|
||||
}
|
||||
if (FAILEDx(ObBalanceJobTableOperator::update_job_status(tenant_id_, job.get_job_id(),
|
||||
job.get_job_status(), new_status, false, comment,
|
||||
*GCTX.sql_proxy_))) {
|
||||
trans))) {
|
||||
LOG_WARN("failed to update job status", KR(ret), K(tenant_id_), K(job), K(new_status));
|
||||
}
|
||||
END_TRANSACTION(trans)
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (!can_clean_job) {
|
||||
@ -558,6 +574,58 @@ int ObTenantBalanceService::try_finish_current_job_(const share::ObBalanceJob &j
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
//在balance_job结束时,可能存在transfer partition任务的残留,这里残留有两种情况:
|
||||
//1. cancel 时,需要一把把没有处理完成的任务全都回滚掉。
|
||||
//2. complete时,可能也会有残留的任务,例如生成了LS_SPLIT + ALTER + MERGE任务
|
||||
//用户在split任务执行成功后,就把对应的分区删除掉了,后续的merge任务的part_list中就看不到这个分区了,所以在整个balance_job结束掉后,就会存在transfer_partition任务的残留,这种我们也回滚成WAITING状态,等待下一轮结束掉:
|
||||
int ObTenantBalanceService::try_finish_transfer_partition_(
|
||||
const share::ObBalanceJob &job, common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!inited_ || ! ATOMIC_LOAD(&loaded_))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(inited_), K(loaded_));
|
||||
} else if (OB_UNLIKELY(!job.is_valid() || !job.get_job_type().is_transfer_partition())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("job is invalid", KR(ret), K(job));
|
||||
} else if (job.get_job_status().is_canceling()) {
|
||||
//取消所有的关联的transfer partition任务
|
||||
if (OB_FAIL(ObTransferPartitionTaskTableOperator::rollback_all_to_waitting(
|
||||
tenant_id_, job.get_job_id(), trans))) {
|
||||
LOG_WARN("failed to rollback task", KR(ret), K(tenant_id_), K(job));
|
||||
}
|
||||
} else if (job.get_job_status().is_doing()) {
|
||||
ObArray<ObTransferPartitionTask> task_array;
|
||||
if (OB_FAIL(ObTransferPartitionTaskTableOperator::load_all_balance_job_task(
|
||||
tenant_id_, job.get_job_id(), task_array, trans))) {
|
||||
LOG_WARN("failed to load balance job task", KR(ret), K(tenant_id_), K(job));
|
||||
} else if (task_array.count() > 0) {
|
||||
ObString comment("Need retry, partition may be dropped");
|
||||
ISTAT("Job is finish, has transfer task doing, rollback such task",
|
||||
K(task_array), K(job));
|
||||
ObTransferPartList part_list;
|
||||
//通过分析,这部分遗留下来的transfer partition任务一定是doing状态的
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array.at(i);
|
||||
if (OB_UNLIKELY(!task.get_task_status().is_doing())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task must be doing", KR(ret), K(task));
|
||||
} else if (OB_FAIL(part_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(i), K(task));
|
||||
}
|
||||
}
|
||||
if (FAILEDx(ObTransferPartitionTaskTableOperator::
|
||||
rollback_from_doing_to_waiting(tenant_id_,
|
||||
job.get_job_id(), part_list, comment, trans))) {
|
||||
LOG_WARN("failed to rollback balance job", KR(ret), K(job), K(part_list));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("job status is not expected", KR(ret), K(job));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantBalanceService::get_active_unit_num_(int64_t &active_unit_num) const
|
||||
{
|
||||
@ -591,9 +659,22 @@ int ObTenantBalanceService::check_ls_job_need_cancel_(const share::ObBalanceJob
|
||||
} else if (OB_UNLIKELY(!job.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("job is invalid", KR(ret), K(job));
|
||||
} else if (job.get_job_type().is_transfer_partition()) {
|
||||
//手动transfer partition任务只需要看enable_transfer即可
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
|
||||
if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tenant config is invalid", K(tenant_id_));
|
||||
} else if (!tenant_config->enable_transfer) {
|
||||
need_cancel = true;
|
||||
if (OB_TMP_FAIL(comment.assign("Canceled due to tenant transfer being disabled"))) {
|
||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
||||
}
|
||||
ISTAT("tenant transfer is disabled, need cancel current job", K(job), K(comment));
|
||||
}
|
||||
} else if (!ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
||||
need_cancel = true;
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to tenant balance or transfer is disabled"))) {
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to tenant balance or transfer being disabled"))) {
|
||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
||||
}
|
||||
ISTAT("tenant balance or transfer is disabled, need cancel current job", K(job), K(comment),
|
||||
@ -601,7 +682,7 @@ int ObTenantBalanceService::check_ls_job_need_cancel_(const share::ObBalanceJob
|
||||
"enable_transfer", ObShareUtil::is_tenant_enable_transfer(tenant_id_));
|
||||
} else if (job.get_primary_zone_num() != primary_zone_num_) {
|
||||
need_cancel = true;
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to primary zone num change from %ld to %ld",
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to primary zone num changing from %ld to %ld",
|
||||
job.get_primary_zone_num(), primary_zone_num_))) {
|
||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job), K(primary_zone_num_));
|
||||
}
|
||||
@ -612,7 +693,7 @@ int ObTenantBalanceService::check_ls_job_need_cancel_(const share::ObBalanceJob
|
||||
LOG_WARN("failed to get active unit num", KR(ret));
|
||||
} else if (job.get_unit_group_num() != active_unit_num) {
|
||||
need_cancel = true;
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to unit num change from %ld to %ld",
|
||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to unit num changing from %ld to %ld",
|
||||
job.get_unit_group_num(), active_unit_num))) {
|
||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job), K(active_unit_num));
|
||||
}
|
||||
@ -646,24 +727,12 @@ int ObTenantBalanceService::persist_job_and_task_(const share::ObBalanceJob &job
|
||||
} else if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ptr is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(construct_dependency_of_each_task_(tasks))) {
|
||||
LOG_WARN("failed to generate dependency task", KR(ret), K(tasks));
|
||||
} else {
|
||||
common::ObMySQLTransaction trans;
|
||||
if (OB_FAIL(trans.start(GCTX.sql_proxy_, tenant_id_))) {
|
||||
LOG_WARN("failed to start trans", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(lock_and_check_balance_job_(trans, tenant_id_))) {
|
||||
LOG_WARN("lock and check balance job failed", KR(ret), K_(tenant_id));
|
||||
} else if (OB_FAIL(ObBalanceJobTableOperator::insert_new_job(job, trans))) {
|
||||
LOG_WARN("failed to insert new job", KR(ret), K(job));
|
||||
} else if (OB_FAIL(ObTenantSnapshotUtil::check_tenant_not_in_cloning_procedure(tenant_id_, case_to_check))) {
|
||||
LOG_WARN("fail to check whether tenant is cloning", KR(ret), K_(tenant_id), K(case_to_check));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tasks.count(); ++i) {
|
||||
if (OB_FAIL(ObBalanceTaskTableOperator::insert_new_task(tasks.at(i),
|
||||
trans))) {
|
||||
LOG_WARN("failed to insert new task", KR(ret), K(i), K(tasks));
|
||||
}
|
||||
} else if (OB_FAIL(persist_job_and_task_in_trans_(job, tasks, trans))) {
|
||||
LOG_WARN("failed to persist job and task in trans", KR(ret), K(job), K(tasks));
|
||||
}
|
||||
if (trans.is_started()) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
@ -676,6 +745,56 @@ int ObTenantBalanceService::persist_job_and_task_(const share::ObBalanceJob &job
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantBalanceService::persist_job_and_task_in_trans_(const share::ObBalanceJob &job,
|
||||
ObArray<share::ObBalanceTask> &tasks,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObConflictCaseWithClone case_to_check(ObConflictCaseWithClone::TRANSFER);
|
||||
if (OB_UNLIKELY(!inited_ || ! ATOMIC_LOAD(&loaded_))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(inited_), K(loaded_));
|
||||
} else if (OB_UNLIKELY(!job.is_valid() || 0 == tasks.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("job or task is invalid", KR(ret), K(job), K(tasks));
|
||||
} else if (OB_FAIL(construct_dependency_of_each_task_(tasks))) {
|
||||
LOG_WARN("failed to generate dependency task", KR(ret), K(tasks));
|
||||
} else if (OB_FAIL(lock_and_check_balance_job_(trans, tenant_id_))) {
|
||||
LOG_WARN("lock and check balance job failed", KR(ret), K_(tenant_id));
|
||||
} else {
|
||||
//由于ls_array_是在锁外获取,所以可能会存在没有获取到最新状态的问题,在锁内做二次校验
|
||||
//TODO 是否需要检验primary_zone和unit_num,目前看不需要,这些随时都有可能被修改
|
||||
//只能保证最终一致性
|
||||
share::ObLSStatusInfoArray tmp_ls_array;
|
||||
if (OB_FAIL(gather_ls_status_stat(tenant_id_, tmp_ls_array))) {
|
||||
LOG_WARN("failed to get ls status array", KR(ret), K(tenant_id_));
|
||||
} else if (tmp_ls_array.count() != ls_array_.count()) {
|
||||
ret = OB_NEED_RETRY;
|
||||
LOG_WARN("ls status info change, need retry", KR(ret), K(tmp_ls_array),
|
||||
K(ls_array_));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tmp_ls_array.count(); ++i) {
|
||||
if (ls_array_.at(i) != tmp_ls_array.at(i)) {
|
||||
ret = OB_NEED_RETRY;
|
||||
LOG_WARN("ls status info change, need retry", KR(ret),
|
||||
"ls_status", ls_array_.at(i), "ls_status_new", tmp_ls_array.at(i));
|
||||
}
|
||||
}//end for
|
||||
}
|
||||
}
|
||||
if (FAILEDx(ObBalanceJobTableOperator::insert_new_job(job, trans))) {
|
||||
LOG_WARN("failed to insert new job", KR(ret), K(job));
|
||||
} else if (OB_FAIL(ObTenantSnapshotUtil::check_tenant_not_in_cloning_procedure(tenant_id_, case_to_check))) {
|
||||
LOG_WARN("fail to check whether tenant is cloning", KR(ret), K_(tenant_id), K(case_to_check));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tasks.count(); ++i) {
|
||||
if (OB_FAIL(ObBalanceTaskTableOperator::insert_new_task(tasks.at(i),
|
||||
trans))) {
|
||||
LOG_WARN("failed to insert new task", KR(ret), K(i), K(tasks));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTenantBalanceService::lock_and_check_balance_job_(
|
||||
common::ObMySQLTransaction &trans,
|
||||
const uint64_t tenant_id)
|
||||
@ -851,7 +970,68 @@ int ObTenantBalanceService::try_statistic_balance_group_status_(
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTenantBalanceService::transfer_partition_(int64_t &job_cnt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
job_cnt = 0;
|
||||
uint64_t data_version = 0;
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
|
||||
if (OB_UNLIKELY(!inited_ || !ATOMIC_LOAD(&loaded_))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(inited_), K(loaded_));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id_, data_version))) {
|
||||
LOG_WARN("failed to get min data version", KR(ret), K(tenant_id_));
|
||||
} else if (data_version < DATA_VERSION_4_2_1_2
|
||||
//trasnsfer partition 功能提交到了4220分支,所以4220之后的42x分支不用判断兼容性
|
||||
|| (data_version >= DATA_VERSION_4_3_0_0 && DATA_VERSION_4_3_1_0 > data_version)) {
|
||||
LOG_TRACE("no need do transfer partition", K(data_version));
|
||||
} else if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tenant config is invalid", K(tenant_id_));
|
||||
} else if (!tenant_config->enable_transfer) {
|
||||
LOG_TRACE("can not transfer partition while can not transfer");
|
||||
} else {
|
||||
ObTransferPartitionHelper tp_help(tenant_id_, GCTX.sql_proxy_);
|
||||
int64_t unit_num = 0;
|
||||
bool has_job = true;
|
||||
|
||||
if (OB_FAIL(tp_help.build(has_job))) {
|
||||
LOG_WARN("failed to build transfer task info", KR(ret));
|
||||
} else if (!has_job) {
|
||||
LOG_INFO("no transfer partition job");
|
||||
} else if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ptr is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(get_active_unit_num_(unit_num))) {
|
||||
LOG_WARN("failed to get unit num", KR(ret));
|
||||
} else if (OB_FAIL(gather_ls_status_stat(tenant_id_, ls_array_))) {
|
||||
LOG_WARN("failed to gather ls status stat", KR(ret), K(tenant_id_));
|
||||
} else {
|
||||
START_TRANSACTION(GCTX.sql_proxy_, tenant_id_)
|
||||
if (FAILEDx(tp_help.process_in_trans(ls_array_, unit_num,
|
||||
primary_zone_num_, trans))) {
|
||||
LOG_WARN("failed to process transfer partition", KR(ret),
|
||||
K(ls_array_), K(unit_num), K(primary_zone_num_));
|
||||
} else if (0 == tp_help.get_balance_tasks().count()) {
|
||||
job_cnt = 0;
|
||||
} else if (OB_FAIL(persist_job_and_task_in_trans_(tp_help.get_balance_job(),
|
||||
tp_help.get_balance_tasks(),
|
||||
trans))) {
|
||||
LOG_WARN("failed to persist job and task", KR(ret), "job",
|
||||
tp_help.get_balance_job(), "tasks",
|
||||
tp_help.get_balance_tasks());
|
||||
} else {
|
||||
job_cnt = 1;
|
||||
}
|
||||
END_TRANSACTION(trans)
|
||||
}
|
||||
}
|
||||
|
||||
ISTAT("finish transfer partition", KR(ret), K(job_cnt),
|
||||
"enable transfer", tenant_config->enable_transfer);
|
||||
return ret;
|
||||
|
||||
}
|
||||
#undef SET_TASK_DEPENDENCY
|
||||
#undef ISTAT
|
||||
#undef WSTAT
|
||||
|
@ -103,6 +103,9 @@ private:
|
||||
void reset();
|
||||
int persist_job_and_task_(const share::ObBalanceJob &job,
|
||||
ObArray<share::ObBalanceTask> &tasks);
|
||||
int persist_job_and_task_in_trans_(const share::ObBalanceJob &job,
|
||||
ObArray<share::ObBalanceTask> &tasks,
|
||||
common::ObMySQLTransaction &trans);
|
||||
int construct_dependency_of_each_task_(ObArray<share::ObBalanceTask> &tasks);
|
||||
int lock_and_check_balance_job_(common::ObMySQLTransaction &trans, const uint64_t tenant_id);
|
||||
int try_update_job_comment_(const share::ObBalanceJob &job, const common::ObSqlString &comment);
|
||||
@ -112,6 +115,10 @@ private:
|
||||
int64_t &last_statistic_schema_version,
|
||||
share::ObTransferTaskID &last_statistic_max_transfer_task_id);
|
||||
int get_active_unit_num_(int64_t &active_unit_num) const;
|
||||
//transfer partition
|
||||
int transfer_partition_(int64_t &job_cnt);
|
||||
int try_finish_transfer_partition_(const share::ObBalanceJob &job,
|
||||
common::ObMySQLTransaction &trans);
|
||||
private:
|
||||
bool inited_;
|
||||
bool loaded_;
|
||||
|
@ -162,8 +162,9 @@ int ObTenantTransferService::process_task_(const ObTransferTask::TaskStatus &tas
|
||||
LOG_WARN("fail to process init task", KR(ret), K(task_stat));
|
||||
}
|
||||
} else if (task_stat.get_status().is_finish_status()) {
|
||||
ObTransferTask transfer_task;//no used
|
||||
if (OB_FAIL(try_clear_transfer_task(
|
||||
task_stat.get_task_id(),
|
||||
task_stat.get_task_id(), transfer_task,
|
||||
all_part_list,
|
||||
finished_part_list))) {
|
||||
LOG_WARN("fail to process finish task", KR(ret), K(task_stat));
|
||||
@ -1137,10 +1138,9 @@ int ObTenantTransferService::generate_transfer_task(
|
||||
const ObLSID &dest_ls,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObBalanceTaskID balance_task_id,
|
||||
ObTransferTaskID &task_id)
|
||||
ObTransferTask &task)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_id.reset();
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -1152,7 +1152,8 @@ int ObTenantTransferService::generate_transfer_task(
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid args", KR(ret), K(src_ls), K(dest_ls), K(part_list), K(balance_task_id));
|
||||
} else {
|
||||
ObTransferTask task;
|
||||
task.reset();
|
||||
ObTransferTaskID task_id;
|
||||
ObCurTraceId::TraceId trace_id;
|
||||
trace_id.init(GCONF.self_addr_);
|
||||
ObTransferStatus status(ObTransferStatus::INIT);
|
||||
@ -1180,7 +1181,8 @@ int ObTenantTransferService::generate_transfer_task(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTransferService::try_cancel_transfer_task(const ObTransferTaskID task_id)
|
||||
int ObTenantTransferService::try_cancel_transfer_task(
|
||||
const ObTransferTaskID task_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObMySQLTransaction trans;
|
||||
@ -1271,12 +1273,12 @@ int ObTenantTransferService::try_cancel_transfer_task(const ObTransferTaskID tas
|
||||
|
||||
int ObTenantTransferService::try_clear_transfer_task(
|
||||
const ObTransferTaskID task_id,
|
||||
ObTransferTask &task,
|
||||
share::ObTransferPartList &all_part_list,
|
||||
share::ObTransferPartList &finished_part_list)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
DEBUG_SYNC(BEFORE_PROCESS_BALANCE_TASK_TRANSFER_END);
|
||||
ObTransferTask task;
|
||||
if (OB_FAIL(unlock_and_clear_task_(task_id, task))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
int64_t create_time = OB_INVALID_TIMESTAMP;
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
* @param [in] dest_ls: destination log stream
|
||||
* @param [in] part_list: partition list for transfer
|
||||
* @param [in] balance_task_id: parenet balance task id
|
||||
* @param [out] task_id: unique transfer task id
|
||||
* @param [out] task: transfer task
|
||||
* @return
|
||||
* - OB_SUCCESS: generate task successfully
|
||||
* - other: generate task failed
|
||||
@ -74,7 +74,7 @@ public:
|
||||
const share::ObLSID &dest_ls,
|
||||
const share::ObTransferPartList &part_list,
|
||||
const share::ObBalanceTaskID balance_task_id,
|
||||
share::ObTransferTaskID &task_id);
|
||||
share::ObTransferTask &transfer_task);
|
||||
/*
|
||||
* try cancel and clear transfer task (only task in INIT status can be canceled)
|
||||
*
|
||||
@ -91,7 +91,8 @@ public:
|
||||
* if task is already cleared, return OB_SUCCESS and related info recorded in history
|
||||
*
|
||||
* @param[in] task_id: transfer task id
|
||||
* @param[out] all_part_list: all partitions of the transfer task
|
||||
* @param[out] task: transfer task
|
||||
* @param[out] all_part_list: all partitons of the transfer task
|
||||
* @param[out] finished_part_list: successfully transferred partitions + needless transferred (not exist or not in src LS) partitions
|
||||
* @return
|
||||
* - OB_SUCCESS: clear task successfully
|
||||
@ -101,6 +102,7 @@ public:
|
||||
*/
|
||||
int try_clear_transfer_task(
|
||||
const share::ObTransferTaskID task_id,
|
||||
share::ObTransferTask &transfer_task,
|
||||
share::ObTransferPartList &all_part_list,
|
||||
share::ObTransferPartList &finished_part_list);
|
||||
|
||||
|
745
src/rootserver/ob_transfer_partition_command.cpp
Normal file
745
src/rootserver/ob_transfer_partition_command.cpp
Normal file
@ -0,0 +1,745 @@
|
||||
/**
|
||||
* Copyright (c) 2022 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 RS
|
||||
|
||||
#include "ob_transfer_partition_command.h"
|
||||
|
||||
#include "lib/oblog/ob_log_module.h" // LOG_*
|
||||
#include "share/ob_balance_define.h" // need_balance_table()
|
||||
#include "share/balance/ob_transfer_partition_task_table_operator.h"
|
||||
#include "share/balance/ob_balance_job_table_operator.h"//ObBalanceJobTableOperator
|
||||
#include "share/transfer/ob_transfer_task_operator.h"//ObTransferTask
|
||||
#include "share/ob_tenant_info_proxy.h"
|
||||
#include "share/ob_primary_standby_service.h"
|
||||
#include "observer/omt/ob_tenant_config_mgr.h" // ObTenantConfigGuard
|
||||
#include "share/ls/ob_ls_i_life_manager.h"//START/END_TRANSACTION
|
||||
#include "storage/tablelock/ob_lock_utils.h"//table_lock
|
||||
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace share;
|
||||
using namespace share::schema;
|
||||
using namespace common;
|
||||
using namespace obrpc;
|
||||
namespace rootserver
|
||||
{
|
||||
int ObTransferPartitionArg::init_for_transfer_partition_to_ls(
|
||||
const uint64_t target_tenant_id,
|
||||
const uint64_t table_id,
|
||||
const ObObjectID &object_id,
|
||||
const share::ObLSID &ls_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(target_tenant_id)
|
||||
&& OB_INVALID_ID != table_id
|
||||
&& OB_INVALID_OBJECT_ID != object_id
|
||||
&& !ls_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(target_tenant_id),
|
||||
K(table_id), K(object_id), K(ls_id));
|
||||
} else {
|
||||
type_ = TRANSFER_PARTITION_TO_LS;
|
||||
target_tenant_id_ = target_tenant_id;
|
||||
table_id_ = table_id;
|
||||
object_id_ = object_id;
|
||||
ls_id_ = ls_id;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionArg::init_for_cancel_transfer_partition(
|
||||
const uint64_t target_tenant_id,
|
||||
const ObTransferPartitionType type,
|
||||
const uint64_t table_id,
|
||||
const ObObjectID &object_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
reset();
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(target_tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(target_tenant_id),
|
||||
K(table_id), K(object_id));
|
||||
} else if (CANCEL_TRANSFER_PARTITION == type) {
|
||||
if (OB_UNLIKELY(OB_INVALID_ID == table_id
|
||||
|| OB_INVALID_OBJECT_ID == object_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(table_id), K(object_id));
|
||||
} else {
|
||||
table_id_ = table_id;
|
||||
object_id_ = object_id;
|
||||
}
|
||||
} else if (CANCEL_TRANSFER_PARTITION_ALL == type) {
|
||||
//nothing to check
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("type is invalid", KR(ret), K(type));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
type_ = type;
|
||||
target_tenant_id_ = target_tenant_id;
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int ObTransferPartitionArg::init_for_cancel_balance_job(
|
||||
const uint64_t target_tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
reset();
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(target_tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(target_tenant_id));
|
||||
} else {
|
||||
type_ = CANCEL_BALANCE_JOB;
|
||||
target_tenant_id_ = target_tenant_id;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObTransferPartitionArg::is_valid() const
|
||||
{
|
||||
int bret = false;
|
||||
if (OB_UNLIKELY(type_ <= INVALID_TYPE || type_ >= MAX_TYPE)) {
|
||||
bret = false;
|
||||
} else if (!is_valid_tenant_id(target_tenant_id_)) {
|
||||
bret = false;
|
||||
} else if (TRANSFER_PARTITION_TO_LS == type_
|
||||
&& OB_INVALID_ID != table_id_
|
||||
&& OB_INVALID_OBJECT_ID != object_id_
|
||||
&& ls_id_.is_valid()) {
|
||||
bret = true;
|
||||
} else if (CANCEL_TRANSFER_PARTITION == type_
|
||||
&& OB_INVALID_ID != table_id_
|
||||
&& OB_INVALID_OBJECT_ID != object_id_) {
|
||||
bret = true;
|
||||
} else if (CANCEL_TRANSFER_PARTITION_ALL == type_
|
||||
|| CANCEL_BALANCE_JOB == type_) {
|
||||
bret = true;
|
||||
}
|
||||
return bret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionArg::assign(const ObTransferPartitionArg &other)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (this == &other) {
|
||||
} else {
|
||||
type_ = other.type_;
|
||||
target_tenant_id_ = other.target_tenant_id_;
|
||||
table_id_ = other.table_id_;
|
||||
object_id_ = other.object_id_;
|
||||
ls_id_ = other.ls_id_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::execute(const ObTransferPartitionArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t tenant_id = arg.get_target_tenant_id();
|
||||
if (OB_UNLIKELY(!arg.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("arg is invalid", KR(ret), K(arg));
|
||||
} else if (arg.is_transfer_partition_to_ls()) {
|
||||
if (OB_FAIL(execute_transfer_partition_(arg))) {
|
||||
LOG_WARN("failed to execute transfer partition", KR(ret), K(arg));
|
||||
}
|
||||
} else if (arg.is_cancel_transfer_partition()) {
|
||||
if (OB_FAIL(execute_cancel_transfer_partition_(arg))) {
|
||||
LOG_WARN("failed to execute cancel transfer partition", KR(ret), K(arg));
|
||||
}
|
||||
} else if (arg.is_cancel_transfer_partition_all()) {
|
||||
if (OB_FAIL(execute_cancel_transfer_partition_all_(arg))) {
|
||||
LOG_WARN("failed to execute cancel transfer partition all", KR(ret), K(arg));
|
||||
}
|
||||
} else if (arg.is_cancel_balance_job()) {
|
||||
if (OB_FAIL(execute_cancel_balance_job_(arg))) {
|
||||
LOG_WARN("failed to execute cancel balance job", KR(ret), K(arg));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("arg is unexpected", KR(ret), K(arg));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::execute_transfer_partition_(const ObTransferPartitionArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t tenant_id = arg.get_target_tenant_id();
|
||||
const ObLSID &ls_id = arg.get_ls_id();
|
||||
if (OB_UNLIKELY(!arg.is_valid() || !arg.is_transfer_partition_to_ls())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(arg));
|
||||
} else if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(check_tenant_status_(tenant_id))) {
|
||||
LOG_WARN("failed to check tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(check_data_version_and_config_(tenant_id))) {
|
||||
LOG_WARN("fail to check tenant", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(check_table_schema_(tenant_id, arg.get_table_id(), arg.get_object_id()))) {
|
||||
LOG_WARN("fail to execute check_table_schema_", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(check_ls_(tenant_id, ls_id))) {
|
||||
LOG_WARN("fail to execute check_ls_", KR(ret), K(tenant_id), K(ls_id));
|
||||
} else {
|
||||
ObTransferPartInfo part_info(arg.get_table_id(), arg.get_object_id());
|
||||
ObMySQLTransaction trans;
|
||||
if (OB_FAIL(trans.start(GCTX.sql_proxy_, tenant_id))) {
|
||||
LOG_WARN("fail to start trans", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::insert_new_task(
|
||||
tenant_id,
|
||||
part_info,
|
||||
ls_id,
|
||||
trans))) {
|
||||
LOG_WARN("fail to insert new task", KR(ret), K(tenant_id), K(part_info), K(ls_id));
|
||||
if (OB_ERR_PRIMARY_KEY_DUPLICATE == ret) {
|
||||
ret = OB_ENTRY_EXIST;
|
||||
LOG_USER_ERROR(OB_ENTRY_EXIST, "Partition task already exists");
|
||||
}
|
||||
}
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!trans.is_started())) {
|
||||
LOG_WARN("the transaction is not started");
|
||||
} else {
|
||||
if (OB_TMP_FAIL(trans.end(OB_SUCC(ret)))) {
|
||||
LOG_WARN("fail to commit the transaction", KR(ret), KR(tmp_ret), K(tenant_id), K(part_info), K(ls_id));
|
||||
ret = OB_SUCC(ret) ? tmp_ret : ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::check_data_version_and_config_(const uint64_t tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||
uint64_t compat_version = 0;
|
||||
bool bret = false;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant_id is invalid", KR(ret), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tenant config is invalid", KR(ret), K(tenant_id));
|
||||
} else if (!(bret = tenant_config->enable_transfer)) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("enable_transfer is off", KR(ret));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Transfer is disabled, transfer partition is");
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
||||
} else if (compat_version < DATA_VERSION_4_2_1_2
|
||||
//由于transfer partition在4220版本上存在,所以不用判断4220之后的42x分支
|
||||
|| (compat_version >= DATA_VERSION_4_3_0_0 && compat_version < DATA_VERSION_4_3_1_0)) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("Tenant COMPATIBLE is below target version, transfer partition is not supported", KR(ret), K(compat_version));
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Tenant COMPATIBLE is below target version, transfer partition is");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::check_tenant_status_(const uint64_t tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObAllTenantInfo tenant_info;
|
||||
ObTenantStatus tenant_status = TENANT_STATUS_MAX;
|
||||
if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(OB_PRIMARY_STANDBY_SERVICE.get_tenant_status(tenant_id, tenant_status))) {
|
||||
LOG_WARN("fail to get tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(!is_tenant_normal(tenant_status))) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("the tenant's status is not normal", KR(ret), K(tenant_status));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Tenant status is not NORMAL. Operation is");
|
||||
} else if (OB_FAIL(ObAllTenantInfoProxy::load_tenant_info(
|
||||
tenant_id, GCTX.sql_proxy_, false /*for_update*/, tenant_info))) {
|
||||
LOG_WARN("fail to load tenant info", KR(ret), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(!tenant_info.is_primary())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("the tenant's role is not primary", KR(ret), K(tenant_info));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Tenant role is not PRIMARY. Operation is");
|
||||
} else if (OB_UNLIKELY(!tenant_info.is_normal_status())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("the tenant's switchover status is not normal", KR(ret), K(tenant_info));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Tenant switchover status is not NORMAL. Operation is");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::check_data_version_for_cancel_(const uint64_t tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t compat_version = 0;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("failed to check data version", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
||||
} else if (compat_version < MOCK_DATA_VERSION_4_2_1_4
|
||||
|| (compat_version >= DATA_VERSION_4_2_2_0 && compat_version < MOCK_DATA_VERSION_4_2_4_0)
|
||||
|| (compat_version >= DATA_VERSION_4_3_0_0 && compat_version < DATA_VERSION_4_3_1_0)) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Tenant COMPATIBLE is below target version. Operation is");
|
||||
LOG_WARN("Tenant COMPATIBLE is below target version, command is not supported",
|
||||
KR(ret), K(compat_version));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::check_table_schema_(
|
||||
const uint64_t tenant_id,
|
||||
const uint64_t table_id,
|
||||
const ObObjectID &object_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t allocator_tenant_id = is_valid_tenant_id(MTL_ID()) ? MTL_ID() : OB_SYS_TENANT_ID;
|
||||
common::ObArenaAllocator tmp_allocator("TABLE_SCHEMA", OB_MALLOC_NORMAL_BLOCK_SIZE, allocator_tenant_id);
|
||||
ObSimpleTableSchemaV2* table_schema = NULL;
|
||||
ObTabletID tablet_id;
|
||||
const char* table_type_str = NULL;
|
||||
const int64_t ERR_MSG_BUF_LEN = 255;
|
||||
char table_type_err_msg[ERR_MSG_BUF_LEN] = "";
|
||||
int64_t pos = 0;
|
||||
bool need_balance = false;
|
||||
if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(ObSchemaUtils::get_latest_table_schema(
|
||||
*GCTX.sql_proxy_,
|
||||
tmp_allocator,
|
||||
tenant_id,
|
||||
table_id,
|
||||
table_schema))) {
|
||||
LOG_WARN("fail to get latest table schema", KR(ret), K(tenant_id), K(table_id),
|
||||
K(allocator_tenant_id), K(MTL_ID()));
|
||||
if (OB_TABLE_NOT_EXIST == ret) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
LOG_USER_ERROR(OB_ENTRY_NOT_EXIST, "Table not exists");
|
||||
}
|
||||
} else if (OB_ISNULL(table_schema)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table_schema is null", KR(ret), KP(table_schema));
|
||||
} else if (FALSE_IT(need_balance = check_if_need_balance_table(*table_schema, table_type_str))) {
|
||||
//can not be here
|
||||
} else if (!need_balance) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
LOG_WARN("only get related tables for user table and other need balance table", KR(ret),
|
||||
K(table_id), K(table_schema));
|
||||
if (OB_TMP_FAIL(databuff_printf(
|
||||
table_type_err_msg,
|
||||
ERR_MSG_BUF_LEN,
|
||||
pos,
|
||||
"Transfer partition of '%s' is",
|
||||
table_type_str))) {
|
||||
LOG_WARN("fail to execute databuff_printf", KR(ret), KR(tmp_ret), K(table_type_str));
|
||||
} else {
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, table_type_err_msg);
|
||||
}
|
||||
} else if (OB_FAIL(table_schema->get_tablet_id_by_object_id(object_id, tablet_id))) {
|
||||
LOG_WARN("fail to get tablet id", KR(ret));
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
LOG_USER_ERROR(OB_ENTRY_NOT_EXIST, "Partition not exists");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::check_ls_(const uint64_t tenant_id, const share::ObLSID &ls_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_UNLIKELY(!ls_id.is_user_ls())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("transfer partition to sys ls is not allowed", KR(ret), K(ls_id));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Transfer partition to SYS LS is");
|
||||
} else {
|
||||
share::ObLSAttrOperator ls_operator(tenant_id, GCTX.sql_proxy_);
|
||||
ObLSAttr ls_attr;
|
||||
if (OB_FAIL(ls_operator.get_ls_attr(ls_id, false /*for_update*/, *GCTX.sql_proxy_, ls_attr))) {
|
||||
LOG_WARN("fail to get ls attr", KR(ret), K(tenant_id), K(ls_id));
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
LOG_USER_ERROR(OB_ENTRY_NOT_EXIST, "LS not exists");
|
||||
}
|
||||
} else if (OB_UNLIKELY(!ls_attr.ls_is_normal())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("ls status is not normal", KR(ret), K(ls_attr));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "LS status is not NORMAL. Operation is");
|
||||
} else if (OB_UNLIKELY(ls_attr.get_ls_flag().is_block_tablet_in())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("ls flag is block_tablet_in", KR(ret), K(ls_attr));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "LS is in BLOCK_TABLET_IN state. Operation is");
|
||||
} else if (OB_UNLIKELY(ls_attr.get_ls_flag().is_duplicate_ls())) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("transfer partition to duplicate ls is not allowed", KR(ret), K(ls_attr));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Transfer partition to DUPLICATE LS is");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::execute_cancel_transfer_partition_(const ObTransferPartitionArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t tenant_id = arg.get_target_tenant_id();
|
||||
if (OB_UNLIKELY(!arg.is_valid() || !arg.is_cancel_transfer_partition())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("arg is invalid", KR(ret), K(arg));
|
||||
} else if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(check_tenant_status_(tenant_id))) {
|
||||
LOG_WARN("failed to check tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(check_data_version_for_cancel_(tenant_id))) {
|
||||
LOG_WARN("failed to check data version for cancel", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ObTransferPartitionTask task;
|
||||
START_TRANSACTION(GCTX.sql_proxy_, tenant_id)
|
||||
if (FAILEDx(ObInnerTableLockUtil::lock_inner_table_in_trans(trans,
|
||||
tenant_id, OB_ALL_BALANCE_JOB_TID, EXCLUSIVE, true))) {
|
||||
LOG_WARN("lock inner table failed", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::get_transfer_partition_task(
|
||||
tenant_id, ObTransferPartInfo(arg.get_table_id(), arg.get_object_id()),
|
||||
task, trans))) {
|
||||
LOG_WARN("failed to get transfer partition task", KR(ret), K(arg));
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
LOG_USER_ERROR(OB_ENTRY_NOT_EXIST, "Transfer partition task not exist");
|
||||
}
|
||||
} else if (OB_FAIL(try_cancel_transfer_partition_(task, trans))) {
|
||||
LOG_WARN("failed to try cancel transfer partition", KR(ret), K(task));
|
||||
}
|
||||
END_TRANSACTION(trans);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::execute_cancel_transfer_partition_all_(const ObTransferPartitionArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t tenant_id = arg.get_target_tenant_id();
|
||||
if (OB_UNLIKELY(!arg.is_valid() || !arg.is_cancel_transfer_partition_all())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("arg is invalid", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(check_tenant_status_(tenant_id))) {
|
||||
LOG_WARN("failed to check tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(check_data_version_for_cancel_(tenant_id))) {
|
||||
LOG_WARN("failed to check data version for cancel", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ObTransferPartitionTaskStatus status(share::ObTransferPartitionTaskStatus::TRP_TASK_STATUS_CANCELED);
|
||||
ObTransferPartList wait_task;
|
||||
ObTransferPartList init_task;
|
||||
ObTransferPartList doing_task;
|
||||
ObTransferPartitionTaskID max_task_id;
|
||||
|
||||
START_TRANSACTION(GCTX.sql_proxy_, tenant_id)
|
||||
if (FAILEDx(ObInnerTableLockUtil::lock_inner_table_in_trans(trans,
|
||||
tenant_id, OB_ALL_BALANCE_JOB_TID, EXCLUSIVE, true))) {
|
||||
LOG_WARN("lock inner table failed", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(get_transfer_part_list_(tenant_id, wait_task, init_task,
|
||||
doing_task, max_task_id, trans))) {
|
||||
LOG_WARN("failed to get transfer part list", KR(ret), K(tenant_id));
|
||||
}
|
||||
if (OB_SUCC(ret) && wait_task.count() > 0) {
|
||||
if (OB_FAIL(ObTransferPartitionTaskTableOperator::finish_task(
|
||||
tenant_id, wait_task, max_task_id,
|
||||
status, "Canceled in WAITING status", trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(tenant_id), K(wait_task), K(max_task_id));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && init_task.count() > 0) {
|
||||
//存在init状态的任务,不管有没有doing状态的任务,为了保证新创建出来的日志流都可以回收掉
|
||||
//都要挨个处理balance_task的part_list,不能简单的把balance_job给cancel掉。
|
||||
if (OB_FAIL(cancel_all_init_transfer_partition_(tenant_id, init_task, trans))) {
|
||||
LOG_WARN("failed to cancel all init transfer partition", KR(ret), K(tenant_id), K(init_task));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::finish_task(
|
||||
tenant_id, init_task, max_task_id, status,
|
||||
"Canceled in INIT status", trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(tenant_id), K(init_task), K(max_task_id));
|
||||
}
|
||||
}
|
||||
END_TRANSACTION(trans);
|
||||
if (OB_SUCC(ret) && doing_task.count() > 0) {
|
||||
ret = OB_PARTIAL_FAILED;
|
||||
LOG_WARN("has partition is in transfer", K(doing_task));
|
||||
LOG_USER_ERROR(OB_PARTIAL_FAILED,
|
||||
"Some tasks are already in DOING status, can not be canceled");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::get_transfer_part_list_(const uint64_t tenant_id,
|
||||
ObTransferPartList &wait_list, ObTransferPartList &init_list,
|
||||
ObTransferPartList &doing_list, ObTransferPartitionTaskID &max_task_id,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArray<ObTransferPartitionTask> task_array;
|
||||
wait_list.reset();
|
||||
init_list.reset();
|
||||
doing_list.reset();
|
||||
max_task_id.reset();
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id is invalid", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::load_all_task(
|
||||
tenant_id, task_array, trans))) {
|
||||
LOG_WARN("failed to get all transfer partition task", KR(ret), K(tenant_id));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array.at(i);
|
||||
if (!max_task_id.is_valid() || task.get_task_id() > max_task_id) {
|
||||
max_task_id = task.get_task_id();
|
||||
}
|
||||
if (task.get_task_status().is_waiting()) {
|
||||
if (OB_FAIL(wait_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
} else if (task.get_task_status().is_init()) {
|
||||
if (OB_FAIL(init_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
} else if (task.get_task_status().is_doing()) {
|
||||
if (OB_FAIL(doing_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task status is unexpected", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::cancel_all_init_transfer_partition_(const uint64_t tenant_id,
|
||||
const share::ObTransferPartList &init_list,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBalanceTaskArray balance_tasks;
|
||||
ObBalanceJob balance_job;
|
||||
int64_t start_time = 0, finish_time = 0;//no used
|
||||
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || 0 == init_list.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(init_list));
|
||||
} else if (OB_FAIL(ObBalanceJobTableOperator::get_balance_job(tenant_id,
|
||||
true, trans, balance_job, start_time, finish_time))) {
|
||||
LOG_WARN("failed to get balance job", KR(ret), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(!balance_job.get_job_type().is_transfer_partition())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("balance job must be transfer partition", KR(ret), K(balance_job));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::load_task(tenant_id, balance_tasks, trans))) {
|
||||
LOG_WARN("failed to load task", KR(ret), K(tenant_id));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < balance_tasks.count(); ++i) {
|
||||
const ObBalanceTask &balance_task = balance_tasks.at(i);
|
||||
const ObTransferTaskID transfer_task_id = balance_task.get_current_transfer_task_id();
|
||||
ObTransferPartList new_part_list;
|
||||
new_part_list.reset();
|
||||
if (!transfer_task_id.is_valid()) {
|
||||
//如果没有发起过transfer,直接清空当前的part_list
|
||||
} else {
|
||||
for (int64_t j = 0; OB_SUCC(ret) && j < balance_task.get_part_list().count(); ++j) {
|
||||
const ObTransferPartInfo &part = balance_task.get_part_list().at(j);
|
||||
if (!has_exist_in_array(init_list, part)) {
|
||||
//如果part不是init task的范围,则需要保留
|
||||
if (OB_FAIL(new_part_list.push_back(part))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(part), K(balance_task), K(new_part_list));
|
||||
}
|
||||
}
|
||||
}//end for j
|
||||
if (OB_SUCC(ret) && 0 == new_part_list.count()) {
|
||||
//如果存在current_transfer_task,则这个balance_task肯定有part处于doing状态
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("part list can not be empty", KR(ret), K(balance_task), K(init_list));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (balance_task.get_part_list().count() == new_part_list.count()) {
|
||||
//个数相等应该part_list就是相等的,不去做其他的校验了
|
||||
LOG_INFO("part list no change, no need update", K(balance_task), K(new_part_list), K(init_list));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::update_task_part_list(tenant_id,
|
||||
balance_task.get_balance_task_id(), new_part_list, trans))) {
|
||||
LOG_WARN("failed to update task part list", KR(ret), K(tenant_id), K(balance_task),
|
||||
K(new_part_list));
|
||||
}
|
||||
}//end for
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObTransferPartitionCommand::try_cancel_transfer_partition_(
|
||||
const share::ObTransferPartitionTask &task,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartList part_list;
|
||||
ObTransferPartitionTaskStatus status(share::ObTransferPartitionTaskStatus::TRP_TASK_STATUS_CANCELED);
|
||||
ObSqlString comment;
|
||||
if (OB_UNLIKELY(!task.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("task is invalid", KR(ret), K(task));
|
||||
} else if (OB_FAIL(part_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back part_info", KR(ret), K(task));
|
||||
} else if (OB_FAIL(comment.assign_fmt("Canceled in %s status",
|
||||
task.get_task_status().to_str()))) {
|
||||
LOG_WARN("failed to assign comment", KR(ret), K(task));
|
||||
} else if (task.get_task_status().is_waiting()) {
|
||||
} else if (task.get_task_status().is_init()) {
|
||||
//直接去修改balance_task的part_list
|
||||
if (OB_FAIL(cancel_transfer_partition_in_init_(
|
||||
task, trans))) {
|
||||
LOG_WARN("failed to cancel transfer partition", KR(ret), K(task));
|
||||
}
|
||||
} else if (task.get_task_status().is_doing()) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("task is in transfer, can not cancel", KR(ret), K(task));
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW,
|
||||
"Task is already in DOING status. Operation is");
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task status is unexpected", KR(ret), K(task));
|
||||
}
|
||||
if (FAILEDx(ObTransferPartitionTaskTableOperator::finish_task(
|
||||
task.get_tenant_id(), part_list, task.get_task_id(),
|
||||
status, comment.string(), trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(task), K(part_list));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::cancel_transfer_partition_in_init_(
|
||||
const share::ObTransferPartitionTask &task,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartList part_list;
|
||||
ObBalanceTaskArray balance_tasks;
|
||||
const uint64_t tenant_id = task.get_tenant_id();
|
||||
bool found = false;//不存在找不到balance_task的情况,也可能一个transfer_partition涉及多个task
|
||||
ObBalanceJob balance_job;
|
||||
int64_t start_time = 0, finish_time = 0;//no used
|
||||
|
||||
if (OB_UNLIKELY(!task.is_valid() || !task.get_task_status().is_init())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("task is invalid", KR(ret), K(task));
|
||||
} else if (OB_FAIL(ObBalanceJobTableOperator::get_balance_job(tenant_id,
|
||||
true, trans, balance_job, start_time, finish_time))) {
|
||||
LOG_WARN("failed to get balance job", KR(ret), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(!balance_job.get_job_type().is_transfer_partition()
|
||||
|| task.get_balance_job_id() != balance_job.get_job_id())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("balance job must be transfer partition", KR(ret), K(balance_job), K(task));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::load_task(tenant_id, balance_tasks, trans))) {
|
||||
LOG_WARN("failed to load task", KR(ret), K(tenant_id));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < balance_tasks.count(); ++i) {
|
||||
const ObBalanceTask &balance_task = balance_tasks.at(i);
|
||||
int64_t idx = 0;
|
||||
if (has_exist_in_array(balance_task.get_part_list(), task.get_part_info(), &idx)) {
|
||||
found = true;
|
||||
ObTransferPartList new_part_list;
|
||||
if (OB_FAIL(new_part_list.assign(balance_task.get_part_list()))) {
|
||||
LOG_WARN("failed to assign part list", KR(ret), K(balance_task));
|
||||
} else if (OB_FAIL(new_part_list.remove(idx))) {
|
||||
LOG_WARN("failed to remove idx", KR(ret), K(idx), K(balance_task), K(new_part_list));
|
||||
} else if (OB_FAIL(ObBalanceTaskTableOperator::update_task_part_list(
|
||||
tenant_id, balance_task.get_balance_task_id(), new_part_list, trans))) {
|
||||
LOG_WARN("failed to update task part list", KR(ret), K(tenant_id), K(balance_task),
|
||||
K(new_part_list));
|
||||
}
|
||||
}
|
||||
}//end for
|
||||
if (OB_SUCC(ret) && !found) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("can not find balance task of transfer partition", KR(ret), K(task), K(balance_tasks));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::execute_cancel_balance_job_(const ObTransferPartitionArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const uint64_t tenant_id = arg.get_target_tenant_id();
|
||||
if (OB_UNLIKELY(!arg.is_valid() || !arg.is_cancel_balance_job())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("arg is invalid", KR(ret), K(arg));
|
||||
} else if (OB_ISNULL(GCTX.sql_proxy_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||
} else if (OB_FAIL(check_tenant_status_(tenant_id))) {
|
||||
LOG_WARN("failed to check tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(check_data_version_for_cancel_(tenant_id))) {
|
||||
LOG_WARN("failed to check data version for cancel", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ObBalanceJob balance_job;
|
||||
int64_t start_time = 0, finish_time = 0;//no used
|
||||
START_TRANSACTION(GCTX.sql_proxy_, tenant_id)
|
||||
if (FAILEDx(cancel_balance_job_in_trans_(tenant_id, trans))) {
|
||||
LOG_WARN("failed to cancel balance job", KR(ret), K(tenant_id));
|
||||
}
|
||||
END_TRANSACTION(trans)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionCommand::cancel_balance_job_in_trans_(
|
||||
const uint64_t tenant_id, common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant_id is invalid", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ObBalanceJob balance_job;
|
||||
int64_t start_time = 0, finish_time = 0;//no used
|
||||
if (FAILEDx(ObBalanceJobTableOperator::get_balance_job(tenant_id,
|
||||
true, trans, balance_job, start_time, finish_time))) {
|
||||
LOG_WARN("failed to get balance job", KR(ret), K(tenant_id));
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
LOG_USER_ERROR(OB_ENTRY_NOT_EXIST, "Balance job not exist");
|
||||
}
|
||||
} else if (balance_job.get_job_status().is_canceling()) {
|
||||
//nothing
|
||||
} else if (balance_job.get_job_status().is_doing()) {
|
||||
if (OB_FAIL(ObBalanceJobTableOperator::update_job_status(tenant_id,
|
||||
balance_job.get_job_id(), balance_job.get_job_status(),
|
||||
share::ObBalanceJobStatus(share::ObBalanceJobStatus::BALANCE_JOB_STATUS_CANCELING),
|
||||
true, "Manual cancel balance job", trans))) {
|
||||
LOG_WARN("failed to update job status", KR(ret), K(tenant_id), K(balance_job));
|
||||
}
|
||||
} else if (balance_job.get_job_status().is_success()
|
||||
|| balance_job.get_job_status().is_canceled()) {
|
||||
//已经执行结束了,不报错,但是也不修改状态
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("balance job is unexpected", KR(ret), K(balance_job));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
123
src/rootserver/ob_transfer_partition_command.h
Normal file
123
src/rootserver/ob_transfer_partition_command.h
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Copyright (c) 2022 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_ROOTSERVER_OB_TENANT_PARTIION_COMMAND_H
|
||||
#define OCEANBASE_ROOTSERVER_OB_TENANT_PARTIION_COMMAND_H
|
||||
#include "share/ob_ls_id.h"
|
||||
#include "share/transfer/ob_transfer_info.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
class ObMySQLTransaction;
|
||||
}
|
||||
namespace share
|
||||
{
|
||||
class ObTransferPartitionTask;
|
||||
}
|
||||
namespace rootserver
|
||||
{
|
||||
struct ObTransferPartitionArg
|
||||
{
|
||||
public:
|
||||
enum ObTransferPartitionType {
|
||||
INVALID_TYPE = -1,
|
||||
TRANSFER_PARTITION_TO_LS = 0,
|
||||
CANCEL_TRANSFER_PARTITION,
|
||||
CANCEL_TRANSFER_PARTITION_ALL,
|
||||
CANCEL_BALANCE_JOB,
|
||||
MAX_TYPE
|
||||
};
|
||||
ObTransferPartitionArg() : type_(INVALID_TYPE), target_tenant_id_(OB_INVALID_TENANT_ID),
|
||||
table_id_(OB_INVALID_ID), object_id_(OB_INVALID_OBJECT_ID), ls_id_() {};
|
||||
~ObTransferPartitionArg() {};
|
||||
int init_for_transfer_partition_to_ls(
|
||||
const uint64_t target_tenant_id,
|
||||
const uint64_t table_id,
|
||||
const ObObjectID &object_id,
|
||||
const share::ObLSID &ls_id);
|
||||
int init_for_cancel_transfer_partition(
|
||||
const uint64_t target_tenant_id,
|
||||
const ObTransferPartitionType type,
|
||||
const uint64_t table_id,
|
||||
const ObObjectID &object_id);
|
||||
int init_for_cancel_balance_job(
|
||||
const uint64_t target_tenant_id);
|
||||
bool is_valid() const;
|
||||
int assign(const ObTransferPartitionArg &other);
|
||||
void reset()
|
||||
{
|
||||
type_ = INVALID_TYPE;
|
||||
target_tenant_id_ = OB_INVALID_TENANT_ID;
|
||||
table_id_ = OB_INVALID_ID;
|
||||
object_id_ = OB_INVALID_OBJECT_ID;
|
||||
ls_id_.reset();
|
||||
}
|
||||
TO_STRING_KV(K_(type), K_(target_tenant_id), K_(table_id), K_(object_id), K_(ls_id));
|
||||
bool is_transfer_partition_to_ls() const { return TRANSFER_PARTITION_TO_LS == type_; }
|
||||
bool is_cancel_transfer_partition() const
|
||||
{
|
||||
return CANCEL_TRANSFER_PARTITION == type_;
|
||||
}
|
||||
bool is_cancel_transfer_partition_all() const
|
||||
{
|
||||
return CANCEL_TRANSFER_PARTITION_ALL == type_;
|
||||
}
|
||||
bool is_cancel_balance_job() const
|
||||
{
|
||||
return CANCEL_BALANCE_JOB == type_;
|
||||
}
|
||||
const uint64_t &get_target_tenant_id() const { return target_tenant_id_; }
|
||||
const uint64_t &get_table_id() const { return table_id_; }
|
||||
const ObObjectID &get_object_id() const { return object_id_; }
|
||||
const share::ObLSID &get_ls_id() const { return ls_id_; }
|
||||
private:
|
||||
ObTransferPartitionType type_;
|
||||
uint64_t target_tenant_id_;
|
||||
uint64_t table_id_;
|
||||
ObObjectID object_id_;
|
||||
share::ObLSID ls_id_;
|
||||
};
|
||||
|
||||
class ObTransferPartitionCommand
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionCommand() {};
|
||||
~ObTransferPartitionCommand() {};
|
||||
int execute(const ObTransferPartitionArg &arg);
|
||||
private:
|
||||
int execute_transfer_partition_(const ObTransferPartitionArg &arg);
|
||||
int execute_cancel_transfer_partition_(const ObTransferPartitionArg &arg);
|
||||
int execute_cancel_transfer_partition_all_(const ObTransferPartitionArg &arg);
|
||||
int execute_cancel_balance_job_(const ObTransferPartitionArg &arg);
|
||||
int check_tenant_status_(const uint64_t tenant_id);
|
||||
int check_data_version_for_cancel_(const uint64_t tenant_id);
|
||||
int check_data_version_and_config_(const uint64_t tenant_id);
|
||||
int check_table_schema_(const uint64_t tenant_id, const uint64_t table_id, const ObObjectID &object_id);
|
||||
int check_ls_(const uint64_t tenant_id, const share::ObLSID &ls_id);
|
||||
int try_cancel_transfer_partition_(const share::ObTransferPartitionTask &task,
|
||||
common::ObMySQLTransaction &trans);
|
||||
int cancel_balance_job_in_trans_(const uint64_t tenant_id, common::ObMySQLTransaction &trans);
|
||||
int cancel_transfer_partition_in_init_(const share::ObTransferPartitionTask &task,
|
||||
common::ObMySQLTransaction &trans);
|
||||
int get_transfer_part_list_(const uint64_t tenant_id,
|
||||
share::ObTransferPartList &wait_list, share::ObTransferPartList &init_list,
|
||||
share::ObTransferPartList &doing_list, share::ObTransferPartitionTaskID &max_task_id,
|
||||
common::ObMySQLTransaction &trans);
|
||||
int cancel_all_init_transfer_partition_(const uint64_t tenant_id,
|
||||
const share::ObTransferPartList &init_list,
|
||||
common::ObMySQLTransaction &trans);
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
638
src/rootserver/ob_transfer_partition_task.cpp
Normal file
638
src/rootserver/ob_transfer_partition_task.cpp
Normal file
@ -0,0 +1,638 @@
|
||||
/**
|
||||
* 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 BALANCE
|
||||
|
||||
#include "rootserver/ob_transfer_partition_task.h"
|
||||
#include "rootserver/ob_bootstrap.h"
|
||||
#include "rootserver/ob_tenant_balance_service.h"//gather_ls_status
|
||||
#include "share/schema/ob_schema_utils.h"//batch_get_latest_table_schemas
|
||||
#include "share/tablet/ob_tablet_info.h" //ObTabletTablePair/ObTabletLSPair
|
||||
#include "share/ls/ob_ls_status_operator.h"//ObLSStatusInfo
|
||||
#include "share/transfer/ob_transfer_info.h" //ObTransferPartList
|
||||
#include "share/tablet/ob_tablet_to_ls_iterator.h"//batch_get_tablet_to_ls
|
||||
#include "storage/ob_common_id_utils.h" //gen_unique_id
|
||||
|
||||
|
||||
#define ISTAT(fmt, args...) FLOG_INFO("[TRANSFER_PARTITION] " fmt, ##args)
|
||||
#define WSTAT(fmt, args...) FLOG_WARN("[TRANSFER_PARTITION] " fmt, ##args)
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace share;
|
||||
namespace rootserver
|
||||
{
|
||||
|
||||
int ObTransferPartitionInfo::init(share::ObTransferPartitionTask &task,
|
||||
const ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!task.is_valid() || !tablet_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(task), K(tablet_id));
|
||||
} else {
|
||||
tablet_id_ = tablet_id;
|
||||
task_ = &task;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionInfo::set_src_ls(const ObLSID &ls_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!ls_id.is_valid() )) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("ls id is invalid", KR(ret), K(ls_id));
|
||||
} else if (OB_ISNULL(task_)) {
|
||||
ret = OB_ERR_UNDEFINED;
|
||||
LOG_WARN("task is null", KR(ret), KP(task_));
|
||||
} else {
|
||||
src_ls_ = ls_id;
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionInfo::assign(const ObTransferPartitionInfo &other)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (this != &other) {
|
||||
task_ = other.task_;
|
||||
tablet_id_ = other.tablet_id_;
|
||||
src_ls_ = other.src_ls_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObTransferPartitionHelper::destroy()
|
||||
{
|
||||
is_inited_ = false;
|
||||
sql_proxy_ = NULL;
|
||||
//part_info的内存依赖于task_array,要先于task_array释放
|
||||
part_info_.reset();
|
||||
task_array_.reset();
|
||||
transfer_logical_tasks_.destroy();
|
||||
balance_tasks_.reset();
|
||||
allocator_.reset();
|
||||
tenant_id_ = OB_INVALID_TENANT_ID;
|
||||
balance_job_.reset();
|
||||
max_task_id_.reset();
|
||||
}
|
||||
int ObTransferPartitionHelper::check_inner_stat_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (!is_valid_tenant_id(tenant_id_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id_));
|
||||
} else if (OB_ISNULL(sql_proxy_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("sql proxy is null", KR(ret), KP(sql_proxy_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::build(bool &has_job)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
has_job = true;
|
||||
int64_t task_cnt = 0;
|
||||
ObLSStatusInfoArray status_info_array;
|
||||
ObTransferPartitionTaskID tmp_max_task_id(INT64_MAX);//第一次获取所有的任务列表,设置了一个最大值
|
||||
if (IS_INIT) {
|
||||
ret = OB_INIT_TWICE;
|
||||
LOG_WARN("init twice", KR(ret));
|
||||
} else if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("inner stat error", KR(ret));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::load_all_wait_task_in_part_info_order(
|
||||
tenant_id_, false, tmp_max_task_id, task_array_,
|
||||
*sql_proxy_))) {
|
||||
LOG_WARN("failed to load all wait task", KR(ret), K(tenant_id_));
|
||||
} else if (0 == task_array_.count()) {
|
||||
has_job = false;
|
||||
ISTAT("no transfer partition task", K(tenant_id_));
|
||||
//防止出现load_ls_status成功很久后,才load_task成功,导致出现一些日志流不存在的误判
|
||||
//所以先load任务,然后在获取ls_status,保证用户看到日志流存在后再去生成的任务一定不会
|
||||
//被判断称目标的不存在
|
||||
} else if (OB_FAIL(ObTenantBalanceService::gather_ls_status_stat(
|
||||
tenant_id_, status_info_array))) {
|
||||
LOG_WARN("failed to gather ls status stat", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(try_process_dest_not_exist_task_(status_info_array,
|
||||
task_cnt))) {
|
||||
LOG_WARN("failed to process dest not exist task", KR(ret), K(status_info_array));
|
||||
//由于一部分任务不能成功执行,重新load,防止后面的程序还需要处理这部分非法的任务不合理
|
||||
} else if (!max_task_id_.is_valid()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("max task id is invalid", KR(ret), K(max_task_id_));
|
||||
} else if (0 != task_cnt
|
||||
// 这次load的范围不能超过上一次的范围
|
||||
&& OB_FAIL(ObTransferPartitionTaskTableOperator::
|
||||
load_all_wait_task_in_part_info_order(
|
||||
tenant_id_, false, max_task_id_, task_array_,
|
||||
*sql_proxy_))) {
|
||||
LOG_WARN("failed to load all wait task", KR(ret), K(tenant_id_), K(max_task_id_));
|
||||
} else if (0 == task_array_.count()) {
|
||||
has_job = false;
|
||||
ISTAT("no transfer partition task", K(tenant_id_));
|
||||
//检查分区是否存在,不需要重新reload,分区不存在不会被放在part_info_中
|
||||
} else if (OB_FAIL(try_process_object_not_exist_task_())) {
|
||||
LOG_WARN("failed to process object not exist task", KR(ret));
|
||||
} else if (0 == part_info_.count()) {
|
||||
has_job = false;
|
||||
ISTAT("no transfer partition task", K(tenant_id_), K(task_array_));
|
||||
//根据part_info_中的task设置源端
|
||||
} else if (OB_FAIL(set_task_src_ls_())) {
|
||||
LOG_WARN("failed to construct task info", KR(ret), K(status_info_array));
|
||||
} else {
|
||||
has_job = true;
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
is_inited_ = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::try_process_dest_not_exist_task_(
|
||||
const share::ObLSStatusInfoIArray &status_info_array,
|
||||
int64_t& task_cnt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_cnt = 0;
|
||||
ObTransferPartList dest_not_exist_list;
|
||||
ObTransferPartList dest_not_valid_list;
|
||||
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("check inner stat error", KR(ret));
|
||||
} else if (0 >= status_info_array.count() || 0 >= task_array_.count()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("status info array is null", KR(ret), K(status_info_array), K(task_array_));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array_.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array_.at(i);
|
||||
if (!max_task_id_.is_valid() || max_task_id_ < task.get_task_id()) {
|
||||
max_task_id_ = task.get_task_id();
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int64_t j = 0; OB_SUCC(ret) && j < status_info_array.count() && !found; ++j) {
|
||||
const ObLSStatusInfo &ls_info = status_info_array.at(j);
|
||||
if (task.get_dest_ls() == ls_info.get_ls_id()) {
|
||||
found = true;
|
||||
if (ls_info.ls_is_normal() && !ls_info.ls_is_block_tablet_in()) {
|
||||
//the dest ls is valid
|
||||
} else if (OB_FAIL(dest_not_valid_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
} else {
|
||||
ISTAT("dest ls is not valid to transfer in", K(task), K(ls_info));
|
||||
}
|
||||
}
|
||||
}//end for check ls is valid
|
||||
if (OB_SUCC(ret) && !found) {
|
||||
ISTAT("dest ls is not exist to transfer in", K(task));
|
||||
if (OB_FAIL(dest_not_exist_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
}//end for check all task
|
||||
if (OB_SUCC(ret) && dest_not_exist_list.count() > 0) {
|
||||
ObString comment("LS not exist or may be in DROPPING/WAIT_OFFLINE status");
|
||||
if (OB_FAIL(try_finish_failed_task_(dest_not_exist_list, comment))) {
|
||||
LOG_WARN("failed to finish failed task", KR(ret), K(dest_not_exist_list));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && dest_not_valid_list.count() > 0) {
|
||||
ObString comment("LS status is not NORMAL or is in BLOCK_TABLET_IN state");
|
||||
if (OB_FAIL(try_finish_failed_task_(dest_not_valid_list, comment))) {
|
||||
LOG_WARN("failed to finish failed task", KR(ret), K(dest_not_valid_list));
|
||||
}
|
||||
}
|
||||
}
|
||||
task_cnt = dest_not_exist_list.count() + dest_not_valid_list.count();
|
||||
ISTAT("finish check dest LS", KR(ret), K(task_cnt), K(dest_not_exist_list),
|
||||
K(dest_not_valid_list));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::try_finish_failed_task_(const ObTransferPartList &part_list,
|
||||
const ObString &comment)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("check inner stat error", KR(ret));
|
||||
} else if (0 >= part_list.count() || comment.empty() || !max_task_id_.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(part_list), K(comment), K(max_task_id_));
|
||||
} else {
|
||||
ObTransferPartitionTaskStatus status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_FAILED;
|
||||
START_TRANSACTION(sql_proxy_, tenant_id_)
|
||||
if (FAILEDx(ObTransferPartitionTaskTableOperator::finish_task(
|
||||
tenant_id_, part_list, max_task_id_, status, comment, trans))) {
|
||||
LOG_WARN("failed to finish task", KR(ret), K(tenant_id_), K(part_list),
|
||||
K(max_task_id_));
|
||||
}
|
||||
END_TRANSACTION(trans)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObTransferPartitionHelper::try_process_object_not_exist_task_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartList table_not_exist_list;
|
||||
ObTransferPartList part_not_exist_list;
|
||||
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("check inner stat error", KR(ret));
|
||||
} else if (0 >= task_array_.count()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("task array is null", KR(ret), K(task_array_));
|
||||
} else {
|
||||
common::ObArenaAllocator tmp_allocator("SCHEMA_ARRAY", OB_MALLOC_NORMAL_BLOCK_SIZE, tenant_id_);
|
||||
ObArray<ObSimpleTableSchemaV2*> table_schema_array;
|
||||
int64_t table_index = 0;
|
||||
ObTabletID tablet_id;
|
||||
if (OB_FAIL(batch_get_table_schema_in_order_(
|
||||
tmp_allocator, table_schema_array))) {
|
||||
LOG_WARN("failed to construct table schema", KR(ret));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array_.count(); ++i) {
|
||||
ObTransferPartitionTask &task = task_array_.at(i);
|
||||
if (OB_FAIL(get_tablet_in_order_array(table_schema_array,
|
||||
task.get_part_info(), table_index, tablet_id))) {
|
||||
if (OB_TABLE_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
ISTAT("table is no exist", K(task), K(table_index));
|
||||
if (OB_FAIL(table_not_exist_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
} else if (OB_PARTITION_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
ISTAT("part is no exist", K(task));
|
||||
if (OB_FAIL(part_not_exist_list.push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("failed to get tablet", KR(ret), K(task));
|
||||
}
|
||||
} else {
|
||||
ObTransferPartitionInfo info;
|
||||
if (OB_FAIL(info.init(task, tablet_id))) {
|
||||
LOG_WARN("failed to init partition info", KR(ret), K(task), K(tablet_id));
|
||||
} else if (OB_FAIL(part_info_.push_back(info))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(info));
|
||||
}
|
||||
}
|
||||
}//end for get tablet_id
|
||||
if (OB_SUCC(ret) && table_not_exist_list.count() > 0) {
|
||||
ObString comment("Table has beed dropped");
|
||||
if (OB_FAIL(try_finish_failed_task_(table_not_exist_list, comment))) {
|
||||
LOG_WARN("failed to finish failed task", KR(ret), K(table_not_exist_list));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && part_not_exist_list.count() > 0) {
|
||||
ObString comment("Partition has beed dropped");
|
||||
if (OB_FAIL(try_finish_failed_task_(part_not_exist_list, comment))) {
|
||||
LOG_WARN("failed to finish failed task", KR(ret), K(part_not_exist_list));
|
||||
}
|
||||
}
|
||||
}
|
||||
ISTAT("finish check object exist", KR(ret), K(table_not_exist_list),
|
||||
K(part_not_exist_list));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::batch_get_table_schema_in_order_(
|
||||
common::ObArenaAllocator &allocator,
|
||||
ObArray<ObSimpleTableSchemaV2*> &table_schema_array)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("check inner stat error", KR(ret));
|
||||
} else if (0 >= task_array_.count()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("task array is null", KR(ret), K(task_array_));
|
||||
} else {
|
||||
ObArray<ObObjectID> table_id_array;
|
||||
ObObjectID last_table_id = OB_INVALID_ID;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array_.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array_.at(i);
|
||||
if (OB_INVALID_ID == last_table_id
|
||||
|| last_table_id != task.get_part_info().table_id()) {
|
||||
last_table_id = task.get_part_info().table_id();
|
||||
if (OB_FAIL(table_id_array.push_back(last_table_id))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(last_table_id));
|
||||
}
|
||||
}
|
||||
}//end for get table_id array
|
||||
if (FAILEDx(ObSchemaUtils::batch_get_latest_table_schemas(
|
||||
*sql_proxy_, allocator, tenant_id_, table_id_array, table_schema_array))) {
|
||||
LOG_WARN("failed to get latest table schema", KR(ret),
|
||||
K(tenant_id_), K(table_id_array));
|
||||
} else {
|
||||
//按照table_id的顺序对table_schema_array进行排序
|
||||
ObBootstrap::TableIdCompare compare;
|
||||
std::sort(table_schema_array.begin(), table_schema_array.end(), compare);
|
||||
if (OB_FAIL(compare.get_ret())) {
|
||||
LOG_WARN("failed to sort table schema", KR(ret), K(table_schema_array));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
//table_schema_array maybe empty, table maybe dropped
|
||||
int ObTransferPartitionHelper::get_tablet_in_order_array(
|
||||
const ObArray<ObSimpleTableSchemaV2*> &table_schema_array,
|
||||
const ObTransferPartInfo &part_info,
|
||||
int64_t &table_index, ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!part_info.is_valid() || 0 > table_index)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(part_info), K(table_schema_array));
|
||||
} else {
|
||||
const uint64_t table_id = part_info.table_id();
|
||||
while(OB_SUCC(ret) && table_index < table_schema_array.count()) {
|
||||
const ObSimpleTableSchemaV2 * table_schema = table_schema_array.at(table_index);
|
||||
if (OB_ISNULL(table_schema)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table schema is null", KR(ret), K(table_index));
|
||||
} else if (table_schema->get_table_id() < table_id) {
|
||||
table_index++;
|
||||
} else if (table_schema->get_table_id() == table_id) {
|
||||
if (OB_FAIL(table_schema->get_tablet_id_by_object_id(
|
||||
part_info.part_object_id(), tablet_id))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_PARTITION_NOT_EXIST;
|
||||
LOG_WARN("partition not exist", KR(ret), K(part_info), KPC(table_schema));
|
||||
} else {
|
||||
LOG_WARN("failed to get tablet id from object_id", KR(ret),
|
||||
K(part_info), KPC(table_schema));
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
//table_id < table_schema->get_table_id()
|
||||
//the table is delete
|
||||
ret = OB_TABLE_NOT_EXIST;
|
||||
LOG_WARN("table not exist", KR(ret), K(part_info), K(table_index), KPC(table_schema));
|
||||
}
|
||||
}//end for get tablet for task
|
||||
if (OB_SUCC(ret) && table_index >= table_schema_array.count()) {
|
||||
ret = OB_TABLE_NOT_EXIST;
|
||||
LOG_WARN("table not exist", KR(ret), K(table_index), K(table_schema_array));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObTransferPartitionHelper::set_task_src_ls_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartList dest_src_equal_list;
|
||||
if (IS_INIT || 0 == part_info_.count()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(is_inited_), K(part_info_));
|
||||
} else if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("check inner stat error", KR(ret));
|
||||
} else {
|
||||
ObArray<ObTabletID> tablet_array;
|
||||
ObArray<ObLSID> ls_id_array;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < part_info_.count(); ++i) {
|
||||
const ObTransferPartitionInfo &info = part_info_.at(i);
|
||||
if (OB_FAIL(tablet_array.push_back(info.get_tablet_id()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(info));
|
||||
}
|
||||
} // end for get all tablet
|
||||
if (FAILEDx(ObTabletToLSTableOperator::batch_get_ls(
|
||||
*sql_proxy_, tenant_id_, tablet_array, ls_id_array))) {
|
||||
if (OB_ITEM_NOT_MATCH == ret) {
|
||||
WSTAT("has partition beed dropped, try again", KR(ret),
|
||||
K(tablet_array), K(ls_id_array));
|
||||
} else {
|
||||
LOG_WARN("failed to batch get", KR(ret), K(tenant_id_), K(tablet_array));
|
||||
}
|
||||
} else if (tablet_array.count() != ls_id_array.count() ||
|
||||
tablet_array.count() != part_info_.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet and ls count not match", KR(ret), "tablet_array",
|
||||
tablet_array.count(), "ls count", ls_id_array.count(),
|
||||
"task info count", part_info_.count(), K(tablet_array),
|
||||
K(ls_id_array));
|
||||
}
|
||||
//tablet_to_ls_infos has same order of tablet_array
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < part_info_.count(); ++i) {
|
||||
ObTransferPartitionInfo &info = part_info_.at(i);
|
||||
const ObLSID &ls_id = ls_id_array.at(i);
|
||||
if (OB_FAIL(info.set_src_ls(ls_id))) {
|
||||
LOG_WARN("failed to set to ls", KR(ret), K(ls_id), K(info));
|
||||
} else if (OB_ISNULL(info.get_task())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("info is invalid", KR(ret), K(info));
|
||||
} else if (info.get_task()->get_dest_ls() == ls_id) {
|
||||
//tranfer_partition task dest_ls is equal to src ls, no need transfer
|
||||
ISTAT("partition already in dest LS", K(info), K(ls_id));
|
||||
if (OB_FAIL(dest_src_equal_list.push_back(info.get_task()->get_part_info()))) {
|
||||
LOG_WARN("push back error", KR(ret), K(info));
|
||||
}
|
||||
}
|
||||
}//end for
|
||||
if (OB_SUCC(ret) && dest_src_equal_list.count() > 0) {
|
||||
ObString comment("Partition is already in dest LS");
|
||||
if (OB_FAIL(try_finish_failed_task_(dest_src_equal_list, comment))) {
|
||||
LOG_WARN("failed to finish failed task", KR(ret), K(dest_src_equal_list));
|
||||
}
|
||||
}
|
||||
}
|
||||
ISTAT("finish set src ls", KR(ret), K(dest_src_equal_list));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::process_in_trans(
|
||||
const share::ObLSStatusInfoIArray &status_info_array,
|
||||
int64_t unit_num, int64_t primary_zone_num,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArray<share::ObTransferPartitionTask> task_array;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("inner stat error", KR(ret));
|
||||
} else if (OB_UNLIKELY(0 >= status_info_array.count()
|
||||
|| OB_INVALID_ID == unit_num || OB_INVALID_ID == primary_zone_num)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(unit_num), K(primary_zone_num),
|
||||
K(status_info_array));
|
||||
} else if (OB_FAIL(ObTransferPartitionTaskTableOperator::load_all_wait_task_in_part_info_order(
|
||||
tenant_id_, true, max_task_id_, task_array, trans))) {
|
||||
LOG_WARN("failed to load all task", KR(ret), K(tenant_id_), K(max_task_id_));
|
||||
} else if (0 == task_array.count()) {
|
||||
//no task
|
||||
} else if (OB_FAIL(construct_logical_task_(task_array))) {
|
||||
LOG_WARN("failed to construct logical task", KR(ret), K(task_array));
|
||||
} else {
|
||||
ObBalanceJobID job_id;
|
||||
ObBalanceJobStatus job_status(ObBalanceJobStatus::BALANCE_JOB_STATUS_DOING);
|
||||
ObBalanceJobType job_type(ObBalanceJobType::BALANCE_JOB_TRANSFER_PARTITION);
|
||||
const char* balance_stradegy = "manual transfer partition"; // TODO
|
||||
ObString comment;
|
||||
|
||||
if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, job_id))) {
|
||||
LOG_WARN("gen_unique_id", KR(ret), K(tenant_id_));
|
||||
} else if (OB_FAIL(balance_job_.init(tenant_id_, job_id, job_type, job_status,
|
||||
primary_zone_num, unit_num,
|
||||
comment, ObString(balance_stradegy)))) {
|
||||
LOG_WARN("job init fail", KR(ret), K(tenant_id_), K(job_id),
|
||||
K(primary_zone_num), K(unit_num));
|
||||
} else {
|
||||
hash::ObHashMap<ObPartitionBalance::ObTransferTaskKey, ObTransferPartList>::iterator
|
||||
iter = transfer_logical_tasks_.begin();
|
||||
for (; OB_SUCC(ret) && iter != transfer_logical_tasks_.end(); ++iter) {
|
||||
ObLSID src_ls = iter->first.get_src_ls_id();
|
||||
ObLSID dest_ls = iter->first.get_dest_ls_id();
|
||||
uint64_t src_ls_group = 0;
|
||||
uint64_t dest_ls_group = 0;
|
||||
if (OB_FAIL(get_ls_group_id(status_info_array, src_ls, dest_ls,
|
||||
src_ls_group, dest_ls_group))) {
|
||||
LOG_WARN("failed to get ls group", KR(ret), K(status_info_array),
|
||||
K(src_ls), K(dest_ls));
|
||||
} else if (OB_FAIL(ObPartitionBalance::transfer_logical_task_to_balance_task(
|
||||
tenant_id_, balance_job_.get_job_id(), src_ls, dest_ls,
|
||||
src_ls_group, dest_ls_group, iter->second,
|
||||
balance_tasks_))) {
|
||||
LOG_WARN("failed to transfer logical task", KR(ret), K(tenant_id_), K(balance_job_),
|
||||
K(src_ls), K(dest_ls), K(iter->second));
|
||||
}
|
||||
}//end for
|
||||
}
|
||||
if (FAILEDx(ObTransferPartitionTaskTableOperator::set_all_tasks_schedule(
|
||||
tenant_id_, max_task_id_, balance_job_.get_job_id(), task_array.count(), trans))) {
|
||||
LOG_WARN("failed to set all tasks to schedule", KR(ret), K(tenant_id_), K(max_task_id_),
|
||||
K(balance_job_), "count", task_array.count());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::construct_logical_task_(
|
||||
const ObArray<share::ObTransferPartitionTask> &task_array)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("inner stat error", KR(ret));
|
||||
} else if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", KR(ret));
|
||||
} else if (task_array.count() > part_info_.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task array can not larger than part info", KR(ret),
|
||||
"part_info count", part_info_.count(), "task_array count", task_array.count(),
|
||||
K(part_info_), K(task_array));
|
||||
} else if (OB_FAIL(transfer_logical_tasks_.create(1024,
|
||||
lib::ObLabel("Trans_Part"), lib::ObLabel("Trans_Part"),
|
||||
tenant_id_))) {
|
||||
LOG_WARN("map create fail", KR(ret), K(tenant_id_));
|
||||
} else {
|
||||
//task_array and part_info is order by table_id, object_id
|
||||
int64_t part_info_index = 0;
|
||||
bool found = true;
|
||||
//每个task_array肯定都可以在part_info_中找到
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_array.count(); ++i) {
|
||||
const ObTransferPartitionTask &task = task_array.at(i);
|
||||
found = false;
|
||||
for (; OB_SUCC(ret) && !found && part_info_index < part_info_.count(); ++part_info_index) {
|
||||
const ObTransferPartitionInfo &part_info = part_info_.at(part_info_index);
|
||||
if (OB_ISNULL(part_info.get_task())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task is null in part_info", KR(ret), K(part_info));
|
||||
} else if (task.get_part_info() == part_info.get_task()->get_part_info()) {
|
||||
if (task.get_task_id() != part_info.get_task()->get_task_id()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("same transfer partition task has different task id", KR(ret),
|
||||
K(task), K(part_info));
|
||||
} else {
|
||||
found = true;
|
||||
ObPartitionBalance::ObTransferTaskKey key(part_info.get_ls_id(),
|
||||
task.get_dest_ls());
|
||||
ObTransferPartList *tansfer_part_info = transfer_logical_tasks_.get(key);
|
||||
if (OB_ISNULL(tansfer_part_info)) {
|
||||
ObTransferPartList part_arr;
|
||||
if (OB_FAIL(transfer_logical_tasks_.set_refactored(key, part_arr))) {
|
||||
LOG_WARN("fail to init transfer task into map", KR(ret), K(key),
|
||||
K(part_arr));
|
||||
} else {
|
||||
tansfer_part_info = transfer_logical_tasks_.get(key);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && OB_ISNULL(tansfer_part_info)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("fail get transfer task from map", KR(ret), K(key));
|
||||
}
|
||||
if (FAILEDx(tansfer_part_info->push_back(task.get_part_info()))) {
|
||||
LOG_WARN("failed to push back", KR(ret), K(task));
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end for find part info
|
||||
if (OB_SUCC(ret) && !found) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("part info index is out of range",
|
||||
KR(ret), K(part_info_index), K(i),
|
||||
K(task), K(part_info_), K(task_array));
|
||||
}
|
||||
}//end for process each task
|
||||
}//end else
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionHelper::get_ls_group_id(
|
||||
const share::ObLSStatusInfoIArray &status_info_array,
|
||||
const ObLSID &src_ls, const ObLSID &dest_ls,
|
||||
uint64_t &src_ls_group, uint64_t &dest_ls_group)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(0 == status_info_array.count()
|
||||
|| !src_ls.is_valid() || !dest_ls.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(status_info_array), K(src_ls), K(dest_ls));
|
||||
}
|
||||
int found_cnt = 0;
|
||||
src_ls_group = OB_INVALID_ID;
|
||||
dest_ls_group = OB_INVALID_ID;
|
||||
for (int64_t i = 0;
|
||||
OB_SUCC(ret) && found_cnt < 2 && i < status_info_array.count(); ++i) {
|
||||
const ObLSStatusInfo &info = status_info_array.at(i);
|
||||
if (info.get_ls_id() == src_ls && OB_INVALID_ID == src_ls_group) {
|
||||
src_ls_group = info.ls_group_id_;
|
||||
found_cnt++;
|
||||
}
|
||||
if (info.get_ls_id() == dest_ls && OB_INVALID_ID == dest_ls_group) {
|
||||
dest_ls_group = info.ls_group_id_;
|
||||
found_cnt++;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && (2 != found_cnt || OB_INVALID_ID == src_ls_group
|
||||
|| OB_INVALID_ID == dest_ls_group)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("dest or src ls not exist", KR(ret), K(found_cnt), K(src_ls),
|
||||
K(dest_ls), K(dest_ls_group), K(src_ls_group),
|
||||
K(status_info_array));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#undef ISTAT
|
||||
#undef WSTAT
|
||||
|
||||
}
|
||||
}
|
160
src/rootserver/ob_transfer_partition_task.h
Normal file
160
src/rootserver/ob_transfer_partition_task.h
Normal file
@ -0,0 +1,160 @@
|
||||
/**
|
||||
* 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_ROOTSERVER_OB_TRANSFER_PARTITION_TASK_H
|
||||
#define OCEANBASE_ROOTSERVER_OB_TRANSFER_PARTITION_TASK_H
|
||||
|
||||
#include "share/balance/ob_balance_task_table_operator.h"//ObBalanceTask
|
||||
#include "share/balance/ob_balance_job_table_operator.h"//ObBalanceJob
|
||||
#include "share/balance/ob_transfer_partition_task_table_operator.h"//ObTransferPartitionTask
|
||||
#include "lib/container/ob_array.h"//ObArray
|
||||
#include "lib/allocator/page_arena.h"//allocator
|
||||
#include "rootserver/ob_partition_balance.h"//logical task
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
class ObMySQLProxy;
|
||||
class ObMySQLTransaction;
|
||||
}
|
||||
namespace share
|
||||
{
|
||||
struct ObBalanceJob;
|
||||
namespace schema{
|
||||
class ObSimpleTableSchemaV2;
|
||||
}
|
||||
}
|
||||
namespace rootserver
|
||||
{
|
||||
struct ObTransferPartitionInfo
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionInfo() : task_(NULL), tablet_id_(), src_ls_(){}
|
||||
~ObTransferPartitionInfo() {}
|
||||
int init(share::ObTransferPartitionTask &task,
|
||||
const ObTabletID &tablet_id);
|
||||
int set_src_ls(const ObLSID &ls_id);
|
||||
int assign(const ObTransferPartitionInfo &other);
|
||||
bool is_valid() const
|
||||
{
|
||||
return OB_NOT_NULL(task_) && task_->is_valid()
|
||||
&& tablet_id_.is_valid() && src_ls_.is_valid();
|
||||
}
|
||||
const ObTabletID& get_tablet_id() const
|
||||
{
|
||||
return tablet_id_;
|
||||
}
|
||||
const ObLSID& get_ls_id() const
|
||||
{
|
||||
return src_ls_;
|
||||
}
|
||||
const share::ObTransferPartitionTask* get_task() const
|
||||
{
|
||||
return task_;
|
||||
}
|
||||
TO_STRING_KV(KPC_(task), K_(tablet_id), K_(src_ls));
|
||||
private:
|
||||
share::ObTransferPartitionTask* task_;
|
||||
ObTabletID tablet_id_;
|
||||
ObLSID src_ls_;
|
||||
};
|
||||
|
||||
class ObTransferPartitionHelper
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionHelper(const uint64_t tenant_id,
|
||||
common::ObMySQLProxy *sql_proxy) :
|
||||
is_inited_(false), tenant_id_(tenant_id), sql_proxy_(sql_proxy),
|
||||
allocator_("TRANFER_PART", OB_MALLOC_NORMAL_BLOCK_SIZE, tenant_id),
|
||||
task_array_(OB_MALLOC_NORMAL_BLOCK_SIZE, ModulePageAllocator(allocator_, "TrPTaskArray")),
|
||||
part_info_(OB_MALLOC_NORMAL_BLOCK_SIZE, ModulePageAllocator(allocator_, "PartInfoArray")),
|
||||
transfer_logical_tasks_(), balance_job_(),
|
||||
balance_tasks_(OB_MALLOC_NORMAL_BLOCK_SIZE, ModulePageAllocator(allocator_, "BalanceArray")),
|
||||
max_task_id_() {}
|
||||
~ObTransferPartitionHelper()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
void destroy();
|
||||
|
||||
share::ObBalanceJob& get_balance_job()
|
||||
{
|
||||
return balance_job_;
|
||||
}
|
||||
ObArray<share::ObBalanceTask>& get_balance_tasks()
|
||||
{
|
||||
return balance_tasks_;
|
||||
}
|
||||
//构造好每个任务所需要的源端日志流信息
|
||||
int build(bool &has_job);
|
||||
//加锁构造逻辑任务和物理任务并写入表中
|
||||
int process_in_trans(const share::ObLSStatusInfoIArray &status_info_array,
|
||||
int64_t unit_num, int64_t primary_zone_num,
|
||||
ObMySQLTransaction &trans);
|
||||
/*
|
||||
* 从按table_id递增顺序数组(table_schema_array)中查找指定分区的tablet_id信息。该函数可以反复调用,用于查找一组分区的tablet_id信息。
|
||||
* 使用方法:
|
||||
* 1.保证table_schema_array按table_id从小到大排序
|
||||
* 2.一组分区信息part_info,按<table_id, part_id>从小到大排序
|
||||
* 3. 初始化table_index = 0,按从小到大顺序指定part_info反复调用该函数,获取对应分区的tablet_id信息
|
||||
*
|
||||
* @param[in] table_schema_array: 按照table_id升序排列的table_schema_array
|
||||
* @param[in] part_info: 指定的part_info,table_id一定大于等于上次指定的part_info
|
||||
* @param[in/out] table_index: 当前遍历的位置,调用者只需要第一次初始化为0,后续不要修改该变量值,否则可能导致结果报错
|
||||
* @param[out] tablet_id:tablet_id of part_info
|
||||
* @return OB_SUCCESS if success
|
||||
* OB_TABLE_NOT_EXIST :表不存在
|
||||
* OB_PARTITION_NOT_EXIST : part_object_id不存在
|
||||
* */
|
||||
static int get_tablet_in_order_array(
|
||||
const ObArray<share::schema::ObSimpleTableSchemaV2*> &table_schema_array,
|
||||
const ObTransferPartInfo &part_info,
|
||||
int64_t &table_index,
|
||||
ObTabletID &tablet_id);
|
||||
private:
|
||||
//no need check is_inited_, after rebuild, is_inited_ = true
|
||||
int check_inner_stat_();
|
||||
int try_process_dest_not_exist_task_(
|
||||
const share::ObLSStatusInfoIArray &status_info_array,
|
||||
int64_t& task_cnt);
|
||||
int try_process_object_not_exist_task_();
|
||||
int set_task_src_ls_();
|
||||
int try_finish_failed_task_(const ObTransferPartList &part_list,
|
||||
const ObString &comment);
|
||||
int construct_logical_task_(const ObArray<share::ObTransferPartitionTask> &task_array);
|
||||
static int get_ls_group_id(
|
||||
const ObLSStatusInfoIArray &status_info_array,
|
||||
const ObLSID &src_ls, const ObLSID &dest_ls,
|
||||
uint64_t &src_ls_group, uint64_t &dest_ls_group);
|
||||
//通过按照tablet_id,object_id排查的part_list或者按照table_id排查过的table_schema
|
||||
int batch_get_table_schema_in_order_(
|
||||
common::ObArenaAllocator &allocator,
|
||||
ObArray<share::schema::ObSimpleTableSchemaV2*> &table_schema_array);
|
||||
private:
|
||||
bool is_inited_;
|
||||
uint64_t tenant_id_;
|
||||
common::ObMySQLProxy *sql_proxy_;
|
||||
common::ObArenaAllocator allocator_;
|
||||
ObArray<share::ObTransferPartitionTask> task_array_;
|
||||
//part_info_中的task指针使用了task_array的内存
|
||||
//在初始化part_info_后,task_array不能在发生变化
|
||||
ObArray<ObTransferPartitionInfo> part_info_;
|
||||
hash::ObHashMap<ObPartitionBalance::ObTransferTaskKey, ObTransferPartList> transfer_logical_tasks_;
|
||||
ObBalanceJob balance_job_;
|
||||
ObArray<ObBalanceTask> balance_tasks_;
|
||||
share::ObTransferPartitionTaskID max_task_id_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !OB_TRANSFER_PARTITION_TASK_H */
|
@ -512,6 +512,7 @@ ob_set_subtarget(ob_share balance
|
||||
balance/ob_balance_job_table_operator.cpp
|
||||
balance/ob_balance_task_table_operator.cpp
|
||||
balance/ob_balance_task_helper_operator.cpp
|
||||
balance/ob_transfer_partition_task_table_operator.cpp
|
||||
)
|
||||
|
||||
if (OB_ERRSIM)
|
||||
|
@ -32,7 +32,7 @@ static const char* BALANCE_JOB_STATUS_ARRAY[] =
|
||||
};
|
||||
static const char *BALANCE_JOB_TYPE[] =
|
||||
{
|
||||
"LS_BALANCE", "PARTITION_BALANCE",
|
||||
"LS_BALANCE", "PARTITION_BALANCE", "TRANSFER_PARTITION"
|
||||
};
|
||||
|
||||
const char* ObBalanceJobStatus::to_str() const
|
||||
|
@ -80,7 +80,8 @@ public:
|
||||
static const int64_t BALANCE_JOB_LS = 0;
|
||||
//partition balance
|
||||
static const int64_t BALANCE_JOB_PARTITION = 1;
|
||||
static const int64_t BALANCE_JOB_MAX = 2;
|
||||
static const int64_t BALANCE_JOB_TRANSFER_PARTITION = 2;
|
||||
static const int64_t BALANCE_JOB_MAX = 3;
|
||||
ObBalanceJobType(const int64_t value = BALANCE_JOB_INVALID) : val_(value) {}
|
||||
ObBalanceJobType(const ObString &str);
|
||||
public:
|
||||
@ -99,6 +100,7 @@ public:
|
||||
// ObBalanceJobStatus attribute interface
|
||||
bool is_balance_ls() const { return BALANCE_JOB_LS == val_; }
|
||||
bool is_balance_partition() const { return BALANCE_JOB_PARTITION == val_; }
|
||||
bool is_transfer_partition() const { return BALANCE_JOB_TRANSFER_PARTITION == val_; }
|
||||
private:
|
||||
int64_t val_;
|
||||
};
|
||||
|
@ -835,6 +835,27 @@ int ObBalanceTaskTableOperator::load_can_execute_task(const uint64_t tenant_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskTableOperator::load_task(const uint64_t tenant_id,
|
||||
ObBalanceTaskIArray &task_array,
|
||||
ObISQLClient &client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_array.reset();
|
||||
ObSqlString sql;
|
||||
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid tenant id", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s",
|
||||
OB_ALL_BALANCE_TASK_TNAME))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(sql));
|
||||
} else if (OB_FAIL(read_tasks_(tenant_id, client, sql, task_array))) {
|
||||
LOG_WARN("failed to read task", KR(ret), K(tenant_id), K(sql));
|
||||
}
|
||||
LOG_INFO("load all balance task", KR(ret), K(task_array), K(sql));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObBalanceTaskTableOperator::get_job_cannot_execute_task(
|
||||
const uint64_t tenant_id, const ObBalanceJobID balance_job_id,
|
||||
ObBalanceTaskIArray &task_array, ObISQLClient &client)
|
||||
@ -988,7 +1009,7 @@ int ObBalanceTaskTableOperator::get_job_task_cnt(const uint64_t tenant_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBalanceTaskTableOperator::update_merge_ls_part_list(const uint64_t tenant_id,
|
||||
int ObBalanceTaskTableOperator::update_task_part_list(const uint64_t tenant_id,
|
||||
const ObBalanceTaskID balance_task_id,
|
||||
const ObTransferPartList &part_list,
|
||||
common::ObMySQLTransaction &trans)
|
||||
@ -998,24 +1019,25 @@ int ObBalanceTaskTableOperator::update_merge_ls_part_list(const uint64_t tenant_
|
||||
int64_t affected_rows = 0;
|
||||
common::ObArenaAllocator allocator;
|
||||
ObString part_list_str;
|
||||
//maybe part_list empty
|
||||
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == tenant_id
|
||||
|| !balance_task_id.is_valid()
|
||||
|| 0 == part_list.count())) {
|
||||
|| !balance_task_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(balance_task_id),
|
||||
K(part_list));
|
||||
} else if (OB_FAIL(part_list.to_display_str(allocator, part_list_str))) {
|
||||
LOG_WARN("failed to transfer list to str", KR(ret), K(part_list));
|
||||
} else if (OB_FAIL(sql.assign_fmt("update %s set part_list = '%.*s', part_count = %ld where "
|
||||
"task_id = %ld and part_count = 0",
|
||||
"task_id = %ld",
|
||||
OB_ALL_BALANCE_TASK_TNAME, part_list_str.length(),
|
||||
part_list_str.ptr(), part_list.count(), balance_task_id.id()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(balance_task_id), K(part_list_str));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_rows))) {
|
||||
LOG_WARN("failed to exec sql", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (is_zero_row(affected_rows)) {
|
||||
//调用点处理
|
||||
ret = OB_STATE_NOT_MATCH;
|
||||
LOG_WARN("expected one row, may status change", KR(ret), K(sql), K(affected_rows));
|
||||
LOG_WARN("expected one row, may part_list not change", KR(ret), K(sql), K(affected_rows));
|
||||
} else if (!is_single_row(affected_rows)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("expected single row", KR(ret), K(sql), K(affected_rows));
|
||||
|
@ -395,8 +395,19 @@ public:
|
||||
* @return OB_SUCCESS if success, otherwise failed
|
||||
* */
|
||||
static int load_can_execute_task(const uint64_t tenant_id,
|
||||
ObBalanceTaskIArray &task_array,
|
||||
ObISQLClient &client);
|
||||
ObBalanceTaskIArray &task_array,
|
||||
ObISQLClient &client);
|
||||
/*
|
||||
* @description: load all task
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[out] balance_task_array : get all task
|
||||
* @param[in] client: sql client or trans
|
||||
* @return OB_SUCCESS if success, otherwise failed
|
||||
* */
|
||||
static int load_task(const uint64_t tenant_id,
|
||||
ObBalanceTaskIArray &task_array,
|
||||
ObISQLClient &client);
|
||||
|
||||
/*
|
||||
* @description: load all task of the balance job that parent list not empty
|
||||
* @param[in] job_id : balance_job_id
|
||||
@ -429,7 +440,7 @@ public:
|
||||
* @param[in] trans: update in trans
|
||||
* @return OB_SUCCESS if success, otherwise failed
|
||||
* */
|
||||
static int update_merge_ls_part_list(const uint64_t tenant_id,
|
||||
static int update_task_part_list(const uint64_t tenant_id,
|
||||
const ObBalanceTaskID balance_task_id,
|
||||
const ObTransferPartList &part_list,
|
||||
common::ObMySQLTransaction &trans);
|
||||
|
703
src/share/balance/ob_transfer_partition_task_table_operator.cpp
Normal file
703
src/share/balance/ob_transfer_partition_task_table_operator.cpp
Normal file
@ -0,0 +1,703 @@
|
||||
/**
|
||||
* 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 SHARE
|
||||
|
||||
#include "ob_transfer_partition_task_table_operator.h"
|
||||
#include "lib/mysqlclient/ob_isql_client.h"//ObISQLClient
|
||||
#include "lib/mysqlclient/ob_mysql_result.h"//MySQLResult
|
||||
#include "lib/mysqlclient/ob_mysql_proxy.h"//MySQLResult
|
||||
#include "lib/mysqlclient/ob_mysql_transaction.h"//ObMySQLTrans
|
||||
#include "share/inner_table/ob_inner_table_schema.h"//ALL_TRANSFER_PARTITION_TASK_TNAME
|
||||
#include "share/ob_dml_sql_splicer.h"//ObDMLSqlSplicer
|
||||
#include "share/ls/ob_ls_operator.h"//get_tenant_gts
|
||||
#include "storage/tablelock/ob_lock_utils.h"//lock table
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace transaction;
|
||||
using namespace common;
|
||||
namespace share
|
||||
{
|
||||
static const char* TRP_TASK_STATUS_ARRAY[] =
|
||||
{
|
||||
"WAITING", "INIT", "DOING", "COMPLETED", "FAILED", "CANCELED"
|
||||
};
|
||||
|
||||
const char* ObTransferPartitionTaskStatus::to_str() const
|
||||
{
|
||||
STATIC_ASSERT(ARRAYSIZEOF(TRP_TASK_STATUS_ARRAY) == TRP_TASK_STATUS_MAX, "array size mismatch");
|
||||
const char *type_str = "INVALID";
|
||||
if (OB_UNLIKELY(val_ >= ARRAYSIZEOF(TRP_TASK_STATUS_ARRAY) || val_ < 0)) {
|
||||
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "fatal error, unknown transfer partition task status", K_(val));
|
||||
} else {
|
||||
type_str = TRP_TASK_STATUS_ARRAY[val_];
|
||||
}
|
||||
return type_str;
|
||||
}
|
||||
|
||||
ObTransferPartitionTaskStatus::ObTransferPartitionTaskStatus(const ObString &str)
|
||||
{
|
||||
val_ = TRP_TASK_STATUS_INVALID;
|
||||
if (str.empty()) {
|
||||
} else {
|
||||
for (int64_t i = 0; i < ARRAYSIZEOF(TRP_TASK_STATUS_ARRAY); ++i) {
|
||||
if (0 == str.case_compare(TRP_TASK_STATUS_ARRAY[i])) {
|
||||
val_ = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TRP_TASK_STATUS_INVALID == val_) {
|
||||
LOG_WARN_RET(OB_INVALID_ARGUMENT, "invalid transfer partition status", K(val_), K(str));
|
||||
}
|
||||
}
|
||||
|
||||
int ObTransferPartitionTask::simple_init(const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls, const ObTransferPartitionTaskID &task_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
reset();
|
||||
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == tenant_id || !part_info.is_valid()
|
||||
|| !dest_ls.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(part_info), K(dest_ls));
|
||||
} else {
|
||||
tenant_id_ = tenant_id;
|
||||
part_info_ = part_info;
|
||||
dest_ls_ = dest_ls;
|
||||
task_id_ = task_id;
|
||||
task_status_ = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING;
|
||||
balance_job_id_.reset();
|
||||
transfer_task_id_.reset();
|
||||
comment_.reset();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTask::init(const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls,
|
||||
const ObTransferPartitionTaskID &task_id,
|
||||
const ObBalanceJobID &balance_job_id,
|
||||
const ObTransferTaskID &transfer_task_id,
|
||||
const ObTransferPartitionTaskStatus &task_status,
|
||||
const ObString &comment)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
reset();
|
||||
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == tenant_id || !part_info.is_valid()
|
||||
|| !dest_ls.is_valid() || !task_status.is_valid()
|
||||
|| !task_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(part_info), K(dest_ls),
|
||||
K(task_status), K(task_id));
|
||||
} else if (OB_FAIL(comment_.assign(comment))) {
|
||||
LOG_WARN("failed to assign commet", KR(ret), K(comment));
|
||||
} else {
|
||||
tenant_id_ = tenant_id;
|
||||
part_info_ = part_info;
|
||||
dest_ls_ = dest_ls;
|
||||
task_id_ = task_id;
|
||||
balance_job_id_ = balance_job_id;
|
||||
transfer_task_id_ = transfer_task_id;
|
||||
task_status_ = task_status;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObTransferPartitionTask::is_valid() const
|
||||
{
|
||||
return OB_INVALID_TENANT_ID != tenant_id_
|
||||
&& part_info_.is_valid()
|
||||
&& dest_ls_.is_valid()
|
||||
&& task_id_.is_valid()
|
||||
&& task_status_.is_valid();
|
||||
}
|
||||
int ObTransferPartitionTask::assign(const ObTransferPartitionTask &other)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (this != &other) {
|
||||
reset();
|
||||
if (!other.comment_.empty() && OB_FAIL(comment_.assign(other.comment_))) {
|
||||
LOG_WARN("failed to assign comment", KR(ret), K(other));
|
||||
} else {
|
||||
tenant_id_ = other.tenant_id_;
|
||||
part_info_ = other.part_info_;
|
||||
dest_ls_ = other.dest_ls_;
|
||||
task_id_ = other.task_id_;
|
||||
balance_job_id_ = other.balance_job_id_;
|
||||
transfer_task_id_ = other.transfer_task_id_;
|
||||
task_status_ = other.task_status_;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObTransferPartitionTask::reset()
|
||||
{
|
||||
tenant_id_ = OB_INVALID_TENANT_ID;
|
||||
part_info_.reset();
|
||||
dest_ls_.reset();
|
||||
task_id_.reset();
|
||||
balance_job_id_.reset();
|
||||
transfer_task_id_.reset();
|
||||
task_status_.reset();
|
||||
comment_.reset();
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::insert_new_task(
|
||||
const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
//生成唯一并且递增的task_id, 先加表锁
|
||||
ObTransferPartitionTaskID task_id;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id)
|
||||
|| !part_info.is_valid() || !dest_ls.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(part_info), K(dest_ls));
|
||||
} else if (OB_FAIL(tablelock::ObInnerTableLockUtil::lock_inner_table_in_trans(
|
||||
trans,
|
||||
tenant_id,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TID,
|
||||
tablelock::EXCLUSIVE, true))) {
|
||||
LOG_WARN("lock inner table failed", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(fetch_new_task_id_(tenant_id, trans, task_id))) {
|
||||
LOG_WARN("failed to get max task id", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ObTransferPartitionTask new_task;
|
||||
int64_t affected_rows = 0;
|
||||
ObDMLSqlSplicer dml;
|
||||
ObDMLExecHelper exec(trans, tenant_id);
|
||||
if (OB_FAIL(new_task.simple_init(tenant_id, part_info, dest_ls,
|
||||
task_id))) {
|
||||
LOG_WARN("failed to init new task", KR(ret), K(part_info), K(dest_ls), K(task_id));
|
||||
} else if (OB_UNLIKELY(!new_task.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task is invalid", KR(ret), K(new_task));
|
||||
} else if (OB_FAIL(fill_dml_splicer_(dml, new_task))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(new_task));
|
||||
} else if (OB_FAIL(exec.exec_insert(OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
dml, affected_rows))) {
|
||||
LOG_WARN("execute update failed", KR(ret), K(new_task));
|
||||
} else if (!is_single_row(affected_rows)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("expected single row", KR(ret), K(affected_rows));
|
||||
}
|
||||
LOG_INFO("insert new task", KR(ret), K(new_task));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::load_all_wait_task_in_part_info_order(
|
||||
const uint64_t tenant_id, const bool for_update,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_array.reset();
|
||||
ObSqlString sql;
|
||||
ObTransferPartitionTaskStatus wait_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || !max_task_id.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(max_task_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt(
|
||||
"select * from %s where status = '%s' and task_id <= %ld "
|
||||
" order by table_id, object_id",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, wait_status.to_str(),
|
||||
max_task_id.id()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret));
|
||||
} else if (OB_FAIL(for_update && OB_FAIL(sql.append(" for update")))) {
|
||||
LOG_WARN("failed to append for update", KR(ret), K(sql), K(for_update));
|
||||
} else if (OB_FAIL(get_tasks_(tenant_id, sql, task_array, sql_client))) {
|
||||
LOG_WARN("failed to get tasks", KR(ret), K(tenant_id), K(sql));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::load_all_balance_job_task(const uint64_t tenant_id,
|
||||
const share::ObBalanceJobID &job_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_array.reset();
|
||||
ObSqlString sql;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || !job_id.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(job_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s where balance_job_id = %ld",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, job_id.id()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(job_id));
|
||||
} else if (OB_FAIL(get_tasks_(tenant_id, sql, task_array, sql_client))) {
|
||||
LOG_WARN("failed to get tasks", KR(ret), K(tenant_id), K(sql));
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::load_all_task(const uint64_t tenant_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_array.reset();
|
||||
ObSqlString sql;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret));
|
||||
} else if (OB_FAIL(get_tasks_(tenant_id, sql, task_array, sql_client))) {
|
||||
LOG_WARN("failed to get tasks", KR(ret), K(tenant_id), K(sql));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::get_tasks_(const uint64_t tenant_id,
|
||||
const ObSqlString &sql,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
task_array.reset();
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || sql.empty())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(sql));
|
||||
} else {
|
||||
HEAP_VAR(ObMySQLProxy::MySQLResult, res) {
|
||||
common::sqlclient::ObMySQLResult *result = NULL;
|
||||
if (OB_FAIL(sql_client.read(res, tenant_id, sql.ptr()))) {
|
||||
LOG_WARN("failed to read", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (OB_ISNULL(result = res.get_result())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("failed to get sql result", KR(ret));
|
||||
} else {
|
||||
ObTransferPartitionTask task;
|
||||
while(OB_SUCC(ret) && OB_SUCC(result->next())) {
|
||||
if (OB_FAIL(fill_cell_(tenant_id, result, task))) {
|
||||
LOG_WARN("failed to fill cell", KR(ret), K(sql));
|
||||
} else if (OB_FAIL(task_array.push_back(task))) {
|
||||
LOG_WARN("failed to push back task", KR(ret), K(task));
|
||||
}
|
||||
}//end while
|
||||
if (OB_ITER_END == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get cell", KR(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::set_all_tasks_schedule(const uint64_t tenant_id,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const int64_t &task_count,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
int64_t affected_row = 0;
|
||||
ObTransferPartitionTaskStatus wait_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING;
|
||||
ObTransferPartitionTaskStatus new_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_INIT;
|
||||
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id)
|
||||
|| !max_task_id.is_valid() || !job_id.is_valid()
|
||||
|| 0 >= task_count)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(job_id),
|
||||
K(max_task_id), K(task_count));
|
||||
} else if (OB_FAIL(sql.assign_fmt("update %s set balance_job_id = %ld, "
|
||||
"status = '%s' where task_id <= %ld and status = '%s'",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
job_id.id(), new_status.to_str(), max_task_id.id(), wait_status.to_str()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(job_id), K(max_task_id), K(sql));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_row))) {
|
||||
LOG_WARN("failed to exec sql", KR(ret), K(sql), K(tenant_id));
|
||||
} else if (affected_row != task_count) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task count not equal to affected row, need retry", KR(ret), K(sql),
|
||||
K(affected_row), K(task_count));
|
||||
}
|
||||
LOG_INFO("set task to init", KR(ret), K(affected_row), K(task_count),
|
||||
K(max_task_id), K(job_id), K(sql));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::rollback_all_to_waitting(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
int64_t affected_row = 0;
|
||||
ObTransferPartitionTaskStatus old_status1 = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_DOING;
|
||||
ObTransferPartitionTaskStatus old_status2 = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_INIT;
|
||||
ObTransferPartitionTaskStatus new_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING;
|
||||
ObBalanceJobID invalid_job_id;
|
||||
ObTransferTaskID invalid_task_id;
|
||||
ObSqlString comment;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id)
|
||||
|| !job_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(job_id));
|
||||
} else if (OB_FAIL(comment.assign_fmt(
|
||||
"Rollback due to balance job %ld being canceled",
|
||||
job_id.id()))) {
|
||||
LOG_WARN("failed to assign comment", KR(ret), K(job_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt(
|
||||
"update %s set balance_job_id = %ld, transfer_task_id = %ld, "
|
||||
"comment = '%s', status = '%s' where balance_job_id = %ld and "
|
||||
"status in ('%s', '%s')",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, invalid_job_id.id(),
|
||||
invalid_task_id.id(), comment.ptr(), new_status.to_str(),
|
||||
job_id.id(), old_status1.to_str(), old_status2.to_str()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(job_id), K(sql));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_row))) {
|
||||
LOG_WARN("failed to exec sql", KR(ret), K(sql), K(tenant_id));
|
||||
}
|
||||
LOG_INFO("rollback task to waiting", KR(ret), K(affected_row), K(job_id),
|
||||
K(sql));
|
||||
return ret;
|
||||
}
|
||||
int ObTransferPartitionTaskTableOperator::rollback_from_doing_to_waiting(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObString &comment,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartitionTaskStatus old_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_DOING;
|
||||
ObTransferPartitionTaskStatus new_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_WAITING;
|
||||
ObBalanceJobID invalid_job_id;
|
||||
ObTransferTaskID invalid_task_id;
|
||||
ObSqlString sql;
|
||||
ObSqlString part_list_sql;
|
||||
int64_t affected_row = 0;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || !job_id.is_valid()
|
||||
|| part_list.count() <= 0 || comment.empty())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(job_id),
|
||||
K(part_list), K(comment));
|
||||
} else if (OB_FAIL(append_sql_with_part_list_(part_list, part_list_sql))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(part_list));
|
||||
} else if (OB_FAIL(sql.assign_fmt(
|
||||
"update %s set transfer_task_id = %ld, balance_job_id = %ld, "
|
||||
"status = '%s', comment = '%.*s'"
|
||||
"where balance_job_id = %ld and status = '%s' "
|
||||
"and (table_id, object_id) in (%s)",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, invalid_task_id.id(),
|
||||
invalid_job_id.id(), new_status.to_str(), comment.length(),
|
||||
comment.ptr(), job_id.id(), old_status.to_str(),
|
||||
part_list_sql.ptr()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(job_id), K(sql), K(comment));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_row))) {
|
||||
LOG_WARN("failed to exec sql", KR(ret), K(sql), K(tenant_id));
|
||||
} else if (affected_row > part_list.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
// 不能检查part_list的个数等于affected_row。
|
||||
// 对于中间状态的日志流,并没有限制新建表,所以transfer的列表是包含临时日志流上的新建表信息
|
||||
LOG_WARN("affected row not match with part list", KR(ret), K(part_list.count()), K(affected_row),
|
||||
K(sql), K(part_list));
|
||||
}
|
||||
LOG_INFO("rollback task from doing to waiting", KR(ret), K(affected_row), K(job_id),
|
||||
K(part_list), K(comment), K(sql));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::start_transfer_task(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObTransferTaskID &transfer_task_id,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
ObSqlString part_list_sql;
|
||||
int64_t affected_row = 0;
|
||||
//由于一个transfer partition任务会经过多轮transfer,所以start_transfer_task会调度多轮
|
||||
//可能status为init或者doing
|
||||
ObTransferPartitionTaskStatus status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_DOING;
|
||||
ObTransferPartitionTaskStatus old_status = ObTransferPartitionTaskStatus::TRP_TASK_STATUS_INIT;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || !job_id.is_valid()
|
||||
|| !transfer_task_id.is_valid() || part_list.count() <= 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(transfer_task_id), K(job_id),
|
||||
K(part_list));
|
||||
} else if (OB_FAIL(append_sql_with_part_list_(part_list, part_list_sql))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(part_list));
|
||||
} else if (OB_FAIL(sql.assign_fmt("update %s set transfer_task_id = %ld, status = '%s' "
|
||||
"where balance_job_id = %ld and status in ('%s', '%s') "
|
||||
"and (table_id, object_id) in (%s)",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, transfer_task_id.id(), status.to_str(),
|
||||
job_id.id(), old_status.to_str(), status.to_str(), part_list_sql.ptr()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(transfer_task_id), K(sql));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_row))) {
|
||||
LOG_WARN("failed to exec sql", KR(ret), K(sql), K(tenant_id));
|
||||
} else if (affected_row > part_list.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
// 不能检查part_list的个数等于affected_row。
|
||||
// 对于中间状态的日志流,并没有限制新建表,所以transfer的列表是包含临时日志流上的新建表信息
|
||||
LOG_WARN("affected row not match with part list", KR(ret), K(part_list.count()), K(affected_row),
|
||||
K(sql), K(part_list));
|
||||
}
|
||||
LOG_INFO("start transfer task", KR(ret), K(affected_row),
|
||||
K(job_id), K(part_list), K(sql));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::finish_task(const uint64_t tenant_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
const ObTransferPartitionTaskStatus &status,
|
||||
const ObString &comment,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
ObSqlString delete_sql;
|
||||
ObSqlString condition_sql;
|
||||
ObSqlString part_list_sql;
|
||||
int64_t affected_row = 0;
|
||||
int64_t delete_affected_row = 0;
|
||||
const char* table_column = "table_id, object_id, task_id, dest_ls, balance_job_id, transfer_task_id";
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || !max_task_id.is_valid()
|
||||
|| !status.is_valid() || part_list.count() <= 0 || !status.is_finish_status())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(status),
|
||||
K(part_list), K(max_task_id));
|
||||
} else if (OB_FAIL(append_sql_with_part_list_(part_list, part_list_sql))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(part_list));
|
||||
} else if (OB_FAIL(condition_sql.assign_fmt("(table_id, object_id) in (%s) and task_id <= %ld",
|
||||
part_list_sql.ptr(), max_task_id.id()))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(part_list_sql));
|
||||
} else if (OB_FAIL(sql.assign_fmt("insert into %s (%s, status, comment, create_time, "
|
||||
"finish_time) select %s, '%s', '%.*s', gmt_create, "
|
||||
"now() from %s where %s",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TNAME, table_column,
|
||||
table_column, status.to_str(), comment.length(), comment.ptr(),
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, condition_sql.ptr()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(status), K(comment), K(condition_sql));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_row))) {
|
||||
LOG_WARN("failed to write", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (affected_row > part_list.count()) {
|
||||
//因为part_list可能不是这么准确,不能做准确
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("affected row not match with part list", KR(ret),
|
||||
K(part_list.count()), K(affected_row), K(sql));
|
||||
} else if (OB_FAIL(delete_sql.assign_fmt("delete from %s where %s",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME, condition_sql.ptr()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(status), K(comment), K(condition_sql));
|
||||
} else if (OB_FAIL(trans.write(tenant_id, delete_sql.ptr(), delete_affected_row))) {
|
||||
LOG_WARN("failed to write", KR(ret), K(tenant_id), K(delete_sql));
|
||||
} else if (affected_row != delete_affected_row) {
|
||||
//插入和删除的行应该是匹配的
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("affected row not match with part list", KR(ret), K(delete_affected_row),
|
||||
K(part_list.count()), K(affected_row), K(delete_sql));
|
||||
}
|
||||
LOG_INFO("finish task", KR(ret), K(affected_row), K(delete_affected_row), K(status),
|
||||
K(max_task_id), K(part_list), K(sql), K(delete_sql));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::fill_dml_splicer_(share::ObDMLSqlSplicer &dml,
|
||||
const ObTransferPartitionTask &task)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(dml.add_pk_column("task_id", task.get_task_id().id()))
|
||||
|| OB_FAIL(dml.add_pk_column("table_id", task.get_part_info().table_id()))
|
||||
|| OB_FAIL(dml.add_pk_column("object_id", task.get_part_info().part_object_id()))
|
||||
|| OB_FAIL(dml.add_column("dest_ls", task.get_dest_ls().id()))
|
||||
|| OB_FAIL(dml.add_column("balance_job_id", task.get_balance_job_id().id()))
|
||||
|| OB_FAIL(dml.add_column("transfer_task_id", task.get_transfer_task_id().id()))
|
||||
|| OB_FAIL(dml.add_column("status", task.get_task_status().to_str()))
|
||||
|| (!task.get_comment().empty() && OB_FAIL(dml.add_column("comment", task.get_comment())))) {
|
||||
LOG_WARN("failed to fill dml spliter", KR(ret), K(task));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTransferPartitionTaskTableOperator::fill_cell_(const uint64_t tenant_id,
|
||||
sqlclient::ObMySQLResult *result,
|
||||
ObTransferPartitionTask &task) {
|
||||
int ret = OB_SUCCESS;
|
||||
task.reset();
|
||||
if (OB_ISNULL(result)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("result is null", KR(ret));
|
||||
} else {
|
||||
int64_t balance_job_id = ObBalanceJobID::INVALID_ID;
|
||||
int64_t task_id = ObTransferPartitionTaskID::INVALID_ID;
|
||||
int64_t dest_ls_id = 0;
|
||||
int64_t transfer_task_id = ObTransferTaskID::INVALID_ID;
|
||||
ObString task_status;
|
||||
ObString comment;
|
||||
uint64_t table_id = OB_INVALID_ID;
|
||||
uint64_t object_id = OB_INVALID_ID;
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "task_id", task_id, int64_t);
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "table_id", table_id, uint64_t);
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "object_id", object_id, uint64_t);
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "balance_job_id", balance_job_id, int64_t);
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "dest_ls", dest_ls_id, int64_t);
|
||||
EXTRACT_INT_FIELD_MYSQL(*result, "transfer_task_id", transfer_task_id, int64_t);
|
||||
EXTRACT_VARCHAR_FIELD_MYSQL(*result, "status", task_status);
|
||||
EXTRACT_VARCHAR_FIELD_MYSQL_WITH_DEFAULT_VALUE(*result, "comment", comment, true, false, "");
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_WARN("failed to get cell", KR(ret), K(task_id), K(balance_job_id),
|
||||
K(task_status), K(dest_ls_id), K(table_id), K(object_id),
|
||||
K(transfer_task_id), K(comment));
|
||||
} else if (OB_FAIL(task.init(
|
||||
tenant_id, ObTransferPartInfo(table_id, object_id), ObLSID(dest_ls_id),
|
||||
ObTransferPartitionTaskID(task_id), ObBalanceJobID(balance_job_id),
|
||||
ObTransferTaskID(transfer_task_id),
|
||||
ObTransferPartitionTaskStatus(task_status), comment))) {
|
||||
LOG_WARN("failed to init task", KR(ret), K(task_id), K(balance_job_id),
|
||||
K(task_status), K(dest_ls_id), K(table_id),
|
||||
K(object_id), K(transfer_task_id), K(comment), K(tenant_id));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//TODO, transfer part is small than 100, no need take care of part_list count
|
||||
int ObTransferPartitionTaskTableOperator::append_sql_with_part_list_(
|
||||
const ObTransferPartList &part_list, ObSqlString &sql)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(0 >= part_list.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(sql), K(part_list));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < part_list.count(); ++i) {
|
||||
const ObTransferPartInfo& part = part_list.at(i);
|
||||
if (0 != i && OB_FAIL(sql.append(", "))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(i));
|
||||
} else if (OB_FAIL(sql.append_fmt("(%ld, %ld)", part.table_id(),
|
||||
part.part_object_id()))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(i), K(part), K(sql));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::fetch_new_task_id_(
|
||||
const uint64_t tenant_id,
|
||||
ObMySQLTransaction &trans,
|
||||
ObTransferPartitionTaskID &task_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(sql.assign_fmt(
|
||||
"select max(task_id) as task_id from (select max(task_id) as task_id from %s "
|
||||
"union select max(task_id) as task_id from %s) as a",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TNAME))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret));
|
||||
} else {
|
||||
HEAP_VAR(ObMySQLProxy::MySQLResult, res) {
|
||||
common::sqlclient::ObMySQLResult *result = NULL;
|
||||
if (OB_FAIL(trans.read(res, tenant_id, sql.ptr()))) {
|
||||
LOG_WARN("failed to read", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (OB_ISNULL(result = res.get_result())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("failed to get sql result", KR(ret));
|
||||
} else if (OB_SUCC(result->next())) {
|
||||
int64_t id = ObTransferPartitionTaskID::INVALID_ID;
|
||||
//maybe null and default is zero
|
||||
EXTRACT_INT_FIELD_MYSQL_SKIP_RET(*result, "task_id", id, int64_t);
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_WARN("failed to get task id", KR(ret), K(sql));
|
||||
} else {
|
||||
task_id = (id + 1);
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("failed to get cell", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionTaskTableOperator::load_part_list_task(
|
||||
const uint64_t tenant_id, const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
ObSqlString part_list_sql;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id)
|
||||
|| part_list.count() <= 0
|
||||
|| !job_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(part_list), K(job_id));
|
||||
} else if (OB_FAIL(append_sql_with_part_list_(part_list, part_list_sql))) {
|
||||
LOG_WARN("failed to append sql", KR(ret), K(part_list));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s where balance_job_id = %ld "
|
||||
"and (table_id, object_id) in (%s)",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
job_id.id(), part_list_sql.ptr()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(sql), K(job_id));
|
||||
} else if (OB_FAIL(get_tasks_(tenant_id, sql, task_array, trans))) {
|
||||
LOG_WARN("failed to get tasks", KR(ret), K(tenant_id), K(sql));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTransferPartitionTaskTableOperator::get_transfer_partition_task(
|
||||
const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
ObTransferPartitionTask &task,
|
||||
ObISQLClient &sql_client)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSEArray<ObTransferPartitionTask, 1> task_array;
|
||||
ObSqlString sql;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id)
|
||||
|| !part_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(part_info));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s where table_id = %ld "
|
||||
"and object_id = %ld",
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
part_info.table_id(), part_info.part_object_id()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(tenant_id), K(sql), K(part_info));
|
||||
} else if (OB_FAIL(get_tasks_(tenant_id, sql, task_array, sql_client))) {
|
||||
LOG_WARN("failed to get tasks", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (0 == task_array.count()) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
LOG_WARN("part not in transfer partition", KR(ret), K(part_info), K(tenant_id));
|
||||
} else if (1 != task_array.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("error unexpected", KR(ret), K(part_info), K(task_array));
|
||||
} else if (OB_FAIL(task.assign(task_array.at(0)))) {
|
||||
LOG_WARN("failed to assin transfer partition task", KR(ret), K(task_array));
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}//end of share
|
||||
}//end of ob
|
316
src/share/balance/ob_transfer_partition_task_table_operator.h
Normal file
316
src/share/balance/ob_transfer_partition_task_table_operator.h
Normal file
@ -0,0 +1,316 @@
|
||||
/**
|
||||
* 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_SHARE_OB_TRANSFER_PARTITION_TASK_OPERATOR_H_
|
||||
#define OCEANBASE_SHARE_OB_TRANSFER_PARTITION_TASK_OPERATOR_H_
|
||||
|
||||
#include "share/ob_ls_id.h"//share::ObLSID
|
||||
#include "share/ob_common_id.h"// ObCommonID
|
||||
#include "share/ob_balance_define.h" // ObTransferPartitionTaskID
|
||||
#include "share/transfer/ob_transfer_info.h"//ObTransferPartInfo
|
||||
#include "lib/string/ob_sql_string.h"//ObSqlString
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
|
||||
namespace common
|
||||
{
|
||||
class ObMySQLTransaction;
|
||||
class ObString;
|
||||
namespace sqltrans
|
||||
{
|
||||
class ObMySQLResult;
|
||||
}
|
||||
}
|
||||
|
||||
namespace share
|
||||
{
|
||||
class ObDMLSqlSplicer;
|
||||
class ObTransferPartitionTaskStatus
|
||||
{
|
||||
public:
|
||||
static const int64_t TRP_TASK_STATUS_INVALID = -1;
|
||||
static const int64_t TRP_TASK_STATUS_WAITING = 0;
|
||||
static const int64_t TRP_TASK_STATUS_INIT = 1;
|
||||
static const int64_t TRP_TASK_STATUS_DOING = 2;
|
||||
static const int64_t TRP_TASK_STATUS_COMPLETED = 3;
|
||||
static const int64_t TRP_TASK_STATUS_FAILED = 4;
|
||||
static const int64_t TRP_TASK_STATUS_CANCELED = 5;
|
||||
static const int64_t TRP_TASK_STATUS_MAX = 6;
|
||||
ObTransferPartitionTaskStatus(const int64_t value = TRP_TASK_STATUS_INVALID) : val_(value) {}
|
||||
ObTransferPartitionTaskStatus(const ObString &str);
|
||||
~ObTransferPartitionTaskStatus() {reset(); }
|
||||
|
||||
public:
|
||||
void reset() { val_ = TRP_TASK_STATUS_INVALID; }
|
||||
bool is_valid() const { return val_ > TRP_TASK_STATUS_INVALID
|
||||
&& val_ < TRP_TASK_STATUS_MAX; }
|
||||
const char* to_str() const;
|
||||
|
||||
// assignment
|
||||
ObTransferPartitionTaskStatus &operator=(const int64_t value) { val_ = value; return *this; }
|
||||
|
||||
// compare operator
|
||||
bool operator == (const ObTransferPartitionTaskStatus &other) const { return val_ == other.val_; }
|
||||
bool operator != (const ObTransferPartitionTaskStatus &other) const { return val_ != other.val_; }
|
||||
#define IS_TRANSFER_PARTITION_TASK(TRANSFER_PARTITION_TASK, TRANSFER_PARTITION)\
|
||||
bool is_##TRANSFER_PARTITION()const { return TRANSFER_PARTITION_TASK == val_;}
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_INVALID, invalid)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_WAITING, waiting)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_INIT, init)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_DOING, doing)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_COMPLETED, completed)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_FAILED, failed)
|
||||
IS_TRANSFER_PARTITION_TASK(TRP_TASK_STATUS_CANCELED, canceled)
|
||||
#undef IS_TRANSFER_PARTITION_TASK
|
||||
bool is_finish_status() const
|
||||
{
|
||||
return is_completed() || is_failed() || is_canceled();
|
||||
}
|
||||
TO_STRING_KV(K_(val), "job_status", to_str());
|
||||
private:
|
||||
int64_t val_;
|
||||
};
|
||||
|
||||
struct ObTransferPartitionTask
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionTask() { reset(); }
|
||||
~ObTransferPartitionTask() {}
|
||||
void reset();
|
||||
//set status_ to waiting, reset balance_job_id_, reset transfer_task_id_
|
||||
int simple_init(const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls,
|
||||
const ObTransferPartitionTaskID &task_id);
|
||||
int init(const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls,
|
||||
const ObTransferPartitionTaskID &task_id,
|
||||
const ObBalanceJobID &balance_job_id,
|
||||
const ObTransferTaskID &transfer_task_id,
|
||||
const ObTransferPartitionTaskStatus &task_status,
|
||||
const ObString &comment);
|
||||
bool is_valid() const;
|
||||
int assign(const ObTransferPartitionTask &other);
|
||||
TO_STRING_KV(K_(tenant_id), K_(part_info), K_(dest_ls), K_(task_id),
|
||||
K_(balance_job_id), K_(transfer_task_id), K_(task_status), K_(comment));
|
||||
|
||||
#define Property_declare_var(variable_type, variable_name) \
|
||||
private: \
|
||||
variable_type variable_name##_; \
|
||||
\
|
||||
public: \
|
||||
variable_type get_##variable_name() const { return variable_name##_; }
|
||||
|
||||
Property_declare_var(uint64_t, tenant_id)
|
||||
Property_declare_var(ObLSID, dest_ls)
|
||||
Property_declare_var(ObTransferPartitionTaskID, task_id)
|
||||
Property_declare_var(ObBalanceJobID, balance_job_id)
|
||||
Property_declare_var(ObTransferTaskID, transfer_task_id)
|
||||
Property_declare_var(ObTransferPartitionTaskStatus, task_status)
|
||||
|
||||
#undef Property_declare_var
|
||||
public:
|
||||
const ObSqlString& get_comment() const
|
||||
{
|
||||
return comment_;
|
||||
}
|
||||
const ObTransferPartInfo& get_part_info() const
|
||||
{
|
||||
return part_info_;
|
||||
}
|
||||
private:
|
||||
ObTransferPartInfo part_info_;
|
||||
ObSqlString comment_;
|
||||
};
|
||||
|
||||
class ObTransferPartitionTaskTableOperator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* for add task by sql
|
||||
* @description: insert new task to __all_transfer_partition_task
|
||||
* @param[in] task : a valid transfer partition task include tenant_id
|
||||
* @param[in] trans: trans
|
||||
* @return OB_SUCCESS if success, otherwise failed
|
||||
*/
|
||||
static int insert_new_task(
|
||||
const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
const ObLSID &dest_ls,
|
||||
ObMySQLTransaction &trans);
|
||||
/* 生成任务时,需要获取所有的transfer partition任务,不关心是否有并发的新插入的任务。
|
||||
* @description: get all transfer partition task from __all_transfer_partition_task
|
||||
and smaller than max_task_id
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] max_task_id : max_task_id
|
||||
* @param[in] for_update
|
||||
* @param[in] trans: trans
|
||||
* @param[out] task_array: transfer_partition_task
|
||||
* */
|
||||
static int load_all_wait_task_in_part_info_order(const uint64_t tenant_id,
|
||||
const bool for_update,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client);
|
||||
/*
|
||||
* @description: get all transfer partition task from __all_transfer_partition_task
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] trans: sql trans or trans
|
||||
* @param[out] task_array: transfer_partition_task
|
||||
* */
|
||||
static int load_all_task(const uint64_t tenant_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client);
|
||||
/*
|
||||
* @description:获取某个balance_job的所有的任务
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[in] trans: sql trans or trans
|
||||
* @param[out] task_array: transfer_partition_task
|
||||
* */
|
||||
static int load_all_balance_job_task(const uint64_t tenant_id,
|
||||
const share::ObBalanceJobID &job_id,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client);
|
||||
|
||||
/*
|
||||
* 构造任务时,需要保证任务之间的偏序关系,后插进来的任务task_id是小的,可能会把多个任务合并成一个balance_job
|
||||
* 所以不能一个个的改,需要改一批,利用了偏序关系
|
||||
* 后续如果有需求的话,可以按照批来做,例如1024个任务做一批
|
||||
* @description: set all task smaller than max_task_id from waiting to schedule and set balance job id
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] max_task_id : max_task_id
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[in] task_count: for double check the task smller than max_task_id and affected_rows
|
||||
* @param[in] trans: trans
|
||||
* @return OB_SUCCESS if success, otherwise failed
|
||||
* */
|
||||
static int set_all_tasks_schedule(const uint64_t tenant_id,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const int64_t &task_count,
|
||||
ObMySQLTransaction &trans);
|
||||
/*
|
||||
* 关闭enable_transfer的时候,当前的balance_job需要取消掉,和balance_job关联的transfer partition任务需要回到waiting状态
|
||||
* @description: balance job maybe cancel, Disassociate balance_job and transfer_partition_task,
|
||||
* rollback task from doing to waiting, and clean balance_job and transfer_task_id
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[in] trans: must in trans
|
||||
* */
|
||||
static int rollback_all_to_waitting(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
ObMySQLTransaction &trans);
|
||||
/*
|
||||
* 当一个transfer任务开始时,需要标记这一批任务transfer task
|
||||
* @description: set task corelative transfer task ID
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[in] part_list : part_info start transfer
|
||||
* @param[in] transfer_task_id : the corelative transfer task id
|
||||
* @param[in] trans: must in trans
|
||||
* */
|
||||
static int start_transfer_task(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObTransferTaskID &transfer_task_id,
|
||||
ObMySQLTransaction &trans);
|
||||
|
||||
/*
|
||||
* 任务在执行时发现分区不在需要失败掉,调用点在finish_task_from_init和生成balance_job的过程中
|
||||
* transfer任务在执行成功的时候,需要结束掉,调用点在finish_task里面
|
||||
* canceled这个状态这一次不做
|
||||
* @description: task maybe CANCELED, FAILED, COMPLETE
|
||||
* and insert into __all_transfer_partition_task_history
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] part_list : part_info need finish
|
||||
* @param[in] status : must be CANCELED, FAILED, COMPLETE, must be finish
|
||||
* @param[in] max_task_id: max_task_id
|
||||
* @param[in] comment : task comment
|
||||
* @param[in] trans: must in trans
|
||||
* */
|
||||
static int finish_task(const uint64_t tenant_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObTransferPartitionTaskID &max_task_id,
|
||||
const ObTransferPartitionTaskStatus &status,
|
||||
const ObString &comment,
|
||||
ObMySQLTransaction &trans);
|
||||
/*
|
||||
* transfer任务在结束时可能会存在一批not_exist的分区,但是这一部分分区可能
|
||||
* 不是真的not_exist,可能是由于前置统计的源端日志流不正确导致的,需要回滚掉
|
||||
* 这部分任务的状态到waiting状态,重新生成任务
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[in] part_list : part_info start transfer
|
||||
* @param[in] transfer_task_id : the corelative transfer task id
|
||||
* @param[in] comment : reason of rollback
|
||||
* @param[in] trans: must in trans
|
||||
* */
|
||||
|
||||
static int rollback_from_doing_to_waiting(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,
|
||||
const ObString &comment,
|
||||
ObMySQLTransaction &trans);
|
||||
|
||||
/*
|
||||
* 获取一批part_list的任务信息,part_list可能不存在表里。
|
||||
* @description: get dest_ls of part_list
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] part_list : part_info
|
||||
* @param[in] job_id : the corelative balance job id
|
||||
* @param[out] dest_ls : dest_ls of part_info
|
||||
* @param[in] trans: must in trans
|
||||
*/
|
||||
static int load_part_list_task(const uint64_t tenant_id,
|
||||
const ObBalanceJobID &job_id,
|
||||
const ObTransferPartList &part_list,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObMySQLTransaction &trans);
|
||||
/*
|
||||
* 获取指定分区的transfer partition task
|
||||
* @description: get transfer partition task of part
|
||||
* @param[in] tenant_id : user_tenant_id
|
||||
* @param[in] part_info : table_id and part_object_id
|
||||
* @param[out] task : transfer partition task
|
||||
* @param[in] sql_client: trans or sql_client
|
||||
* return OB_SUCCESS if success,
|
||||
* OB_ENTRY_NOT_EXIST if task not exist
|
||||
* otherwise failed
|
||||
* */
|
||||
static int get_transfer_partition_task(const uint64_t tenant_id,
|
||||
const ObTransferPartInfo &part_info,
|
||||
ObTransferPartitionTask &task,
|
||||
ObISQLClient &sql_client);
|
||||
private:
|
||||
static int fill_dml_splicer_(share::ObDMLSqlSplicer &dml,
|
||||
const ObTransferPartitionTask &task);
|
||||
static int fill_cell_(const uint64_t tenant_id,
|
||||
sqlclient::ObMySQLResult *result,
|
||||
ObTransferPartitionTask &task);
|
||||
static int append_sql_with_part_list_(const ObTransferPartList &part_list,
|
||||
ObSqlString &sql);
|
||||
static int get_tasks_(const uint64_t tenant_id,
|
||||
const ObSqlString &sql,
|
||||
ObIArray<ObTransferPartitionTask> &task_array,
|
||||
ObISQLClient &sql_client);
|
||||
static int fetch_new_task_id_(const uint64_t tenant_id,
|
||||
ObMySQLTransaction &trans,
|
||||
ObTransferPartitionTaskID &task_id);
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !OCEANBASE_SHARE_OB_TRANSFER_PARTITION_TASK_OPERATOR_H_ */
|
@ -25,6 +25,460 @@ using namespace common;
|
||||
namespace share
|
||||
{
|
||||
|
||||
int ObInnerTableSchema::all_virtual_transfer_partition_task_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_TRANSFER_PARTITION_TASK_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(2);
|
||||
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_TRANSFER_PARTITION_TASK_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("tenant_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("task_id", //column_name
|
||||
++column_id, //column_id
|
||||
2, //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_TS("gmt_create", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("gmt_modified", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("table_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("object_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("dest_ls", //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("status", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("balance_job_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("transfer_task_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("comment", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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::all_virtual_transfer_partition_task_history_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_TRANSFER_PARTITION_TASK_HISTORY_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(2);
|
||||
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_TRANSFER_PARTITION_TASK_HISTORY_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("tenant_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("task_id", //column_name
|
||||
++column_id, //column_id
|
||||
2, //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_TS("gmt_create", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("gmt_modified", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("table_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("object_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("dest_ls", //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("status", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("balance_job_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("transfer_task_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("comment", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("create_time", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("finish_time", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
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::all_virtual_tenant_snapshot_job_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -4967,6 +4967,424 @@ int ObInnerTableSchema::all_virtual_aux_stat_real_agent_ora_schema(ObTableSchema
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_transfer_partition_task_real_agent_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_TRANSFER_PARTITION_TASK_REAL_AGENT_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(1);
|
||||
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_TRANSFER_PARTITION_TASK_REAL_AGENT_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("TASK_ID", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("TABLE_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("OBJECT_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("DEST_LS", //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("STATUS", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("BALANCE_JOB_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("TRANSFER_TASK_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("COMMENT", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //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("GMT_MODIFIED", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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::all_virtual_transfer_partition_task_history_real_agent_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_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_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(1);
|
||||
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_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_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("TASK_ID", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("TABLE_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("OBJECT_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("DEST_LS", //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("STATUS", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("BALANCE_JOB_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("TRANSFER_TASK_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("COMMENT", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("CREATE_TIME", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //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("FINISH_TIME", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //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("GMT_CREATE", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //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("GMT_MODIFIED", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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::all_virtual_ls_snapshot_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -25,6 +25,206 @@ using namespace common;
|
||||
namespace share
|
||||
{
|
||||
|
||||
int ObInnerTableSchema::dba_ob_transfer_partition_tasks_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_DBA_OB_TRANSFER_PARTITION_TASKS_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_DBA_OB_TRANSFER_PARTITION_TASKS_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 TASK_ID, GMT_CREATE AS CREATE_TIME, GMT_MODIFIED AS MODIFY_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, COMMENT FROM oceanbase.__all_transfer_partition_task )__"))) {
|
||||
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::cdb_ob_transfer_partition_tasks_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_CDB_OB_TRANSFER_PARTITION_TASKS_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_CDB_OB_TRANSFER_PARTITION_TASKS_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 TENANT_ID, TASK_ID, GMT_CREATE AS CREATE_TIME, GMT_MODIFIED AS MODIFY_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, COMMENT FROM oceanbase.__all_virtual_transfer_partition_task )__"))) {
|
||||
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::dba_ob_transfer_partition_task_history_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_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_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_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_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 TASK_ID, CREATE_TIME, FINISH_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, COMMENT FROM oceanbase.__all_transfer_partition_task_history )__"))) {
|
||||
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::cdb_ob_transfer_partition_task_history_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_CDB_OB_TRANSFER_PARTITION_TASK_HISTORY_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_CDB_OB_TRANSFER_PARTITION_TASK_HISTORY_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 TENANT_ID, TASK_ID, CREATE_TIME, FINISH_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, COMMENT FROM oceanbase.__all_virtual_transfer_partition_task_history )__"))) {
|
||||
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::dba_ob_trusted_root_certificate_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -625,6 +625,106 @@ int ObInnerTableSchema::dba_ob_import_table_task_history_ora_schema(ObTableSchem
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::dba_ob_transfer_partition_tasks_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_DBA_OB_TRANSFER_PARTITION_TASKS_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_DBA_OB_TRANSFER_PARTITION_TASKS_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 TASK_ID, GMT_CREATE AS CREATE_TIME, GMT_MODIFIED AS MODIFY_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, "COMMENT" FROM SYS.ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT )__"))) {
|
||||
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::dba_ob_transfer_partition_task_history_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_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_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_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_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 TASK_ID, CREATE_TIME, FINISH_TIME, TABLE_ID, OBJECT_ID, DEST_LS, BALANCE_JOB_ID, TRANSFER_TASK_ID, STATUS, "COMMENT" FROM SYS.ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT )__"))) {
|
||||
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::user_users_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -11696,6 +11696,123 @@ int ObInnerTableSchema::all_mview_refresh_stats_idx_mview_refresh_stats_mview_en
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_idx_transfer_partition_key_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(USER_INDEX);
|
||||
table_schema.set_index_type(INDEX_TYPE_UNIQUE_LOCAL);
|
||||
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_table_name(OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_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)) {
|
||||
++column_id; // for gmt_create
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
++column_id; // for gmt_modified
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("table_id", //column_name
|
||||
column_id + 2, //column_id
|
||||
1, //rowkey_id
|
||||
1, //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("object_id", //column_name
|
||||
column_id + 3, //column_id
|
||||
2, //rowkey_id
|
||||
2, //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_WITH_COLUMN_FLAGS("shadow_pk_0", //column_name
|
||||
column_id + 32768, //column_id
|
||||
3, //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
|
||||
true,//is_nullable
|
||||
false,//is_autoincrement
|
||||
true,//is_hidden
|
||||
false);//is_storing_column
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("task_id", //column_name
|
||||
column_id + 1, //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
|
||||
}
|
||||
table_schema.set_index_status(INDEX_STATUS_AVAILABLE);
|
||||
table_schema.set_index_type(INDEX_TYPE_UNIQUE_LOCAL);
|
||||
table_schema.set_data_table_id(OB_ALL_TRANSFER_PARTITION_TASK_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id + 32768);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_table_real_agent_ora_idx_data_table_id_real_agent_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -11295,6 +11295,462 @@ int ObInnerTableSchema::all_index_usage_info_schema(ObTableSchema &table_schema)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_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_TRANSFER_PARTITION_TASK_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)) {
|
||||
ObObj gmt_create_default;
|
||||
ObObj gmt_create_default_null;
|
||||
|
||||
gmt_create_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
|
||||
gmt_create_default_null.set_null();
|
||||
ADD_COLUMN_SCHEMA_TS_T("gmt_create", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_BINARY,//collation_type
|
||||
0, //column length
|
||||
-1, //column_precision
|
||||
6, //column_scale
|
||||
true,//is nullable
|
||||
false, //is_autoincrement
|
||||
false, //is_on_update_for_timestamp
|
||||
gmt_create_default_null,
|
||||
gmt_create_default)
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ObObj gmt_modified_default;
|
||||
ObObj gmt_modified_default_null;
|
||||
|
||||
gmt_modified_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
|
||||
gmt_modified_default_null.set_null();
|
||||
ADD_COLUMN_SCHEMA_TS_T("gmt_modified", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_BINARY,//collation_type
|
||||
0, //column length
|
||||
-1, //column_precision
|
||||
6, //column_scale
|
||||
true,//is nullable
|
||||
false, //is_autoincrement
|
||||
true, //is_on_update_for_timestamp
|
||||
gmt_modified_default_null,
|
||||
gmt_modified_default)
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("task_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("table_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("object_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("dest_ls", //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("status", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("balance_job_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("transfer_task_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("comment", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_TID);
|
||||
table_schema.set_aux_lob_meta_tid(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TID);
|
||||
table_schema.set_aux_lob_piece_tid(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_history_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(SYSTEM_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_TRANSFER_PARTITION_TASK_HISTORY_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)) {
|
||||
ObObj gmt_create_default;
|
||||
ObObj gmt_create_default_null;
|
||||
|
||||
gmt_create_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
|
||||
gmt_create_default_null.set_null();
|
||||
ADD_COLUMN_SCHEMA_TS_T("gmt_create", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_BINARY,//collation_type
|
||||
0, //column length
|
||||
-1, //column_precision
|
||||
6, //column_scale
|
||||
true,//is nullable
|
||||
false, //is_autoincrement
|
||||
false, //is_on_update_for_timestamp
|
||||
gmt_create_default_null,
|
||||
gmt_create_default)
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ObObj gmt_modified_default;
|
||||
ObObj gmt_modified_default_null;
|
||||
|
||||
gmt_modified_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
|
||||
gmt_modified_default_null.set_null();
|
||||
ADD_COLUMN_SCHEMA_TS_T("gmt_modified", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_BINARY,//collation_type
|
||||
0, //column length
|
||||
-1, //column_precision
|
||||
6, //column_scale
|
||||
true,//is nullable
|
||||
false, //is_autoincrement
|
||||
true, //is_on_update_for_timestamp
|
||||
gmt_modified_default_null,
|
||||
gmt_modified_default)
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("task_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("table_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("object_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("dest_ls", //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("status", //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
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("balance_job_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("transfer_task_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("comment", //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
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("create_time", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("finish_time", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(ObPreciseDateTime), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
false); //is_on_update_for_timestamp
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID);
|
||||
table_schema.set_aux_lob_meta_tid(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TID);
|
||||
table_schema.set_aux_lob_piece_tid(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -4480,6 +4480,276 @@ int ObInnerTableSchema::all_index_usage_info_aux_lob_meta_schema(ObTableSchema &
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_aux_lob_meta_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_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(2);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(AUX_LOB_META);
|
||||
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_TRANSFER_PARTITION_TASK_AUX_LOB_META_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("lob_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
16, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("seq_id", //column_name
|
||||
++column_id, //column_id
|
||||
2, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
8192, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("binary_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("char_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("piece_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("lob_data", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
262144, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TID);
|
||||
table_schema.set_data_table_id(OB_ALL_TRANSFER_PARTITION_TASK_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_history_aux_lob_meta_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_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(2);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(AUX_LOB_META);
|
||||
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_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_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("lob_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
16, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("seq_id", //column_name
|
||||
++column_id, //column_id
|
||||
2, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
8192, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("binary_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("char_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("piece_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("lob_data", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
262144, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TID);
|
||||
table_schema.set_data_table_id(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -2995,6 +2995,186 @@ int ObInnerTableSchema::all_index_usage_info_aux_lob_piece_schema(ObTableSchema
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_aux_lob_piece_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(AUX_LOB_PIECE);
|
||||
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_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_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("piece_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("data_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("lob_data", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
32, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TID);
|
||||
table_schema.set_data_table_id(OB_ALL_TRANSFER_PARTITION_TASK_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_transfer_partition_task_history_aux_lob_piece_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_SYS_TABLEGROUP_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(AUX_LOB_PIECE);
|
||||
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_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_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("piece_id", //column_name
|
||||
++column_id, //column_id
|
||||
1, //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("data_len", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("lob_data", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_BINARY, //column_collation_type
|
||||
32, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
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(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TID);
|
||||
table_schema.set_data_table_id(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -571,6 +571,8 @@ public:
|
||||
static int all_clone_job_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_aux_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_index_usage_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_job_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_trusted_root_certificate_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_ls_replica_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -999,6 +1001,8 @@ public:
|
||||
static int all_virtual_checkpoint_diagnose_checkpoint_unit_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_checkpoint_diagnose_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_aux_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_transfer_partition_task_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_transfer_partition_task_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tenant_snapshot_job_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_ls_snapshot_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_index_usage_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1261,6 +1265,8 @@ public:
|
||||
static int all_virtual_ls_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_cgroup_config_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_aux_stat_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_transfer_partition_task_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
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 gv_ob_plan_cache_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1635,6 +1641,10 @@ public:
|
||||
static int dba_ob_aux_statistics_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_aux_statistics_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_index_usage_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_transfer_partition_tasks_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_transfer_partition_tasks_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_transfer_partition_task_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_transfer_partition_task_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_trusted_root_certificate_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_clone_progress_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_index_usage_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1911,6 +1921,8 @@ public:
|
||||
static int dba_ob_import_table_job_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_import_table_tasks_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_import_table_task_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_transfer_partition_tasks_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_transfer_partition_task_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int user_users_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_mview_logs_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_mview_logs_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -2382,6 +2394,8 @@ public:
|
||||
static int all_clone_job_history_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_aux_stat_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_index_usage_info_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_history_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_job_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_trusted_root_certificate_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_ls_replica_history_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -2664,6 +2678,8 @@ public:
|
||||
static int all_clone_job_history_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_aux_stat_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_index_usage_info_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_history_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_job_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_trusted_root_certificate_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_tenant_snapshot_ls_replica_history_aux_lob_piece_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -2860,6 +2876,7 @@ public:
|
||||
static int all_mview_refresh_run_stats_idx_mview_refresh_run_stats_num_mvs_current_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_mview_refresh_stats_idx_mview_refresh_stats_end_time_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_mview_refresh_stats_idx_mview_refresh_stats_mview_end_time_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_transfer_partition_task_idx_transfer_partition_key_schema(share::schema::ObTableSchema &table_schema);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObInnerTableSchema);
|
||||
@ -3154,6 +3171,8 @@ const schema_create_func sys_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_clone_job_history_schema,
|
||||
ObInnerTableSchema::all_aux_stat_schema,
|
||||
ObInnerTableSchema::all_index_usage_info_schema,
|
||||
ObInnerTableSchema::all_transfer_partition_task_schema,
|
||||
ObInnerTableSchema::all_transfer_partition_task_history_schema,
|
||||
ObInnerTableSchema::all_tenant_snapshot_job_schema,
|
||||
ObInnerTableSchema::all_trusted_root_certificate_schema,
|
||||
ObInnerTableSchema::all_tenant_snapshot_ls_replica_history_schema,
|
||||
@ -3585,6 +3604,8 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_checkpoint_diagnose_checkpoint_unit_info_schema,
|
||||
ObInnerTableSchema::all_virtual_checkpoint_diagnose_info_schema,
|
||||
ObInnerTableSchema::all_virtual_aux_stat_schema,
|
||||
ObInnerTableSchema::all_virtual_transfer_partition_task_schema,
|
||||
ObInnerTableSchema::all_virtual_transfer_partition_task_history_schema,
|
||||
ObInnerTableSchema::all_virtual_tenant_snapshot_job_schema,
|
||||
ObInnerTableSchema::all_virtual_ls_snapshot_schema,
|
||||
ObInnerTableSchema::all_virtual_index_usage_info_schema,
|
||||
@ -3857,6 +3878,8 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_ls_info_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_cgroup_config_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_aux_stat_real_agent_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_transfer_partition_task_real_agent_ora_schema,
|
||||
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_table_real_agent_ora_idx_data_table_id_real_agent_schema,
|
||||
@ -4315,6 +4338,10 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::dba_ob_aux_statistics_schema,
|
||||
ObInnerTableSchema::cdb_ob_aux_statistics_schema,
|
||||
ObInnerTableSchema::dba_index_usage_schema,
|
||||
ObInnerTableSchema::dba_ob_transfer_partition_tasks_schema,
|
||||
ObInnerTableSchema::cdb_ob_transfer_partition_tasks_schema,
|
||||
ObInnerTableSchema::dba_ob_transfer_partition_task_history_schema,
|
||||
ObInnerTableSchema::cdb_ob_transfer_partition_task_history_schema,
|
||||
ObInnerTableSchema::dba_ob_trusted_root_certificate_schema,
|
||||
ObInnerTableSchema::dba_ob_clone_progress_schema,
|
||||
ObInnerTableSchema::cdb_index_usage_schema,
|
||||
@ -4591,6 +4618,8 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::dba_ob_import_table_job_history_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_import_table_tasks_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_import_table_task_history_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_transfer_partition_tasks_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_transfer_partition_task_history_ora_schema,
|
||||
ObInnerTableSchema::user_users_schema,
|
||||
ObInnerTableSchema::dba_mview_logs_ora_schema,
|
||||
ObInnerTableSchema::all_mview_logs_ora_schema,
|
||||
@ -4891,6 +4920,7 @@ const schema_create_func sys_index_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_mview_refresh_run_stats_idx_mview_refresh_run_stats_num_mvs_current_schema,
|
||||
ObInnerTableSchema::all_mview_refresh_stats_idx_mview_refresh_stats_end_time_schema,
|
||||
ObInnerTableSchema::all_mview_refresh_stats_idx_mview_refresh_stats_mview_end_time_schema,
|
||||
ObInnerTableSchema::all_transfer_partition_task_idx_transfer_partition_key_schema,
|
||||
NULL,};
|
||||
|
||||
const schema_create_func information_schema_table_schema_creators[] = {
|
||||
@ -5159,6 +5189,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_TID,
|
||||
OB_ALL_AUX_STAT_TID,
|
||||
OB_ALL_INDEX_USAGE_INFO_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TID,
|
||||
OB_TENANT_VIRTUAL_ALL_TABLE_TID,
|
||||
@ -5649,6 +5681,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_VIRTUAL_LS_INFO_ORA_TID,
|
||||
OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TID,
|
||||
OB_ALL_VIRTUAL_AUX_STAT_REAL_AGENT_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TID,
|
||||
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_GV_OB_PLAN_CACHE_STAT_TID,
|
||||
@ -5918,6 +5952,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_V_OB_CGROUP_CONFIG_TID,
|
||||
OB_DBA_OB_AUX_STATISTICS_TID,
|
||||
OB_DBA_INDEX_USAGE_TID,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASKS_TID,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_TID,
|
||||
OB_GV_OB_LS_SNAPSHOTS_TID,
|
||||
OB_V_OB_LS_SNAPSHOTS_TID,
|
||||
OB_DBA_MVIEW_LOGS_TID,
|
||||
@ -6182,6 +6218,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_DBA_OB_IMPORT_TABLE_JOB_HISTORY_ORA_TID,
|
||||
OB_DBA_OB_IMPORT_TABLE_TASKS_ORA_TID,
|
||||
OB_DBA_OB_IMPORT_TABLE_TASK_HISTORY_ORA_TID,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASKS_ORA_TID,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_ORA_TID,
|
||||
OB_USER_USERS_TID,
|
||||
OB_DBA_MVIEW_LOGS_ORA_TID,
|
||||
OB_ALL_MVIEW_LOGS_ORA_TID,
|
||||
@ -6470,6 +6508,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_MVIEW_REFRESH_RUN_STATS_IDX_MVIEW_REFRESH_RUN_STATS_NUM_MVS_CURRENT_TID,
|
||||
OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_END_TIME_TID,
|
||||
OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DATA_TABLE_ID_REAL_AGENT_TID,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DB_TB_NAME_REAL_AGENT_TID,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_TB_NAME_REAL_AGENT_TID,
|
||||
@ -6800,6 +6839,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_META_TID,
|
||||
OB_ALL_AUX_STAT_AUX_LOB_META_TID,
|
||||
OB_ALL_INDEX_USAGE_INFO_AUX_LOB_META_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_META_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_META_TID,
|
||||
OB_ALL_TABLE_AUX_LOB_PIECE_TID,
|
||||
@ -7060,6 +7101,8 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_AUX_STAT_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_INDEX_USAGE_INFO_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_PIECE_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_PIECE_TID, };
|
||||
|
||||
@ -7616,6 +7659,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_TNAME,
|
||||
OB_ALL_AUX_STAT_TNAME,
|
||||
OB_ALL_INDEX_USAGE_INFO_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TNAME,
|
||||
OB_TENANT_VIRTUAL_ALL_TABLE_TNAME,
|
||||
@ -8106,6 +8151,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_VIRTUAL_LS_INFO_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_AUX_STAT_REAL_AGENT_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TNAME,
|
||||
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_GV_OB_PLAN_CACHE_STAT_TNAME,
|
||||
@ -8375,6 +8422,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_V_OB_CGROUP_CONFIG_TNAME,
|
||||
OB_DBA_OB_AUX_STATISTICS_TNAME,
|
||||
OB_DBA_INDEX_USAGE_TNAME,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASKS_TNAME,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_TNAME,
|
||||
OB_GV_OB_LS_SNAPSHOTS_TNAME,
|
||||
OB_V_OB_LS_SNAPSHOTS_TNAME,
|
||||
OB_DBA_MVIEW_LOGS_TNAME,
|
||||
@ -8639,6 +8688,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_DBA_OB_IMPORT_TABLE_JOB_HISTORY_ORA_TNAME,
|
||||
OB_DBA_OB_IMPORT_TABLE_TASKS_ORA_TNAME,
|
||||
OB_DBA_OB_IMPORT_TABLE_TASK_HISTORY_ORA_TNAME,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASKS_ORA_TNAME,
|
||||
OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_ORA_TNAME,
|
||||
OB_USER_USERS_TNAME,
|
||||
OB_DBA_MVIEW_LOGS_ORA_TNAME,
|
||||
OB_ALL_MVIEW_LOGS_ORA_TNAME,
|
||||
@ -8927,6 +8978,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_MVIEW_REFRESH_RUN_STATS_IDX_MVIEW_REFRESH_RUN_STATS_NUM_MVS_CURRENT_TNAME,
|
||||
OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_END_TIME_TNAME,
|
||||
OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TNAME,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DATA_TABLE_ID_REAL_AGENT_TNAME,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DB_TB_NAME_REAL_AGENT_TNAME,
|
||||
OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_TB_NAME_REAL_AGENT_TNAME,
|
||||
@ -9257,6 +9309,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_META_TNAME,
|
||||
OB_ALL_AUX_STAT_AUX_LOB_META_TNAME,
|
||||
OB_ALL_INDEX_USAGE_INFO_AUX_LOB_META_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_META_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_META_TNAME,
|
||||
OB_ALL_TABLE_AUX_LOB_PIECE_TNAME,
|
||||
@ -9517,6 +9571,8 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_AUX_STAT_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_INDEX_USAGE_INFO_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_PIECE_TNAME,
|
||||
OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_PIECE_TNAME, };
|
||||
|
||||
@ -9857,6 +9913,8 @@ const uint64_t restrict_access_virtual_tables[] = {
|
||||
OB_ALL_VIRTUAL_IMPORT_TABLE_TASK_ORA_TID,
|
||||
OB_ALL_VIRTUAL_IMPORT_TABLE_TASK_HISTORY_ORA_TID,
|
||||
OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TID,
|
||||
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 };
|
||||
|
||||
@ -12237,6 +12295,22 @@ LOBMapping const lob_aux_table_mappings [] = {
|
||||
ObInnerTableSchema::all_index_usage_info_aux_lob_piece_schema
|
||||
},
|
||||
|
||||
{
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TID,
|
||||
ObInnerTableSchema::all_transfer_partition_task_aux_lob_meta_schema,
|
||||
ObInnerTableSchema::all_transfer_partition_task_aux_lob_piece_schema
|
||||
},
|
||||
|
||||
{
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TID,
|
||||
OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TID,
|
||||
ObInnerTableSchema::all_transfer_partition_task_history_aux_lob_meta_schema,
|
||||
ObInnerTableSchema::all_transfer_partition_task_history_aux_lob_piece_schema
|
||||
},
|
||||
|
||||
{
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_TID,
|
||||
OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_META_TID,
|
||||
@ -12298,12 +12372,12 @@ 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 = 279;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 780;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 840;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1904;
|
||||
const int64_t OB_SYS_TABLE_COUNT = 281;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 784;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 846;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1916;
|
||||
const int64_t OB_CORE_SCHEMA_VERSION = 1;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1907;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1919;
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -21,7 +21,7 @@ inner_lob_map_t inner_lob_map;
|
||||
bool lob_mapping_init()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(inner_lob_map.create(282, ObModIds::OB_INNER_LOB_HASH_SET))) {
|
||||
if (OB_FAIL(inner_lob_map.create(284, ObModIds::OB_INNER_LOB_HASH_SET))) {
|
||||
SERVER_LOG(WARN, "fail to create inner lob map", K(ret));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < ARRAYSIZEOF(lob_aux_table_mappings); ++i) {
|
||||
|
@ -1183,6 +1183,20 @@ bool vt_mapping_init()
|
||||
tmp_vt_mapping.is_real_vt_ = true;
|
||||
}
|
||||
|
||||
{
|
||||
int64_t idx = OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT_ORA_TID - start_idx;
|
||||
VTMapping &tmp_vt_mapping = vt_mappings[idx];
|
||||
tmp_vt_mapping.mapping_tid_ = OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID;
|
||||
tmp_vt_mapping.is_real_vt_ = true;
|
||||
}
|
||||
|
||||
{
|
||||
int64_t idx = OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TID - start_idx;
|
||||
VTMapping &tmp_vt_mapping = vt_mappings[idx];
|
||||
tmp_vt_mapping.mapping_tid_ = OB_ALL_TRANSFER_PARTITION_TASK_TID;
|
||||
tmp_vt_mapping.is_real_vt_ = true;
|
||||
}
|
||||
|
||||
{
|
||||
int64_t idx = OB_ALL_VIRTUAL_TRANSFER_TASK_HISTORY_REAL_AGENT_ORA_TID - start_idx;
|
||||
VTMapping &tmp_vt_mapping = vt_mappings[idx];
|
||||
|
@ -307,6 +307,8 @@ const uint64_t OB_ALL_CLONE_JOB_TID = 485; // "__all_clone_job"
|
||||
const uint64_t OB_ALL_CLONE_JOB_HISTORY_TID = 486; // "__all_clone_job_history"
|
||||
const uint64_t OB_ALL_AUX_STAT_TID = 494; // "__all_aux_stat"
|
||||
const uint64_t OB_ALL_INDEX_USAGE_INFO_TID = 495; // "__all_index_usage_info"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_TID = 498; // "__all_transfer_partition_task"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID = 499; // "__all_transfer_partition_task_history"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_JOB_TID = 500; // "__all_tenant_snapshot_job"
|
||||
const uint64_t OB_ALL_TRUSTED_ROOT_CERTIFICATE_TID = 502; // "__all_trusted_root_certificate"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TID = 507; // "__all_tenant_snapshot_ls_replica_history"
|
||||
@ -735,6 +737,8 @@ const uint64_t OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_MEMTABLE_INFO_TID = 12437; //
|
||||
const uint64_t OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_CHECKPOINT_UNIT_INFO_TID = 12438; // "__all_virtual_checkpoint_diagnose_checkpoint_unit_info"
|
||||
const uint64_t OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_INFO_TID = 12439; // "__all_virtual_checkpoint_diagnose_info"
|
||||
const uint64_t OB_ALL_VIRTUAL_AUX_STAT_TID = 12447; // "__all_virtual_aux_stat"
|
||||
const uint64_t OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_TID = 12451; // "__all_virtual_transfer_partition_task"
|
||||
const uint64_t OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_TID = 12452; // "__all_virtual_transfer_partition_task_history"
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_SNAPSHOT_JOB_TID = 12453; // "__all_virtual_tenant_snapshot_job"
|
||||
const uint64_t OB_ALL_VIRTUAL_LS_SNAPSHOT_TID = 12458; // "__all_virtual_ls_snapshot"
|
||||
const uint64_t OB_ALL_VIRTUAL_INDEX_USAGE_INFO_TID = 12459; // "__all_virtual_index_usage_info"
|
||||
@ -997,6 +1001,8 @@ const uint64_t OB_ALL_VIRTUAL_IMPORT_TABLE_TASK_HISTORY_ORA_TID = 15412; // "ALL
|
||||
const uint64_t OB_ALL_VIRTUAL_LS_INFO_ORA_TID = 15414; // "ALL_VIRTUAL_LS_INFO_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TID = 15418; // "ALL_VIRTUAL_CGROUP_CONFIG_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_AUX_STAT_REAL_AGENT_ORA_TID = 15427; // "ALL_VIRTUAL_AUX_STAT_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TID = 15430; // "ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA"
|
||||
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_GV_OB_PLAN_CACHE_STAT_TID = 20001; // "GV$OB_PLAN_CACHE_STAT"
|
||||
@ -1371,6 +1377,10 @@ const uint64_t OB_V_OB_CGROUP_CONFIG_TID = 21480; // "V$OB_CGROUP_CONFIG"
|
||||
const uint64_t OB_DBA_OB_AUX_STATISTICS_TID = 21497; // "DBA_OB_AUX_STATISTICS"
|
||||
const uint64_t OB_CDB_OB_AUX_STATISTICS_TID = 21498; // "CDB_OB_AUX_STATISTICS"
|
||||
const uint64_t OB_DBA_INDEX_USAGE_TID = 21499; // "DBA_INDEX_USAGE"
|
||||
const uint64_t OB_DBA_OB_TRANSFER_PARTITION_TASKS_TID = 21501; // "DBA_OB_TRANSFER_PARTITION_TASKS"
|
||||
const uint64_t OB_CDB_OB_TRANSFER_PARTITION_TASKS_TID = 21502; // "CDB_OB_TRANSFER_PARTITION_TASKS"
|
||||
const uint64_t OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_TID = 21503; // "DBA_OB_TRANSFER_PARTITION_TASK_HISTORY"
|
||||
const uint64_t OB_CDB_OB_TRANSFER_PARTITION_TASK_HISTORY_TID = 21504; // "CDB_OB_TRANSFER_PARTITION_TASK_HISTORY"
|
||||
const uint64_t OB_DBA_OB_TRUSTED_ROOT_CERTIFICATE_TID = 21509; // "DBA_OB_TRUSTED_ROOT_CERTIFICATE"
|
||||
const uint64_t OB_DBA_OB_CLONE_PROGRESS_TID = 21510; // "DBA_OB_CLONE_PROGRESS"
|
||||
const uint64_t OB_CDB_INDEX_USAGE_TID = 21513; // "CDB_INDEX_USAGE"
|
||||
@ -1647,6 +1657,8 @@ const uint64_t OB_DBA_OB_IMPORT_TABLE_JOBS_ORA_TID = 25264; // "DBA_OB_IMPORT_TA
|
||||
const uint64_t OB_DBA_OB_IMPORT_TABLE_JOB_HISTORY_ORA_TID = 25265; // "DBA_OB_IMPORT_TABLE_JOB_HISTORY_ORA"
|
||||
const uint64_t OB_DBA_OB_IMPORT_TABLE_TASKS_ORA_TID = 25266; // "DBA_OB_IMPORT_TABLE_TASKS_ORA"
|
||||
const uint64_t OB_DBA_OB_IMPORT_TABLE_TASK_HISTORY_ORA_TID = 25267; // "DBA_OB_IMPORT_TABLE_TASK_HISTORY_ORA"
|
||||
const uint64_t OB_DBA_OB_TRANSFER_PARTITION_TASKS_ORA_TID = 25275; // "DBA_OB_TRANSFER_PARTITION_TASKS_ORA"
|
||||
const uint64_t OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_ORA_TID = 25276; // "DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_ORA"
|
||||
const uint64_t OB_USER_USERS_TID = 25278; // "USER_USERS"
|
||||
const uint64_t OB_DBA_MVIEW_LOGS_ORA_TID = 25283; // "DBA_MVIEW_LOGS_ORA"
|
||||
const uint64_t OB_ALL_MVIEW_LOGS_ORA_TID = 25284; // "ALL_MVIEW_LOGS_ORA"
|
||||
@ -2118,6 +2130,8 @@ const uint64_t OB_ALL_CLONE_JOB_AUX_LOB_META_TID = 50485; // "__all_clone_job_au
|
||||
const uint64_t OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_META_TID = 50486; // "__all_clone_job_history_aux_lob_meta"
|
||||
const uint64_t OB_ALL_AUX_STAT_AUX_LOB_META_TID = 50494; // "__all_aux_stat_aux_lob_meta"
|
||||
const uint64_t OB_ALL_INDEX_USAGE_INFO_AUX_LOB_META_TID = 50495; // "__all_index_usage_info_aux_lob_meta"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TID = 50498; // "__all_transfer_partition_task_aux_lob_meta"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TID = 50499; // "__all_transfer_partition_task_history_aux_lob_meta"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_META_TID = 50500; // "__all_tenant_snapshot_job_aux_lob_meta"
|
||||
const uint64_t OB_ALL_TRUSTED_ROOT_CERTIFICATE_AUX_LOB_META_TID = 50502; // "__all_trusted_root_certificate_aux_lob_meta"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_META_TID = 50507; // "__all_tenant_snapshot_ls_replica_history_aux_lob_meta"
|
||||
@ -2400,6 +2414,8 @@ const uint64_t OB_ALL_CLONE_JOB_AUX_LOB_PIECE_TID = 60485; // "__all_clone_job_a
|
||||
const uint64_t OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_PIECE_TID = 60486; // "__all_clone_job_history_aux_lob_piece"
|
||||
const uint64_t OB_ALL_AUX_STAT_AUX_LOB_PIECE_TID = 60494; // "__all_aux_stat_aux_lob_piece"
|
||||
const uint64_t OB_ALL_INDEX_USAGE_INFO_AUX_LOB_PIECE_TID = 60495; // "__all_index_usage_info_aux_lob_piece"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TID = 60498; // "__all_transfer_partition_task_aux_lob_piece"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TID = 60499; // "__all_transfer_partition_task_history_aux_lob_piece"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_PIECE_TID = 60500; // "__all_tenant_snapshot_job_aux_lob_piece"
|
||||
const uint64_t OB_ALL_TRUSTED_ROOT_CERTIFICATE_AUX_LOB_PIECE_TID = 60502; // "__all_trusted_root_certificate_aux_lob_piece"
|
||||
const uint64_t OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_PIECE_TID = 60507; // "__all_tenant_snapshot_ls_replica_history_aux_lob_piece"
|
||||
@ -2524,6 +2540,7 @@ const uint64_t OB_ALL_KV_TTL_TASK_HISTORY_IDX_KV_TTL_TASK_HISTORY_UPD_TIME_TID =
|
||||
const uint64_t OB_ALL_MVIEW_REFRESH_RUN_STATS_IDX_MVIEW_REFRESH_RUN_STATS_NUM_MVS_CURRENT_TID = 101095; // "__all_mview_refresh_run_stats"
|
||||
const uint64_t OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_END_TIME_TID = 101096; // "__all_mview_refresh_stats"
|
||||
const uint64_t OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TID = 101097; // "__all_mview_refresh_stats"
|
||||
const uint64_t OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID = 101098; // "__all_transfer_partition_task"
|
||||
const uint64_t OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DATA_TABLE_ID_REAL_AGENT_TID = 15306; // "ALL_VIRTUAL_TABLE_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DB_TB_NAME_REAL_AGENT_TID = 15307; // "ALL_VIRTUAL_TABLE_REAL_AGENT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_TB_NAME_REAL_AGENT_TID = 15308; // "ALL_VIRTUAL_TABLE_REAL_AGENT_ORA"
|
||||
@ -2877,6 +2894,8 @@ const char *const OB_ALL_CLONE_JOB_TNAME = "__all_clone_job";
|
||||
const char *const OB_ALL_CLONE_JOB_HISTORY_TNAME = "__all_clone_job_history";
|
||||
const char *const OB_ALL_AUX_STAT_TNAME = "__all_aux_stat";
|
||||
const char *const OB_ALL_INDEX_USAGE_INFO_TNAME = "__all_index_usage_info";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_TNAME = "__all_transfer_partition_task";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TNAME = "__all_transfer_partition_task_history";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_JOB_TNAME = "__all_tenant_snapshot_job";
|
||||
const char *const OB_ALL_TRUSTED_ROOT_CERTIFICATE_TNAME = "__all_trusted_root_certificate";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_TNAME = "__all_tenant_snapshot_ls_replica_history";
|
||||
@ -3305,6 +3324,8 @@ const char *const OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_MEMTABLE_INFO_TNAME = "__al
|
||||
const char *const OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_CHECKPOINT_UNIT_INFO_TNAME = "__all_virtual_checkpoint_diagnose_checkpoint_unit_info";
|
||||
const char *const OB_ALL_VIRTUAL_CHECKPOINT_DIAGNOSE_INFO_TNAME = "__all_virtual_checkpoint_diagnose_info";
|
||||
const char *const OB_ALL_VIRTUAL_AUX_STAT_TNAME = "__all_virtual_aux_stat";
|
||||
const char *const OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_TNAME = "__all_virtual_transfer_partition_task";
|
||||
const char *const OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_TNAME = "__all_virtual_transfer_partition_task_history";
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_SNAPSHOT_JOB_TNAME = "__all_virtual_tenant_snapshot_job";
|
||||
const char *const OB_ALL_VIRTUAL_LS_SNAPSHOT_TNAME = "__all_virtual_ls_snapshot";
|
||||
const char *const OB_ALL_VIRTUAL_INDEX_USAGE_INFO_TNAME = "__all_virtual_index_usage_info";
|
||||
@ -3567,6 +3588,8 @@ const char *const OB_ALL_VIRTUAL_IMPORT_TABLE_TASK_HISTORY_ORA_TNAME = "ALL_VIRT
|
||||
const char *const OB_ALL_VIRTUAL_LS_INFO_ORA_TNAME = "ALL_VIRTUAL_LS_INFO";
|
||||
const char *const OB_ALL_VIRTUAL_CGROUP_CONFIG_ORA_TNAME = "ALL_VIRTUAL_CGROUP_CONFIG";
|
||||
const char *const OB_ALL_VIRTUAL_AUX_STAT_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_AUX_STAT_REAL_AGENT";
|
||||
const char *const OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT";
|
||||
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_GV_OB_PLAN_CACHE_STAT_TNAME = "GV$OB_PLAN_CACHE_STAT";
|
||||
@ -3941,6 +3964,10 @@ const char *const OB_V_OB_CGROUP_CONFIG_TNAME = "V$OB_CGROUP_CONFIG";
|
||||
const char *const OB_DBA_OB_AUX_STATISTICS_TNAME = "DBA_OB_AUX_STATISTICS";
|
||||
const char *const OB_CDB_OB_AUX_STATISTICS_TNAME = "CDB_OB_AUX_STATISTICS";
|
||||
const char *const OB_DBA_INDEX_USAGE_TNAME = "DBA_INDEX_USAGE";
|
||||
const char *const OB_DBA_OB_TRANSFER_PARTITION_TASKS_TNAME = "DBA_OB_TRANSFER_PARTITION_TASKS";
|
||||
const char *const OB_CDB_OB_TRANSFER_PARTITION_TASKS_TNAME = "CDB_OB_TRANSFER_PARTITION_TASKS";
|
||||
const char *const OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_TNAME = "DBA_OB_TRANSFER_PARTITION_TASK_HISTORY";
|
||||
const char *const OB_CDB_OB_TRANSFER_PARTITION_TASK_HISTORY_TNAME = "CDB_OB_TRANSFER_PARTITION_TASK_HISTORY";
|
||||
const char *const OB_DBA_OB_TRUSTED_ROOT_CERTIFICATE_TNAME = "DBA_OB_TRUSTED_ROOT_CERTIFICATE";
|
||||
const char *const OB_DBA_OB_CLONE_PROGRESS_TNAME = "DBA_OB_CLONE_PROGRESS";
|
||||
const char *const OB_CDB_INDEX_USAGE_TNAME = "CDB_INDEX_USAGE";
|
||||
@ -4217,6 +4244,8 @@ const char *const OB_DBA_OB_IMPORT_TABLE_JOBS_ORA_TNAME = "DBA_OB_IMPORT_TABLE_J
|
||||
const char *const OB_DBA_OB_IMPORT_TABLE_JOB_HISTORY_ORA_TNAME = "DBA_OB_IMPORT_TABLE_JOB_HISTORY";
|
||||
const char *const OB_DBA_OB_IMPORT_TABLE_TASKS_ORA_TNAME = "DBA_OB_IMPORT_TABLE_TASKS";
|
||||
const char *const OB_DBA_OB_IMPORT_TABLE_TASK_HISTORY_ORA_TNAME = "DBA_OB_IMPORT_TABLE_TASK_HISTORY";
|
||||
const char *const OB_DBA_OB_TRANSFER_PARTITION_TASKS_ORA_TNAME = "DBA_OB_TRANSFER_PARTITION_TASKS";
|
||||
const char *const OB_DBA_OB_TRANSFER_PARTITION_TASK_HISTORY_ORA_TNAME = "DBA_OB_TRANSFER_PARTITION_TASK_HISTORY";
|
||||
const char *const OB_USER_USERS_TNAME = "USER_USERS";
|
||||
const char *const OB_DBA_MVIEW_LOGS_ORA_TNAME = "DBA_MVIEW_LOGS";
|
||||
const char *const OB_ALL_MVIEW_LOGS_ORA_TNAME = "ALL_MVIEW_LOGS";
|
||||
@ -4688,6 +4717,8 @@ const char *const OB_ALL_CLONE_JOB_AUX_LOB_META_TNAME = "__all_clone_job_aux_lob
|
||||
const char *const OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_META_TNAME = "__all_clone_job_history_aux_lob_meta";
|
||||
const char *const OB_ALL_AUX_STAT_AUX_LOB_META_TNAME = "__all_aux_stat_aux_lob_meta";
|
||||
const char *const OB_ALL_INDEX_USAGE_INFO_AUX_LOB_META_TNAME = "__all_index_usage_info_aux_lob_meta";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_META_TNAME = "__all_transfer_partition_task_aux_lob_meta";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_META_TNAME = "__all_transfer_partition_task_history_aux_lob_meta";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_META_TNAME = "__all_tenant_snapshot_job_aux_lob_meta";
|
||||
const char *const OB_ALL_TRUSTED_ROOT_CERTIFICATE_AUX_LOB_META_TNAME = "__all_trusted_root_certificate_aux_lob_meta";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_META_TNAME = "__all_tenant_snapshot_ls_replica_history_aux_lob_meta";
|
||||
@ -4970,6 +5001,8 @@ const char *const OB_ALL_CLONE_JOB_AUX_LOB_PIECE_TNAME = "__all_clone_job_aux_lo
|
||||
const char *const OB_ALL_CLONE_JOB_HISTORY_AUX_LOB_PIECE_TNAME = "__all_clone_job_history_aux_lob_piece";
|
||||
const char *const OB_ALL_AUX_STAT_AUX_LOB_PIECE_TNAME = "__all_aux_stat_aux_lob_piece";
|
||||
const char *const OB_ALL_INDEX_USAGE_INFO_AUX_LOB_PIECE_TNAME = "__all_index_usage_info_aux_lob_piece";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_AUX_LOB_PIECE_TNAME = "__all_transfer_partition_task_aux_lob_piece";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_AUX_LOB_PIECE_TNAME = "__all_transfer_partition_task_history_aux_lob_piece";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_JOB_AUX_LOB_PIECE_TNAME = "__all_tenant_snapshot_job_aux_lob_piece";
|
||||
const char *const OB_ALL_TRUSTED_ROOT_CERTIFICATE_AUX_LOB_PIECE_TNAME = "__all_trusted_root_certificate_aux_lob_piece";
|
||||
const char *const OB_ALL_TENANT_SNAPSHOT_LS_REPLICA_HISTORY_AUX_LOB_PIECE_TNAME = "__all_tenant_snapshot_ls_replica_history_aux_lob_piece";
|
||||
@ -5094,6 +5127,7 @@ const char *const OB_ALL_KV_TTL_TASK_HISTORY_IDX_KV_TTL_TASK_HISTORY_UPD_TIME_TN
|
||||
const char *const OB_ALL_MVIEW_REFRESH_RUN_STATS_IDX_MVIEW_REFRESH_RUN_STATS_NUM_MVS_CURRENT_TNAME = "__idx_467_idx_mview_refresh_run_stats_num_mvs_current";
|
||||
const char *const OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_END_TIME_TNAME = "__idx_468_idx_mview_refresh_stats_end_time";
|
||||
const char *const OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TNAME = "__idx_468_idx_mview_refresh_stats_mview_end_time";
|
||||
const char *const OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TNAME = "__idx_498_idx_transfer_partition_key";
|
||||
const char *const OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DATA_TABLE_ID_REAL_AGENT_TNAME = "__idx_15120_idx_data_table_id_real_agent";
|
||||
const char *const OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_DB_TB_NAME_REAL_AGENT_TNAME = "__idx_15120_idx_db_tb_name_real_agent";
|
||||
const char *const OB_ALL_VIRTUAL_TABLE_REAL_AGENT_ORA_IDX_TB_NAME_REAL_AGENT_TNAME = "__idx_15120_idx_tb_name_real_agent";
|
||||
|
@ -6843,8 +6843,30 @@ def_table_schema(
|
||||
|
||||
# 496: __all_detect_lock_info
|
||||
# 497: __all_client_to_server_session_info
|
||||
# 498: __all_transfer_partition_task
|
||||
# 499: __all_transfer_partition_task_history
|
||||
all_transfer_partition_task_def= dict(
|
||||
owner = 'msy164651',
|
||||
table_name = '__all_transfer_partition_task',
|
||||
table_id = '498',
|
||||
table_type = 'SYSTEM_TABLE',
|
||||
gm_columns = ['gmt_create', 'gmt_modified'],
|
||||
in_tenant_space = True,
|
||||
is_cluster_private = False,
|
||||
meta_record_in_sys = False,
|
||||
rowkey_columns = [
|
||||
('task_id', 'int', 'false'),
|
||||
],
|
||||
normal_columns = [
|
||||
('table_id', 'int', 'false'),
|
||||
('object_id', 'int', 'false'),
|
||||
('dest_ls', 'int', 'false'),
|
||||
('status', 'varchar:OB_DEFAULT_STATUS_LENTH', 'false'),
|
||||
('balance_job_id', 'int', 'false'),
|
||||
('transfer_task_id', 'int', 'false'),
|
||||
('comment', 'longtext', 'true'),
|
||||
],
|
||||
)
|
||||
def_table_schema(**all_transfer_partition_task_def)
|
||||
def_table_schema(**gen_history_table_def_of_task(499, all_transfer_partition_task_def))
|
||||
|
||||
def_table_schema(
|
||||
owner = 'chensen.cs',
|
||||
@ -13791,8 +13813,18 @@ def_table_schema(**gen_iterate_virtual_table_def(
|
||||
# 12448: __all_virtual_detect_lock_info
|
||||
# 12449: __all_virtual_client_to_server_session_info
|
||||
# 12450: __all_virtual_sys_variable_default_value
|
||||
# 12451: __all_virtual_transfer_partition_task
|
||||
# 12452: __all_virtual_transfer_partition_task_history
|
||||
|
||||
def_table_schema(**gen_iterate_virtual_table_def(
|
||||
table_id = '12451',
|
||||
table_name = '__all_virtual_transfer_partition_task',
|
||||
keywords = all_def_keywords['__all_transfer_partition_task']))
|
||||
|
||||
def_table_schema(**gen_iterate_virtual_table_def(
|
||||
table_id = '12452',
|
||||
table_name = '__all_virtual_transfer_partition_task_history',
|
||||
keywords = all_def_keywords['__all_transfer_partition_task_history']))
|
||||
|
||||
|
||||
|
||||
def_table_schema(**gen_iterate_private_virtual_table_def(
|
||||
table_id = '12453',
|
||||
@ -14318,8 +14350,8 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15418'
|
||||
def_table_schema(**gen_oracle_mapping_real_virtual_table_def('15427', all_def_keywords['__all_aux_stat']))
|
||||
# 15428: __all_sys_variable
|
||||
# 15429: __all_virtual_sys_variable_default_value
|
||||
# 15430: __all_transfer_partition_task
|
||||
# 15431: __all_transfer_partition_task_history
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('15430', all_def_keywords['__all_transfer_partition_task'])))
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('15431', all_def_keywords['__all_transfer_partition_task_history'])))
|
||||
# 15432: __all_virtual_wr_sqltext
|
||||
# 15433: abandoned
|
||||
# 15434: abandoned
|
||||
@ -14383,8 +14415,6 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('1
|
||||
# * # 100001: __all_table
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# System View (20000,30000]
|
||||
# MySQL System View (20000, 25000]
|
||||
@ -31935,10 +31965,103 @@ def_table_schema(
|
||||
)
|
||||
|
||||
#21500: DBA_OB_SYS_VARIABLES
|
||||
#21501: DBA_OB_TRANSFER_PARTITION_TASKS
|
||||
#21502: CDB_OB_TRANSFER_PARTITION_TASKS
|
||||
#21503: DBA_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
#21504: CDB_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_TRANSFER_PARTITION_TASKS',
|
||||
table_id = '21501',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
in_tenant_space = True,
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TASK_ID,
|
||||
GMT_CREATE AS CREATE_TIME,
|
||||
GMT_MODIFIED AS MODIFY_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
COMMENT
|
||||
FROM oceanbase.__all_transfer_partition_task
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'CDB_OB_TRANSFER_PARTITION_TASKS',
|
||||
table_id = '21502',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TENANT_ID,
|
||||
TASK_ID,
|
||||
GMT_CREATE AS CREATE_TIME,
|
||||
GMT_MODIFIED AS MODIFY_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
COMMENT
|
||||
FROM oceanbase.__all_virtual_transfer_partition_task
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_TRANSFER_PARTITION_TASK_HISTORY',
|
||||
table_id = '21503',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
in_tenant_space = True,
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TASK_ID,
|
||||
CREATE_TIME,
|
||||
FINISH_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
COMMENT
|
||||
FROM oceanbase.__all_transfer_partition_task_history
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'CDB_OB_TRANSFER_PARTITION_TASK_HISTORY',
|
||||
table_id = '21504',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TENANT_ID,
|
||||
TASK_ID,
|
||||
CREATE_TIME,
|
||||
FINISH_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
COMMENT
|
||||
FROM oceanbase.__all_virtual_transfer_partition_task_history
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
|
||||
#21505: DBA_WR_SQLTEXT
|
||||
#21506: CDB_WR_SQLTEXT
|
||||
#21507: GV$OB_ACTIVE_SESSION_HISTORY
|
||||
@ -33075,7 +33198,6 @@ def_table_schema(
|
||||
# * # 100001: __all_table
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
# Oracle System View (25000, 30000]
|
||||
# Data Dictionary View (25000, 28000]
|
||||
@ -51781,6 +51903,7 @@ def_table_schema(
|
||||
WHERE TENANT_ID = EFFECTIVE_TENANT_ID()
|
||||
""".replace("\n", " ")
|
||||
)
|
||||
|
||||
# 25268: DBA_OB_IMPORT_STMT_EXEC_HISTORY
|
||||
# 25269: DBA_WR_SYSTEM_EVENT
|
||||
# 25270: DBA_WR_EVENT_NAME
|
||||
@ -51788,8 +51911,59 @@ def_table_schema(
|
||||
# 25272: DBA_OB_FORMAT_OUTLINES
|
||||
# 25273: DBA_WR_SQLSTAT
|
||||
# 25274: DBA_WR_SYS_TIME_MODEL
|
||||
# 25275: DBA_OB_TRANSFER_PARTITION_TASKS
|
||||
# 25276: DBA_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_TRANSFER_PARTITION_TASKS',
|
||||
name_postfix = '_ORA',
|
||||
database_id = 'OB_ORA_SYS_DATABASE_ID',
|
||||
table_id = '25275',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
in_tenant_space = True,
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TASK_ID,
|
||||
GMT_CREATE AS CREATE_TIME,
|
||||
GMT_MODIFIED AS MODIFY_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
"COMMENT"
|
||||
FROM SYS.ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_TRANSFER_PARTITION_TASK_HISTORY',
|
||||
name_postfix = '_ORA',
|
||||
database_id = 'OB_ORA_SYS_DATABASE_ID',
|
||||
table_id = '25276',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
in_tenant_space = True,
|
||||
view_definition =
|
||||
"""
|
||||
SELECT TASK_ID,
|
||||
CREATE_TIME,
|
||||
FINISH_TIME,
|
||||
TABLE_ID,
|
||||
OBJECT_ID,
|
||||
DEST_LS,
|
||||
BALANCE_JOB_ID,
|
||||
TRANSFER_TASK_ID,
|
||||
STATUS,
|
||||
"COMMENT"
|
||||
FROM SYS.ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
# 25277: DBA_WR_SQLTEXT
|
||||
|
||||
def_table_schema(
|
||||
@ -60956,7 +61130,14 @@ def_sys_index_table(
|
||||
index_type = 'INDEX_TYPE_NORMAL_LOCAL',
|
||||
keywords = all_def_keywords['__all_mview_refresh_stats'])
|
||||
|
||||
# 101098: __all_transfer_partition_task
|
||||
def_sys_index_table(
|
||||
index_name = 'idx_transfer_partition_key',
|
||||
index_table_id = 101098,
|
||||
index_columns = ['table_id', 'object_id'],
|
||||
index_using_type = 'USING_BTREE',
|
||||
index_type = 'INDEX_TYPE_UNIQUE_LOCAL',
|
||||
keywords = all_def_keywords['__all_transfer_partition_task'])
|
||||
|
||||
# 101099: __all_client_to_server_session_info
|
||||
# 101100: __all_column_privilege
|
||||
# 101101: __all_user_proxy_info
|
||||
|
@ -1909,6 +1909,8 @@ case OB_ALL_VIRTUAL_TIME_ZONE_TID:
|
||||
case OB_ALL_VIRTUAL_TIME_ZONE_NAME_TID:
|
||||
case OB_ALL_VIRTUAL_TIME_ZONE_TRANSITION_TID:
|
||||
case OB_ALL_VIRTUAL_TIME_ZONE_TRANSITION_TYPE_TID:
|
||||
case OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_TID:
|
||||
case OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_TID:
|
||||
case OB_ALL_VIRTUAL_TRANSFER_TASK_TID:
|
||||
case OB_ALL_VIRTUAL_TRANSFER_TASK_HISTORY_TID:
|
||||
case OB_ALL_VIRTUAL_TRIGGER_TID:
|
||||
@ -4250,6 +4252,36 @@ case OB_ALL_VIRTUAL_USER_HISTORY_TID:
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_TID: {
|
||||
ObIterateVirtualTable *iter = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIterateVirtualTable, iter))) {
|
||||
SERVER_LOG(WARN, "create virtual table iterator failed", K(ret));
|
||||
} else if (OB_FAIL(iter->init(OB_ALL_TRANSFER_PARTITION_TASK_TID, index_schema, params))) {
|
||||
SERVER_LOG(WARN, "virtual table iter init failed", K(ret));
|
||||
iter->~ObIterateVirtualTable();
|
||||
allocator.free(iter);
|
||||
iter = NULL;
|
||||
} else {
|
||||
vt_iter = iter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_TID: {
|
||||
ObIterateVirtualTable *iter = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIterateVirtualTable, iter))) {
|
||||
SERVER_LOG(WARN, "create virtual table iterator failed", K(ret));
|
||||
} else if (OB_FAIL(iter->init(OB_ALL_TRANSFER_PARTITION_TASK_HISTORY_TID, index_schema, params))) {
|
||||
SERVER_LOG(WARN, "virtual table iter init failed", K(ret));
|
||||
iter->~ObIterateVirtualTable();
|
||||
allocator.free(iter);
|
||||
iter = NULL;
|
||||
} else {
|
||||
vt_iter = iter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_TRANSFER_TASK_TID: {
|
||||
ObIterateVirtualTable *iter = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIterateVirtualTable, iter))) {
|
||||
@ -4309,7 +4341,9 @@ case OB_ALL_VIRTUAL_USER_HISTORY_TID:
|
||||
}
|
||||
break;
|
||||
}
|
||||
END_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
|
||||
BEGIN_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
case OB_ALL_VIRTUAL_TYPE_TID: {
|
||||
ObIterateVirtualTable *iter = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIterateVirtualTable, iter))) {
|
||||
@ -4339,9 +4373,7 @@ case OB_ALL_VIRTUAL_USER_HISTORY_TID:
|
||||
}
|
||||
break;
|
||||
}
|
||||
END_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
|
||||
BEGIN_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
case OB_ALL_VIRTUAL_TYPE_ATTR_HISTORY_TID: {
|
||||
ObIterateVirtualTable *iter = NULL;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIterateVirtualTable, iter))) {
|
||||
@ -4765,6 +4797,7 @@ case OB_ALL_KV_TTL_TASK_HISTORY_IDX_KV_TTL_TASK_HISTORY_UPD_TIME_TID:
|
||||
case OB_ALL_MVIEW_REFRESH_RUN_STATS_IDX_MVIEW_REFRESH_RUN_STATS_NUM_MVS_CURRENT_TID:
|
||||
case OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_END_TIME_TID:
|
||||
case OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TID:
|
||||
case OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID:
|
||||
|
||||
#endif
|
||||
|
||||
@ -4824,6 +4857,7 @@ case OB_ALL_JOB_TID:
|
||||
case OB_ALL_TENANT_DEPENDENCY_TID:
|
||||
case OB_ALL_TABLEGROUP_TID:
|
||||
case OB_ALL_TENANT_HISTORY_TID:
|
||||
case OB_ALL_TRANSFER_PARTITION_TASK_TID:
|
||||
case OB_ALL_SUB_PART_TID:
|
||||
case OB_ALL_ROUTINE_TID:
|
||||
case OB_ALL_TENANT_DIRECTORY_TID:
|
||||
@ -5236,6 +5270,12 @@ case OB_ALL_TENANT_HISTORY_TID: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_TRANSFER_PARTITION_TASK_TID: {
|
||||
if (FAILEDx(index_tids.push_back(OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID))) {
|
||||
LOG_WARN("fail to push back index tid", KR(ret));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_SUB_PART_TID: {
|
||||
if (FAILEDx(index_tids.push_back(OB_ALL_SUB_PART_IDX_SUB_PART_NAME_TID))) {
|
||||
LOG_WARN("fail to push back index tid", KR(ret));
|
||||
@ -5992,6 +6032,15 @@ case OB_ALL_TENANT_HISTORY_TID: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_TRANSFER_PARTITION_TASK_TID: {
|
||||
index_schema.reset();
|
||||
if (FAILEDx(ObInnerTableSchema::all_transfer_partition_task_idx_transfer_partition_key_schema(index_schema))) {
|
||||
LOG_WARN("fail to create index schema", KR(ret), K(tenant_id), K(data_table_id));
|
||||
} else if (OB_FAIL(append_table_(tenant_id, index_schema, tables))) {
|
||||
LOG_WARN("fail to append", KR(ret), K(tenant_id), K(data_table_id));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OB_ALL_SUB_PART_TID: {
|
||||
index_schema.reset();
|
||||
if (FAILEDx(ObInnerTableSchema::all_sub_part_idx_sub_part_name_schema(index_schema))) {
|
||||
@ -6415,5 +6464,7 @@ case OB_ALL_FOREIGN_KEY_TID: {
|
||||
LOG_WARN("add index id failed", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(table_ids.push_back(OB_ALL_MVIEW_REFRESH_STATS_IDX_MVIEW_REFRESH_STATS_MVIEW_END_TIME_TID))) {
|
||||
LOG_WARN("add index id failed", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(table_ids.push_back(OB_ALL_TRANSFER_PARTITION_TASK_IDX_TRANSFER_PARTITION_KEY_TID))) {
|
||||
LOG_WARN("add index id failed", KR(ret), K(tenant_id));
|
||||
|
||||
#endif
|
||||
|
@ -333,6 +333,9 @@
|
||||
# 486: __all_clone_job_history
|
||||
# 494: __all_aux_stat
|
||||
# 495: __all_index_usage_info
|
||||
# 498: __all_transfer_partition_task
|
||||
# 499: __all_transfer_partition_task_history
|
||||
# 499: __all_transfer_partition_task # BASE_TABLE_NAME
|
||||
# 500: __all_tenant_snapshot_job
|
||||
# 502: __all_trusted_root_certificate
|
||||
# 507: __all_tenant_snapshot_ls_replica_history
|
||||
@ -1054,6 +1057,11 @@
|
||||
# 12439: __all_virtual_checkpoint_diagnose_info
|
||||
# 12447: __all_virtual_aux_stat
|
||||
# 12447: __all_aux_stat # BASE_TABLE_NAME
|
||||
# 12451: __all_virtual_transfer_partition_task
|
||||
# 12451: __all_transfer_partition_task # BASE_TABLE_NAME
|
||||
# 12452: __all_virtual_transfer_partition_task_history
|
||||
# 12452: __all_transfer_partition_task # BASE_TABLE_NAME
|
||||
# 12452: __all_transfer_partition_task_history # BASE_TABLE_NAME1
|
||||
# 12453: __all_virtual_tenant_snapshot_job
|
||||
# 12453: __all_tenant_snapshot_job # BASE_TABLE_NAME
|
||||
# 12458: __all_virtual_ls_snapshot
|
||||
@ -1635,6 +1643,11 @@
|
||||
# 15418: __all_virtual_cgroup_config # BASE_TABLE_NAME
|
||||
# 15427: ALL_VIRTUAL_AUX_STAT_REAL_AGENT
|
||||
# 15427: __all_aux_stat # BASE_TABLE_NAME
|
||||
# 15430: ALL_VIRTUAL_TRANSFER_PARTITION_TASK_REAL_AGENT
|
||||
# 15430: __all_transfer_partition_task # BASE_TABLE_NAME
|
||||
# 15431: ALL_VIRTUAL_TRANSFER_PARTITION_TASK_HISTORY_REAL_AGENT
|
||||
# 15431: __all_transfer_partition_task # BASE_TABLE_NAME
|
||||
# 15431: __all_transfer_partition_task_history # BASE_TABLE_NAME1
|
||||
# 15439: ALL_VIRTUAL_LS_SNAPSHOT
|
||||
# 15439: __all_virtual_ls_snapshot # BASE_TABLE_NAME
|
||||
# 15440: ALL_VIRTUAL_INDEX_USAGE_INFO_REAL_AGENT
|
||||
@ -2011,6 +2024,10 @@
|
||||
# 21497: DBA_OB_AUX_STATISTICS
|
||||
# 21498: CDB_OB_AUX_STATISTICS
|
||||
# 21499: DBA_INDEX_USAGE
|
||||
# 21501: DBA_OB_TRANSFER_PARTITION_TASKS
|
||||
# 21502: CDB_OB_TRANSFER_PARTITION_TASKS
|
||||
# 21503: DBA_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
# 21504: CDB_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
# 21509: DBA_OB_TRUSTED_ROOT_CERTIFICATE
|
||||
# 21510: DBA_OB_CLONE_PROGRESS
|
||||
# 21513: CDB_INDEX_USAGE
|
||||
@ -2287,6 +2304,8 @@
|
||||
# 25265: DBA_OB_IMPORT_TABLE_JOB_HISTORY
|
||||
# 25266: DBA_OB_IMPORT_TABLE_TASKS
|
||||
# 25267: DBA_OB_IMPORT_TABLE_TASK_HISTORY
|
||||
# 25275: DBA_OB_TRANSFER_PARTITION_TASKS
|
||||
# 25276: DBA_OB_TRANSFER_PARTITION_TASK_HISTORY
|
||||
# 25278: USER_USERS
|
||||
# 25283: DBA_MVIEW_LOGS
|
||||
# 25284: ALL_MVIEW_LOGS
|
||||
@ -2861,6 +2880,9 @@
|
||||
# 101097: __idx_468_idx_mview_refresh_stats_mview_end_time
|
||||
# 101097: idx_mview_refresh_stats_mview_end_time # INDEX_NAME
|
||||
# 101097: __all_mview_refresh_stats # DATA_BASE_TABLE_NAME
|
||||
# 101098: __idx_498_idx_transfer_partition_key
|
||||
# 101098: idx_transfer_partition_key # INDEX_NAME
|
||||
# 101098: __all_transfer_partition_task # DATA_BASE_TABLE_NAME
|
||||
# 15306: __idx_15120_idx_data_table_id_real_agent
|
||||
# 15306: idx_data_table_id_real_agent # INDEX_NAME
|
||||
# 15306: __all_table # DATA_BASE_TABLE_NAME
|
||||
|
@ -138,6 +138,10 @@ public:
|
||||
~ObLSFlag() {}
|
||||
void reset() {flag_ = NORMAL_FLAG;}
|
||||
int assign(const ObLSFlag &ls_flag);
|
||||
bool operator==(const ObLSFlag &other) const
|
||||
{
|
||||
return flag_ == other.flag_;
|
||||
}
|
||||
bool is_valid() const { return flag_ >= 0; }
|
||||
void set_block_tablet_in() { flag_ |= BLOCK_TABLET_IN_FLAG; }
|
||||
void clear_block_tablet_in() { flag_ &= (~BLOCK_TABLET_IN_FLAG); }
|
||||
@ -345,7 +349,6 @@ public:
|
||||
* */
|
||||
int load_all_ls_and_snapshot(const share::SCN &read_scn, ObLSAttrIArray &ls_array, bool only_existing_ls = true);
|
||||
static int get_tenant_gts(const uint64_t &tenant_id, SCN >s_scn);
|
||||
static int get_tenant_gts(const uint64_t &tenant_id, int64_t >s_ts_ns);
|
||||
int alter_ls_group_in_trans(const ObLSAttr &ls_info,
|
||||
const uint64_t new_ls_group_id,
|
||||
common::ObMySQLTransaction &trans);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "share/scn.h" // SCN
|
||||
#include "share/ls/ob_ls_operator.h" //ObLSFlag
|
||||
#include "share/ls/ob_ls_status_operator.h"
|
||||
#include "share/resource_manager/ob_cgroup_ctrl.h"//OBCG_DEFAULT
|
||||
|
||||
using namespace oceanbase;
|
||||
using namespace oceanbase::common;
|
||||
|
@ -161,6 +161,20 @@ struct ObLSStatusInfo
|
||||
{
|
||||
return OB_LS_NORMAL == status_;
|
||||
}
|
||||
bool operator==(const ObLSStatusInfo &other) const
|
||||
{
|
||||
return tenant_id_ == other.tenant_id_
|
||||
&& ls_id_ == other.ls_id_
|
||||
&& ls_group_id_ == other.ls_group_id_
|
||||
&& status_ == other.status_
|
||||
&& unit_group_id_ == other.unit_group_id_
|
||||
&& primary_zone_ == other.primary_zone_
|
||||
&& flag_ == other.flag_;
|
||||
}
|
||||
|
||||
bool operator!=(const ObLSStatusInfo &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool is_user_ls() const { return ls_id_.is_user_ls(); }
|
||||
|
||||
|
@ -20,10 +20,29 @@ namespace share
|
||||
bool need_balance_table(const schema::ObSimpleTableSchemaV2 &table_schema)
|
||||
{
|
||||
//TODO not support nonduplicate and duplicate exchange
|
||||
return !table_schema.is_duplicate_table()
|
||||
&& (table_schema.is_user_table()
|
||||
bool need_balance = false;
|
||||
const char* table_type_str = NULL;
|
||||
need_balance = check_if_need_balance_table(table_schema, table_type_str);
|
||||
return need_balance;
|
||||
}
|
||||
|
||||
bool check_if_need_balance_table(
|
||||
const schema::ObSimpleTableSchemaV2 &table_schema,
|
||||
const char *&table_type_str)
|
||||
{
|
||||
bool need_balance = false;
|
||||
if (table_schema.is_duplicate_table()) {
|
||||
table_type_str = "DUPLICATE TABLE";
|
||||
} else if (table_schema.is_index_table() && !table_schema.is_global_index_table()) {
|
||||
table_type_str = "LOCAL INDEX";
|
||||
} else {
|
||||
table_type_str = ob_table_type_str(table_schema.get_table_type());
|
||||
}
|
||||
need_balance = !table_schema.is_duplicate_table()
|
||||
&& (table_schema.is_user_table()
|
||||
|| table_schema.is_global_index_table()
|
||||
|| table_schema.is_tmp_table());
|
||||
return need_balance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace share
|
||||
typedef ObCommonID ObBalanceJobID;
|
||||
typedef ObCommonID ObBalanceTaskID;
|
||||
typedef ObCommonID ObTransferTaskID;
|
||||
typedef ObCommonID ObTransferPartitionTaskID;
|
||||
|
||||
// check Tables that need balance by RS
|
||||
//
|
||||
@ -30,7 +31,9 @@ typedef ObCommonID ObTransferTaskID;
|
||||
// 2. GLOBAL INDEX: global index is distributed independently from the main table, need balance
|
||||
// 3. TMP TABLE: temp table is created by user, need balance
|
||||
bool need_balance_table(const schema::ObSimpleTableSchemaV2 &table_schema);
|
||||
|
||||
bool check_if_need_balance_table(
|
||||
const schema::ObSimpleTableSchemaV2 &table_schema,
|
||||
const char *&table_type_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,7 @@ cal_version(const uint64_t major, const uint64_t minor, const uint64_t major_pat
|
||||
#define DATA_VERSION_4_2_2_0 (oceanbase::common::cal_version(4, 2, 2, 0))
|
||||
#define MOCK_DATA_VERSION_4_2_2_1 (oceanbase::common::cal_version(4, 2, 2, 1))
|
||||
#define MOCK_DATA_VERSION_4_2_3_0 (oceanbase::common::cal_version(4, 2, 3, 0))
|
||||
#define MOCK_DATA_VERSION_4_2_4_0 (oceanbase::common::cal_version(4, 2, 4, 0))
|
||||
// new data version before 4.3 cannot upgrade to master, must add "MOCK_" prefix
|
||||
#define DATA_VERSION_4_3_0_0 (oceanbase::common::cal_version(4, 3, 0, 0))
|
||||
#define DATA_VERSION_4_3_0_1 (oceanbase::common::cal_version(4, 3, 0, 1))
|
||||
|
@ -352,10 +352,10 @@ static const _error _error_OB_PARTIAL_FAILED = {
|
||||
.mysql_errno = -1,
|
||||
.sqlstate = "HY000",
|
||||
.str_error = "Partial failed",
|
||||
.str_user_error = "Partial failed",
|
||||
.str_user_error = "%s",
|
||||
.oracle_errno = 600,
|
||||
.oracle_str_error = "ORA-00600: internal error code, arguments: -4025, Partial failed",
|
||||
.oracle_str_user_error = "ORA-00600: internal error code, arguments: -4025, Partial failed"
|
||||
.oracle_str_user_error = "ORA-00600: internal error code, arguments: -4025, %s"
|
||||
};
|
||||
static const _error _error_OB_READ_NOTHING = {
|
||||
.error_name = "OB_READ_NOTHING",
|
||||
|
@ -131,7 +131,7 @@ DEFINE_ERROR_DEP(OB_CONFLICT_VALUE, -4021, -1, "HY000", "Conflict value");
|
||||
DEFINE_ERROR_DEP(OB_ITEM_NOT_SETTED, -4022, -1, "HY000", "Item not set");
|
||||
DEFINE_ERROR_DEP(OB_EAGAIN, -4023, -1, "HY000", "Try again");
|
||||
DEFINE_ERROR_DEP(OB_BUF_NOT_ENOUGH, -4024, -1, "HY000", "Buffer not enough");
|
||||
DEFINE_ERROR(OB_PARTIAL_FAILED, -4025, -1, "HY000", "Partial failed");
|
||||
DEFINE_ERROR_EXT_DEP(OB_PARTIAL_FAILED, -4025, -1, "HY000", "Partial failed", "%s");
|
||||
DEFINE_ORACLE_ERROR_DEP(OB_READ_NOTHING, -4026, ER_SP_FETCH_NO_DATA, "02000", "No data - zero rows fetched, selected, or processed", 1403, "no data found");
|
||||
DEFINE_ERROR_DEP(OB_FILE_NOT_EXIST, -4027, ER_FILE_NOT_FOUND, "HY000", "File not exist");
|
||||
DEFINE_ERROR_DEP(OB_DISCONTINUOUS_LOG, -4028, -1, "HY000", "Log entry not continuous");
|
||||
|
@ -23,7 +23,6 @@ constexpr int OB_LAST_ERROR_CODE = -38105;
|
||||
constexpr int OB_ERR_SQL_START = -5000;
|
||||
constexpr int OB_ERR_SQL_END = -5999;
|
||||
constexpr int OB_PACKET_NOT_SENT = -4011;
|
||||
constexpr int OB_PARTIAL_FAILED = -4025;
|
||||
constexpr int OB_SCHEMA_ERROR = -4029;
|
||||
constexpr int OB_TENANT_OUT_OF_MEM = -4030;
|
||||
constexpr int OB_UNKNOWN_OBJ = -4031;
|
||||
@ -1890,7 +1889,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ITEM_NOT_SETTED__USER_ERROR_MSG "Item not set"
|
||||
#define OB_EAGAIN__USER_ERROR_MSG "Try again"
|
||||
#define OB_BUF_NOT_ENOUGH__USER_ERROR_MSG "Buffer not enough"
|
||||
#define OB_PARTIAL_FAILED__USER_ERROR_MSG "Partial failed"
|
||||
#define OB_PARTIAL_FAILED__USER_ERROR_MSG "%s"
|
||||
#define OB_READ_NOTHING__USER_ERROR_MSG "No data - zero rows fetched, selected, or processed"
|
||||
#define OB_FILE_NOT_EXIST__USER_ERROR_MSG "File not exist"
|
||||
#define OB_DISCONTINUOUS_LOG__USER_ERROR_MSG "Log entry not continuous"
|
||||
@ -4123,7 +4122,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ITEM_NOT_SETTED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4022, Item not set"
|
||||
#define OB_EAGAIN__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4023, Try again"
|
||||
#define OB_BUF_NOT_ENOUGH__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4024, Buffer not enough"
|
||||
#define OB_PARTIAL_FAILED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4025, Partial failed"
|
||||
#define OB_PARTIAL_FAILED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4025, %s"
|
||||
#define OB_READ_NOTHING__ORA_USER_ERROR_MSG "ORA-01403: no data found"
|
||||
#define OB_FILE_NOT_EXIST__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4027, File not exist"
|
||||
#define OB_DISCONTINUOUS_LOG__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4028, Log entry not continuous"
|
||||
|
@ -110,7 +110,7 @@ int ObPrimaryStandbyService::switch_tenant(const obrpc::ObSwitchTenantArg &arg)
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("Tenant COMPATIBLE is below 4.1.0.0, switch tenant is not supported", KR(ret));
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Tenant COMPATIBLE is below 4.1.0.0, switch tenant is");
|
||||
} else if (OB_FAIL(get_tenant_status_(switch_tenant_id, tenant_status))) {
|
||||
} else if (OB_FAIL(get_tenant_status(switch_tenant_id, tenant_status))) {
|
||||
LOG_WARN("failed to get tenant status", KR(ret), K(switch_tenant_id));
|
||||
} else if (is_tenant_normal(tenant_status)) {
|
||||
switch (arg.get_op_type()) {
|
||||
@ -175,7 +175,7 @@ int ObPrimaryStandbyService::failover_to_primary(const uint64_t tenant_id,
|
||||
LOG_WARN("failed to load tenant info", KR(ret), K(tenant_id));
|
||||
} else if (tenant_info.is_primary() && tenant_info.is_normal_status()) {
|
||||
LOG_INFO("already is primary tenant, no need switch", K(tenant_info));
|
||||
} else if (OB_FAIL(get_tenant_status_(tenant_id, tenant_status))) {
|
||||
} else if (OB_FAIL(get_tenant_status(tenant_id, tenant_status))) {
|
||||
LOG_WARN("failed to get tenant status", KR(ret), K(tenant_id));
|
||||
} else if (is_tenant_normal(tenant_status)) {
|
||||
ObTenantRoleTransitionService role_transition_service(tenant_id, sql_proxy_, GCTX.srv_rpc_proxy_, switch_optype);
|
||||
@ -269,7 +269,7 @@ int ObPrimaryStandbyService::recover_tenant(const obrpc::ObRecoverTenantArg &arg
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPrimaryStandbyService::get_tenant_status_(
|
||||
int ObPrimaryStandbyService::get_tenant_status(
|
||||
const uint64_t tenant_id,
|
||||
ObTenantStatus &status)
|
||||
{
|
||||
@ -314,7 +314,7 @@ int ObPrimaryStandbyService::get_tenant_status_(
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_WARN("failed to get result", KR(ret), K(tenant_id), K(sql));
|
||||
} else if (OB_FAIL(get_tenant_status(tenant_status_str, status))) {
|
||||
} else if (OB_FAIL(schema::get_tenant_status(tenant_status_str, status))) {
|
||||
LOG_WARN("fail to get tenant status", KR(ret), K(tenant_status_str), K(tenant_id), K(sql));
|
||||
}
|
||||
}
|
||||
@ -349,7 +349,7 @@ int ObPrimaryStandbyService::do_recover_tenant(
|
||||
} else if (OB_UNLIKELY(OB_INVALID_TENANT_ID == tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(get_tenant_status_(tenant_id, tenant_status))) {
|
||||
} else if (OB_FAIL(get_tenant_status(tenant_id, tenant_status))) {
|
||||
LOG_WARN("failed to get tenant status", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(trans.start(sql_proxy_, exec_tenant_id))) {
|
||||
LOG_WARN("failed to start trans", KR(ret), K(exec_tenant_id), K(tenant_id));
|
||||
|
@ -99,6 +99,17 @@ public:
|
||||
* @return return code
|
||||
*/
|
||||
int wait_create_standby_tenant_end(const uint64_t tenant_id);
|
||||
/**
|
||||
* @description:
|
||||
* get tenant status from all_tenant
|
||||
* @param[in] tenant_id
|
||||
* @param[out] status tenant status from all_tenant
|
||||
* @return return code
|
||||
*/
|
||||
int get_tenant_status(
|
||||
const uint64_t tenant_id,
|
||||
ObTenantStatus &status);
|
||||
|
||||
|
||||
private:
|
||||
int check_inner_stat_();
|
||||
@ -193,17 +204,6 @@ private:
|
||||
const int64_t switchover_epoch,
|
||||
ObAllTenantInfo &new_tenant_info);
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* get tenant status from all_tenant
|
||||
* @param[in] tenant_id
|
||||
* @param[out] status tenant status from all_tenant
|
||||
* @return return code
|
||||
*/
|
||||
int get_tenant_status_(
|
||||
const uint64_t tenant_id,
|
||||
ObTenantStatus &status);
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* check ls restore_status is normal
|
||||
|
@ -139,7 +139,8 @@ public:
|
||||
// @param [in] tenant_id, tenant for query
|
||||
// @param [in] tablet_ids, ObTabletIDs for query
|
||||
// (should exist in __all_tablet_to_ls and have no duplicate values)
|
||||
// @param [out] infos, ObTabletToLSInfo corresponding to tablet_ids (same order)
|
||||
// @param [out] infos, ObTabletToLSInfo corresponding to tablet_ids (not same order)
|
||||
// not same order, not same order, not same order
|
||||
// @return OB_SUCCESS if success;
|
||||
// OB_ITEM_NOT_MATCH if tablet_ids have duplicates or nonexistent tablets;
|
||||
// Other error according to unexpected situation
|
||||
|
@ -2794,5 +2794,18 @@ int ObCancelCloneExecutor::execute(ObExecContext &ctx, ObCancelCloneStmt &stmt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionExecutor::execute(ObExecContext& ctx, ObTransferPartitionStmt& stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const rootserver::ObTransferPartitionArg &arg = stmt.get_arg();
|
||||
rootserver::ObTransferPartitionCommand command;
|
||||
if (OB_UNLIKELY(!arg.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invaid argument", KR(ret), K(arg));
|
||||
} else if (OB_FAIL(command.execute(arg))) {
|
||||
LOG_WARN("fail to execute command", KR(ret), K(arg));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
@ -140,6 +140,8 @@ DEF_SIMPLE_EXECUTOR(ObResetConfig);
|
||||
|
||||
DEF_SIMPLE_EXECUTOR(ObCancelClone);
|
||||
|
||||
DEF_SIMPLE_EXECUTOR(ObTransferPartition);
|
||||
|
||||
class ObCancelTaskExecutor
|
||||
{
|
||||
public:
|
||||
|
@ -1039,6 +1039,10 @@ int ObCmdExecutor::execute(ObExecContext &ctx, ObICmd &cmd)
|
||||
case stmt::T_CANCEL_CLONE: {
|
||||
DEFINE_EXECUTE_CMD(ObCancelCloneStmt, ObCancelCloneExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_TRANSFER_PARTITION: {
|
||||
DEFINE_EXECUTE_CMD(ObTransferPartitionStmt, ObTransferPartitionExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_CS_DISKMAINTAIN:
|
||||
case stmt::T_TABLET_CMD:
|
||||
|
@ -574,6 +574,7 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] =
|
||||
{"nth_value", NTH_VALUE},
|
||||
{"obconfig_url", OBCONFIG_URL},
|
||||
{"object", OBJECT},
|
||||
{"object_id", OBJECT_ID},
|
||||
{"of", OF},
|
||||
{"off", OFF},
|
||||
{"offset", OFFSET},
|
||||
@ -901,6 +902,7 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] =
|
||||
{"trace", TRACE},
|
||||
{"traditional", TRADITIONAL},
|
||||
{"trailing", TRAILING},
|
||||
{"transfer", TRANSFER},
|
||||
{"transaction", TRANSACTION},
|
||||
{"trigger", TRIGGER},
|
||||
{"triggers", TRIGGERS},
|
||||
|
@ -320,6 +320,7 @@ END_P SET_VAR DELIMITER
|
||||
|
||||
OBSOLETE OCCUR OF OFF OFFSET OLD OLD_PASSWORD ONE ONE_SHOT ONLY OPEN OPTIONS ORDINALITY ORIG_DEFAULT OWNER OLD_KEY OVER
|
||||
OBCONFIG_URL OJ
|
||||
OBJECT_ID
|
||||
|
||||
PACK_KEYS PAGE PARALLEL PARAMETERS PARSER PARTIAL PARTITION_ID PARTITIONING PARTITIONS PASSWORD PATH PAUSE PERCENTAGE
|
||||
PERCENT_RANK PHASE PLAN PHYSICAL PLANREGRESS PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PERFORMANCE
|
||||
@ -353,6 +354,7 @@ END_P SET_VAR DELIMITER
|
||||
TEMPLATE TEMPORARY TEMPTABLE TENANT TEXT THAN TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TP_NO
|
||||
TP_NAME TRACE TRADITIONAL TRANSACTION TRIGGERS TRIM TRUNCATE TYPE TYPES TASK TABLET_SIZE
|
||||
TABLEGROUP_ID TENANT_ID THROTTLE TIME_ZONE_INFO TOP_K_FRE_HIST TIMES TRIM_SPACE TTL
|
||||
TRANSFER
|
||||
|
||||
UNCOMMITTED UNDEFINED UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNIT UNIT_GROUP UNIT_NUM UNLOCKED UNTIL
|
||||
UNUSUAL UPGRADE USE_BLOOM_FILTER UNKNOWN USE_FRM USER USER_RESOURCES UNBOUNDED UP UNLIMITED
|
||||
@ -367,7 +369,7 @@ END_P SET_VAR DELIMITER
|
||||
YEAR
|
||||
|
||||
ZONE ZONE_LIST ZONE_TYPE
|
||||
|
||||
//-----------------------------non_reserved keyword end---------------------------------------------
|
||||
%type <node> sql_stmt stmt_list stmt opt_end_p
|
||||
%type <node> select_stmt update_stmt delete_stmt
|
||||
%type <node> insert_stmt single_table_insert values_clause dml_table_name
|
||||
@ -532,7 +534,7 @@ END_P SET_VAR DELIMITER
|
||||
%type <node> opt_value_on_empty_or_error_or_mismatch opt_on_mismatch
|
||||
%type <node> table_values_caluse table_values_caluse_with_order_by_and_limit values_row_list row_value
|
||||
%type <node> create_tenant_snapshot_stmt snapshot_name drop_tenant_snapshot_stmt clone_tenant_stmt clone_snapshot_option clone_tenant_option clone_tenant_option_list
|
||||
|
||||
%type <node> transfer_partition_stmt transfer_partition_clause part_info cancel_transfer_partition_clause
|
||||
%type <node> ttl_definition ttl_expr ttl_unit
|
||||
%type <node> id_dot_id id_dot_id_dot_id
|
||||
%start sql_stmt
|
||||
@ -706,6 +708,7 @@ stmt:
|
||||
| create_tenant_snapshot_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| drop_tenant_snapshot_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| clone_tenant_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| transfer_partition_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
@ -18929,7 +18932,53 @@ opt_restore_until
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_RECOVER_CANCEL);
|
||||
};
|
||||
|
||||
/*===========================================================
|
||||
*
|
||||
* 手动transfer命令
|
||||
*
|
||||
*===========================================================*/
|
||||
transfer_partition_stmt:
|
||||
alter_with_opt_hint SYSTEM transfer_partition_clause opt_tenant_name
|
||||
{
|
||||
(void)($1);
|
||||
(void)($2);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_TRANSFER_PARTITION, 2, $3, $4);
|
||||
}
|
||||
| alter_with_opt_hint SYSTEM CANCEL TRANSFER PARTITION cancel_transfer_partition_clause opt_tenant_name
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_TRANSFER_PARTITION, 2, $6, $7);
|
||||
}
|
||||
| alter_with_opt_hint SYSTEM CANCEL BALANCE JOB opt_tenant_name
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_BALANCE_JOB, 1, $6)
|
||||
}
|
||||
;
|
||||
transfer_partition_clause:
|
||||
TRANSFER PARTITION part_info TO LS INTNUM
|
||||
{
|
||||
(void)($2);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_TRANSFER_PARTITION_TO_LS, 2, $3, $6);
|
||||
}
|
||||
;
|
||||
part_info:
|
||||
TABLE_ID opt_equal_mark INTNUM ',' OBJECT_ID opt_equal_mark INTNUM
|
||||
{
|
||||
(void) ($2);
|
||||
(void) ($6);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_INFO, 2, $3, $7);
|
||||
};
|
||||
cancel_transfer_partition_clause:
|
||||
part_info
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| ALL
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_ALL);
|
||||
}
|
||||
;
|
||||
/*===========================================================
|
||||
*
|
||||
* Name classification
|
||||
@ -20403,6 +20452,8 @@ ACCOUNT
|
||||
| CONNECT
|
||||
| STATEMENT_ID
|
||||
| KV_ATTRIBUTES
|
||||
| OBJECT_ID
|
||||
| TRANSFER
|
||||
;
|
||||
|
||||
unreserved_keyword_special:
|
||||
|
@ -1850,7 +1850,8 @@ int get_sys_tenant_alter_system_priv(
|
||||
stmt::T_BACKUP_KEY != basic_stmt->get_stmt_type() &&
|
||||
stmt::T_RECOVER != basic_stmt->get_stmt_type() &&
|
||||
stmt::T_TABLE_TTL != basic_stmt->get_stmt_type() &&
|
||||
stmt::T_ALTER_SYSTEM_RESET_PARAMETER != basic_stmt->get_stmt_type()) {
|
||||
stmt::T_ALTER_SYSTEM_RESET_PARAMETER != basic_stmt->get_stmt_type() &&
|
||||
stmt::T_TRANSFER_PARTITION != basic_stmt->get_stmt_type()) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
LOG_WARN("Only sys tenant can do this operation",
|
||||
K(ret), "stmt type", basic_stmt->get_stmt_type());
|
||||
|
@ -5912,6 +5912,28 @@ int ObResetConfigResolver::resolve(const ParseNode &parse_tree)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int resolve_part_info(const ParseNode &parse_node, uint64_t &table_id, ObObjectID &object_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
table_id = OB_INVALID_ID;
|
||||
object_id = OB_INVALID_OBJECT_ID;
|
||||
if (OB_UNLIKELY(T_PARTITION_INFO != parse_node.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_PARTITION_INFO", KR(ret), "type",
|
||||
get_type_name(parse_node.type_));
|
||||
} else if (2 != parse_node.num_child_
|
||||
|| OB_ISNULL(parse_node.children_[0])
|
||||
|| OB_ISNULL(parse_node.children_[1])) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid parse node", KR(ret), "num_child", parse_node.num_child_,
|
||||
KP(parse_node.children_[0]), KP(parse_node.children_[1]));
|
||||
} else {
|
||||
table_id = parse_node.children_[0]->value_;
|
||||
object_id = parse_node.children_[1]->value_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAlterSystemResetResolver::resolve(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -6129,9 +6151,280 @@ int ObCancelCloneResolver::resolve(const ParseNode &parse_tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int resolve_transfer_partition_to_ls(
|
||||
const ParseNode &parse_node,
|
||||
const uint64_t target_tenant_id,
|
||||
const uint64_t exec_tenant_id,
|
||||
ObTransferPartitionStmt *stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t table_id = OB_INVALID_ID;
|
||||
ObObjectID object_id = OB_INVALID_OBJECT_ID;
|
||||
if (OB_UNLIKELY(T_TRANSFER_PARTITION_TO_LS != parse_node.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_TRANSFER_PARTITION_TO_LS", KR(ret), "type",
|
||||
get_type_name(parse_node.type_));
|
||||
} else if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("stmt is null", KR(ret), KP(stmt));
|
||||
} else if (OB_UNLIKELY(!is_valid_tenant_id(exec_tenant_id) || !is_valid_tenant_id(target_tenant_id))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid exec_tenant_id or target_tenant_id", KR(ret), K(exec_tenant_id), K(target_tenant_id));
|
||||
} else if (2 != parse_node.num_child_
|
||||
|| OB_ISNULL(parse_node.children_[0])
|
||||
|| OB_ISNULL(parse_node.children_[1])) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid parse node", KR(ret), "num_child", parse_node.num_child_,
|
||||
KP(parse_node.children_[0]), KP(parse_node.children_[1]));
|
||||
} else if (OB_FAIL(resolve_part_info(*parse_node.children_[0], table_id, object_id))) {
|
||||
LOG_WARN("fail to resolve partition info", KR(ret), KP(parse_node.children_[0]));
|
||||
} else {
|
||||
int64_t id = parse_node.children_[1]->value_;
|
||||
ObLSID ls_id(id);
|
||||
if (OB_FAIL(stmt->get_arg().init_for_transfer_partition_to_ls(
|
||||
target_tenant_id,
|
||||
table_id,
|
||||
object_id,
|
||||
ls_id))) {
|
||||
LOG_WARN("fail to init stmt rpc arg", KR(ret), K(target_tenant_id),
|
||||
K(table_id), K(object_id), K(ls_id));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_and_verify_tenant_name(
|
||||
const ParseNode *parse_node,
|
||||
const uint64_t exec_tenant_id,
|
||||
uint64_t &target_tenant_id,
|
||||
const char * const op_str)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObString tenant_name;
|
||||
ObSchemaGetterGuard schema_guard;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
const int64_t COMMENT_LENGTH = 512;
|
||||
char comment[COMMENT_LENGTH] = {0};
|
||||
int64_t pos = 0;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(exec_tenant_id))
|
||||
|| OB_ISNULL(op_str)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("exec tenant id is invalid", KR(ret), K(exec_tenant_id), K(op_str));
|
||||
} else if (NULL == parse_node) {
|
||||
if (OB_SYS_TENANT_ID != exec_tenant_id) {
|
||||
target_tenant_id = exec_tenant_id;
|
||||
} else {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("no specified tenant in the sys tenant's session", KR(ret));
|
||||
if (OB_TMP_FAIL(databuff_printf(comment, COMMENT_LENGTH, pos,
|
||||
"%s of SYS tenant is", op_str))) {
|
||||
LOG_WARN("failed to printf to comment", KR(ret), KR(tmp_ret), K(op_str));
|
||||
} else {
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, comment);
|
||||
}
|
||||
}
|
||||
} else if (OB_FAIL(resolve_tenant_name(parse_node, exec_tenant_id, tenant_name))) {
|
||||
LOG_WARN("fail to resolve target tenant id", KR(ret));
|
||||
} else if (OB_ISNULL(GCTX.schema_service_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("GCTX.schema_service_ is null", KR(ret), KP(GCTX.schema_service_));
|
||||
} else if (OB_FAIL(GCTX.schema_service_->get_tenant_schema_guard(OB_SYS_TENANT_ID, schema_guard))) {
|
||||
LOG_WARN("failed to get_tenant_schema_guard", KR(ret));
|
||||
} else if (OB_FAIL(schema_guard.get_tenant_id(tenant_name, target_tenant_id))) {
|
||||
LOG_WARN("failed to get tenant id from schema guard", KR(ret), K(tenant_name));
|
||||
if (OB_TENANT_NOT_EXIST == ret || OB_ERR_INVALID_TENANT_NAME == ret) {
|
||||
ret = OB_TENANT_NOT_EXIST;
|
||||
LOG_USER_ERROR(OB_TENANT_NOT_EXIST, tenant_name.length(), tenant_name.ptr());
|
||||
}
|
||||
} else if (OB_UNLIKELY(!is_user_tenant(target_tenant_id))) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("only support user tenant", KR(ret), K(target_tenant_id));
|
||||
if (OB_TMP_FAIL(databuff_printf(comment, COMMENT_LENGTH, pos,
|
||||
"%s of META or SYS tenant is", op_str))) {
|
||||
LOG_WARN("failed to printf to comment", KR(ret), KR(tmp_ret), K(op_str));
|
||||
} else {
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, comment);
|
||||
}
|
||||
} else if (OB_SYS_TENANT_ID != exec_tenant_id && target_tenant_id != exec_tenant_id) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
LOG_WARN("no support operating other user tenants", KR(ret), K(target_tenant_id), K(exec_tenant_id));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionResolver::resolve_transfer_partition_(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartitionStmt *stmt = create_stmt<ObTransferPartitionStmt>();
|
||||
uint64_t target_tenant_id = OB_INVALID_TENANT_ID;
|
||||
if (OB_UNLIKELY(T_TRANSFER_PARTITION != parse_tree.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_TRANSFER_PARTITION", KR(ret), "type",
|
||||
get_type_name(parse_tree.type_));
|
||||
} else if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("create stmt fail", KR(ret));
|
||||
} else if (2 != parse_tree.num_child_ || OB_ISNULL(session_info_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid parse tree or session info", KR(ret), "num_child", parse_tree.num_child_,
|
||||
KP(session_info_));
|
||||
} else if (OB_ISNULL(parse_tree.children_[0])) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("parse node is null", KR(ret), KP(parse_tree.children_[0]));
|
||||
} else if (OB_FAIL(get_and_verify_tenant_name(
|
||||
parse_tree.children_[1],
|
||||
session_info_->get_effective_tenant_id(),
|
||||
target_tenant_id, "Transfer partition"))) {
|
||||
LOG_WARN("fail to execute get_and_verify_tenant_name", KR(ret),
|
||||
K(session_info_->get_effective_tenant_id()), KP(parse_tree.children_[1]));
|
||||
} else {
|
||||
ParseNode *transfer_partition_node = parse_tree.children_[0];
|
||||
switch(transfer_partition_node->type_) {
|
||||
case T_TRANSFER_PARTITION_TO_LS:
|
||||
if (OB_FAIL(resolve_transfer_partition_to_ls(
|
||||
*transfer_partition_node,
|
||||
target_tenant_id,
|
||||
session_info_->get_effective_tenant_id(),
|
||||
stmt))) {
|
||||
LOG_WARN("fail to resolve transfer_partition_to_ls", KR(ret), K(target_tenant_id), K(session_info_->get_effective_tenant_id()));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid transfer partition node type", KR(ret), "type", get_type_name(transfer_partition_node->type_));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
stmt_ = stmt;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTransferPartitionResolver::resolve(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (T_TRANSFER_PARTITION == parse_tree.type_) {
|
||||
if (OB_FAIL(resolve_transfer_partition_(parse_tree))) {
|
||||
LOG_WARN("failed to reslove transfer partition", KR(ret));
|
||||
}
|
||||
} else if (T_CANCEL_TRANSFER_PARTITION == parse_tree.type_) {
|
||||
if (OB_FAIL(resolve_cancel_transfer_partition_(parse_tree))) {
|
||||
LOG_WARN("failed to resolve cancel transfer partition", KR(ret));
|
||||
}
|
||||
} else if (T_CANCEL_BALANCE_JOB == parse_tree.type_) {
|
||||
if (OB_FAIL(resolve_cancel_balance_job_(parse_tree))) {
|
||||
LOG_WARN("failed to resolve cancel balance job", KR(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_TRANSFER_PARTITION", KR(ret), "type",
|
||||
get_type_name(parse_tree.type_));
|
||||
}
|
||||
if (OB_SUCC(ret) && ObSchemaChecker::is_ora_priv_check()) {
|
||||
if (OB_ISNULL(schema_checker_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret));
|
||||
} else if (OB_FAIL(schema_checker_->check_ora_ddl_priv(
|
||||
session_info_->get_effective_tenant_id(),
|
||||
session_info_->get_priv_user_id(),
|
||||
ObString(""),
|
||||
// why use T_ALTER_SYSTEM_SET_PARAMETER?
|
||||
// because T_ALTER_SYSTEM_SET_PARAMETER has following traits:
|
||||
// T_ALTER_SYSTEM_SET_PARAMETER can allow dba to do an operation
|
||||
// and prohibit other user to do this operation
|
||||
// so we reuse this.
|
||||
stmt::T_ALTER_SYSTEM_SET_PARAMETER,
|
||||
session_info_->get_enable_role_array()))) {
|
||||
LOG_WARN("failed to check privilege", K(session_info_->get_effective_tenant_id()), K(session_info_->get_user_id()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionResolver::resolve_cancel_transfer_partition_(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartitionStmt *stmt = create_stmt<ObTransferPartitionStmt>();
|
||||
uint64_t target_tenant_id = OB_INVALID_TENANT_ID;
|
||||
if (OB_UNLIKELY(T_CANCEL_TRANSFER_PARTITION != parse_tree.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_TRANSFER_PARTITION", KR(ret), "type",
|
||||
get_type_name(parse_tree.type_));
|
||||
} else if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("create stmt fail", KR(ret));
|
||||
} else if (2 != parse_tree.num_child_ || OB_ISNULL(session_info_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid parse tree or session info", KR(ret), "num_child", parse_tree.num_child_,
|
||||
KP(session_info_));
|
||||
} else if (OB_ISNULL(parse_tree.children_[0])) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("parse node is null", KR(ret), KP(parse_tree.children_[0]));
|
||||
} else if (OB_FAIL(get_and_verify_tenant_name(
|
||||
parse_tree.children_[1],
|
||||
session_info_->get_effective_tenant_id(),
|
||||
target_tenant_id, "Cancel transfer partition"))) {
|
||||
LOG_WARN("fail to execute get_and_verify_tenant_name", KR(ret),
|
||||
K(session_info_->get_effective_tenant_id()), KP(parse_tree.children_[1]));
|
||||
} else {
|
||||
ParseNode *transfer_partition_node = parse_tree.children_[0];
|
||||
uint64_t table_id = OB_INVALID_ID;
|
||||
ObObjectID object_id = OB_INVALID_OBJECT_ID;
|
||||
rootserver::ObTransferPartitionArg::ObTransferPartitionType type = rootserver::ObTransferPartitionArg::INVALID_TYPE;
|
||||
if (T_PARTITION_INFO == transfer_partition_node->type_) {
|
||||
type = rootserver::ObTransferPartitionArg::CANCEL_TRANSFER_PARTITION;
|
||||
if (OB_FAIL(resolve_part_info(*transfer_partition_node, table_id, object_id))) {
|
||||
LOG_WARN("failed to resolve part info", KR(ret));
|
||||
}
|
||||
} else if (T_ALL == transfer_partition_node->type_) {
|
||||
type = rootserver::ObTransferPartitionArg::CANCEL_TRANSFER_PARTITION_ALL;
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid transfer partition node type", KR(ret), "type", get_type_name(transfer_partition_node->type_));
|
||||
}
|
||||
if (FAILEDx(stmt->get_arg().init_for_cancel_transfer_partition(
|
||||
target_tenant_id, type, table_id, object_id))) {
|
||||
LOG_WARN("fail to init stmt rpc arg", KR(ret), K(target_tenant_id), K(type),
|
||||
K(table_id), K(object_id));
|
||||
} else {
|
||||
stmt_ = stmt;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransferPartitionResolver::resolve_cancel_balance_job_(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTransferPartitionStmt *stmt = create_stmt<ObTransferPartitionStmt>();
|
||||
uint64_t target_tenant_id = OB_INVALID_TENANT_ID;
|
||||
if (OB_UNLIKELY(T_CANCEL_BALANCE_JOB != parse_tree.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_TRANSFER_PARTITION", KR(ret), "type",
|
||||
get_type_name(parse_tree.type_));
|
||||
} else if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("create stmt fail", KR(ret));
|
||||
} else if (1 != parse_tree.num_child_
|
||||
|| OB_ISNULL(session_info_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid parse tree or session info", KR(ret), "num_child", parse_tree.num_child_,
|
||||
KP(session_info_));
|
||||
} else if (OB_FAIL(get_and_verify_tenant_name(
|
||||
parse_tree.children_[0],
|
||||
session_info_->get_effective_tenant_id(),
|
||||
target_tenant_id, "Cancel balance job"))) {
|
||||
LOG_WARN("fail to execute get_and_verify_tenant_name", KR(ret),
|
||||
K(session_info_->get_effective_tenant_id()), KP(parse_tree.children_[0]));
|
||||
} else if (OB_FAIL(stmt->get_arg().init_for_cancel_balance_job(
|
||||
target_tenant_id))) {
|
||||
LOG_WARN("fail to init stmt rpc arg", KR(ret), K(target_tenant_id));
|
||||
} else {
|
||||
stmt_ = stmt;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
@ -162,6 +162,7 @@ DEF_SIMPLE_CMD_RESOLVER(ObAddRestoreSourceResolver);
|
||||
DEF_SIMPLE_CMD_RESOLVER(ObClearRestoreSourceResolver);
|
||||
DEF_SIMPLE_CMD_RESOLVER(ObCheckpointSlogResolver);
|
||||
|
||||
|
||||
int resolve_restore_until(const ParseNode &time_node,
|
||||
const ObSQLSessionInfo *session_info,
|
||||
share::SCN &recovery_until_scn,
|
||||
@ -223,7 +224,17 @@ private:
|
||||
int check_param_valid(int64_t tenant_id,
|
||||
const common::ObString &name_node, const common::ObString &value_node);
|
||||
};
|
||||
|
||||
class ObTransferPartitionResolver : public ObSystemCmdResolver
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionResolver(ObResolverParams ¶ms) : ObSystemCmdResolver(params) {}
|
||||
virtual ~ObTransferPartitionResolver() {}
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
private:
|
||||
int resolve_transfer_partition_(const ParseNode &parse_tree);
|
||||
int resolve_cancel_transfer_partition_(const ParseNode &parse_tree);
|
||||
int resolve_cancel_balance_job_(const ParseNode &parse_tree);
|
||||
};
|
||||
class ObFreezeResolver : public ObSystemCmdResolver {
|
||||
public:
|
||||
ObFreezeResolver(ObResolverParams ¶ms) : ObSystemCmdResolver(params) {}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "share/ob_rpc_struct.h"
|
||||
#include "share/scheduler/ob_sys_task_stat.h"
|
||||
#include "share/backup/ob_backup_clean_struct.h"
|
||||
#include "rootserver/ob_transfer_partition_command.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -1364,6 +1365,18 @@ public:
|
||||
private:
|
||||
common::ObFixedLengthString<common::OB_MAX_TENANT_NAME_LENGTH + 1> clone_tenant_name_;
|
||||
};
|
||||
class ObTransferPartitionStmt : public ObSystemCmdStmt
|
||||
{
|
||||
public:
|
||||
ObTransferPartitionStmt()
|
||||
: ObSystemCmdStmt(stmt::T_TRANSFER_PARTITION),
|
||||
arg_() {}
|
||||
virtual ~ObTransferPartitionStmt() {}
|
||||
|
||||
rootserver::ObTransferPartitionArg &get_arg() { return arg_; }
|
||||
private:
|
||||
rootserver::ObTransferPartitionArg arg_;
|
||||
};
|
||||
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
@ -1185,6 +1185,18 @@ int ObResolver::resolve(IsPrepared if_prepared, const ParseNode &parse_tree, ObS
|
||||
REGISTER_STMT_RESOLVER(CancelClone);
|
||||
break;
|
||||
}
|
||||
case T_TRANSFER_PARTITION: {
|
||||
REGISTER_STMT_RESOLVER(TransferPartition);
|
||||
break;
|
||||
}
|
||||
case T_CANCEL_TRANSFER_PARTITION: {
|
||||
REGISTER_STMT_RESOLVER(TransferPartition);
|
||||
break;
|
||||
}
|
||||
case T_CANCEL_BALANCE_JOB: {
|
||||
REGISTER_STMT_RESOLVER(TransferPartition);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
const char *type_name = get_type_name(parse_tree.type_);
|
||||
|
@ -294,8 +294,8 @@ OB_STMT_TYPE_DEF_UNKNOWN_AT(T_CLONE_TENANT, get_sys_tenant_alter_system_priv, 29
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_CANCEL_CLONE, get_sys_tenant_alter_system_priv, 294)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_CREATE_MLOG, get_create_mlog_stmt_need_privs, 295)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_DROP_MLOG, get_drop_mlog_stmt_need_privs, 296)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_TRANSFER_PARTITION, get_sys_tenant_alter_system_priv, 297)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_FLUSH_PRIVILEGES, no_priv_needed, 298)
|
||||
// OB_STMT_TYPE_DEF_UNKNOWN_AT(T_TRANSFER_PARTITION, get_sys_tenant_alter_system_priv, 297)
|
||||
// OB_STMT_TYPE_DEF_UNKNOWN_AT(T_ALTER_LS_REPLICA, get_sys_tenant_alter_system_priv, 299)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_SHOW_PROCEDURE_CODE, err_stmt_type_priv, 300)
|
||||
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_SHOW_FUNCTION_CODE, err_stmt_type_priv, 301)
|
||||
|
@ -37,7 +37,8 @@ public:
|
||||
{
|
||||
bool b_ret = share::OB_ALL_BALANCE_JOB_TID == inner_table_id
|
||||
|| share::OB_ALL_RECOVER_TABLE_JOB_TID == inner_table_id
|
||||
|| share::OB_ALL_LS_REPLICA_TASK_TID == inner_table_id;
|
||||
|| share::OB_ALL_LS_REPLICA_TASK_TID == inner_table_id
|
||||
|| share::OB_ALL_TRANSFER_PARTITION_TASK_TID == inner_table_id;
|
||||
return b_ret;
|
||||
}
|
||||
/*
|
||||
|
@ -309,6 +309,8 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | DBA_OB_TASK_OPT_STAT_GATHER_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TENANTS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TENANT_EVENT_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_PARTITION_TASKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_PARTITION_TASK_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_TASKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_TASK_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_USERS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -641,6 +643,8 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | __all_tenant_time_zone_transition_type | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_tenant_trigger | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_tenant_trigger_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_partition_task | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_partition_task_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_task | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_task_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_type | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -1490,6 +1494,10 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 2 | base_object_id | A | NULL | NULL | NULL | YES | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 3 | schema_version | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 1 | table_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 2 | object_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_type | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
@ -1669,6 +1677,8 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | DBA_OB_TASK_OPT_STAT_GATHER_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TENANTS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TENANT_EVENT_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_PARTITION_TASKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_PARTITION_TASK_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_TASKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_TRANSFER_TASK_HISTORY | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | DBA_OB_USERS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -2000,6 +2010,8 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
|
||||
| def | oceanbase | __all_tenant_time_zone_transition_type | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_tenant_trigger | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_tenant_trigger_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_partition_task | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_partition_task_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_task | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_transfer_task_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
| def | oceanbase | __all_type | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
|
||||
@ -3150,6 +3162,10 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 3 | schema_version | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_user_failed_login_stat | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_user_failed_login_stat | 0 | oceanbase | PRIMARY | 2 | user_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 1 | table_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 2 | object_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_trusted_root_certificate | 0 | oceanbase | PRIMARY | 1 | common_name | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
@ -3851,6 +3867,10 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 2 | base_object_id | A | NULL | NULL | NULL | YES | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_tenant_trigger_history | 1 | oceanbase | idx_trigger_his_base_obj_id | 3 | schema_version | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 1 | table_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task | 0 | oceanbase | idx_transfer_partition_key | 2 | object_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_partition_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_transfer_task_history | 0 | oceanbase | PRIMARY | 1 | task_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
| def | oceanbase | __all_type | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | VALID | | YES | NULL |
|
||||
|
@ -5682,6 +5682,36 @@ LAST_USED varchar(128) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_INDEX_USAGE limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.DBA_OB_TRANSFER_PARTITION_TASKS;
|
||||
Field Type Null Key Default Extra
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) YES
|
||||
MODIFY_TIME timestamp(6) YES
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_OB_TRANSFER_PARTITION_TASKS limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.DBA_OB_TRANSFER_PARTITION_TASK_HISTORY;
|
||||
Field Type Null Key Default Extra
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) NO NULL
|
||||
FINISH_TIME timestamp(6) NO NULL
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_OB_TRANSFER_PARTITION_TASK_HISTORY limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.GV$OB_LS_SNAPSHOTS;
|
||||
Field Type Null Key Default Extra
|
||||
TENANT_ID bigint(20) NO NULL
|
||||
|
@ -8141,6 +8141,68 @@ LAST_USED varchar(128) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_INDEX_USAGE limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.DBA_OB_TRANSFER_PARTITION_TASKS;
|
||||
Field Type Null Key Default Extra
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) YES
|
||||
MODIFY_TIME timestamp(6) YES
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_OB_TRANSFER_PARTITION_TASKS limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.CDB_OB_TRANSFER_PARTITION_TASKS;
|
||||
Field Type Null Key Default Extra
|
||||
TENANT_ID bigint(20) NO NULL
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) NO NULL
|
||||
MODIFY_TIME timestamp(6) NO NULL
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.CDB_OB_TRANSFER_PARTITION_TASKS limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.DBA_OB_TRANSFER_PARTITION_TASK_HISTORY;
|
||||
Field Type Null Key Default Extra
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) NO NULL
|
||||
FINISH_TIME timestamp(6) NO NULL
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_OB_TRANSFER_PARTITION_TASK_HISTORY limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.CDB_OB_TRANSFER_PARTITION_TASK_HISTORY;
|
||||
Field Type Null Key Default Extra
|
||||
TENANT_ID bigint(20) NO NULL
|
||||
TASK_ID bigint(20) NO NULL
|
||||
CREATE_TIME timestamp(6) NO NULL
|
||||
FINISH_TIME timestamp(6) NO NULL
|
||||
TABLE_ID bigint(20) NO NULL
|
||||
OBJECT_ID bigint(20) NO NULL
|
||||
DEST_LS bigint(20) NO NULL
|
||||
BALANCE_JOB_ID bigint(20) NO NULL
|
||||
TRANSFER_TASK_ID bigint(20) NO NULL
|
||||
STATUS varchar(64) NO NULL
|
||||
COMMENT longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.CDB_OB_TRANSFER_PARTITION_TASK_HISTORY limit 1);
|
||||
cnt
|
||||
1
|
||||
desc oceanbase.DBA_OB_TRUSTED_ROOT_CERTIFICATE;
|
||||
Field Type Null Key Default Extra
|
||||
COMMON_NAME varchar(256) NO NULL
|
||||
|
@ -9111,6 +9111,40 @@ network_speed bigint(20) YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_aux_stat;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_transfer_partition_task;
|
||||
Field Type Null Key Default Extra
|
||||
tenant_id bigint(20) NO PRI NULL
|
||||
task_id bigint(20) NO PRI NULL
|
||||
gmt_create timestamp(6) NO NULL
|
||||
gmt_modified timestamp(6) NO NULL
|
||||
table_id bigint(20) NO NULL
|
||||
object_id bigint(20) NO NULL
|
||||
dest_ls bigint(20) NO NULL
|
||||
status varchar(64) NO NULL
|
||||
balance_job_id bigint(20) NO NULL
|
||||
transfer_task_id bigint(20) NO NULL
|
||||
comment longtext YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_transfer_partition_task;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_transfer_partition_task_history;
|
||||
Field Type Null Key Default Extra
|
||||
tenant_id bigint(20) NO PRI NULL
|
||||
task_id bigint(20) NO PRI NULL
|
||||
gmt_create timestamp(6) NO NULL
|
||||
gmt_modified timestamp(6) NO NULL
|
||||
table_id bigint(20) NO NULL
|
||||
object_id bigint(20) NO NULL
|
||||
dest_ls bigint(20) NO NULL
|
||||
status varchar(64) NO NULL
|
||||
balance_job_id bigint(20) NO NULL
|
||||
transfer_task_id bigint(20) NO NULL
|
||||
comment longtext YES NULL
|
||||
create_time timestamp(6) NO NULL
|
||||
finish_time timestamp(6) NO NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_transfer_partition_task_history;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
desc oceanbase.__all_virtual_tenant_snapshot_job;
|
||||
Field Type Null Key Default Extra
|
||||
tenant_id bigint(20) NO PRI NULL
|
||||
|
@ -279,6 +279,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
486 __all_clone_job_history 0 201001 1
|
||||
494 __all_aux_stat 0 201001 1
|
||||
495 __all_index_usage_info 0 201001 1
|
||||
498 __all_transfer_partition_task 0 201001 1
|
||||
499 __all_transfer_partition_task_history 0 201001 1
|
||||
500 __all_tenant_snapshot_job 0 201001 1
|
||||
502 __all_trusted_root_certificate 0 201001 1
|
||||
507 __all_tenant_snapshot_ls_replica_history 0 201001 1
|
||||
@ -707,6 +709,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
12438 __all_virtual_checkpoint_diagnose_checkpoint_unit_info 2 201001 1
|
||||
12439 __all_virtual_checkpoint_diagnose_info 2 201001 1
|
||||
12447 __all_virtual_aux_stat 2 201001 1
|
||||
12451 __all_virtual_transfer_partition_task 2 201001 1
|
||||
12452 __all_virtual_transfer_partition_task_history 2 201001 1
|
||||
12453 __all_virtual_tenant_snapshot_job 2 201001 1
|
||||
12458 __all_virtual_ls_snapshot 2 201001 1
|
||||
12459 __all_virtual_index_usage_info 2 201001 1
|
||||
@ -1083,6 +1087,10 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
21497 DBA_OB_AUX_STATISTICS 1 201001 1
|
||||
21498 CDB_OB_AUX_STATISTICS 1 201001 1
|
||||
21499 DBA_INDEX_USAGE 1 201001 1
|
||||
21501 DBA_OB_TRANSFER_PARTITION_TASKS 1 201001 1
|
||||
21502 CDB_OB_TRANSFER_PARTITION_TASKS 1 201001 1
|
||||
21503 DBA_OB_TRANSFER_PARTITION_TASK_HISTORY 1 201001 1
|
||||
21504 CDB_OB_TRANSFER_PARTITION_TASK_HISTORY 1 201001 1
|
||||
21509 DBA_OB_TRUSTED_ROOT_CERTIFICATE 1 201001 1
|
||||
21510 DBA_OB_CLONE_PROGRESS 1 201001 1
|
||||
21513 CDB_INDEX_USAGE 1 201001 1
|
||||
|
@ -3494,3 +3494,84 @@ question_mask_size: 0
|
||||
|--[1],[T_VARCHAR], str_value_=[zone1], value=[9223372036854775807]
|
||||
|--[2],[T_VARCHAR], str_value_=["10.101.74.122":41425], value=[9223372036854775807]
|
||||
|
||||
************** Case 188 ***************
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001;
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_TRANSFER_PARTITION_TO_LS], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_PARTITION_INFO], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1001], value=[1001]
|
||||
|
||||
************** Case 189 ***************
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001 tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_TRANSFER_PARTITION_TO_LS], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_PARTITION_INFO], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1001], value=[1001]
|
||||
|--[1],[T_TENANT_NAME], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_VARCHAR], str_value_=[mysql], value=[9223372036854775807]
|
||||
|
||||
************** Case 190 ***************
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1;
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_PARTITION_INFO], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1], value=[1]
|
||||
|
||||
************** Case 191 ***************
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1 tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_PARTITION_INFO], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_INT], str_value_=[1], value=[1]
|
||||
|--[1],[T_TENANT_NAME], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_VARCHAR], str_value_=[mysql], value=[9223372036854775807]
|
||||
|
||||
************** Case 192 ***************
|
||||
alter system cancel transfer partition ALL;
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_ALL], str_value_=[], value=[9223372036854775807]
|
||||
|
||||
************** Case 193 ***************
|
||||
alter system cancel transfer partition ALL tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_TRANSFER_PARTITION], str_value_=[], value=[0]
|
||||
|--[0],[T_ALL], str_value_=[], value=[9223372036854775807]
|
||||
|--[1],[T_TENANT_NAME], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_VARCHAR], str_value_=[mysql], value=[9223372036854775807]
|
||||
|
||||
************** Case 194 ***************
|
||||
alter system cancel balance job;
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_BALANCE_JOB], str_value_=[], value=[0]
|
||||
|
||||
************** Case 195 ***************
|
||||
alter system cancel balance job tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
|
||||
|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_CANCEL_BALANCE_JOB], str_value_=[], value=[0]
|
||||
|--[0],[T_TENANT_NAME], str_value_=[], value=[9223372036854775807]
|
||||
|--[0],[T_VARCHAR], str_value_=[mysql], value=[9223372036854775807]
|
||||
|
@ -23032,3 +23032,335 @@ question_mask_size: 0
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 188 ***************
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001;
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_TRANSFER_PARTITION_TO_LS",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_PARTITION_INFO",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1001,
|
||||
"str_len":4,
|
||||
"str_val":"1001"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 189 ***************
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001 tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_TRANSFER_PARTITION_TO_LS",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_PARTITION_INFO",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1001,
|
||||
"str_len":4,
|
||||
"str_val":"1001"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type":"T_TENANT_NAME",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_VARCHAR",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":5,
|
||||
"str_val":"mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 190 ***************
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1;
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_PARTITION_INFO",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 191 ***************
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1 tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_PARTITION_INFO",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
},
|
||||
{
|
||||
"type":"T_INT",
|
||||
"int_val":1,
|
||||
"str_len":1,
|
||||
"str_val":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type":"T_TENANT_NAME",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_VARCHAR",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":5,
|
||||
"str_val":"mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 192 ***************
|
||||
alter system cancel transfer partition ALL;
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_ALL",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":""
|
||||
},
|
||||
{ }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 193 ***************
|
||||
alter system cancel transfer partition ALL tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_TRANSFER_PARTITION",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_ALL",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":""
|
||||
},
|
||||
{
|
||||
"type":"T_TENANT_NAME",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_VARCHAR",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":5,
|
||||
"str_val":"mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 194 ***************
|
||||
alter system cancel balance job;
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_BALANCE_JOB",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{ }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
************** Case 195 ***************
|
||||
alter system cancel balance job tenant 'mysql';
|
||||
question_mask_size: 0
|
||||
{
|
||||
"type":"T_STMT_LIST",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_CANCEL_BALANCE_JOB",
|
||||
"int_val":0,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_TENANT_NAME",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":0,
|
||||
"str_val":"",
|
||||
"children": [
|
||||
{
|
||||
"type":"T_VARCHAR",
|
||||
"int_val":9223372036854775807,
|
||||
"str_len":5,
|
||||
"str_val":"mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -305,3 +305,11 @@ alter tablegroup tg2 add table t1,t2;
|
||||
insert into t1 values(X'');
|
||||
create table t1(`thedate` date NOT NULL COMMENT '日期');
|
||||
alter system bootstrap REGION 'sys_region' ZONE 'zone1' SERVER '10.101.74.122:41425';
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001;
|
||||
alter system transfer partition table_id = 1, object_id = 1 to ls 1001 tenant 'mysql';
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1;
|
||||
alter system cancel transfer partition table_id = 1, object_id = 1 tenant 'mysql';
|
||||
alter system cancel transfer partition ALL;
|
||||
alter system cancel transfer partition ALL tenant 'mysql';
|
||||
alter system cancel balance job;
|
||||
alter system cancel balance job tenant 'mysql';
|
||||
|
Loading…
x
Reference in New Issue
Block a user