[FEAT MERGE] Support exchanging partition between partitioned table A and non-partitioned table B.

Co-authored-by: fkuner <784819644@qq.com>
This commit is contained in:
791065426@qq.com
2024-04-16 07:19:48 +00:00
committed by ob-robot
parent 2c510c6538
commit 1ee64365ea
46 changed files with 4105 additions and 102 deletions

View File

@ -0,0 +1,66 @@
/**
* 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_STORAGE_OB_CHANGE_TABLET_TO_TABLE_HELPER
#define OCEANBASE_STORAGE_OB_CHANGE_TABLET_TO_TABLE_HELPER
#include "common/ob_tablet_id.h"
#include "lib/container/ob_array.h"
#include "lib/container/ob_array_serialization.h"
#include "lib/ob_define.h"
#include "share/ob_ls_id.h"
namespace oceanbase
{
namespace share
{
class SCN;
}
namespace storage
{
namespace mds
{
struct BufferCtx;
}
class ObChangeTabletToTableHelper final
{
public:
static int on_register(const char* buf,
const int64_t len,
mds::BufferCtx &ctx); // 出参,将对应修改记录在Ctx中
static int on_replay(const char* buf,
const int64_t len,
const share::SCN &scn, // 日志scn
mds::BufferCtx &ctx); // 备机回放
};
inline int ObChangeTabletToTableHelper::on_register(const char* buf,
const int64_t len,
mds::BufferCtx &ctx)
{
int ret = OB_SUCCESS;
return ret;
}
inline int ObChangeTabletToTableHelper::on_replay(const char* buf,
const int64_t len,
const share::SCN &scn, // 日志scn
mds::BufferCtx &ctx)
{
int ret = OB_SUCCESS;
return ret;
}
} // namespace storage
} // namespace oceanbase
#endif

View File

@ -18,6 +18,7 @@
// inlcude those classes definations header file in below MACRO BLOCK
// CAUTION: MAKE SURE your header file is as CLEAN as possible to avoid recursive dependencies!
#if defined (NEED_MDS_REGISTER_DEFINE) && !defined (NEED_GENERATE_MDS_FRAME_CODE_FOR_TRANSACTION)
#include "src/storage/ddl/ob_ddl_change_tablet_to_table_helper.h"
#include "src/storage/multi_data_source/compile_utility/mds_dummy_key.h"
#include "src/storage/multi_data_source/mds_ctx.h"
#include "src/storage/multi_data_source/test/example_user_data_define.h"
@ -118,7 +119,10 @@ _GENERATE_MDS_FRAME_CODE_FOR_TRANSACTION_(HELPER_CLASS, BUFFER_CTX_TYPE, ID, ENU
28,\
TRANSFER_DEST_PREPARE)
// UNBIND_LOB_TABLET: ID = 29 for drop lob tablet when drop column instant.
// CHANGE_TABLET_TO_TABLE_MDS: ID = 30 for exchange tablet to table bind relationship after exchanging partition.
GENERATE_MDS_FRAME_CODE_FOR_TRANSACTION(::oceanbase::storage::ObChangeTabletToTableHelper,\
::oceanbase::storage::mds::MdsCtx,\
30,\
CHANGE_TABLET_TO_TABLE_MDS)
// TABLET_SPLIT: ID = 31 for auto_split.
#undef GENERATE_MDS_FRAME_CODE_FOR_TRANSACTION
#endif