Repository navigation
Show the transfer of a SQL Server backup in the run instead of its 100 percent - #229
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This branch was previously deployed
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 SQL Server backup over SFTP or a shared folder runs in two parts:
BACKUP DATABASEwrites the .bak on the server, then DBackup fetches it. For a large database the fetch often takes longer than the backup itself. During the whole fetch the run summary showed the last message of SQL Server, "100 % by SQL Server" with no time left, so the run looked stuck at the end of the dump. The live detail line also measured its speed from the start of the dump, which counted the time on the server as a slow transfer.Solution
The adapter now tells the runner when it starts to fetch a .bak and how large it is on the server. The runner keeps that with the dump of the database, and the summary measures the fetch against it: share, bytes, speed and time left.
Details:
dumpOnetakes an optionalonTransfer(totalBytes)callback. MSSQL calls it with the size fromhost.statbefore the SFTP download, and with the size of the file in the shared folder before it copies it. A server that does not tell the size fetches as before, without a transfer to follow.DumpStateandDumpRecordcarry an optionaltransferwith the total and its start, so it lands in the metadata of the run like the rest of the dump.progressOfinrun-dumps.tschecks a transfer before the SQL Server percent, and shows "x of y fetched at z/s" with the time left.watchDumpSizemeasures the speed from when the file appeared and says "written" instead of "dumped".Testing
pnpm validatepasses, with new unit tests for the summary of a transfer, the metadata of one, and the size MSSQL reports over SSH and from a shared folder.mssql-2022, fetched over SFTP from the lab host. Early in the fetch the summary showed "4 % · 123.5 MB of 2.8 GB fetched at 8.8 MB/s, about 5m 7s left", the fetch took 4m 45s, and the recorded bytes matched the size on the server for every database.