Skip to content

fix(backend): spool released exports safely - #6926

Open
clonder wants to merge 1 commit into
mainfrom
fix/get-released-data-single-pass-spool
Open

fix(backend): spool released exports safely#6926
clonder wants to merge 1 commit into
mainfrom
fix/get-released-data-single-pass-spool

Conversation

@clonder

@clonder clonder commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

materialize each released-data export from a single successful run of the released-record stream. count records while writing the temporary file so X-Total-Records matches the served bytes and the database transaction closes before network transfer begins.

because the backend now prepares the complete export before sending the first byte, increased the read timeouts for the bundled SILO and CLI clients and configure bounded spool storage in the deployment.

Resolves #5198
Related to #3511

🚀 Preview: https://fix-get-released-data-sin.loculus.org

Build each export from one successful query result so X-Total-Records matches the served bytes and the database transaction ends before transfer.

Write security headers before the async file copy. Bound spool storage and clean it across retries, failed handoffs, timeouts, disconnects, and restarts.

Align the bundled download clients and deployment timeouts with generating the full spool before the first byte is sent.

Refs #3511, #5198
@clonder clonder added bug Something isn't working preview Triggers a deployment to argocd performance labels Jul 20, 2026
@claude claude Bot added backend related to the loculus backend component deployment Code changes targetting the deployment infrastructure labels Jul 20, 2026
@clonder clonder self-assigned this Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clonder and @corneliusroemer I heard you guys did some perf of this new feature - could you maybe summarize your results in the PR description? would be nice to have this for future reference :-)

@clonder
clonder requested a review from chaoran-chen July 21, 2026 11:34
Comment on lines +143 to +145
return when (compressionFormat) {
CompressionFormat.ZSTD -> ZstdCompressorOutputStream(checkedFileStream)
null -> checkedFileStream

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the data can be very large, I think that we should always compress them when writing to disk. If the user has requested compressed data, the compressed file can be directly returned. If the user does not want compressed data, they would be decompressed again when returning to the user.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @clonder for the PR and @corneliusroemer for the proposal. Like Anya, I'd also be quite interested in seeing the performance impacts; maybe let's merge #6807 first and use it to compare the performances?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend related to the loculus backend component bug Something isn't working deployment Code changes targetting the deployment infrastructure performance preview Triggers a deployment to argocd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When calculating number of rows in get-released-data, cache to disk instead of requesting from db twice

3 participants