MVD 结果说明
MVD 结果默认以可读文本的方式在终端直接输出,用户可以输出为 json 和 plain 格式,且可以将最终结果输出到指定的结果文件中。以下以文本格式,介绍 MVD 结果各个部分的具体含义。
MD5 逐行对比
以下结果来源于如下命令:
./mvd_linux_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. Summary:
>>>> =============================================
+-----------------------+-------+
| OPTION | VALUE |
+-----------------------+-------+
| TOTAL_OBJECTS | 22 |
| DIFF_OBJECTS | 10 |
| TOTAL_TABLES | 9 |
| STRUCTURE_DIFF_TABLES | 1 |
| DATA_DIFF_TABLES | 2 |
+-----------------------+-------+
>>>> =============================================
>>>> 3. 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 | |
+-------------+-------------------+------------------+
>>>> =============================================
>>>> 4. 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 |
+-------+---------------+-----------------+---------+--------+--------+
>>>> =============================================
>>>> 5. Table Data Differences (MD5 ROW-BY-ROW):
>>>> =============================================
+-------+----------------+--------+-------------+-------------+-------------+-------------+------------------+------------------+--------------+
| OWNER | TABLE | Method | SOURCE_ROWS | TARGET_ROWS | SOURCE_DIFF | TARGET_DIFF | SOURCE_SIGNATURE | TARGET_SIGNATURE | CHECK_RESULT |
+-------+----------------+--------+-------------+-------------+-------------+-------------+------------------+------------------+--------------+
| mtk | bug_1005673 | Normal | 7 | 0 | 7 | 0 | | | FAILED |
| mtk | tab_data_check | Normal | 22 | 0 | 22 | 0 | | | FAILED |
+-------+----------------+--------+-------------+-------------+-------------+-------------+------------------+------------------+--------------+
>>>> =============================================
>>>> 6. Completed
>>>> =============================================
全量特征对比
以下结果来源于如下命令:
./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.*' -m summary
对比结果
>>>> =============================================
>>>> 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. Summary:
>>>> =============================================
+-----------------------+-------+
| OPTION | VALUE |
+-----------------------+-------+
| TOTAL_OBJECTS | 22 |
| DIFF_OBJECTS | 10 |
| TOTAL_TABLES | 9 |
| STRUCTURE_DIFF_TABLES | 1 |
| DATA_DIFF_TABLES | 2 |
+-----------------------+-------+
>>>> =============================================
>>>> 3. 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 |
+-------------+-------------------+------------------+
>>>> =============================================
>>>> 4. 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 |
+-------+---------------+-----------------+---------+--------+--------+
>>>> =============================================
>>>> 5. Table Data Differences (MD5 ROW-BY-ROW):
>>>> =============================================
+-------+----------------+--------+-------------+-------------+-------------+-------------+----------------------------------+----------------------------------+--------------+
| OWNER | TABLE | Method | SOURCE_ROWS | TARGET_ROWS | SOURCE_DIFF | TARGET_DIFF | SOURCE_SIGNATURE | TARGET_SIGNATURE | CHECK_RESULT |
+-------+----------------+--------+-------------+-------------+-------------+-------------+----------------------------------+----------------------------------+--------------+
| mtk | bug_1005673 | Normal | 7 | 0 | | | 8040db9b7ea88fea4edd7e30fe0b3992 | d41d8cd98f00b204e9800998ecf8427e | FAILED |
| mtk | tab_data_check | Normal | 22 | 0 | | | 05c4b8258de107a422a12247a09f8326 | d41d8cd98f00b204e9800998ecf8427e | FAILED |
+-------+----------------+--------+-------------+-------------+-------------+-------------+----------------------------------+----------------------------------+--------------+
>>>> =============================================
>>>> 6. 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);
表数据差异
数据差异,展示表中的数据差异,无差异的表表默认不展示,也可使用 --detail-mode 展示所有表的对比结果。
对比结果分为 10 列展示:
- OWNER: 表的 Schema 信息
- NAME: 表名
- MODE: 对比模式,分为:Normal, Partition, Sample, Split, Partial
- SOURCE_ROWS: 源端总行数
- TARGET_ROWS: 目标端总行数
- SOURCE_DIFF: 源端差异行数 (即源端存在且与目标端不一致的行的数量)
- TARGET_DIFF: 目标端差异行数 (即目标端存在且与源端不一致的行的数量)
- SOURCE_SIGNATURE: 源端全量特征值
- TARGET_SIGNATURE: 目标端全量特征值
- CHECK_RESULT: 校验是否通过 (SUCCEED/FAILED)