Skip to content

feat: add space diff table new gsi for cause#609

Merged
BravoNatalie merged 2 commits into
mainfrom
chore/add-space-diff-cause-gsi
Feb 16, 2026
Merged

feat: add space diff table new gsi for cause#609
BravoNatalie merged 2 commits into
mainfrom
chore/add-space-diff-cause-gsi

Conversation

@BravoNatalie
Copy link
Copy Markdown
Contributor

@BravoNatalie BravoNatalie commented Feb 10, 2026

According to this storacha/RFC#78 (related issue storacha/project-tracking#307)

This PR implements the short term solution, adding a GSI on cause to the existing space-diff table. It then uses that GSI to check if a diff with the same cause already exists before writing a new one. If it does, we just skip the write.

This approach:

  • Helps prevent new duplicates without changing the table schema
  • Is quick to roll out with minimal risk
  • Doesn’t require a migration or any dual-write setup

Limitation: this is a best-effort guard. It adds a read-before-write step and doesn’t fully guarantee uniqueness (there’s still a small chance of a race condition).

@seed-deploy
Copy link
Copy Markdown

seed-deploy Bot commented Feb 10, 2026

View stack outputs
  • pr609-warm-upload-api-BillingDbStack

    Name Value
    customerTableName pr609-warm-upload-api-customer
    egressTrafficTableName pr609-warm-upload-api-egress-traffic-events
    spaceDiffArchiveTableName pr609-warm-upload-api-space-diff-archive
    spaceDiffTableName pr609-warm-upload-api-space-diff
    spaceSnapshotTableName pr609-warm-upload-api-space-snapshot
    usageTable pr609-warm-upload-api-usage
  • pr609-warm-upload-api-BillingStack

    Name Value
    ApiEndpoint https://8nt354fsx5.execute-api.us-east-2.amazonaws.com
    billingCronHandlerURL https://rr5oazl4cvozaftqaccgsbeiyu0mhmpz.lambda-url.us-east-2.on.aws/
    CustomDomain https://pr609.billing.warm.storacha.network
    EgressTrafficQueueURL https://sqs.us-east-2.amazonaws.com/505595374361/pr609-warm-upload-api-egress-traffic-queue
  • pr609-warm-upload-api-CarparkStack

    Name Value
    BucketName pr609-warm-upload-api-carpark-0
    Region us-east-2
  • pr609-warm-upload-api-RoundaboutStack

    Name Value
    ApiEndpoint https://staging.roundabout.web3.storage/
    CustomDomain Using ROUNDABOUT_API_URL - no custom domain
  • pr609-warm-upload-api-UcanInvocationStack

    Name Value
    agentIndexBucketName pr609-warm-upload-api-invocation-store-0
    agentMessageBucketName pr609-warm-upload-api-workflow-store-0
  • pr609-warm-upload-api-UploadApiStack

    Name Value
    ApiEndpoints ["https://qk0lt7fn9a.execute-api.us-east-2.amazonaws.com"]
    CustomDomains ["https://pr609.up.warm.storacha.network"]
  • pr609-warm-upload-api-BusStack

  • pr609-warm-upload-api-FilecoinStack

  • pr609-warm-upload-api-UcanFirehoseStack

  • pr609-warm-upload-api-UploadDbStack

Copy link
Copy Markdown
Member

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

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

LGTM, but please fix the TODO comment -- it's confusing.

Comment thread upload-api/stores/blob-registry.js Outdated
const existingDiffs = await spaceDiffStore.listByCause(cause, { size: 1 })
const causeAlreadyExists = (existingDiffs.ok?.results?.length ?? 0) > 0

// TODO: Should we fail the entire transaction if the cause already exists?
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.

pretty sure no -- we're writing to the blob registry in this function no? assuming there are cases where we are putting to the blob registry but for whatever reason the cause is already in the diff table -- I don't htink we should be failing the whole register function. -- probably worth putting a rationale rather than leaving as an open question in a TODO comment.

@BravoNatalie BravoNatalie force-pushed the chore/add-space-diff-cause-gsi branch from d69f514 to 2a3ebc1 Compare February 16, 2026 10:24
@seed-deploy seed-deploy Bot temporarily deployed to pr609 February 16, 2026 10:24 Inactive
@seed-deploy seed-deploy Bot temporarily deployed to pr609 February 16, 2026 10:24 Inactive
@BravoNatalie BravoNatalie merged commit f93608a into main Feb 16, 2026
4 of 5 checks passed
@BravoNatalie BravoNatalie deleted the chore/add-space-diff-cause-gsi branch February 16, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants