开发者
我要评分
获取效率
正确性
完整性
易理解
在线提单
论坛求助

配置兼容性评估过滤类型

创建SQL迁移任务时若连接迁移目标数据库,则会对提取的SQL语句进行动态兼容性评估。对于不兼容的SQL语句,支持用户自定义配置EXPLAIN执行结果的过滤列表,可灵活添加需要过滤的类型。

场景示例

以迁移路线为MySQL > DM为例,扫描结果如下,EXPLAIN执行结果为“Invalid table or view name [not_exist_table]”。

配置过滤类型

  1. 使用安装DevKit使用的用户 SSH 远程登录工具,进入Linux操作系统命令行界面。
  2. 打开“sqlAnalysisSettingsConfig.json”文件。
    vi /opt/DevKit/devkitplugins/porting/config/sysmig/sql_analysis/sqlAnalysisSettingsConfig.json

    “/opt”为工具安装目录,请根据实际情况替换。

  3. 按“i”进入编辑模式,添加explainExecutionResult字段。
    {
      "crossFunction": false,
      "compilationUnitMaxCache": 3000,
      "poolSize": 0,
      "taskQueueCapacity": 5000,
      "ifMaxNum": 12,
      "sourceIfMaxNum": 256,
      "compatibilityCheckTimeoutSeconds": 120,
      "explainExecutionResult": ["Invalid table or view name.*"],  
      "addTodoInPatch": false,
      "todoSuggestionUseEnLang": true,
      "dbConnOptionsConfig": {
        "sourceDb": {
          "--source-db-user": "",
          "--source-db-jdbc-url": "",
          "--source-db-driver-jar-path": "",
          "--source-db-driver-class-name": ""
        },
        "targetDb": {
          "--target-db-user": "",
          "--target-db-jdbc-url": "",
          "--target-db-driver-jar-path": "",
          "--target-db-driver-class-name": ""
        }
      }
    }

    explainExecutionResult:配置需要过滤的执行结果,支持正则匹配。多个过滤项请以英文逗号分隔,例如:["Invalid table or view name.*","Table '.*' doesn't exist"]。

  4. 按“Esc”,输入:wq!,按“Enter”保存并退出。
  5. 重新扫描源码文件,报告显示之前不兼容的SQL语句为已兼容。
    图1 修改后报告