MVD 结果说明
MVD 结果默认以可读文本的方式在终端直接输出,用户可以输出为 json 和 plain 格式,且可以将最终结果输出到指定的结果文件中。以下以文本格式,介绍 MVD 结果各个部分的具体含义。
特征值对比
以下结果来源于如下命令:
./mvd_macos_x86_64 -s 'MYSQL:127.0.0.1:3306::root:pwd' -t 'MOGDB:127.0.0.1:5432:mysql_mtk:hongye:pwd' -i 'mtk.*'
对比结果:
>>>> =============================================
>>>> 1. Environments:
>>>> =============================================
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| OPTION | VALUE |
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| SOURCE_DB | ['MYSQL', '121.36.15.2', '55444', '', 'root', '******'] |
| TARGET_DB | ['MOGDB', '121.36.15.2', '55432', 'mysql_mtk', 'hongye', '******'] |
| WORKERS | 8 |
| INCLUDE | [['%', 'MTK', '%']] |
| RESULT_FORMAT | json |
| FUNCTION_DIMENSION | {'AVG': {'TYPE': 'A', 'FUNCTIONS': {'*': 'AVG'}}, 'MIN': {'TYPE': 'NP', 'FUNCTIONS': {'*': 'MIN'}}, 'MAX': {'TYPE': 'NP', 'FUNCTIONS': {'*': 'MAX'}}} |
| CATAGORY | ALL |
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
>>>> =============================================
>>>> 2. Object Differences:
>>>> =============================================
+-------------+-------------------+------------------+
| OBJECT_TYPE | SOURCE_EXTRA | TARGET_EXTRA |
+-------------+-------------------+------------------+
| TABLE | MTK.MTK_TEST | |
| | MTK.MTK_TEST_1 | |
| | MTK.MTK_TEST_2 | |
| | MTK.MTK_TEST_3 | |
| | MTK.MTK_TEST_4 | |
| TRIGGER | MTK.USER_LOG | |
| SEQUENCE | | MTK.SEQ_LOGS_ID |
| | | MTK.SEQ_USERS_ID |
| PROCEDURE | MTK.TEST_MTK_DATA | |
| | MTK.TEST_MTK_TEST | |
+-------------+-------------------+------------------+
>>>> =============================================
>>>> 3. Table Structure Differences:
>>>> =============================================
+-------+---------------+-----------------+---------+--------+--------+
| OWNER | TABLE | TYPE | NAME | SOURCE | TARGET |
+-------+---------------+-----------------+---------+--------+--------+
| MTK | TEST_VARCHAR3 | COLUMN_NULLABLE | ID | Y | N |
| MTK | TEST_VARCHAR3 | CONSTRAINT | PRIMARY | | ID |
| MTK | TEST_VARCHAR3 | INDEX | | | ID |
+-------+---------------+-----------------+---------+--------+--------+
>>>> =============================================
>>>> 4. Table Data Differences (Statistics Analysis):
>>>> =============================================
+-------+---------------+--------------+-----------+----------------+----------------+
| OWNER | TABLE | COLUMN | DIMENSION | SOURCE | TARGET |
+-------+---------------+--------------+-----------+----------------+----------------+
| MTK | TABLE_NULL | COL_NOT_NULL | AVG | 1 | 1.666666666667 |
| MTK | TABLE_NULL | COL_NOT_NULL | MIN | 0 | 1 |
| MTK | TABLE_NULL | COL_NULL | AVG | 1.5 | 3 |
| MTK | TABLE_NULL | COL_NULL | MIN | 0 | 3 |
| MTK | TEST_VARCHAR3 | NAME | AVG | 5.166666666667 | 5 |
| MTK | TEST_VARCHAR3 | NAME | MIN | 4 | 3 |
| MTK | TEST_VARCHAR3 | NAME | MAX | 7 | 9 |
+-------+---------------+--------------+-----------+----------------+----------------+
>>>> =============================================
>>>> 5. Completed
>>>> =============================================
MD5 逐行对比
以下结果来源于如下命令:
./mvd_macos_x86_64 -s 'MYSQL:127.0.0.1:3306::root:pwd' -t 'MOGDB:127.0.0.1:5432:mysql_mtk:hongye:pwd' -i 'mtk.*' -R './diff'
对比结果
>>>> =============================================
>>>> 1. Environments:
>>>> =============================================
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| OPTION | VALUE |
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| SOURCE_DB | ['MYSQL', '121.36.15.2', '55444', '', 'root', '******'] |
| TARGET_DB | ['MOGDB', '121.36.15.2', '55432', 'mysql_mtk', 'hongye', '******'] |
| WORKERS | 8 |
| INCLUDE | [['%', 'MTK', '%']] |
| RESULT_FORMAT | json |
| ROW_DIR | ./diff |
| FUNCTION_DIMENSION | {'AVG': {'TYPE': 'A', 'FUNCTIONS': {'*': 'AVG'}}, 'MIN': {'TYPE': 'NP', 'FUNCTIONS': {'*': 'MIN'}}, 'MAX': {'TYPE': 'NP', 'FUNCTIONS': {'*': 'MAX'}}} |
| CATAGORY | ALL |
+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
>>>> =============================================
>>>> 2. Object Differences:
>>>> =============================================
+-------------+-------------------+------------------+
| OBJECT_TYPE | SOURCE_EXTRA | TARGET_EXTRA |
+-------------+-------------------+------------------+
| TABLE | MTK.MTK_TEST | |
| | MTK.MTK_TEST_1 | |
| | MTK.MTK_TEST_2 | |
| | MTK.MTK_TEST_3 | |
| | MTK.MTK_TEST_4 | |
| TRIGGER | MTK.USER_LOG | |
| PROCEDURE | MTK.TEST_MTK_DATA | |
| | MTK.TEST_MTK_TEST | |
| SEQUENCE | | MTK.SEQ_LOGS_ID |
| | | MTK.SEQ_USERS_ID |
+-------------+-------------------+------------------+
>>>> =============================================
>>>> 3. Table Structure Differences:
>>>> =============================================
+-------+---------------+-----------------+---------+--------+--------+
| OWNER | TABLE | TYPE | NAME | SOURCE | TARGET |
+-------+---------------+-----------------+---------+--------+--------+
| MTK | TEST_VARCHAR3 | COLUMN_NULLABLE | ID | Y | N |
| MTK | TEST_VARCHAR3 | CONSTRAINT | PRIMARY | | ID |
| MTK | TEST_VARCHAR3 | INDEX | | | ID |
+-------+---------------+-----------------+---------+--------+--------+
>>>> =============================================
>>>> 4. Table Data Differences (MD5 ROW-BY-ROW):
>>>> =============================================
+-------+---------------+-------------+-------------+-------------+-------------+
| OWNER | TABLE | SOURCE_ROWS | TARGET_ROWS | SOURCE_DIFF | TARGET_DIFF |
+-------+---------------+-------------+-------------+-------------+-------------+
| MTK | TABLE_NULL | 3 | 3 | 2 | 2 |
| MTK | TEST_VARCHAR3 | 6 | 6 | 1 | 1 |
+-------+---------------+-------------+-------------+-------------+-------------+
>>>> =============================================
>>>> 5. Completed
>>>> =============================================
环境
环境参数与变量信息,展示当前运行过程中的一些程序参数与变量。
对象差异
对象差异,按类别汇总源库和目标库的对象差异,该结果分 3 列展示:
- OBJECT_TYPE: 差异对象的类别
- SOURCE_EXTRA: 源库中多出来的对象,以列表形式展示,每行为一个对象,列表按名称排序
- TARGET_EXTRA: 目标库中多出来的对象,以列表形式展示,每行为一个对象,列表按名称排序
表结构差异
表结构差异,展示每一张差异表的具体差异项,该结果分为 5 列展示:
- OWNER: 表的 Schema 信息
- TABLE_NAME: 表名
- TYPE: 差异类别,主要有: COLUMN_COUNT, COLUMN, COLUMN_POSITION, COLUMN_DATATYPE, COLUMN_NULLABLE, CONSTRAINT, INDEX 等
- NAME: 差异名称,不同差异类别中,差异名称有不同的含义
- SOURCE: 源库中的差异值,不同类别下差异值是不一样的
- TARGET: 目标库中的差异值,不同类别下差异值是不一样的
注意事项:
对于约束和索引,名称不同不认为存在差异,只要约束和索引对应的 “字段名称,位置,顺序,是否使用函数” 等信息一致,即认为双方是一致的。即如下两个索引认为是相同的:
-- Oracle
create index idx_test_pk_oracle on hongye.test(id);
-- MogDB
create index idx_test_pk_mogdb on hongye.test(id);
表数据差异
数据差异,展示表中的数据差异,无差异的表表不展示。数据差异按照对比方式的不同分为两种:
-
特征值对比(Statistics Analysis)
-
逐行对比(MD5 ROW-BY-ROW)
特征值对比结果分为 6 列展示:
- OWNER: 表的 Schema 信息
- TABLE_NAME: 表名
- COLUMN_NAME: 字段名称
- DIMENSION: 统计维度,默认情况下,对于主键表,统计维度为:COUNT + AVG + CORR,对于非主键表,统计维度为: COUNT + AVG + MIN + MAX + MEDIAN
- SOURCE_VALUE: 源库统计值
- TARGET_VALUE: 目标库统计值
逐行对比结果也分为 6 列展示:
- OWNER: 表的 Schema 信息
- TABLE_NAME: 表名
- SOURCE_ROWS: 源端总行数
- TARGET_ROWS: 目标端总行数
- SOURCE_DIFF: 源端差异行数 (即源端存在且与目标端不一致的行的数量)
- TARGET_DIFF: 目标端差异行数 (即目标端存在且与源端不一致的行的数量)