Storage layout
Object versioning, multipart uploads, and SSE-S3/SSE-C encryption are part of the core pgsilo MVP. Object Lock retention/legal hold, bucket lifecycle rules, hard bucket quotas, and object annotations are Preview features in the MVP release.
pgsilo stores all bucket metadata, object versions, byte segments, multipart parts, annotations, and IAM state in PostgreSQL (schema 14). Understanding the boundary between object visibility, logical quota accounting, and PostgreSQL physical space reclamation is essential for capacity planning.
Segment layout and multipart publication
Object payloads are split into fixed-size bytea segments stored in silo.object_segments. The default segment size (SILO_PG_SEGMENT_SIZE) is 8 MiB, configurable from 1 MiB to 64 MiB at initial database setup. Streaming S3 reads and range requests fetch only the required segments without buffering the entire object in gateway memory.
The default maximum object size (SILO_PG_MAX_OBJECT_SIZE) is 256 MiB, configurable from 1 MiB to 1 GiB at initialization. Completed multipart uploads obey the same ceiling.
Unfinished multipart parts consume physical table space in PostgreSQL, but they do not count toward a bucket’s committed logical quota until CompleteMultipartUpload atomically validates part order, checksums, quota, and Object Lock rules and publishes the assembled version. Clean up abandoned uploads with AbortMultipartUpload or an AbortIncompleteMultipartUpload lifecycle rule.
Versions and delete markers
| Bucket versioning state / operation | Storage behavior |
|---|---|
Unversioned PUT overwrite | Replaces the current unversioned body and unlinks its previous annotation set |
Versioned PUT overwrite | Publishes a new version_id and retains historical versions |
Versioned DELETE without versionId | Inserts a delete marker as the latest version; historical bodies remain stored and count toward quota |
DELETE with explicit versionId | Permanently removes that version (unless blocked by Object Lock retention or legal hold) |
Suspended versioning (Suspended) | New writes use null-version semantics while preserving existing historical versions |
| Current version is a delete marker | Standard GET / HEAD without versionId returns 404 NoSuchKey |
Each published version carries an external version_id (UUID) and an internal object_id (bigint). Independent S3 HTTP requests never share a database snapshot, whereas SQL queries via silo_api can read object bodies and application tables within a single transaction snapshot.
Object Lock and retention (Preview)
Shared database mutation logic enforces GOVERNANCE retention, COMPLIANCE retention, and legal hold across both S3 HTTP requests and silo_api SQL calls. Object-lock buckets require versioning to be enabled at bucket creation.
- Bypassing
GOVERNANCEretention requires an S3 request withx-amz-bypass-governance-retention: trueands3:BypassGovernanceRetentionpermission (plusUPDATEon the bucket ACL relation underiam_and_pg). - Neither
COMPLIANCEretention nor an activelegal holdcan be bypassed through S3 or SQL. silo_apiSQL functions inherit default bucket retention onput_object/copy_objectand enforce lock checks ondelete_object, but expose no governance bypass parameter.- Object Lock protects against untrusted S3 and SQL callers; it cannot prevent a PostgreSQL superuser or the trusted database owner (
silo_owner) from modifying underlying database tables directly.
Server-side encryption
| Path | Behavior |
|---|---|
SSE-C | Client supplies the encryption key over HTTPS on every read, write, copy, or part upload |
SSE-S3 (AES256) | Uses the gateway’s static KMS key (MINIO_KMS_SECRET_KEY / MINIO_KMS_SECRET_KEY_FILE) for explicit header requests and default bucket encryption |
SSE-KMS (external KMS) | Not implemented in the PostgreSQL backend |
Public SQL API (silo_api) | Rejects reading encrypted bodies and rejects plaintext writes to default-encrypted buckets (SQLSTATE 0A000) |
| Annotations and ZIP extraction | Inherit the parent object version’s SSE-C or SSE-S3 encryption |
SSE encrypts object segment payloads and annotation bodies; it does not encrypt bucket names, object keys, or PostgreSQL catalog metadata. Back up your static MINIO_KMS_SECRET_KEY alongside database backups—restoring PostgreSQL tables without the static KMS key leaves SSE-S3 payloads permanently unreadable.
Hard bucket quotas (Preview)
Hard bucket quotas are enforced atomically in PostgreSQL (silo.bucket_quota) rather than through asynchronous gateway estimates. Billable logical usage (billableBytes) equals the sum of committed object version bodies across all retained versions plus their linked annotation payloads.
| Operation | Effect on logical bucket quota |
|---|---|
| Overwrite in a versioned bucket | Both the new version and retained old versions count toward quota |
DELETE without versionId in a versioned bucket | Adds a zero-byte delete marker; retained historical versions still count |
DELETE with versionId | Immediately decrements that version’s body bytes and linked annotation bytes |
| Replace or delete an annotation | Immediately applies the net byte difference |
CompleteMultipartUpload | Checks total assembled object size against remaining quota at commit |
For example, four retained 256 MiB versions consume a full 1 GiB bucket quota even when only one key is visible in ListObjectsV2. Physical overhead from incomplete multipart uploads, PostgreSQL indexes, WAL segments, and dead MVCC tuples is not bounded by logical bucket quota.
Configure and inspect quotas with mcli:
Lifecycle rules, background cleanup, and VACUUM
- Lifecycle worker (Preview): writable gateways coordinate through PostgreSQL leases (
silo.TryLifecycleLock) to expire current/noncurrent versions, remove expired delete markers, and abort incomplete multipart uploads. Remote storage tiering is not supported. - Annotation orphan reaper: unlinking annotations (via unversioned overwrite, version deletion, or force bucket deletion) releases logical quota immediately and enqueues orphan payload rows for bounded batch deletion by a writable gateway. Always keep at least one writable
silo servergateway connected to the PostgreSQL primary—even if applications only usesilo_apiover SQL—so background cleanup and native-auth heartbeats continue running. - PostgreSQL physical space reclamation: deleting objects or draining the annotation cleanup queue marks PostgreSQL tuples as dead for
autovacuumreuse; it does not immediately shrink OS filesystem files. Long-running SQL transactions hold backVACUUMhorizon and delay space reuse. Monitor logical bucket usage, annotation cleanup backlog, dead tuple ratios, physical database size, and WAL retention separately.
Force bucket deletion
Standard DeleteBucket (DELETE /{bucket}) requires an empty bucket. Sending x-minio-force-delete: true (any non-empty header value, including "false", triggers the permission check) requires both s3:DeleteBucket and s3:ForceDeleteBucket (plus DELETE and UPDATE under iam_and_pg) and removes all versions, delete markers, and incomplete uploads in a single transaction. Object-lock buckets reject force deletion with HTTP 405 even when empty. SQL silo_api.drop_bucket has no force option.
