Repository navigation
fix(server): enforce live storage reservation entitlement before delayed unpaid uploads - #1357
Open
harrymove-ctrl wants to merge 1 commit into
Open
harrymove-ctrl wants to merge 1 commit into
harrymove-ctrl wants to merge 1 commit into
Conversation
…yed unpaid uploads
Collaborator
Author
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
UPDATE storage_reservationsinkeep_upload_storage_reservationandensure_upload_storage_reservation_with_dbwithWHERE id = $1 AND expires_at > NOW()so an expired reservation that has not been swept yet cannot be resurrected in place without re-checking the owner's storage quota under the advisory lock (pg_advisory_xact_lock).ensure_upload_storage_reservation_with_dband call it inexecute_durable_uploadbefore any unpaid sidecar upload step (!upload_journal_signer_committed(&journal) && journal.register_transaction.is_none()).WalletJobError::Permanentwhen their reservation expired and re-admission viatry_admit_storagereportsStorageAdmission::QuotaExceeded, while preserving post-payment recovery (register_transaction.is_some()or signer-committed journals) for blobs that already consumed WAL/gas.expired_reservation_cannot_resurrect_or_upload_past_owner_quotainservices/server/src/storage/db.rscovering both swept and unswept expired reservations, over-quota rejection, and within-quota re-admission.Test Plan
DATABASE_URL="postgresql://memwal:memwal_secret@localhost:5432/memwal" cargo test --lib quota_admission_tests(4 passed)cargo test --lib jobs::tests(90 passed)