Skip to content

Add stats table#194

Open
chris124567 wants to merge 3 commits into
masterfrom
christopher/stats-table
Open

Add stats table#194
chris124567 wants to merge 3 commits into
masterfrom
christopher/stats-table

Conversation

@chris124567

Copy link
Copy Markdown
Member

Close #182

Copilot AI review requested due to automatic review settings June 8, 2026 22:59
@github-project-automation github-project-automation Bot moved this to In Progress in Sia Jun 8, 2026

Copilot AI left a comment

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.

Pull request overview

This PR introduces an incrementally maintained stats table in the SQLite persistence layer to make UploadStats queries scale better on larger databases (per Issue #182), replacing the prior full-table aggregation approach.

Changes:

  • Added a stats table plus helpers to increment/decrement upload-pipeline counters transactionally.
  • Updated object + multipart upload write paths to maintain stats (pending/uploaded/orphaned/multipart counts and sizes) as state changes occur.
  • Added schema init + migration backfill logic, and expanded TestUploadStats to cover additional state transitions.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sia/persist/sqlite/stats.go Introduces stat keys, incremental update helpers, and the new Store.UploadStats() implementation backed by the stats table.
sia/persist/sqlite/objects.go Updates object lifecycle operations to adjust stats and moves UploadStats out of this file.
sia/persist/sqlite/objects_test.go Extends TestUploadStats to validate stat counter behavior across more transitions.
sia/persist/sqlite/multipart.go Updates multipart create/complete/abort flows to maintain multipart_uploads and pending-object stats.
sia/persist/sqlite/migrations.go Adds migration to create/backfill the stats table for existing DBs.
sia/persist/sqlite/init.sql Adds stats table creation and initialization for fresh DBs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sia/persist/sqlite/objects.go Outdated
Comment thread sia/persist/sqlite/multipart.go
Comment thread sia/persist/sqlite/multipart.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Add stats table

4 participants