fastmonkeys / stellar

Fast database snapshot and restore tool for development
MIT License
3.86k stars 119 forks source link

Make diffs between snapshots #5

Open dullgiulio opened 10 years ago

dullgiulio commented 10 years ago

In a (unreleased) shell script to do something analogue I used a command from Percona Tools (MySQL only) to see the queries that migrate one table to another (could apply this to all tables in a snapshot):

pt-table-sync --noversion-check --nohex-blob --print h={hostname},D={dbname},t={table1} h={hostname},D={dbname},t={table2} -u {user} -p{password}

This is my prerequisite to switch from my custom tools to stellar. I am not aware of an equivalent command/utility for Postgres. Suggestions? Knowing that I could provide a patch.

Teemu commented 10 years ago

Does Percona Tools use some kind of MySQL specific magic to do the diff? If not, could similar behaviour implemented purely in Python?

dullgiulio commented 10 years ago

No magic except some clever use of indices to find differences between tables more quickly. IIRC it's written in Perl, could be generalized and ported to Python.