VDiff finds the current position of the source primary and then waits for the target replication to reach
that position for _filtered_replication_wait_time_. If the target is much behind the source or if there is
a high write qps on the source then this time will need to be increased.
Currently VDiff runs within vtctd. Each VDiff will stream rows from all sources and targets and then compare them row by row after assembling the rows in order. Since there are no database transactions, VDiff will run much faster than the actual workflow. However, for huge tables (billions of rows or terabytes in size) this can take several hours or even days depending on the number of rows, row composition, server configurations and the topology of the cluster. If your sources and/or targets are across multiple cells, for example, this can slow down the VDiff considerably.
Actual VDiff speeds are of course dependent on several factors in your cluster. But as a reference, we have seen VDiffs run as fast as 400mrph (million rows per hour) (~9B rows/day) for tables with short rows, or as slow as 60mrph (~1.5B rows/day), for tables with larger width and complex columns.
You may need to use one or more of the following recommendations while running long VDiffs:
If VDiff takes more than an hour vtctlclient will hit grpc/http timeouts of 1 hour. In that case you can use vtctl (the bundled vctlclient + vtctld) instead.
VDiff also synchronizes sources and targets to get consistent snapshots. If you have a high write QPS then you may encounter timeouts during the sync. Use higher values of -filtered_replication_wait_time to prevent that, for example -filtered_replication_wait_time=4h.
If VDiff takes more than a day set the -wait-time parameter, which is the maximum time a vtctl command can run for, to a value comfortably higher than the expected run time, for example -wait_time=168h.
You can follow the progress of the command by tailing the vtctld logs. VDiff logs progress every 10 million rows. This can also give you an early indication of how long it will run for, allowing you to increase your settings if needed.