fix not update column_cnt on schema when upgrade
This commit is contained in:
@ -2052,16 +2052,14 @@ int ObTablet::get_max_sync_medium_scn(int64_t &max_medium_snapshot) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
max_medium_snapshot = 0;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else if (tablet_meta_.tablet_id_.is_special_merge_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else {
|
||||
max_medium_snapshot = data_memtable_mgr->get_medium_info_recorder().get_max_saved_version();
|
||||
}
|
||||
@ -2072,13 +2070,11 @@ int ObTablet::get_max_sync_storage_schema_version(int64_t &max_schema_version) c
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
max_schema_version = 0;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
if (is_ls_inner_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else {
|
||||
max_schema_version = data_memtable_mgr->get_storage_schema_recorder().get_max_saved_version();
|
||||
}
|
||||
@ -2092,7 +2088,6 @@ int ObTablet::try_update_storage_schema(
|
||||
const int64_t timeout_ts)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
@ -2100,9 +2095,8 @@ int ObTablet::try_update_storage_schema(
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else if (tablet_meta_.tablet_id_.is_special_merge_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else if (OB_FAIL(data_memtable_mgr->get_storage_schema_recorder().try_update_storage_schema(
|
||||
table_id, schema_version, allocator, timeout_ts))) {
|
||||
LOG_WARN("fail to record storage schema", K(ret), K(table_id), K(schema_version), K(timeout_ts));
|
||||
@ -2110,6 +2104,24 @@ int ObTablet::try_update_storage_schema(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::get_max_column_cnt_on_schema_recorder(int64_t &max_column_cnt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else if (tablet_meta_.tablet_id_.is_special_merge_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else {
|
||||
max_column_cnt = data_memtable_mgr->get_storage_schema_recorder().get_max_column_cnt();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// be careful to use this max_schem_version on storage_schema
|
||||
int ObTablet::get_max_schema_version(int64_t &schema_version)
|
||||
{
|
||||
@ -3203,7 +3215,6 @@ int ObTablet::replay_update_storage_schema(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t new_pos = pos;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
@ -3211,9 +3222,8 @@ int ObTablet::replay_update_storage_schema(
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else if (tablet_meta_.tablet_id_.is_special_merge_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else if (OB_FAIL(data_memtable_mgr->get_storage_schema_recorder().replay_schema_log(scn, buf, buf_size, new_pos))) {
|
||||
LOG_WARN("storage schema recorder replay fail", K(ret), K(scn));
|
||||
} else {
|
||||
@ -3230,7 +3240,6 @@ int ObTablet::submit_medium_compaction_clog(
|
||||
ObIAllocator &allocator)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
@ -3238,9 +3247,8 @@ int ObTablet::submit_medium_compaction_clog(
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else if (tablet_meta_.tablet_id_.is_special_merge_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else if (OB_FAIL(data_memtable_mgr->get_medium_info_recorder().submit_medium_compaction_info(
|
||||
medium_info, allocator))) {
|
||||
LOG_WARN("medium compaction recorder submit fail", K(ret), K(medium_info));
|
||||
@ -3258,7 +3266,6 @@ int ObTablet::replay_medium_compaction_clog(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t new_pos = pos;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
ObTabletMemtableMgr *data_memtable_mgr = nullptr;
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
@ -3268,9 +3275,8 @@ int ObTablet::replay_medium_compaction_clog(
|
||||
LOG_WARN("invalid argument", K(ret), K(buf_size), K(pos));
|
||||
} else if (tablet_meta_.tablet_id_.is_ls_inner_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
} else if (OB_FAIL(get_tablet_memtable_mgr(data_memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else if (FALSE_IT(data_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr))) {
|
||||
} else if (OB_FAIL(data_memtable_mgr->get_medium_info_recorder().replay_medium_compaction_log(scn, buf, buf_size, new_pos))) {
|
||||
LOG_WARN("medium compaction recorder replay fail", K(ret), KPC(this), K(buf_size), K(new_pos));
|
||||
} else {
|
||||
@ -3549,6 +3555,21 @@ int ObTablet::get_memtable_mgr(ObIMemtableMgr *&memtable_mgr) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::get_tablet_memtable_mgr(ObTabletMemtableMgr *&tablet_memtable_mgr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
tablet_memtable_mgr = nullptr;
|
||||
ObIMemtableMgr *memtable_mgr = nullptr;
|
||||
if (tablet_meta_.tablet_id_.is_ls_inner_tablet()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(get_memtable_mgr(memtable_mgr))) {
|
||||
LOG_WARN("failed to get memtable mgr", K(ret));
|
||||
} else {
|
||||
tablet_memtable_mgr = static_cast<ObTabletMemtableMgr *>(memtable_mgr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::get_ddl_kv_mgr(ObDDLKvMgrHandle &ddl_kv_mgr_handle, bool try_create)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user