Use Repstance to prove that the target holds the same data as the source, before a cutover and while replication runs. This matters most in financial and healthcare systems. Repstance compares the rows of the two databases, tells you which rows differ by their key, and brings exactly these rows in line while the replication keeps running. It is part of the product: there is nothing separate to buy, install or license.
What Repstance does
- Compares all tables or a chosen depth, for example 10% as a quick check.
- Runs in parallel with the ongoing replication, so the source is not frozen.
- The incremental comparison checks only the data changed since the last validation point. The last incremental comparison is part of the cutover.
- Differences are repaired with the built-in repair.
- Compares row by row. Every compared row is turned into an MD5 hash in the source and in the target, and the two hashes are compared. At 100% every row is compared.
- Works across different databases. Values are converted to one text that does not depend on the database before they are hashed, so an Oracle or SQL Server source can be compared with a SQL Server, Oracle, PostgreSQL, MySQL, Snowflake or Redshift target.
- Reports the rows. Per table: the rows that match, the rows that differ (failed rows) and the rows that are missing in the target (missed rows), with their keys.
- Checks the repair. After it, the same keys are compared again, and a row that still differs is reported again.
In numbers
- 91,000 rows per second compared, 328 million rows per hour (Aurora PostgreSQL target, Repstance release 6, see the Benchmark)
- An average 100 GB database is compared in 1.5 to 2.5 hours (an estimate from the measured speed)
- A Fintech customer validated 20 TB in 8,000 tables with a 100% deep comparison that ran in parallel with the replication, then compared the changed data daily (about 150 GB a day)
- A Healthcare customer uses a 10% comparison depth over 60,000 tables
Both customer cases are on the home page.
How it works
- Read. A compare process of the Repstance server reads a chunk of a table from the source in the order of the key and calculates the hash of every row.
- Note. It saves the keys and the hashes in a file on the Repstance server and notes the chunk in the table repi.ValidateTables of the source.
- Carry. The Capture Process captures this note like any other change, so it travels in the stream of the replicated transactions, behind the changes that were made before it.
- Compare. The Apply Process meets the note, reads the same keys from the target, calculates the hashes in the same way and compares them with the hashes of the source. It does this only after it has applied every change that came before the note, so the result does not depend on how far behind the replication was.
- Report. The counts and the keys of the failed and the missed rows are added to the report of the task.
- Repair. On request the Capture Process reloads the reported rows from the source, the Apply Process merges them into the target by the key (a missing row is inserted, a row that differs is updated, nothing is deleted), and the rows are compared once more.
You set per table how many rows of a chunk are compared (Data Validation %, 1 to 100) and how big a chunk is (10,000 rows by default). You can exclude columns or data types, restrict the rows with a condition, and add a function that makes two values equal when the databases write them differently, for example to cut a date to its day.
Run it
First set up a comparison task. In the Web UI (Compare Data) open the Capture Process, click Compare, choose the tables and run the task. When the report shows failed or missed rows, tick the tables and click Repair (Tasks Control). From the command line the repair is one command:
repcli compare run capture=2 taskname=NewTask mode=3Modes of compare run: 0 resumes a stopped task, 1 runs a full comparison, 2 runs an incremental comparison, 3 repairs the rows that the last run found. The same functions are available through the REST API. All modes are described in Start/Stop Task.
Typical uses
- Before a cutover. Compare every row of the migrated tables, repair the differences, compare again, run the last incremental comparison and switch the application.
- After an initial load. Confirm that the load is complete before you rely on the replication.
- After an incident. After a stopped Apply Process, a failed batch or a restore, find out which rows differ and repair only them instead of reloading the table.
- As a regular check. Run the incremental comparison daily, as the Fintech customer above does, to see differences within a day and not at the end of the project.
Limits you should know
A check is only useful when you know what it covers.
- Use 100% for a proof. A smaller Data Validation % compares only the last rows of every chunk in the order of the key. It finds a problem that touches many rows quickly, but it can miss a single row. Use 100 after an initial load and before a switch-over.
- A key is needed. A table is compared when it has a primary key or a unique index, or when you name the key columns. A table without a key is skipped and reported as skipped. Replication itself does not need a key.
- Rows that exist only in the target are not reported. The comparison starts from the source rows, so the repair deletes nothing.
- Floating point values are compared by the whole part. The fraction of float, real, Oracle FLOAT, BINARY_FLOAT and BINARY_DOUBLE is ignored.
- A database in use is not a snapshot. A row that changes between the read and the note can be reported as failed although the target is right. Run the repair or compare the table again: only the rows that still differ are real differences.
- Only values are compared. Indexes, constraints, triggers, defaults and the data types themselves are not.
- Big tables take time and disk space. The files of the chunks wait on the Repstance server until the Apply Process has compared them, and large objects are read completely. Start the Apply Process before the task and check the disk space.
Full list: Requirements and Limits in the documentation.
Questions and answers
How does Repstance validate data after replication?
It compares the rows of the source and the target database with MD5 row hashes, per table, in chunks. The report shows the rows that match, the rows that differ and the rows that are missing, with their keys.
Can Repstance repair the data that does not match?
Yes. The repair reloads the reported rows from the source and merges them into the target by the key, without stopping the replication, and then compares them again.
Does it work between different database types?
Yes. Values are converted to a text that does not depend on the database before they are hashed, for example an Oracle source with a SQL Server, PostgreSQL, MySQL, Snowflake or Redshift target. The conversions of the data types are in the documentation.
Does the comparison check every row?
At Data Validation 100% every row of the selected tables is compared. With a smaller percentage a part of every chunk is compared, and the incremental comparison compares all the rows that changed since the previous run.
Does the comparison slow down my source database?
It reads the tables of both databases and the rows are hashed on the Repstance server, so it uses the processor and the network of that server. A smaller Data Validation %, a condition on the rows and the incremental mode reduce the load. A SQL Server source can be read from a readable secondary.
Is it a separate product or licence?
No. Data validation and repair are part of Repstance.
What does Repstance not compare?
Rows that exist only in the target, the structure (indexes, constraints, triggers, defaults) and the fraction of floating point values.
See also: Database migration, Real-time replication. Documentation: How Data Comparison Works, Requirements and Limits, Start/Stop Task. Questions about your databases: support@repstance.com. Sales and 24/7 Enterprise support: sales@repstance.com.