V2.1.31 版本操作
当 OceanBase 升级到 V2.1.31 版本后,若要继续升级,需要您登录到 OceanBase 中执行渐进合并,操作步骤如下:
执行以下 SQL,准备执行渐进合并:
SET ob_query_timeout = 100000000000;
ALTER system SET enable_sys_table_ddl = TRUE;
配置希望进行的渐进合并轮次:
ALTER TENANT all SET progressive_merge_num = num;
注意
渐进轮次
num
必须大于 1。清空所有租户的回收站:
PURGE RECYCLEBIN;
设置每个租户的
rewrite_merge_version
为下次合并的版本号,其中 ver 表示下次合并的版本号:ALTER tenant xxx SET rewrite_merge_version = ver;
根据渐进合并的轮次,发起相应次数的合并:
ALTER SYSTEM MAJOR FREEZE;
在合并完全结束后,通过下面的SQL检查是否满足升级到 V2.2.1 的条件,如果以下 SQL 的返回值都为空,则说明可满足升级条件:
SELECT * FROM __all_table WHERE table_id IN (SELECT index_id FROM __all_sstable_column_checksum WHERE checksum_method = 1 AND major_version = (SELECT value FROM __all_zone WHERE name = 'last_merged_version' AND zone = '')) LIMIT 1;
SELECT column_value FROM __all_core_table WHERE table_name = '__all_table' AND column_name = 'table_id' AND column_value in (SELECT index_id FROM __all_sstable_column_checksum WHERE checksum_method = 1 AND major_version = (SELECT value FROM __all_zone WHERE name = 'last_merged_version' AND zone = '')) LIMIT 1;
SELECT index_id FROM __all_sstable_column_checksum WHERE checksum_method = 1 AND index_id = 1099511627777 AND major_version = (SELECT value FROM __all_zone WHERE name = 'last_merged_version' AND zone = '') LIMIT 1;
SELECT DISTINCT index_id FROM (SELECT index_id, index_id & ((1 << 40) - 1) AS real_id FROM __all_sstable_column_checksum WHERE checksum_method = 1 AND major_version = (SELECT value FROM __all_zone WHERE name = 'last_merged_version' AND zone = '')) WHERE real_id < 10000 LIMIT 1;
注意
检查必须要在集群不合并的时候进行,否则检查结果可能不准确。
回滚所有表的渐进轮次:
ALTER TENANT ALL SET progressive_merge_num = 0;
回滚 sys table 执行ddl权限:
ALTER SYSTEM SET enable_sys_table_ddl = false;
V2.2.1 版本操作
当 OceanBase 升级到 V2.2.1版本后,若要继续升级,需要您登录到 OceanBase 中,手动触发一轮合并或转储:
ALTER SYSTEM MINOR FREEZE;
或
ALTER SYSTEM MAJOR FREEZE;