Make datasync more reliable.

Now it saves the cursors so it can pick up where it left off if
something goes horribly wrong.