Repository navigation
Conversation
…back A gzip export wrote the whole dump uncompressed to a temp file and compressed it in a second pass after the last row, and could not split. Each part now deflates as it is written, on its own queue, and a split part is a gzip file of its own. A .sql.gz import inflated the whole file to disk and lexed it once more to count statements; the parser now reads the gzip file through an inflater and the count is gone.
datlechin
enabled auto-merge (squash)
November 26, 2026 01:51
This branch has not been 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.
Summary
Export:
.sqlandSQLExportCompressor's second pass are gone.dump.part1.sql.gzand so on, finished at rotation, and the split size is the compressed size on disk. A sync flush everymin(1 MiB, cap / 32)input bytes keeps the size known to within that, and the writer drains the queue before deciding a part is full. The "split size was not applied" warning goes.commit(beforePublish:)checks after every part is closed and before any rename.Import:
SQLFileParserreads throughSQLFileByteReader: the file itself, or, when it starts with the gzip magic number, the SQL inside it throughGzipInflater. Nothing is inflated to disk, and each read inflates about the size asked for, so a block that packs far cannot balloon one read..sql.gz, and the statements run show as a running count.FileDecompressorand the import's decompressed-copy plumbing (decompressedURL,ownsDecompressedFile,knownStatementCount) are removed.SqlFileImportSourceCleanupTests(the expanded copy it cleaned up no longer exists) bySqlFileImportSourceGzipTests,ImportStatementCountTests(the count is gone), andImportFileFormatResolverTestsdrops itsFileDecompressorlines.Measured
512 MB of generated
INSERTtext, release build, on this Mac under a load average of 87 to 180 from parallel builds, so the times are noisy; the byte counts are exact:.sql+ 70 MB.gz).sql.gz, 3.9M statementsTest plan
SQLExportGzipWriterTests(new): a split gzip dump writes parts of at most 1 MiB that each inflate on their own and join to every statement written; an unsplit one keeps its name; a Stop before publish leaves no file.ExportImportRoundTripTests: the existing gzip case passes, and a new split-and-gzip case restores every row from the parts in order.SQLFileParserGzipTests,SQLFileByteReaderBoundTests(TableProCore): a.sql.gzparses to the statements of the SQL inside it, progress reports compressed bytes against the file's size, a truncated file fails, the preview reads inflated text, and a read of zero-filled gzip stays near the size asked for.GzipDeflaterTests: a sync flush writes out every byte taken so far.SqlFileImportSourceGzipTests,ImportFileFormatResolverTests,SqlFileImportSourceEncodingTests,ImportServiceRunningWorkTests,ImportExecutionGateTests,SQLExportInsertModeTests,SQLExportSessionDeclarationTests;verify.sh plugins.Docs: TableProApp/docs#297 (draft), the split and gzip sentence and the import dialog step; it merges after this one.
Not in this PR: the iOS app still expands a
.gzto a temporary file before its own import, and the SQL ServerGOpre-scan is #4555's.Closes #4553