Skip to content

Commit 543b28d

Browse files
committed
note on multi slaves
1 parent 8424665 commit 543b28d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ It was developed to compare MySQL replicas, in particular for a MySQL InnoDB clu
88

99
The tool first retrieves schema information and ensures that tables can be compared. Two tables can be compared when they carry the same columns and the same primary keys. The tool issues warning when columns or primary keys are different type or different ordinal position.
1010

11-
The tool compares md5 of the row, simply speaking `select concat(pk1, ',', pk2) PK, md5(concat(pk1, ',', pk2, ',', coalesce(c1, 'null'), ',', coalesce(c2, 'null'), ...)) MD5 from mytable order by pk1, pk2`. If some primary keys are missing on either master or slave database, or md5 value is not matching, the tool reports the difference, showing the primary keys.
11+
The tool compares md5 of the row, simply speaking `select concat(pk1, ',', pk2) as PK, md5(concat(pk1, ',', pk2, ',', coalesce(c1, 'null'), ',', coalesce(c2, 'null'), ...)) as MD5 from mytable order by pk1, pk2`. If some primary keys are missing on either master or slave database, or md5 value is not matching, the tool reports the difference, showing the primary keys.
1212

1313
The tool being optimized for tables very similar in content, it retrieves 1 row alternatively from master then slave table. As data is sorted by PK, it keeps a sorted list of differences (pk and md5 value) in memory. As soon as there is a match, any value lower than the match pair is immediately reported and removed from memory. Memory footprint shall then remain small.
1414

15+
In the current version when multiple slaves are analyzed, master data (pk and md5) is loaded for every slave. Later version will be optimized.
16+
1517
In the case the tool finds more than N rows (N=100 by default) different, the tool proceeds to analyze the next table.
1618

1719
## Build and Test

0 commit comments

Comments
 (0)