401 Star 1.4K Fork 1.5K

GVPopenGauss / openGauss-server

 / 详情

mysql 分库分表迁移到openGauss不兼容问题:不支持分表功能

已完成
缺陷
创建于  
2023-04-13 19:15

【标题描述】:mysql 分库分表迁移到openGauss不兼容问题:不支持分表(表名不同,结构相同)

【操作系统和硬件信息】与操作系统无关

【测试环境】(单机/1主x备x级联备):

【被测功能】:mysql迁移openGauss兼容性

【测试类型】:测试mysql库表导入openGauss是否兼容

【数据库版本】:openGauss任一版本

【预置条件】: 设置B模式的数据库以兼容MySQL特性,后创建多个分表

【操作步骤】(请填写详细的操作步骤):

  1. create database test_mysql DBCOMPATIBILITY 'B';
  2. 创建mysql_schema mysql_db;
    3.创建2个分表:
    create table t1(id int,index idx_id(id));
    create table t2(id int,index idx_id(id));
    【预期输出】:
    可以正常创建
    【实际输出】:
    t1表创建成功,t2表创建失败,报错:
    ERROR: relation "idx_id" already exists
    【原因分析】:
    Oracle、openGauss、PostgreSQL等数据库表(表名)和索引(索引名)是全局唯一的,但MySQL不是(索引属于某个表),索引名可以重复

【解决方案】
在dolphin插件中兼容MySQL语法,即参考auto_increment自动改为sequence的功能,实现自动将新创建的重复索引名改为和表名相关的新索引名。

评论 (4)

星爷001 创建了缺陷

Hey @星爷001, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.

Hi @星爷001, please use the command /sig xxx to add a SIG label to this issue.
For example: /sig sqlengine or /sig storageengine or /sig om or /sig ai and so on.
You can find more SIG labels from Here.
If you have no idea about that, please contact with @xiangxinyong , @zhangxubo .

yansong_lee 负责人设置为pengjiong
yansong_lee 优先级设置为次要

和提单人沟通,考虑在索引名冲突的情况下,自动将索引名重命名为新的名称,例如:

create table t1(id int, index idx_id(id));
create table t2(id int, index idx_id(id));

这个场景,第二个索引 idx_id 就自动重命名为 idx_id_1 这样,打个告警提示下。
考虑在插件实现,并使用guc参数 dolphin.b_compatibility_mode 控制

pengjiong 任务状态待办的 修改为修复中
pengjiong 计划开始日期设置为2023-04-18
pengjiong 计划截止日期设置为2023-04-20
pengjiong 通过opengauss/Plugin Pull Request !793任务状态修复中 修改为已完成

验证通过:

b_db=#  set dolphin.b_compatibility_mode=on;
b_db=# create table t1(id int,index idx_id(id));
CREATE TABLE
b_db=# create table t2(id int,index idx_id(id));
WARNING:  index "idx_id" already exists, change index name to "t2_id_idx"
CREATE TABLE

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(4)
5622128 opengauss bot 1581905080
C++
1
https://gitee.com/opengauss/openGauss-server.git
git@gitee.com:opengauss/openGauss-server.git
opengauss
openGauss-server
openGauss-server

搜索帮助