Repository navigation
Show backup progress and let the user cancel a backup - #39
Merged
Merged
Conversation
A backup only showed a loading state. Now it shows the file size so far, the time, and the table the dump tool works on. A Cancel button (or Esc) stops the tool and deletes the half written file. An older backup at the same path stays as it was.
A page load during a backup took the Cancel button away. Esc then stopped the backup instead of the page load. The backup now has its own dumping flag. Esc stops a running query or page load first. A second backup in the same tab is refused, in the UI and in the backend. Two backups would write the same side file. The cancel test now cancels while sqlite3 really runs.
A page load or query that failed during a backup left cancellable and cancelling set. Cancel then stayed on "Cancelling…", Esc could not stop the backup, and the backup ended with "Query cancelled". Now cancellableCall resets both flags in a finally. A cancel is kept in its own queryCancelled mark, which run reads once. cancel_dump no longer removes the entry of the tab. Only dump_database removes it, so a cancel can never remove the entry of a newer backup.
The two conflicts were only import lists in commands.rs and service.rs. Tauri can deliver the last progress message after the reply of the command. That message showed "Backing up…" again after the backup ended, also for later page loads and queries. showBackupProgress now does nothing when no backup runs.
…wn side file Escape stopped a running backup also when the user pressed it to close a dialog, clear the table selection, or leave the editor or a menu. The dialog then stayed open. Now Escape stops a backup only when it has no other job there. Queries and page loads still stop on Escape as before. Two tabs that backed up to the same file both wrote <path>.part. The side file is now <path>.<pid>-<counter>.part.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A backup only showed a loading state. The user could not see if it was still moving, and could not stop it.
What changed
.partfile once per second and sends it through a TauriChannel. The UI showsBacking up… 48 MB, 0:32.mysqldumpandpg_dumpnow run with--verbose.DumpLogreads stderr line by line and finds the table. The UI showsDumping table orders (12 of 40). The total comes from the table list of the tab. When the tool dumps more tables than the list has (other PostgreSQL schemas), only the count is shown. SQLite shows size and time only.cancel_dump. The backend kills the tool, waits for it to end, then deletes the.partfile. An older backup at the target path is not touched. The status showsBackup cancelled, not an error.macrosfeature (forselect!). No new crates.Tests
.partfile is left.tests/Backup.test.ts).Checks:
bun run lint,bun run typecheck,bun test(380 pass),cargo clippy --all-targets(0 warnings),cargo test,cargo fmt. The end-to-end test also passed against MySQL and MariaDB in Docker. PostgreSQL was not run: the localpg_dumpis version 15 and the Docker server is 17. The pg_dump line format comes from its source code.