This should fix #7771.  It now syncs the tables, and deletes everything else.