This is the multi-page printable view of this section.
S3
- 1: Quick start
- 2: Tutorials
- 2.1: Objects from SQL
- 2.2: Use an S3 SDK
- 2.3: Versioning
- 2.4: Encryption
- 2.5: Annotations and ZIP
- 2.6: Multipart, Object Lock and STS
- 3: Compatibility
- 4: Architecture
- 5: Reference
- 5.1: Configuration
- 5.2: SQL API
- 5.3: S3 API
- 5.4: Authorization
- 5.5: Annotations
- 5.6: ZIP extraction
- 5.7: Storage layout
- 6: Operations
- 6.1: Install
- 6.2: High availability
- 6.3: Backup and restore
- 6.4: Upgrade
- 6.5: Monitoring
- 6.6: Troubleshooting
- 6.7: Deploy with Pigsty
- 7: pgs3: in-process S3
- 8: Status
- 9: Design
S3 clients and SDKs talk to Silo, PGSTY’s fork of the MinIO server, which keeps its S3, SigV4, IAM and Console front end. With the pgsilo backend, Silo stores everything in PostgreSQL: object bodies, metadata, versions, multipart state, bucket configuration and IAM. The gateways are stateless, and an SQL API can read and write the same objects inside a PostgreSQL transaction.
Status- MVP in progress. The goal is an experimental backend shipped inside a Silo release; there will be no standalone pgsilo binary. Schema version 14. Nothing is published yet.
Ports- S3 and STS on 9000; Console on 9001
Gateway- Silo server (Go) with a PostgreSQL
ObjectLayer; start it withSILO_PG_DSNinstead of disk paths Database- schemas
silo(private),silo_api(11 public functions),silo_bucket(one ACL relation per bucket); PostgreSQL 16 or later Kernel patch- none; runs on stock PostgreSQL
Licence- Silo server: AGPL-3.0-or-later
How S3 maps onto PostgreSQL
- Object bodies are
byteasegments of 8 MiB by default. Objects are limited to 256 MiB by default, or up to 1 GiB when set at initialization. - Metadata, versions, delete markers and multipart uploads are rows, so a write either commits completely or not at all.
- IAM users, groups, policies and service accounts live in the database, with a 5-second lease for cached IAM state.
- SQL API:
silo_api.put_object,get_object,list_objectsand eight more functions work inside a caller’s transaction (Read Committed). Callers are identified bysession_user.
Try it
The object is then readable over S3 as attachments/invoice/2026-001.txt.
Limits
- A gateway uses 32 PostgreSQL connections by default. Above 32 concurrent requests, the current candidate
(
1d387725c) queues requests for up to 5 s and then answers HTTP 503SlowDown. - PgBouncer in transaction-pooling mode is not supported.
- SQL transactions, native authorization, STS, lifecycle, Object Lock, quota, annotations and ZIP extraction, and standby gateways are all Preview features.
- Not supported: SSE-KMS or an external KMS, replication, tiering, erasure coding, automatic high availability.
Alternatives
pgs3 serves path-style S3 from PostgreSQL background workers, in process. It is
an early alpha (v0.1.1) without TLS, IAM or lifecycle. Mimus will pick one of the two as its default S3
implementation.
Source and credit
pgsilo is developed by PGSTY and Silo contributors; general Silo documentation is at
silo.pgsty.com. Silo derives from the MinIO project, © 2015–2025 MinIO, Inc. Silo and
Mimus are not affiliated with or endorsed by MinIO, Inc. The MINIO_* variables and /minio/ paths remain for
compatibility only.
Pages in this section adapt the pgsilo companion documentation, © PGSTY & SILO Contributors, CC BY 4.0; see Licence and attribution.
1 - Quick start
The PostgreSQL backend for Silo (pgsilo) is in MVP development and has not been publicly released. The package names and commands below come from the local schema 14 build; no public download URL exists yet.
This guide prepares a PostgreSQL database, starts a writable Silo gateway in PostgreSQL mode, creates a bucket and a restricted application user, and writes objects over both S3 and SQL. For full host, certificate and macOS setup, see Install.
Prepare PostgreSQL
Use PostgreSQL 16 or later. Connect gateways directly to the writable primary, not through PgBouncer in transaction-pooling mode.
Create an ordinary database owner and the silo database:
The first writable gateway connects as silo_owner and runs migrations 0001–0014 in a transaction to create the silo, silo_api and silo_bucket schemas.
Start the gateway
Silo enters PostgreSQL mode when you set SILO_PG_DSN or pass a single postgres:// URI without disk arguments.
On Debian or Ubuntu with the local package, verify the checksum and install the package:
Write /etc/default/silo with your database DSN, root credentials and pool limits (replace the placeholders before starting the service):
Install the systemd drop-in /etc/systemd/system/silo.service.d/postgresql.conf so the service starts without disk arguments:
Enable and start the service, then check read and write readiness:
A healthy writable gateway returns HTTP 200 for both endpoints. See Configuration for all SILO_PG_* variables.
Create a bucket and user
Install mcli, trust the gateway CA, and configure an administrative alias with the root credentials:
Create the attachments bucket and an application user (app-s3):
Save a bucket-scoped policy to ~/.local/share/silo-tutorial/attachments-rw.json:
Create and attach the policy, then configure an alias (pg-app) with the app-s3 credentials:
Upload, read and delete over S3
Upload a file, list and stat the object, download it to verify the bytes, and delete it:
Write an object from SQL
The SQL transaction API (silo_api) is a Preview feature in the MVP scope.
In a psql session with permissions on silo_api and the bucket ACL relation silo_bucket.attachments, write an object inside a Read Committed transaction:
Once the transaction commits, the object is immediately visible over S3 as attachments/invoice/2026-001.txt. See Objects from SQL and the SQL API reference for grants and function signatures.
Open the Console
Open https://console.example.net:9001 in a browser that trusts the gateway CA and sign in with the root credentials. Browse Buckets → attachments → Objects to inspect or upload files, and use the IAM pages to manage users and policies.
Logical object usage in the Console differs from physical PostgreSQL table and WAL size. A physical capacity reading of Unknown is expected in PostgreSQL mode and does not indicate zero free space.
2 - Tutorials
Complete the Quick start first. Keep the silo database, the attachments bucket, the app-s3 user and the trusted gateway CA certificate for these tutorials.
| Tutorial | Scope |
|---|---|
| Objects from SQL | Commit or roll back objects together with business rows; grant silo_api and silo_bucket permissions; paginate and stream segments (Preview) |
| Use an S3 SDK | Connect AWS CLI, boto3 and browsers with presigned URLs and bucket CORS |
| Versioning | Enable versioning, read historical versions, and configure lifecycle rules and hard bucket quotas |
| Encryption | Configure static-key SSE-S3, use client-held SSE-C keys, and understand key recovery and SQL boundaries |
| Annotations and ZIP | Attach UTF-8 annotations to object versions and read or list ZIP archive members with SigV4 requests (Preview) |
| Multipart, Object Lock and STS | Upload parts with cleanup, apply retention and legal hold, deliver bucket notifications or SQL outbox events, and issue service accounts or STS credentials |
Use the root account only for administration. Use restricted IAM policies for S3 applications, and manage PostgreSQL login roles separately from S3 access keys.
2.1 - Objects from SQL
The SQL transaction API (silo_api) and PostgreSQL native authorization (silo_bucket) are Preview features in the MVP scope.
This tutorial writes an invoice row and its attachment in one PostgreSQL transaction, verifies both from SQL and S3, rolls back a second transaction, and reads paginated lists and object segments. Complete the Quick start first so the silo database and plaintext attachments bucket exist.
Create an application SQL role
Connect to silo as a database administrator and create an unprivileged login role (app_sql) and application schema (app_demo):
The application role needs no superuser rights, no membership in silo_owner, and no direct access to the private silo schema.
Next, connect to silo as the installation owner (silo_owner) and grant EXECUTE on the required silo_api functions plus SELECT and INSERT on the ACL relation for attachments:
In psql, \gexec executes the generated GRANT statement. Because a bucket’s ACL relation name in silo_bucket is decoupled from the bucket name, silo_owner looks it up through silo.bucket_acl. See Authorization for the complete permission mapping.
Reconnect as app_sql and create the business table:
silo_api checks the login-time session_user and rejects SET ROLE impersonation.
Commit a business row and object together
In the app_sql session, write an object and insert the referencing invoice row in one Read Committed transaction:
Read the committed object body and metadata from SQL:
Read the same object over S3:
get_object returns bytea. Use convert_from only when the payload is known UTF-8 text.
Roll back a business row and object together
Start a second transaction, write both the object and the invoice row, and roll back:
Both counts return 0. Neither the relational row nor the S3 object is published.
If your application needs a permanent reference to an immutable object body, enable bucket versioning and pass the saved version_id when calling get_object, stat_object or read_object. Overwriting an unversioned object replaces its body.
Paginate listings and read segments
List the first page of objects under the invoices/ prefix:
To fetch the next page, pass the final key of the current page as the third argument (start_after). Each call returns at most 1,000 live objects in C byte order and omits delete markers.
To read a large object in bounded chunks without materializing the full body in one call, open a read-only Repeatable Read snapshot and call read_object:
read_object returns at most 8 MiB (8388608 bytes) per call. Use REPEATABLE READ only for read-only transactions; SQL writes through silo_api require READ COMMITTED.
Direct SQL writes do not emit S3 bucket notifications. To publish events atomically with SQL object writes, insert into a transactional outbox table in the same transaction; see Multipart, Object Lock and STS and the SQL API reference.
2.2 - Use an S3 SDK
This tutorial connects the AWS CLI and the Python SDK (boto3) to a Silo PostgreSQL gateway, generates a presigned download URL, and configures bucket CORS for browser requests. Complete the Quick start first so the attachments bucket, app-s3 user and local hello.txt file exist.
Set the endpoint and working directory in your terminal:
AWS CLI and Python SDK
Configure an AWS CLI profile (silo-app) with the app-s3 credentials, region us-east-1 and path-style addressing:
Create a Python 3.10+ virtual environment and install boto3:
Save the following script as ~/.local/share/silo-tutorial/sdk.py:
Run "$HOME/.local/share/silo-tutorial/venv/bin/python" "$HOME/.local/share/silo-tutorial/sdk.py". It prints hello from Python.
Keep default SDK checksums and TLS verification enabled. When uploading larger files with SDK multipart helpers, the completed object must fit within the store’s maximum object size (256 MiB by default, up to 1 GiB if configured at initialization).
Presigned URLs and bucket CORS
Generate a presigned GET URL valid for 15 minutes (900 seconds) using the s3 client from above:
A presigned URL carries the signing principal’s permissions and cannot grant access that the signer lacks. If signed by temporary STS credentials, the URL stops working when the session expires even if ExpiresIn is longer.
To allow browser uploads or downloads from another origin, configure a bucket CORS rule with an administrative profile (silo-admin):
A matching preflight request returns the allowed origin and methods in the response headers; a rejected preflight returns HTTP 403 (AccessForbidden). CORS headers do not bypass SigV4 signing or IAM authorization.
2.3 - Versioning
Bucket versioning is a Supported MVP feature. Lifecycle rules, Object Lock and hard bucket quotas described in the second half of this page are Preview features.
This tutorial enables bucket versioning, writes multiple versions of an object, reads a historical version by VersionId, and configures lifecycle expiration and a hard bucket quota. Use the silo-admin profile and mcli_pg alias from the Quick start and Use an S3 SDK.
Retain and read historical versions
Create a dedicated version-demo bucket, enable versioning, write two versions of note.txt, and fetch the first version by its VersionId:
In a versioned bucket, calling delete-object without --version-id inserts a delete marker while preserving prior versions. Permanently deleting a specific version requires passing --version-id and holding s3:DeleteObjectVersion. Reading a historical version requires s3:GetObjectVersion.
Suspending versioning (Status=Suspended) switches new writes to null-version semantics without deleting existing historical versions.
Lifecycle rules and bucket quotas
Create a lifecycle-demo bucket and apply a lifecycle rule that expires current objects under tmp/ after 7 days and aborts incomplete multipart uploads after 1 day:
A background worker on a writable gateway scans for eligible objects under a database lease. Expiring historical versions requires a NoncurrentVersionExpiration rule. Remote storage-class transition rules (Transition / NoncurrentVersionTransition) are not supported and are rejected.
Hard bucket quotas count the committed object bodies and annotations of all live and historical versions (excluding delete markers). Unfinished multipart parts consume physical table space immediately, but count toward the logical bucket quota only when CompleteMultipartUpload publishes the object:
Deleting versions releases logical quota immediately, whereas physical disk space is reclaimed and reused asynchronously by PostgreSQL VACUUM. See Storage layout for details.
2.4 - Encryption
This tutorial configures static-key SSE-S3 (AES256) on a gateway and bucket, then runs a round-trip write and read with a client-supplied SSE-C customer key. Complete Install and Use an S3 SDK first.
Configure static-key SSE-S3
Generate a 32-byte key file once on the gateway host (refusing to overwrite an existing key file):
Back up the exact key ID (silo-key-1) and raw key bytes outside the database, and copy the identical /etc/silo/kms.key file to every gateway that connects to this PostgreSQL database.
Add MINIO_KMS_SECRET_KEY_FILE to /etc/default/silo (do not set MINIO_KMS_SECRET_KEY at the same time):
Restart the gateway, enable default AES256 encryption on a new encrypted-demo bucket, and verify an encrypted upload and download:
If the static key is missing or wrong, encryption and decryption requests fail closed; the gateway never falls back to plaintext. Losing the external key makes encrypted objects in PostgreSQL unrecoverable. See Backup and restore.
External KMS integration and SSE-KMS (aws:kms) are not supported. The silo_api SQL interface cannot decrypt SSE-S3 or SSE-C bodies, and buckets with default encryption reject SQL put_object writes.
Use a client-held SSE-C key
With SSE-C, the client supplies the 32-byte key on every write and read over HTTPS. Save the following script as ~/.local/share/silo-tutorial/sse-c.py:
Run "$HOME/.local/share/silo-tutorial/venv/bin/python" "$HOME/.local/share/silo-tutorial/sse-c.py". It prints SSE-C round trip succeeded.
SSE-C requests require verified HTTPS; HTTP SSE-C requests are rejected. Back up the 32 bytes in sse-c.key independently — the gateway’s static SSE-S3 key cannot decrypt SSE-C objects.
2.5 - Annotations and ZIP
Object annotations (?annotation) and ZIP member extraction (x-minio-extract) are Preview features in the MVP scope. Annotations also depend on four silo-pkg policy actions (s3:*ObjectAnnotation*) that have not been published to the public silo-pkg repository yet, and the general Silo Console (2.6.0) does not include an annotation UI.
This tutorial uses SigV4-signed Python requests to write, read, list and delete object annotations, and to list and read members inside an uploaded ZIP archive without unpacking it into separate S3 objects. Complete Use an S3 SDK first.
Interfaces and permissions
An annotation is attached to a specific parent object version. Each annotation body must be valid UTF-8 text between 1 byte and 1 MiB, and each parent version accepts at most 1,000 annotation names. Updating or deleting an annotation leaves the parent object’s body, ETag and Last-Modified timestamp unchanged.
| Operation | SigV4-signed HTTP request | Required IAM action |
|---|---|---|
| Create or replace | PUT /attachments/<key>?annotation=&annotationName=labels.json | s3:PutObjectAnnotation |
| Read body | GET /attachments/<key>?annotation=&annotationName=labels.json | s3:GetObjectAnnotation |
| List names | GET /attachments/<key>?annotation= | s3:ListObjectAnnotations |
| Delete | DELETE /attachments/<key>?annotation=&annotationName=labels.json | s3:DeleteObjectAnnotation |
Standard object actions (s3:GetObject, s3:PutObject) do not grant annotation access. Pass versionId in the query string to target a historical version, or x-amz-object-if-match on PUT/DELETE to require a matching parent ETag. Annotation bodies inherit the parent object’s server-side encryption mode.
To read or list members inside a ZIP archive stored as an S3 object, include header x-minio-extract: true:
- Read or stat a member:
GETorHEAD /attachments/demo.zip/readme.txtwithx-minio-extract: true. - List archive members:
GET /attachments?list-type=2&prefix=demo.zip/withx-minio-extract: true.
ZIP extraction reads directly from the parent object snapshot without persisting member objects or an index table. It supports Store and Deflate compression (plus bounded ZIP64), up to 10,000 central-directory entries, and up to 256 MiB per uncompressed member. Range and partNumber requests on ZIP members are not supported.
Complete Python example
Because standard S3 SDKs do not have built-in methods for ?annotation or x-minio-extract, sign the requests with botocore.auth.SigV4Auth. Save the script below as ~/.local/share/silo-tutorial/extensions.py:
Run the script:
The script prints the PUT status (200), the annotation JSON, the annotation list XML, the DELETE status (204), the extracted hello from ZIP member content, the HEAD status (200), and the ListObjectsV2 XML for demo.zip/. See Annotations and ZIP extraction for full protocol rules and error codes.
2.6 - Multipart, Object Lock and STS
Multipart uploads, S3 bucket notifications and IAM service accounts are Supported MVP features. Object Lock (retention and legal hold), the silo_api SQL transactional outbox and Basic AssumeRole STS are Preview features.
This tutorial covers five multi-step workflows: multipart uploads with failure cleanup, Object Lock retention and legal hold, S3 bucket webhook notifications, a transactional SQL outbox committed with an object, and service accounts / Basic AssumeRole STS credentials. Complete Use an S3 SDK first.
Multipart uploads and failure cleanup
Every multipart part except the final part must be at least 5 MiB, and the assembled object must fit within the store’s maximum object size (256 MiB by default, up to 1 GiB if configured at initialization).
The script below uploads a 5 MiB part and a short final part, lists the uploaded parts, completes the upload in part-number order, and aborts the upload in finally if completion did not succeed:
In addition to s3:PutObject and s3:GetObject, application policies need s3:AbortMultipartUpload for cleanup and s3:ListMultipartUploadParts to list parts (plus s3:ListBucketMultipartUploads to list active uploads in a bucket). Because a process crash can skip finally, also configure an AbortIncompleteMultipartUpload lifecycle rule (see Versioning).
Object Lock, retention and legal hold
Enabling Object Lock when creating a bucket also enables versioning. The script below creates lock-demo with 1 day of default GOVERNANCE retention, writes a version, extends its retention to 2 days, enables legal hold, verifies that deleting the version returns AccessDenied, and then clears the legal hold:
Calling delete_object without VersionId creates a delete marker without removing the protected version. Bypassing GOVERNANCE retention requires the explicit bypass header and s3:BypassGovernanceRetention; active COMPLIANCE retention cannot be bypassed. The silo_api SQL interface enforces retention and legal hold on mutations and provides no governance bypass.
S3 bucket event notifications
To send S3 request-path events to an HTTPS webhook receiver, configure the same webhook target ID (APP) in /etc/default/silo on every writable gateway and restart the gateways:
Then attach a notification rule using the QueueArn arn:minio:sqs:<region>:<target-id>:webhook:
S3 webhook delivery runs asynchronously after S3 HTTP requests commit; receivers must tolerate retries and duplicates. Direct SQL writes through silo_api do not trigger S3 bucket notifications.
Commit an SQL outbox with the object
When an event must commit or roll back atomically with a business row and an object, write to an application-owned outbox table in the same Read Committed SQL transaction (continuing the app_sql setup from Objects from SQL):
An application worker polls app_demo.outbox, delivers the event idempotently by event_id, and sets delivered_at.
Service accounts and temporary STS identities
To issue a scoped service account under app-s3 without sharing the parent user’s secret key:
To request 15-minute (900-second) temporary credentials over Basic AssumeRole STS, sign AssumeRole with an ordinary IAM user (silo-app). Service accounts and existing STS credentials cannot call Basic AssumeRole, and lifetimes below 900 seconds are rejected:
The inline session Policy further narrows the parent user’s effective permissions; it never expands them. RoleArn is accepted for S3/STS wire compatibility and does not reference an external AWS IAM role.
3 - Compatibility
This page summarizes the MVP support tiers, protocol boundaries, and behavioral differences between S3 HTTP and the silo_api SQL interface in schema 14. For build identifiers and test results, see Status.
MVP support tiers
The PostgreSQL backend is planned as an experimental storage backend inside Silo. Features are divided into Supported, Preview and Not supported tiers:
| Tier | Scope |
|---|---|
| Supported | Single PostgreSQL primary (versions 16–18) with one or more writable gateways (linux/amd64 and linux/arm64) |
| Supported | Bucket and object CRUD, ListObjects V1 and V2, object versions and delete markers |
| Supported | Conditional requests, Range, CopyObject, UploadPartCopy, tagging, multipart upload and checksums |
| Supported | Presigned URLs, POST policy uploads and CORS |
| Supported | IAM users, groups, policies and service accounts |
| Supported | SSE-C, and AES256 SSE-S3 with the built-in static KMS |
| Supported | Unified object and relational backup through PostgreSQL physical backup and PITR |
| Preview | SQL transaction API (silo_api), PostgreSQL native authorization (silo_bucket) and Basic AssumeRole STS |
| Preview | Lifecycle expiration and incomplete-multipart cleanup, Object Lock (retention and legal hold) and hard bucket quotas |
| Preview | Object annotations (?annotation), ZIP member extraction (x-minio-extract) and read-only hot standby gateways |
| Not supported | SSE-KMS and external KMS; bucket and site replication; remote-tier transitions and restores |
| Not supported | Erasure-coded disk management, drive healing, S2 object compression and external etcd IAM storage |
| Not supported | Objects larger than 1 GiB (default limit 256 MiB), high-throughput workloads and automatic HA failover RPO guarantees |
Preview features ship with the backend, but later releases may change them without compatibility guarantees. The MVP uses the general Silo Console (2.6.0), which does not include an annotation interface.
Data and protocol boundaries
| Area | PostgreSQL backend behavior |
|---|---|
| PostgreSQL | Version 16 or later; direct connections; ordinary non-superuser database owner for gateways; no PgBouncer transaction pooling |
| S3 object size | Default 256 MiB; configurable at store initialization up to 1 GiB; applies to completed multipart objects as well |
| Streaming | Segmented bytea I/O; default segment 8 MiB, configurable from 1 MiB to 64 MiB |
| SQL bodies | Inline read, write and copy up to min(store limit, 256 MiB); bounded read_object up to 8 MiB per call |
| Force bucket deletion | Atomically removes all versions, delete markers and unfinished uploads; requires both s3:DeleteBucket and s3:ForceDeleteBucket; Object Lock buckets return HTTP 405 |
| S3 Select | Parser and execution path present with explicit error responses; not part of the MVP checklist — verify required SQL and serialization formats before relying on it |
| Encryption | SSE-C and AES256 SSE-S3 with the built-in static KMS; SSE-KMS and external KMS requests are rejected |
| IAM and authorization | Persistent users, groups, policies, service accounts and Basic AssumeRole STS; optional IAM AND PostgreSQL native authorization |
| Object Lock | Governance retention, compliance retention and legal hold enforced across S3 and SQL mutation paths; SQL has no governance bypass |
| Lifecycle | Current/noncurrent version expiration, expired delete-marker cleanup and incomplete-multipart abort under database leases; transition rules are rejected |
| Bucket quota | Atomic hard quota over committed object bodies plus annotation bytes across versions; unfinished multipart parts are charged upon completion |
| Annotations | Added in schema 13; up to 1,000 UTF-8 payloads of 1 B–1 MiB per parent version; requires unpublished silo-pkg policy actions |
| ZIP extraction | Added in schema 13; read-only member GET/HEAD and ListObjectsV2 from a single parent snapshot; no persistent member index |
| Notifications | S3 request-path notifications with bounded background delivery; direct SQL writes emit no S3 bucket notifications |
See the S3 API reference for checksum algorithms and headers, and Storage layout for schema and segment details.
Region and CORS behavior
All gateways, client signatures and CreateBucket location constraints must use the same effective region (see Configuration). Notification ARNs include the effective region: arn:minio:sqs:us-east-1:<target-id>:webhook when set to us-east-1, or arn:minio:sqs::<target-id>:webhook when the region is empty.
When a request includes Origin, an explicit Access-Control-Request-Method header selects only the bucket CORS response headers; it does not alter the HTTP method, signature verification, IAM or native authorization. Bucket CORS responses include Origin and Access-Control-Request-Method in Vary (and Access-Control-Request-Headers on preflight responses). Rejected preflight requests return HTTP 403 with AccessForbidden.
Differences from erasure-coded mode
PostgreSQL mode has no local object volumes, erasure sets, drive quorum, parity tuning, drive healing, pool expansion or decommissioning. PostgreSQL manages durability and replication. Do not reuse an erasure-coded configuration unchanged.
A gateway does not own exclusive physical disk capacity. Logical object usage, physical database size and cluster-wide WAL are separate metrics. The Console and monitoring endpoints report physical capacity as Unknown when unavailable or unauthorized rather than reporting zero or claiming the entire database disk as Silo capacity.
A writable gateway connected to the primary runs the background maintenance worker that reclaims unlinked annotation bodies. Unlinking releases logical quota immediately while physical deletion completes asynchronously. Read-only standby gateways do not run this worker.
Consistency and availability boundaries
Object publication, multipart completion, quota accounting and retention checks execute inside PostgreSQL transactions. Separate S3 HTTP requests are separate transactions. Direct SQL via silo_api can modify business tables and S3 objects atomically inside a single Read Committed transaction.
Each gateway opens at most 32 PostgreSQL connections by default (4 control, 2 coordination, 26 data). Above 32 concurrent S3 API requests on a gateway, additional requests queue for up to SILO_PG_QUEUE_TIMEOUT (5 s by default) and then receive HTTP 503 SlowDown, starting with 1d387725c (2026-11-08). Earlier builds, including 299378b and 3c7fdc03, reject them at once with HTTP 429 TooManyRequests. See Configuration for sizing.
Standby gateway reads can observe replication lag or be canceled by PostgreSQL recovery conflicts. If a client loses its connection during commit, the application must verify whether the write succeeded. Restoring a logical pg_dump into a new cluster does not preserve role-OID authorization mappings; see Backup and restore.
Choosing between S3 and SQL
| Requirement | S3 HTTP | Public SQL API (silo_api) |
|---|---|---|
| Atomic transaction with business rows | Separate HTTP requests cannot join a SQL transaction | Commits or rolls back together in one Read Committed transaction (Preview) |
| Identity | S3 IAM, optionally combined with PostgreSQL bucket privileges (AND) | PostgreSQL session_user, function grants and silo_bucket ACL (SET ROLE rejected) |
| Object size | Segmented streaming up to the store limit (256 MiB default, 1 GiB max) | Inline bodies capped at min(store limit, 256 MiB); read_object returns at most 8 MiB per call |
| Encryption | SSE-C and static-key AES256 SSE-S3 | Ciphertext reads and copies are rejected; default-encrypted buckets reject SQL writes |
| Retention and legal hold | Full S3 management APIs and explicit governance bypass | Enforces the same retention and legal hold rules; no management or bypass parameters |
| Annotations | Dedicated ?annotation CRUD and list APIs | No annotation CRUD; plaintext copy_object can retain source annotations if authorized |
| Bucket notifications | Emits configured S3 bucket events | Emits no S3 bucket events; use a transactional outbox table in SQL |
| Force bucket deletion | Supported with s3:ForceDeleteBucket (except on Object Lock buckets) | drop_bucket only drops empty buckets |
| Listing | Full ListObjects V1/V2 and ListObjectVersions parameters | list_objects uses prefix and key-cursor pagination, returning at most 1,000 rows |
4 - Architecture
pgsilo is the PostgreSQL storage backend for Silo (internal/pgstore and cmd/pg-*), serving S3 as a service API protocol. Stateless Silo gateways handle the S3 wire protocol, SigV4 authentication, IAM evaluation, encryption and the Console front end. PostgreSQL stores object bodies, versions, multipart state, bucket configuration, IAM state and background maintenance leases.
flowchart LR
S3["S3 clients and Console"] --> GW["Silo gateway"]
APP["Business application"] --> SQL["silo_api public SQL functions"]
GW --> PG[("PostgreSQL primary")]
SQL --> PG
PG -->|"Physical replication"| REPLICA[("PostgreSQL standby")]
RGW["Read-only Silo gateway"] --> REPLICA
GW --> KEYS["Externally retained TLS and encryption keys"]Persistent data and schemas
Gateways keep no persistent local object directory. PostgreSQL stores object bodies as bytea segments of 8 MiB by default (configurable from 1 MiB to 64 MiB). The default object size limit is 256 MiB, and can be set up to 1 GiB when initializing the store. Object metadata and segments become visible in the same database transaction; concurrent readers never see half-written objects.
The database uses three schemas with separate responsibilities:
| Schema | Purpose | Application access |
|---|---|---|
silo | Private object bodies, metadata, versions, IAM, coordination and maintenance state | Do not grant access |
silo_api | Eleven public SQL functions for object and bucket operations | Grant explicit EXECUTE on required functions |
silo_bucket | One ACL relation per bucket for PostgreSQL native authorization | Grant explicit SELECT, INSERT, DELETE and other required privileges |
A bucket’s name is distinct from its internal identity and ACL relation. Deleting and recreating a bucket with the same name creates a new bucket identity and a new ACL relation in silo_bucket; previous grants, annotations and in-flight requests do not carry over.
Two access paths
Before an S3 HTTP request touches storage, the gateway verifies its SigV4 signature, S3 IAM permissions and bucket policy. When joint authorization (IAM AND PostgreSQL native authorization) is enabled, the gateway also checks the PostgreSQL privileges of the mapped role on silo_bucket.<bucket>. Each S3 HTTP request executes in its own database transactions and cannot join an application’s open SQL transaction.
A SQL application connects to PostgreSQL under its own login role and calls silo_api functions. It can modify business tables and S3 objects atomically inside a single Read Committed transaction. The SQL API identifies callers through session_user and rejects SET ROLE impersonation. The database owner (silo_owner) and its role members are blocked from calling silo_api.
The SQL API is intentionally narrower than S3 HTTP: it does not expose multipart upload APIs, annotation CRUD, SSE ciphertext decryption, Object Lock administration or governance-retention bypass, and direct SQL writes do not emit S3 bucket notifications. Applications that need reliable event delivery from SQL transactions should write to an application-owned transactional outbox table. See the SQL API reference.
Requests, connections and memory
Each gateway splits its PostgreSQL connections across three pools. With the default limit of 32 connections (SILO_PG_MAX_CONNS=32), 4 connections are reserved for the control pool, 2 for the coordination pool, and 26 for the data pool:
- Data pool (26): serves object reads, writes, listings and
CopyObject(which requires at least two data connections). - Control pool (4): serves bucket configuration and metadata lookups so long object transfers cannot starve control operations.
- Coordination pool (2): reserves connections for IAM writes,
LISTEN/NOTIFYrevision channels and lease heartbeats.
Above 32 concurrent S3 API requests on a single gateway, additional requests wait for a free slot for up to SILO_PG_QUEUE_TIMEOUT (5 s by default) without holding a database connection, then receive HTTP 503 SlowDown, which SDKs retry. This queue was added in 1d387725c (2026-11-08); earlier builds, including 299378b and the frozen 3c7fdc03, answer HTTP 429 TooManyRequests at once. Segmented I/O bounds per-buffer memory, but each active stream still holds a connection, buffer memory and a database snapshot. See Configuration for pool settings.
Multiple gateways and authorization freshness
Multiple writable gateways connected to the same PostgreSQL primary share all buckets, objects and IAM state. Each gateway caches IAM state in memory and refreshes it via PostgreSQL LISTEN/NOTIFY plus periodic polling. Cached IAM state is valid for a bounded lease of at most 5 seconds; if a gateway cannot confirm a fresh revision token within the lease bound, it fails closed and rejects requests.
Read-only gateways (Preview) can connect to physical PostgreSQL standbys. Standby reads may lag behind the primary or be canceled by recovery conflicts. Standby authorization relies on continuous control heartbeats written by a writable gateway on the primary, and clocks between primary and standby hosts must differ by no more than 500 ms.
PostgreSQL high-availability tooling (such as Patroni) owns primary election and old-primary fencing. See High availability and IAM control plane for details.
Maintenance and recovery
Even if applications access objects exclusively through SQL, keep at least one writable Silo gateway connected to the PostgreSQL primary. The writable gateway maintains control-plane heartbeats and runs lease-guarded background workers for lifecycle expiration and unlinked annotation garbage collection. Read-only standby gateways cannot run these workers.
Durability and recovery rely on PostgreSQL WAL, physical backups and PITR, plus externally backed-up TLS certificates and KMS static keys. See Compatibility and Storage layout.
5 - Reference
This section documents the configuration variables, SQL functions, HTTP endpoints, authorization rules, and storage semantics of the pgsilo PostgreSQL backend (schema 14). For installation steps, see Installation. For component responsibilities, see Architecture.
Reference pages
| Page | Coverage |
|---|---|
| Configuration | SILO_PG_* variables, connection pools, concurrent request queueing, TLS, region selection, and persistent store settings |
| SQL API | Signatures, return columns, transaction rules, and SQLSTATE codes for all 11 public silo_api functions (Preview) |
| S3 API | Bucket and object operations, multipart uploads, conditional requests, notifications, service accounts, and STS |
| Authorization | Database owner vs. SQL application roles vs. S3 IAM, plus iam_and_pg joint authorization (Preview) |
| Annotations | Named UTF-8 text attachments on object versions, custom IAM actions, conditional parent checks, and copy directives (Preview) |
| ZIP extraction | Read-only virtual member access via x-minio-extract: true, snapshot isolation, and archive resource bounds (Preview) |
| Storage layout | Segment layout, version lifecycles, Object Lock, SSE encryption, hard bucket quotas, and PostgreSQL space reclamation |
| Compatibility | Supported S3 operations, MVP vs. Preview classification, hard limits, and unsupported MinIO/EC features |
5.1 - Configuration
Set SILO_PG_DSN to enable the PostgreSQL backend. In PostgreSQL mode, silo server takes no filesystem directory arguments. Alternatively, pass a single postgres:// or postgresql:// URI on the command line. Do not combine both methods or add disk paths. For systemd services, store SILO_PG_DSN in a protected environment file so database passwords do not appear in process arguments.
PostgreSQL backend variables
| Variable | Default | Range and semantics |
|---|---|---|
SILO_PG_DSN | None | Direct connection to PostgreSQL 16+ as a trusted ordinary database owner |
SILO_PG_READ_ONLY | off | on enforces read-only gateway mode; skips initialization, schema migration, and background maintenance |
SILO_PG_MAX_CONNS | 32 | Total database connection budget per gateway (5–1024) |
SILO_PG_CONTROL_CONNS | 4 | Control-plane connection pool (1–64) |
SILO_PG_COORD_CONNS | 2 | Coordination pool (2–64), including the dedicated revision LISTEN connection |
SILO_PG_SEGMENT_SIZE | 8MiB | Segment size (1MiB–64MiB), persisted in the database at initial setup |
SILO_PG_MAX_OBJECT_SIZE | 256MiB | Maximum object size (1MiB–1GiB), persisted at initial setup; applies to single PUT, copy, and completed multipart objects |
SILO_PG_ACQUIRE_TIMEOUT | 5s | Connection pool acquisition deadline (1ms–1m) |
SILO_PG_REQUEST_TIMEOUT | 15m | Storage request deadline (1ms–24h) |
SILO_PG_QUEUE_TIMEOUT | 5s | Maximum wait for a free concurrent request slot (0s–1m; 0s disables waiting). Added in 1d387725c (2026-11-08) |
The data connection pool size equals SILO_PG_MAX_CONNS - SILO_PG_CONTROL_CONNS - SILO_PG_COORD_CONNS. The result must be at least 2 (26 with default settings). All three settings are validated together at startup: for example, SILO_PG_MAX_CONNS=5 is rejected if CONTROL_CONNS (4) and COORD_CONNS (2) remain at their defaults.
Use explicit byte units (MiB, GiB) and Go duration strings (500ms, 5s, 15m). Empty or unset variables use defaults; invalid values fail startup rather than silently falling back.
Concurrent request limit and queueing
Each gateway bounds the number of S3 requests executing concurrently to the smallest of three values:
SILO_PG_MAX_CONNS- Gateway memory limit divided by two segment buffers:
memlimit / (2 * SILO_PG_SEGMENT_SIZE)(wherememlimitcomes from--memlimitor available system memory) - Configured
api requests_max, if set
Starting with 1d387725c on feat/pg-backend (2026-11-08), requests above the limit wait in an admission queue for up to SILO_PG_QUEUE_TIMEOUT (5s by default). Queued requests do not hold database connections, and disconnected clients abort waiting immediately. When the queue timeout expires, the gateway returns HTTP 503 SlowDown, which AWS SDK for Go v2 and boto3 retry by default. Setting SILO_PG_QUEUE_TIMEOUT=0s disables queueing and returns HTTP 503 SlowDown immediately.
Builds before 1d387725c, including 299378b and the frozen October 8, 2026 local schema 14 checkpoint (3c7fdc03), do not queue: requests above the limit receive HTTP 429 TooManyRequests immediately, which the AWS SDK for Go v2 and boto3 do not retry by default.
Admission queueing only absorbs short bursts. To sustain higher client concurrency:
- Raise
SILO_PG_MAX_CONNSabove the expected concurrent S3 request count (for example,72for 64 concurrent clients, leaving 66 data connections after the 4 control and 2 coordination connections). - Ensure gateway memory accommodates
2 * SILO_PG_SEGMENT_SIZEper active slot (about 1.1 GiB for 72 slots at8MiBsegments). - Raise PostgreSQL
max_connectionsabove the sum ofSILO_PG_MAX_CONNSacross all gateways plus application SQL roles, replication, maintenance, andsuperuser_reserved_connections. - Restart the gateway.
Persistent vs. runtime parameters
Initial store creation writes SILO_PG_SEGMENT_SIZE and SILO_PG_MAX_OBJECT_SIZE into silo.meta. Every subsequent gateway startup (both read-write and read-only) must match the persisted values or the gateway refuses to start. Never edit silo.meta directly to alter segment or object size on an existing store.
Connection pool sizes and timeouts are per-gateway runtime parameters that take effect on gateway restart. Operation-specific bounds can terminate a request earlier than SILO_PG_REQUEST_TIMEOUT (for example, read-only ZIP extraction enforces a 1-minute ceiling).
An explicitly configured read-only gateway (SILO_PG_READ_ONLY=on) never promotes itself to writable. A writable gateway connected to a PostgreSQL standby in recovery also fails write transactions, but with database read-only errors rather than explicit gateway rejection.
Environment file example
The following template is suitable for a systemd EnvironmentFile (/etc/silo/silo-pg.env). Replace all placeholder values and restrict file permissions to 0600. Do not execute this file with source.
URL-encode special characters in the DSN password. sslmode=verify-full validates both the PostgreSQL server certificate chain and hostname. Connections must connect directly to PostgreSQL or through a session-mode proxy that preserves LISTEN/NOTIFY, session state, and transactions; do not use a transaction-pooling proxy.
Start the gateway with:
Place public.crt and private.key inside --certs-dir for S3 HTTPS termination. The PostgreSQL client CA (/etc/silo/postgres-ca.crt) and the S3 server TLS certificate (/etc/silo/certs/public.crt) secure different links. See Installation for systemd unit setup.
Region selection
The gateway determines its effective S3 region from the first non-empty source in this order:
MINIO_REGION- Legacy
MINIO_REGION_NAME MINIO_SITE_REGION, falling back to the database-persistedsite regionsetting when unset or empty- Legacy database-persisted
region name
Surrounding whitespace is trimmed from environment values, and a whitespace-only MINIO_SITE_REGION bypasses the persisted site region. Unset unused variables rather than setting them to spaces. If the selected non-empty value is invalid, startup fails immediately without falling back to lower-priority sources. All gateways sharing a database must resolve the same effective region.
Root credentials, encryption, and compatibility names
MINIO_* environment variable names are retained for compatibility with existing S3 tools and service templates. PGSTY and Silo are not affiliated with MinIO, Inc.
MINIO_ROOT_USERandMINIO_ROOT_PASSWORDdefine the S3 root credentials. All gateways attached to the same database must share identical root credentials, effective region, and SSE-S3 keys.- Built-in static SSE-S3 (
AES256) usesMINIO_KMS_SECRET_KEY(key-name:base64-key) orMINIO_KMS_SECRET_KEY_FILE. Back up the static key before enabling default bucket encryption; losing the key makes encrypted objects permanently unreadable. See Encryption. - General Silo flags for erasure-coded disks, S2 object compression, external etcd IAM, SSE-KMS, and remote tiering do not apply to the PostgreSQL backend. See Compatibility.
5.2 - SQL API
The public silo_api SQL interface is a Preview feature in the MVP release. Callers must connect with an ordinary application SQL role (never the installation owner) and execute write functions under Read Committed isolation.
The public SQL API consists of the 11 functions in the silo_api schema listed below. Functions and tables in the silo schema are private implementation internals and must not be called by applications.
Calling contract
- Authorization checks
session_user;SET ROLEis rejected. The installation owner (silo_owner) and its role members cannot callsilo_apifunctions. - Callers need
USAGEonsilo_api,EXECUTEon each required function, and the corresponding table privileges on the bucket’s ACL relation insilo_bucket. Functions are not granted toPUBLIC. See Authorization. - Write functions require
Read Committed(or PostgreSQLRead Uncommitted, which behaves identically). Calling write functions underRepeatable ReadorSerializableraisesSQLSTATE 0A000. - Object mutations and application table rows commit or roll back atomically in the same SQL transaction. Independent S3 HTTP requests do not join that transaction. Direct SQL writes do not emit S3 bucket event notifications.
- Object keys are 1–1024 UTF-8 bytes; zero-length
byteabodies are valid. Passing SQLNULLforp_version_idtargets the current version. To target an S3nullversion explicitly, pass UUID'00000000-0000-0000-0000-000000000000'(not the string'null'). - Inline
put_object,get_object, andcopy_objectbodies are capped atmin(SILO_PG_MAX_OBJECT_SIZE, 256 MiB).read_objectreturns at most8 MiB(8388608bytes) per call. - SQL functions do not decrypt SSE-encrypted bodies or allow plaintext writes to bypass default bucket encryption. All SQL mutations obey synchronized bucket policies, hard bucket quotas, Object Lock retention, and legal holds, with no governance bypass parameter.
Object functions
put_object
Requires INSERT on the destination bucket ACL relation. Setting p_if_none_match = true succeeds only when no current object body exists (a current delete marker does not block the write). p_if_match takes an unquoted ETag string, or '*' to require an existing current body. The two condition parameters are mutually exclusive and each additionally requires SELECT on the bucket. Conditions are evaluated atomically at publication.
p_user_meta must be a flat JSON object with string values (for example, '{"invoice-id":"1001"}'). Omit the x-amz-meta- prefix; the function normalizes keys and rejects reserved names, case-insensitive duplicates, CR/LF characters, and non-string values. Total normalized user metadata is capped at 2048 bytes, and p_content_type is capped at 1024 bytes without CR/LF.
stat_object
Requires SELECT on the bucket. Returns metadata (including whether the selected version is a delete marker) without reading the object body or exposing private encryption keys. user_meta contains user metadata stripped of x-amz-meta- prefixes. size is the stored payload size and actual_size is the logical plaintext size.
get_object
Requires SELECT on the bucket. Returns the complete plaintext body within the 256 MiB inline limit. Raises SO001 if the selected version is a delete marker or missing, and 0A000 if the object is encrypted.
read_object
Requires SELECT on the bucket. p_offset must be >= 0 and not past the end of the object; p_length must be 0–8388608 (8 MiB). Reads crossing the end of the object are truncated. When p_object_id is non-NULL, the function verifies that the selected version still has that object_id and raises SO002 on mismatch. To keep multi-chunk reads consistent across statements, pin an immutable version_id or run inside a read-only Repeatable Read transaction.
list_objects
Requires SELECT on the bucket. Lists current visible objects (excluding delete markers) ordered by key COLLATE "C". p_limit accepts 0–1000. Pass the last key of a page as p_after_key to fetch the next page. Historical versions and S3 delimiter rollups are not exposed here.
delete_object
Requires DELETE on the bucket (plus SELECT when p_if_match is set). Omitting p_version_id either removes the current object or inserts a delete marker according to the bucket’s versioning state. Specifying p_version_id deletes that version unless blocked by Object Lock retention or legal hold (SL003).
copy_object
Requires SELECT on the source bucket and INSERT on the destination bucket (plus destination SELECT when a destination condition is set). Reads the source body, tags, public metadata, and annotations from a single snapshot and publishes the destination object and annotations atomically. Rejects encrypted source objects or encrypted annotations.
Bucket functions
create_bucket
Controlled by EXECUTE privilege on silo_api.create_bucket(text, text). Bucket names must be valid lowercase S3 names (3–63 bytes). Empty region defaults to 'us-east-1'; 'EU' maps to 'eu-west-1'. The creator receives SELECT, INSERT, and DELETE on the new acl_relation in silo_bucket.
bucket_info and list_buckets
Filtered by the caller’s bucket privileges: holding at least one of SELECT, INSERT, or DELETE on a bucket’s ACL relation makes that bucket visible. bucket_info raises 42501 if the bucket does not exist or the caller lacks privileges.
drop_bucket
Requires DELETE on the bucket ACL relation and requires the bucket to be completely empty (no current objects, historical versions, or delete markers). There is no force parameter in SQL.
Errors and retries
Classify failures by SQLSTATE code rather than error message text:
| SQLSTATE | Meaning | Application handling |
|---|---|---|
42501 | Role, function, or bucket permission denied | Fix role bindings and GRANT statements; do not retry |
22023 | Invalid argument, byte range, condition, or metadata | Fix caller input |
0A000 | Unsupported write isolation level, encrypted payload, or unsynchronized bucket policy | Use Read Committed for writes; use S3 API for encrypted objects |
SO001 | Object body or version does not exist (or is a delete marker) | Handle missing object |
SO002 | ETag condition or p_object_id mismatch | Re-read current state and decide whether to retry |
SO003 | Object exceeds the 256 MiB inline SQL limit | Use read_object chunked reads or the S3 API |
SO004 | Incomplete object segment data | Abort and inspect storage consistency |
SB001 / SB002 / SB003 | Bucket missing / bucket not empty / bucket already exists | Handle at the application level |
SL003 | Version protected by Object Lock retention or legal hold | Keep protected version; SQL has no governance bypass |
SL004 | Bucket or object lock state not yet synchronized | Verify compatible gateway processes are running |
SQ001 | Hard bucket quota exceeded | Free logical space or increase bucket quota |
SA004 | Annotation payload integrity failure | Reject corrupt payload and inspect storage |
See the SQL Object Operations tutorial for end-to-end transactional examples.
5.3 - S3 API
Core bucket/object CRUD, versioning, multipart uploads, SSE-S3/SSE-C encryption, webhook notifications, IAM users/policies, and service accounts are part of the pgsilo MVP target. Basic AssumeRole STS, bucket lifecycle expiration/abort, Object Lock retention/legal hold, hard bucket quotas, object annotations, and read-only ZIP extraction are Preview features.
This page summarizes the HTTP S3 operations, headers, and extensions supported by the schema 14 PostgreSQL backend. Examples use path-style addressing (/{bucket}/{key}). For hands-on examples, see SDK & CLI Access and Multipart, Lock & Notifications.
Endpoints, signatures, and clients
- S3 and STS share the gateway API port (
9000by default); the web Console uses9001by default. Never pass the Console port as an S3 SDK endpoint. - Sign requests with AWS Signature Version 4 (
s3service name for object/bucket calls,stsforAssumeRole) using the gateway’s effective region. - Path-style addressing works out of the box. Virtual-hosted-style addressing requires
MINIO_DOMAIN, wildcard DNS for bucket subdomains, and TLS certificates covering those hostnames. - Presigned GET/PUT URLs and POST policy forms are supported within their signed expiration and conditions.
| Client | Primary use | Configuration notes |
|---|---|---|
mcli | Buckets, objects, IAM users/policies, service accounts, quotas, and admin status | Separate administrative aliases from application credentials |
AWS CLI (s3 / s3api / sts) | Versioned object calls, multipart uploads, tagging, Object Lock, and AssumeRole | Pass --endpoint-url, --ca-bundle, and --region |
boto3 / AWS SDK for Go v2 | Application S3 access and automated tests | Use path-style addressing; SDKs automatically retry HTTP 503 SlowDown |
| Custom SigV4 HTTP client | Object annotations and x-minio-extract ZIP headers not modeled by standard SDKs | Sign full query parameters and extension headers |
Bucket and object operations
| Operation | HTTP form | Behavior and limits |
|---|---|---|
ListBuckets | GET / | Lists buckets visible to the caller identity |
CreateBucket / HeadBucket / DeleteBucket | PUT / HEAD / DELETE /{bucket} | Standard DeleteBucket requires an empty bucket; LocationConstraint must match the effective region |
GetBucketLocation | GET /{bucket}?location | Returns the effective region |
ListObjects / ListObjectsV2 | GET /{bucket} / GET /{bucket}?list-type=2 | Supports prefix, delimiter, and continuation tokens |
PutObject / GetObject / HeadObject | PUT / GET / HEAD /{bucket}/{key} | Supports user metadata, content type, conditionals, byte ranges, checksums, and SSE |
CopyObject | PUT /{bucket}/{key} with x-amz-copy-source | Copies across keys or buckets atomically; supports source version selection |
DeleteObject / DeleteObjects | DELETE /{bucket}/{key} / POST /{bucket}?delete | Creates a delete marker in versioned buckets when versionId is omitted; batch delete handles up to 1000 keys |
GetObjectAttributes | GET /{bucket}/{key}?attributes | Returns ETag, checksums, object size, and multipart part metadata |
SelectObjectContent | POST /{bucket}/{key}?select&select-type=2 | S3 Select over CSV, JSON, and Parquet payloads |
The default maximum object size is 256 MiB (SILO_PG_MAX_OBJECT_SIZE), configurable up to 1 GiB at initial store setup. Single PUT, CopyObject, and completed multipart objects all enforce this limit.
Sending DELETE /{bucket} with a non-empty x-minio-force-delete header (including the literal string false) requires s3:ForceDeleteBucket in addition to s3:DeleteBucket. Object-lock buckets reject force deletion with HTTP 405 even when empty.
Versioning, conditionals, ranges, and checksums
Use GET/PUT /{bucket}?versioning to inspect or change bucket versioning (Enabled or Suspended) and GET /{bucket}?versions (ListObjectVersions) to list versions and delete markers.
| Feature | Headers or query parameters | Notes |
|---|---|---|
| Read conditionals | versionId, If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since | Returns 304 Not Modified or 412 Precondition Failed according to HTTP method |
| Write / Copy destination conditionals | If-Match, If-None-Match | Checked atomically at publication without a separate HEAD race |
| Conditional delete | If-Match, optional versionId | Verifies target ETag before deleting or adding a delete marker |
| Copy source conditionals | x-amz-copy-source-if-* | Checked against the selected source version |
| Byte range reads | Range: bytes=start-end | Single byte range supported; cannot be combined with partNumber |
| Part reads | partNumber=N | Reads a specific part of a completed multipart object |
Supported checksum algorithms include CRC32, CRC32C, CRC64NVME, SHA1, SHA256, MD5, SHA512, XXHASH64, XXHASH3, and XXHASH128. Note that ETag values for multipart or encrypted objects are not plain MD5 digests.
Multipart uploads
| Stage | HTTP form | S3 operation |
|---|---|---|
| Initiate | POST /{bucket}/{key}?uploads | CreateMultipartUpload |
| Upload part | PUT /{bucket}/{key}?partNumber=N&uploadId=ID | UploadPart |
| Copy part | PUT /{bucket}/{key}?partNumber=N&uploadId=ID + x-amz-copy-source | UploadPartCopy |
| List parts | GET /{bucket}/{key}?uploadId=ID | ListParts |
| List active uploads | GET /{bucket}?uploads | ListMultipartUploads |
| Complete | POST /{bucket}/{key}?uploadId=ID | CompleteMultipartUpload |
| Abort | DELETE /{bucket}/{key}?uploadId=ID | AbortMultipartUpload |
Part numbers run from 1 to 10000, and every part except the last must be at least 5 MiB. Unfinished parts consume physical database storage but do not count toward logical bucket quota until CompleteMultipartUpload publishes the assembled object in a single transaction. Abort failed uploads explicitly or configure an AbortIncompleteMultipartUpload lifecycle rule.
Subresources: tags, lock, encryption, lifecycle, CORS, notifications
| Subresource | Methods | Scope and status |
|---|---|---|
Object ?tagging | GET / PUT / DELETE | Up to 10 key-value tags per object version (MVP) |
Bucket ?tagging | GET / PUT / DELETE | Bucket-level tag set (MVP) |
Bucket ?policy | GET / PUT / DELETE | Bucket policies persisted in PostgreSQL; combined with native role grants under iam_and_pg (MVP) |
Bucket ?encryption | GET / PUT / DELETE | Default AES256 encryption using built-in static KMS; external SSE-KMS is unsupported (MVP) |
Bucket ?cors | GET / PUT / DELETE, OPTIONS | Per-bucket CORS rules; does not bypass SigV4 or IAM checks (MVP) |
Bucket ?notification | GET / PUT | Publishes S3 object events to configured webhook targets (MVP) |
Bucket ?object-lock | GET / PUT (enabled at bucket creation) | Default GOVERNANCE or COMPLIANCE retention on versioned buckets (Preview) |
Object ?retention, ?legal-hold | GET / PUT | Per-version retention and legal hold; governance bypass requires x-amz-bypass-governance-retention: true and s3:BypassGovernanceRetention (Preview) |
Bucket ?lifecycle | GET / PUT / DELETE | Current/noncurrent expiration, expired delete-marker cleanup, and incomplete multipart abort; no remote tiering (Preview) |
Webhook notifications
- Configure a webhook target on the gateway via
MINIO_NOTIFY_WEBHOOK_ENABLE_<ID>=onandMINIO_NOTIFY_WEBHOOK_ENDPOINT_<ID>=https://.... - Attach bucket notification rules referencing
arn:minio:sqs:<region>:<ID>:webhookusingPutBucketNotificationConfigurationormcli event add.
S3 HTTP mutations and background lifecycle expirations emit bucket notifications after transaction commit (at-least-once delivery; consumers must handle duplicates). Direct SQL mutations via silo_api never emit S3 bucket notifications.
IAM service accounts and STS
IAM users, groups, policies, service accounts, and STS metadata are stored in PostgreSQL and managed through mcli admin user, mcli admin policy, and mcli admin user svcacct.
- Service accounts belong to a parent IAM user, optionally carry a session policy (up to 2048 serialized bytes) that narrows the parent’s permissions, and support an optional expiration between 15 minutes and 365 days from issuance.
- Basic
AssumeRoleSTS (Preview) accepts a formPOST /signed with an ordinary IAM user’s SigV4 credentials (Action=AssumeRole&Version=2011-06-15).DurationSecondsdefaults to3600(1 hour) and accepts900–31536000seconds (15 minutes to 365 days) unless overridden byMINIO_STS_DURATION. - Service accounts and STS temporary credentials cannot call
AssumeRolerecursively to extend credential chains. - Direct exchange of PostgreSQL database usernames/passwords for STS credentials is not implemented, and external OIDC/LDAP STS flows (
AssumeRoleWithWebIdentity,AssumeRoleWithLDAPIdentity) are not part of the validatedpgsiloscope.
Unsupported S3 APIs
The PostgreSQL backend does not implement bucket or site replication, remote storage tiering, RestoreObject, object-level canned ACLs, S3 Inventory, static website hosting, server access logging, Transfer Acceleration, RequestPayment, BitTorrent, or external SSE-KMS. See Compatibility for the complete matrix.
5.4 - Authorization
S3 IAM users, policies, and service accounts are part of the core pgsilo MVP. SQL application role grants (silo_api / silo_bucket) and joint S3-to-PostgreSQL authorization (iam_and_pg mode) are Preview features in the MVP release.
pgsilo separates three kinds of identities:
- Database owner (
silo_owner): the trusted ordinary PostgreSQL role used bysilo servergateways viaSILO_PG_DSN. - SQL application logins (e.g.,
app_sql): independent unprivileged PostgreSQL roles that callsilo_apifunctions. - S3 identities: S3 root credentials, IAM users, service accounts, and STS temporary sessions.
Never connect applications or S3 bindings as the installation owner (silo_owner) or a PostgreSQL superuser.
SQL application privileges
Create an unprivileged login role for SQL callers:
As the installation owner (silo_owner), grant schema USAGE, function EXECUTE, and table privileges on the target bucket’s ACL relation in silo_bucket:
| SQL operation | Required bucket ACL privilege |
|---|---|
stat_object, get_object, read_object, list_objects | SELECT |
put_object (including unconditional overwrite) | INSERT |
Conditional put_object, copy_object, delete_object | Operation privileges plus SELECT |
copy_object | Source SELECT and destination INSERT |
delete_object, drop_bucket | DELETE (drop_bucket also requires an empty bucket) |
bucket_info, list_buckets | At least one of SELECT, INSERT, or DELETE |
create_bucket | EXECUTE on silo_api.create_bucket(text, text) |
Callers must connect directly as app_sql (session_user is checked; SET ROLE is rejected). Recreating a dropped bucket generates a new ACL relation in silo_bucket and requires fresh GRANT statements.
Joint authorization (iam_and_pg)
By default (iam mode), S3 requests are authorized solely by S3 IAM and bucket policies. Optional iam_and_pg mode requires both S3 IAM evaluation and the bound PostgreSQL role’s silo_bucket privileges to succeed:
- An explicit IAM
Deny, service-account policy restriction, or STS session policy restriction always denies the request; PostgreSQLGRANTstatements never override an IAM denial. - The authorization mode is stored in the shared database (
silo.set_native_auth_mode) and applies across all gateways connected to that database. - Anonymous S3 requests have no PostgreSQL role binding and are rejected in
iam_and_pgmode.
Bound PostgreSQL roles must be independent ordinary roles (NOLOGIN roles are recommended for S3-only principals) and must not:
- Hold
SUPERUSER,CREATEDB,CREATEROLE,REPLICATION, orBYPASSRLS - Inherit the installation owner (
silo_owner), schema owners,pg_read_all_data, orpg_write_all_data - Hold privileges on the private
siloschema - Hold
WITH GRANT OPTIONonsilo_apifunctions orCREATEonsilo_api/silo_bucket
Enabling iam_and_pg mode
After creating the IAM user app-s3 and granting bucket privileges to app_sql, create a dedicated NOLOGIN role for the S3 root identity and bind both principals inside a transaction as silo_owner:
Before switching an active deployment to iam_and_pg, bind every required root and IAM user identity and grant privileges on all target buckets.
S3-to-PostgreSQL privilege mapping
| S3 operation class | Required PostgreSQL privilege in iam_and_pg mode |
|---|---|
Object GET/HEAD, version reads, listings, tag/retention/bucket-config reads | SELECT on bucket ACL relation |
Object PUT, tag writes, retention/legal-hold writes, annotation PUT | INSERT on bucket ACL relation |
Object/version DELETE, AbortMultipartUpload, annotation DELETE | DELETE on bucket ACL relation |
| Bucket configuration changes, governance-retention bypass | UPDATE on bucket ACL relation (plus operation-specific privileges) |
DeleteBucket, ForceDeleteBucket | DELETE and UPDATE on bucket ACL relation |
CreateBucket | EXECUTE on silo_api.create_bucket(text, text) |
Conditional writes/deletes and annotation mutations with x-amz-object-if-match | Operation privilege plus SELECT on bucket ACL relation |
CopyObject | Source SELECT and destination INSERT (plus annotation IAM actions when copying annotations) |
Service accounts and STS temporary credentials inherit the PostgreSQL role binding of their parent IAM user while enforcing their own IAM and session-policy restrictions.
Revoking bindings and restoring default mode
As silo_owner, unbind principals or switch back to iam mode:
Bindings track both the PostgreSQL role OID and the IAM user generation. Dropping and recreating a role or IAM user with the same name requires re-running silo.bind_native_principal. Switching S3 back to iam mode does not relax privileges on the silo_api SQL functions.
5.5 - Annotations
The object annotation protocol is a Preview extension in the MVP release. Policy evaluation for the four s3:*ObjectAnnotation actions depends on the unpublished silo-pkg revision (27697e8) compiled into the pgsilo branch.
An object annotation is a named UTF-8 text payload attached to a specific parent object version—such as OCR text, classification labels, or review notes. Introduced in schema 13 and retained in schema 14, annotations are stored separately from S3 user metadata (x-amz-meta-*) and object tags. Updating an annotation neither rewrites the parent object body nor creates a new parent version.
HTTP requests and permissions
Target the parent object key and sign the full path, query string, and headers with AWS SigV4:
| Operation | HTTP request | Required IAM action | Additional bucket privilege (iam_and_pg) |
|---|---|---|---|
| Write or replace | PUT /{bucket}/{key}?annotation=&annotationName=labels.json | s3:PutObjectAnnotation | INSERT |
| Read payload | GET /{bucket}/{key}?annotation=&annotationName=labels.json | s3:GetObjectAnnotation | SELECT |
| List names | GET /{bucket}/{key}?annotation= | s3:ListObjectAnnotations | SELECT |
| Delete | DELETE /{bucket}/{key}?annotation=&annotationName=labels.json | s3:DeleteObjectAnnotation | DELETE |
- Standard
s3:GetObjectands3:PutObjectpermissions do not grant annotation access. IAM policy resources reference the parent object ARN (arn:aws:s3:::bucket/keyor prefix). - The
annotationquery parameter must appear once with an empty value.PUTandDELETErequire a non-emptyannotationName.GETwithoutannotationNamelists all annotations on the selected parent version;GETwithannotationNamereturns that annotation’s body. There is no annotationHEADendpoint. - Successful
PUTreturns HTTP200,DELETEreturns HTTP204, andGETreturnsContent-Type: text/plain; charset=utf-8along with the annotation’s ownETag,Last-Modified, and parentx-amz-version-id.
Size and naming bounds
| Property | Limit |
|---|---|
| Annotations per parent object version | 1000 |
| Plaintext payload size | 1 byte – 1 MiB |
Annotation name (annotationName) | 1 – 512 UTF-8 bytes (no XML-invalid control characters) |
| Payload encoding | Valid UTF-8 |
Annotation names are treated as flat identifiers rather than filesystem paths. Annotation bytes count toward the bucket’s hard logical quota.
A list request (GET /{bucket}/{key}?annotation=) returns up to 1000 entries in a single response without pagination parameters:
Parent version selection and conditional writes
Pass versionId to target a specific historical parent version; omitting versionId targets the current visible object (excluding delete markers).
PUT and DELETE accept x-amz-object-if-match: "<PARENT_ETAG>" to verify the parent object’s ETag atomically (requires SELECT under iam_and_pg mode). Note that x-amz-object-if-match checks the parent object body’s ETag, not the previous annotation’s ETag.
For runnable Python signing examples, see Annotations & ZIP Extraction.
Lifecycle, copying, and encryption
- Independent mutability: annotations have no version history of their own. Updating an annotation leaves the parent object’s body, ETag, modification time, tags, Object Lock retention, and legal hold untouched. Parent Object Lock does not make annotations immutable.
- Unlinking and cleanup: overwriting an unversioned object discards its previous annotation set; deleting a specific parent version unlinks only that version’s annotations. Unlinking releases logical bucket quota immediately, while a writable gateway’s background maintenance worker deletes the unlinked physical rows in batches.
- Copy directives: S3
CopyObjectacceptsx-amz-annotation-directive: COPY(default) orEXCLUDE. Copying a non-empty annotation set requiress3:GetObjectAnnotationon the source ands3:PutObjectAnnotationon the destination. SQLsilo_api.copy_objectalways copies plaintext annotations atomically and has noEXCLUDEoption. - Encryption: annotations inherit the parent version’s SSE-C or static SSE-S3 protection and require the matching key on
PUTandGET. Public SQL functions have no annotation CRUD endpoints and reject copying objects with encrypted annotations.
Error responses
| Error or status | Meaning |
|---|---|
InvalidArgument (HTTP 400) | Malformed query parameters, invalid UTF-8 name/body, or unsupported headers |
TooManyAnnotations (HTTP 400) | Parent version already has 1000 annotations |
NoSuchAnnotation (HTTP 404) | Requested annotationName does not exist on the selected parent version |
AccessDenied (HTTP 403) | Missing s3:*ObjectAnnotation action, parent policy denial, or missing native bucket privilege |
PreconditionFailed (HTTP 412) | x-amz-object-if-match does not match the parent version’s ETag |
5.6 - ZIP extraction
Read-only ZIP member extraction (x-minio-extract: true) is a Preview extension in the MVP release.
Introduced in schema 13 and retained in schema 14, the PostgreSQL backend can expose members inside a stored .zip object as read-only virtual objects over S3. The gateway never extracts files onto local disk, creates separate object rows, or persists a ZIP index in PostgreSQL.
Request forms
Include x-minio-extract: true on a GET or HEAD request whose key path traverses inside a .zip archive:
To list archive members, send a ListObjectsV2 request (list-type=2) with x-minio-extract: true and a prefix containing .zip/:
The first .zip/ boundary in the key identifies the parent archive object. In a.zip/b.zip/c.txt, the parent archive is a.zip and the requested member path is b.zip/c.txt; nested archives are not recursively opened. Without x-minio-extract: true, requests treat the full key as an ordinary S3 object name. For runnable SDK code, see Annotations & ZIP Extraction.
Authorization and snapshot isolation
- Reading a member requires
s3:GetObjecton the parent.zipobject (ors3:GetObjectVersionwhenversionIdis specified). Listing members additionally requiress3:ListBucket. Underiam_and_pgjoint authorization, onlySELECTon the bucket ACL relation is required. - Central directory parsing, member decompression, parent version metadata, and SSE decryption all read from a single pinned PostgreSQL snapshot. Concurrent S3 or SQL overwrites, version deletions, or bucket recreations cannot swap the underlying archive segments mid-read.
- SSE-C and static SSE-S3 encrypted
.ziparchives are supported through the standard parent decryption path, and read-only standby gateways (SILO_PG_READ_ONLY=on) can serve ZIP extraction requests.
Archive format and resource limits
| Parameter | Limit |
|---|---|
| Compression methods | Store (0) and Deflate (8) |
| ZIP64 descriptors | Supported within the size bounds below |
| Central directory size | <= 16 MiB |
| Central directory entries | <= 10000 entries |
| Single uncompressed member size | <= 256 MiB |
| Total declared uncompressed archive size | <= 1 GiB |
| Per-request execution timeout | <= 1 minute (or shorter outer request timeout) |
Member Range or partNumber reads | Unsupported (rejected) |
| Password-protected / encrypted ZIP or multi-disk archives | Unsupported (rejected) |
The gateway rejects archives with trailing or corrupt central directory records, out-of-range offsets, duplicate member names, absolute paths, .. path traversal segments, or special file types.
GET vs. HEAD execution cost
Before streaming a GET response body, the gateway validates the target member’s uncompressed size and CRC-32 across the member stream, then streams the decompressed payload from the same database snapshot. Consequently, every member GET performs two decompression passes. HEAD returns member metadata (Content-Length set to uncompressed size, Content-Type inferred from file extension) from the central directory without decompressing the member body.
Each extraction request holds its database connection and snapshot until the stream finishes or times out. For workloads that repeatedly read individual members at high concurrency, unpack and store those files as independent S3 objects instead.
5.7 - 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.
6 - Operations
pgsilo gateways serve the S3 API, web Console, and IAM evaluation while PostgreSQL stores all objects, segments, and control state. Operate and monitor both layers together: a live gateway process does not prove that PostgreSQL is writable, and logical bucket usage does not measure physical database disk consumption.
Operations guides
| Task | Guide |
|---|---|
| Prepare PostgreSQL and install gateways on Linux or macOS | Install |
| Scale out stateless gateways, attach read-only standbys, and handle failover | High availability |
| Back up and restore the database, WAL stream, and external encryption keys | Backup and restore |
| Perform coordinated schema migrations and binary upgrades | Upgrade |
Configure health probes, scrape /minio/metrics/v3/pg, and track capacity | Monitoring |
| Diagnose TLS, pool exhaustion (HTTP 503 / 429), IAM leases, and space growth | Troubleshooting |
| Automate multi-gateway deployment with the unpublished Pigsty role branch | Deploy with Pigsty |
Operating rules
- All gateways in a deployment must connect to the same logical PostgreSQL database (or its physical standbys) and share identical root credentials, effective region, static SSE-S3 keys,
SILO_PG_SEGMENT_SIZE, andSILO_PG_MAX_OBJECT_SIZE. - Gateways connect as the trusted ordinary database owner (
silo_owner). Applications use separate SQL logins (app_sql) with access only tosilo_apiandsilo_bucket, never the privatesiloschema. - Even if applications access objects exclusively through
silo_apiover SQL, keep at least one writablesilo servergateway connected to the PostgreSQL primary. That gateway runs lifecycle expiration, reaps unlinked annotation payloads, and writes the control-plane heartbeats required by standby gateways. - During recovery or failover, evaluate consistency at the transaction boundary: application rows and
silo_apicalls inside one SQL transaction recover atomically, whereas separate S3 HTTP requests commit as independent transactions.
6.1 - Install
Installation packages for the pgsilo PostgreSQL backend have not yet been publicly released (MVP in progress). No public download URLs exist yet. When released with Silo, the MVP targets linux/amd64 and linux/arm64 DEB and RPM packages (darwin/arm64 is used for local verification). The frozen October 8, 2026 local checkpoint (3c7fdc03) built only linux/arm64 DEB and darwin/arm64 artifacts.
This guide covers preparing the PostgreSQL database and configuring silo server on Linux (systemd) or macOS. For an existing database undergoing a schema change, follow Upgrade instead.
1. Prepare the PostgreSQL database
Prepare a PostgreSQL 16 or newer primary instance (pg.example.net:5432) with TLS enabled. Gateways must connect directly to PostgreSQL or through a session-preserving proxy; do not route SILO_PG_DSN through PgBouncer in transaction-pooling mode.
On the PostgreSQL primary, create an ordinary, non-superuser role (silo_owner) and a dedicated database (silo):
Require TLS and SCRAM authentication in pg_hba.conf for the gateway subnet:
From the gateway host, verify connectivity, TLS certificate verification (sslmode=verify-full), and primary write status (pg_is_in_recovery() = false):
2. Install on Linux with systemd
Install the package and verify the binary
Once you have built or obtained the target DEB/RPM package for your architecture (amd64 or arm64), verify its SHA-256 checksum and install it:
The package creates the silo system user and group. Complete the configuration steps below before starting the service.
Install TLS certificates and /etc/default/silo
Create /etc/silo and /etc/silo/certs, install the PostgreSQL CA certificate and the S3 server TLS certificate/key pair (public.crt and private.key), and create /etc/default/silo:
Write /etc/default/silo (mode 0640, owned by root:silo) using this template (silo-pg.env.example), replacing all placeholder values:
SILO_PG_QUEUE_TIMEOUT takes effect from 1d387725c (2026-11-08); earlier builds ignore it.
Percent-encode reserved characters in the DSN password. This file is read by systemd EnvironmentFile; do not execute it with source.
Install the systemd drop-in and start silo
Install the service override (/etc/systemd/system/silo.service.d/postgresql.conf, matching silo-pg.conf) so systemd clears any default disk-mode arguments and starts silo server in PostgreSQL mode:
Reload systemd and start the first writable gateway:
On first startup against an empty database, the writable gateway initializes schema 14 (migrations 0001 through 0014) inside a transaction and persists SILO_PG_SEGMENT_SIZE and SILO_PG_MAX_OBJECT_SIZE. Wait for initialization to finish before starting additional gateways.
3. Run on macOS (Apple Silicon)
For local verification on Apple Silicon (darwin/arm64), place public.crt and private.key in your certificate directory and launch ./silo-darwin-arm64 with environment variables prompted interactively so secrets stay out of shell history:
4. Verify database-aware health checks
From a client trusting the S3 TLS CA, verify both read and write health endpoints:
A healthy writable gateway returns HTTP 200 on both endpoints. Next, follow the Quickstart or SDK & CLI Access to create application credentials and buckets.
6.2 - High availability
Running multiple stateless read-write gateways against a single PostgreSQL primary is part of the core pgsilo MVP. Read-only hot standby gateways (SILO_PG_READ_ONLY=on) connected to physical PostgreSQL standbys are a Preview feature. pgsilo does not provide automatic database failover, old-primary fencing, or zero-RPO guarantees; persistence, replication, and failover are governed by your PostgreSQL HA cluster.
Because pgsilo gateways hold no local object files on disk, multiple gateways can share one PostgreSQL primary while PostgreSQL physical replication protects the underlying data.
Add a writable gateway
- Install the exact same
silobinary build on the new gateway host. - Point
SILO_PG_DSNto the same PostgreSQL primary database (silo) and owner (silo_owner). Use identical root credentials, effective region, static SSE-S3 keys,SILO_PG_SEGMENT_SIZE, andSILO_PG_MAX_OBJECT_SIZE. - Install the PostgreSQL CA certificate and S3 TLS certificates covering the gateway’s hostname or load-balancer SANs.
- Let the first writable gateway finish schema initialization before starting additional gateways. Verify both
/minio/health/cluster/readand/minio/health/clusterreturn HTTP200on the new gateway before adding it to the load balancer’s write pool.
Each gateway opens up to SILO_PG_MAX_CONNS connections (32 by default: 4 control, 2 coordination, and 26 data connections). Two default gateways consume up to 64 PostgreSQL connections before counting application SQL sessions, replication, and administration. Route read-write traffic with /minio/health/cluster and read-only traffic with /minio/health/cluster/read.
Read-only gateways on a physical standby (Preview)
After configuring PostgreSQL physical streaming replication and confirming the standby has replayed schema 14 (migration:0001 through 0014), configure a read-only gateway against the standby endpoint:
A read-only gateway verifies schema compatibility at startup but never initializes, migrates, or runs background maintenance. Even if pointed at a writable primary, SILO_PG_READ_ONLY=on rejects all S3 mutation requests.
| Gateway & database state | /minio/health/cluster/read | /minio/health/cluster | Mutation behavior |
|---|---|---|---|
| Healthy writable gateway on primary | 200 | 200 | Allowed (subject to IAM / native auth) |
Healthy explicit read-only gateway (SILO_PG_READ_ONLY=on) | 200 | 503 | Rejected with AccessDenied |
| Writable gateway whose database enters recovery / read-only | 200 (if readable) | 503 | Fails with retryable service/read-only error |
| Database unreachable | 503 | 503 | Fails (process liveness /minio/health/live may remain 200) |
Standby reads reflect asynchronous replication lag and can be canceled by PostgreSQL recovery conflicts. Applications requiring read-after-write consistency must read from a primary gateway or coordinate against PostgreSQL LSN replay positions.
IAM cache freshness and the 5-second lease
Gateways authorize S3 requests against an in-memory IAM and bucket-metadata snapshot governed by a strict 5-second lease measured from the start of each database observation query:
- Gateways poll PostgreSQL every 1 second and also listen on
LISTEN silo_control_revfor immediate wakeups.NOTIFYis only a hint; missed notifications never cause permanent staleness. - Schema 14 pairs the monotonic integer
revisionwith a persistent random UUIDrevision_tokenupdated in every control-plane transaction. After a failover, any change inrevision_token—or any change inpg_is_in_recovery()state or listener reconnection—forces a full control-plane reload even if the integerrevisionmatches. - Until a required reload completes, an unexpired snapshot keeps its existing deadline without renewal; local invalidation revokes the lease immediately. Once the 5-second lease expires without a fresh database observation, IAM-authenticated requests fail closed (
503) rather than serving stale permissions. - Physical standby gateways verify freshness using replicated control-plane heartbeats written by a writable gateway on the primary. Clocks on the primary and standby hosts must stay synchronized within 500 milliseconds. Heartbeat age plus the 500 ms clock-skew allowance is subtracted from the 5-second lease window. Always keep at least one writable gateway running on the primary so standby heartbeats stay fresh.
For design details, see IAM, Control Plane & Cache Freshness.
PostgreSQL failover sequence
- Fence the old primary through your PostgreSQL HA manager (e.g., Patroni) and verify it can no longer accept writes.
- Promote the selected standby according to your RPO policy and update the primary DNS/VIP endpoint.
- Verify writable gateways reconnect to the promoted primary, observe
pg_is_in_recovery() = false, and return HTTP200on/minio/health/cluster. - Verify authorization and maintenance: test both allowed and denied S3 requests on every gateway, confirm clock synchronization (
<= 500 ms) and heartbeat replication for any remaining standbys, and verify via metrics (minio_pg_lifecycle_leader) that a writable primary gateway has acquired the maintenance lease. - Restore application traffic. Note that
revision_tokendetects split-brain control caches after failover, but it does not fence an old primary or recover object writes lost during asynchronous replication.
6.3 - Backup and restore
Because pgsilo gateways are stateless, backing up the PostgreSQL cluster backs up all objects, versions, multipart parts, annotations, bucket policies, and IAM accounts together. Complete disaster recovery requires a physical PostgreSQL cluster backup, a continuous archived WAL stream, and separately preserved external secrets (especially static SSE-S3 KMS keys).
Preserve the complete recovery set
The PostgreSQL database stores all of the following in transactional consistency:
- Object byte segments, version metadata, and delete markers
- Active multipart upload state and uploaded parts
- Object annotations, annotation payloads, and the orphan cleanup queue
- Bucket configurations, quotas, Object Lock policies, S3 IAM users/policies/service accounts, and native PostgreSQL role bindings (
silo.native_auth_principals) - Schema migration ledger (
silo.meta) and control-plane revision tokens
Physical backups preserve database tables, role OIDs, and relation OIDs, but you must back up these external items independently:
- The exact
silobinary version and checksums matching the database schema version (schema_version = 14) - Gateway environment configuration (
/etc/default/silo), S3 root credentials (MINIO_ROOT_USER/MINIO_ROOT_PASSWORD), and every static SSE-S3 master key (MINIO_KMS_SECRET_KEY/MINIO_KMS_SECRET_KEY_FILE) ever used to encrypt retained objects - PostgreSQL and S3 TLS certificates, private keys, CA bundles, and webhook notification target credentials
Never store the only copy of your PostgreSQL backup repository or KMS keys inside the same pgsilo S3 service that depends on the database being backed up. Without the matching static SSE-S3 key or customer SSE-C key, restored encrypted rows in PostgreSQL cannot be decrypted.
Physical backup with pgBackRest
Configure an independent pgBackRest repository, WAL archiving, and retention policy on your PostgreSQL cluster, then verify and run a full physical backup on the database host:
Confirm that pgbackrest info reports a valid backup timestamp and continuous WAL archive range.
Rehearse physical restore and PITR
- Select the recovery target (timestamp, LSN, or transaction ID) and prepare an isolated PostgreSQL host so the restored cluster does not conflict with production.
- Restore the cluster and replay WAL to the target point using
pgBackRest. Deploy thesilobinary version compatible with the restoredschema_version(14). - Install matching external configuration and secrets: restore
/etc/default/silo, staticMINIO_KMS_SECRET_KEYvalues, and TLS certificates. Start gateways pointing only at the restored database. - Verify data and authorization:
- Check plaintext and SSE-S3 object SHA-256 digests, version histories, and delete markers.
- Verify multipart uploads, object annotations, and ZIP extraction.
- Test both allowed and denied requests for S3 IAM users and
silo_apiSQL roles, plus bucket quotas and Object Lock retention. - Review any IAM credential revocations or policy changes that occurred after the PITR target timestamp, since point-in-time recovery restores the IAM state as of that earlier timestamp.
- Check health and maintenance leases (
/minio/health/cluster/read,/minio/health/cluster, andminio_pg_lifecycle_leader) before opening client traffic.
Application rows and silo_api object writes committed in the same SQL transaction recover atomically to the same point in time. Note that PostgreSQL PITR cannot recall webhook notifications already delivered to external endpoints before the rollback point.
Why logical pg_dump is not a drop-in migration
pg_dump exports SQL tables and definitions, but pgsilo records PostgreSQL internal role OIDs and relation OIDs (regclass / oid) inside silo.bucket_acl and silo.native_auth_principals. Restoring a logical dump into a new PostgreSQL cluster assigns different OIDs to roles and ACL tables, breaking native authorization and SQL bucket ACL lookups.
Current pgsilo builds do not include an automated cross-cluster OID remapping utility. Always use physical cluster backup and restore (pgBackRest / pg_basebackup + WAL replay) for full disaster recovery, and never manually edit private OID columns in silo.* tables.
6.4 - Upgrade
Upgrading pgsilo across schema versions requires a planned maintenance window. Because a database schema migration does not automatically stop running gateway binaries, never run mixed gateway schema versions concurrently against the same PostgreSQL database.
Coordinated upgrade sequence
- Record current versions and take a physical backup: record the running
silobinary checksums andschema_version, take a verified physical backup (Backup and restore), and confirm external SSE-S3 KMS keys are backed up. - Stop all gateways and SQL writers: drain client traffic, stop every writable and read-only
silogateway, disable automatic systemd/supervisor restarts, and pause directsilo_apiSQL writer jobs. Verify inpg_stat_activitythat all gateway sessions have exited. - Install the new binary on all gateway hosts and verify SHA-256 checksums.
- Migrate the database from a single writable gateway: start one writable gateway connected to the PostgreSQL primary. On startup, it applies pending migrations inside a transaction as
silo_owner. Never attempt schema migration from a read-only gateway. - Verify schema 14 and health endpoints: confirm the first gateway passes
/minio/health/cluster/readand/minio/health/cluster, and verify the migration ledger insilo.meta. - Start remaining gateways: start the other writable gateways, wait for physical standbys to replay the schema migration WAL, and then start read-only standby gateways.
- Run post-upgrade verification before reopening client traffic: test plaintext and encrypted reads, versions, multipart completion, annotations, ZIP extraction, IAM allow/deny rules, and maintenance lease acquisition (
minio_pg_lifecycle_leader).
As silo_owner or a database administrator, inspect the migration ledger with:
In the current build, schema_version must be 14, and entries migration:0001 through migration:0014 must match the SHA-256 migration hashes embedded in the silo binary. Never grant application roles access to silo.meta or manually edit migration rows.
Summary of historical schema versions
| Schema version | Key changes | Compatibility boundary |
|---|---|---|
| Schema 12 | Added checksum metadata compatibility verification (CRC64NVME, SHA512, XXHASH*) | Schema 11 binaries cannot interpret new checksum type bits and are rejected after schema 12 commits |
| Schema 13 | Added object annotations, transactional quota counters, copy_object annotation support, and deferred annotation payload cleanup | Schema 12 binaries are rejected after schema 13 commits |
| Schema 14 | Added persistent random UUID revision_token to the control-plane revision table so gateways detect split-brain IAM state after failover | Schema 13 binaries are rejected after schema 14 commits |
When upgrading across builds that corrected region lookup precedence (MINIO_REGION > MINIO_REGION_NAME > MINIO_SITE_REGION > persisted site region), also verify that no gateway environment file carries an unintended legacy MINIO_REGION_NAME override. See Configuration: Region selection.
Rollback rules
Once a schema migration transaction commits in PostgreSQL, older gateway binaries refuse to start against that database. If a migration fails or you must roll back to an earlier schema version:
- First check
silo.metain PostgreSQL to see whether the migration transaction actually committed (a lost network connection does not prove rollback). - Never decrement
schema_version, altermigration:*hashes, or drop columns manually to force an older binary to start. - To revert to an older schema version, perform a full physical restore from your pre-upgrade backup and WAL archive.
6.5 - Monitoring
Monitor pgsilo gateways, PostgreSQL, and your backup repository as distinct layers. Health check endpoints control load-balancer routing, /minio/metrics/v3/pg exposes gateway-to-PostgreSQL Prometheus metrics, and PostgreSQL system views track physical storage and transaction age.
Health check endpoints
The /minio/health/* and /minio/metrics/* HTTP paths are retained for compatibility with standard S3 load-balancer and Prometheus configurations.
| Endpoint | What it checks | Load-balancer use |
|---|---|---|
/minio/health/live | Gateway process liveness and local request queue | Process liveness check |
/minio/health/ready | Gateway startup initialization and local request queue | General readiness (does not verify PostgreSQL writability) |
/minio/health/cluster/read | PostgreSQL database readability | Read-only gateway pool routing |
/minio/health/cluster | PostgreSQL database writability (pg_is_in_recovery() = false and SILO_PG_READ_ONLY=off) | Read-write gateway pool routing |
A healthy writable gateway returns HTTP 200 on both endpoints. A healthy read-only standby gateway (SILO_PG_READ_ONLY=on) returns 200 on /minio/health/cluster/read and 503 on /minio/health/cluster. Note that /minio/health/live can still return 200 when PostgreSQL is unreachable.
Prometheus metrics (/minio/metrics/v3/pg)
The PostgreSQL backend exposes Prometheus metrics at /minio/metrics/v3/pg with metric names prefixed by minio_pg_. Generate a Prometheus scrape configuration with mcli using your administrative alias (pg-admin):
Set metrics_path in the generated job to /minio/metrics/v3/pg and configure your Prometheus server to trust the gateway’s TLS CA. Keep the generated file out of version control because it contains bearer tokens.
| Area | Metric names | Interpretation |
|---|---|---|
| Pool utilization | minio_pg_pool_acquired_connections, minio_pg_pool_max_connections | Labeled by pool (data, control, coord); track saturation per gateway |
| Admission & pool waits | minio_pg_data_permits_waiters, minio_pg_pool_canceled_acquires_total | Rising waiters indicate concurrent S3 requests hitting the gateway slot ceiling |
| Statistics freshness | minio_pg_statistics_success, minio_pg_statistics_age_seconds | Verify statistics_success == 1 before trusting gauge values |
| Database role state | minio_pg_in_recovery, minio_pg_writable | Reports whether the target PostgreSQL instance is in recovery or writable |
| Annotation reaper | minio_pg_annotation_garbage_payloads, minio_pg_annotation_garbage_bytes | Unlinked annotation payloads queued for background batch deletion |
| Lifecycle maintenance | minio_pg_lifecycle_leader, minio_pg_lifecycle_errors_total | Exactly one writable primary gateway should report lifecycle_leader == 1 |
| Physical DB & WAL size | minio_pg_database_bytes, minio_pg_cluster_wal_bytes_total | Total PostgreSQL database bytes and cluster-wide WAL bytes |
| Standby replay backlog | minio_pg_replay_pending_bytes | Unreplayed WAL bytes on a physical standby (omitted when unavailable) |
| Capacity declaration | minio_pg_capacity_known | Always 0 in PostgreSQL mode because PostgreSQL does not report an exclusive S3 disk volume size |
Logical quota vs. physical PostgreSQL storage
- Billable logical bytes (
billableBytes): counts plaintext object bodies (size/objectsTotalSize) plus attached annotation bytes (annotationBytes) across all committed versions (excluding delete markers). Incomplete multipart uploads do not count toward logical quota untilCompleteMultipartUpload, even though their uploaded parts already occupy physical table space. - Console
Unknowncapacity: becauseminio_pg_capacity_knownis0, the web Console displays Unknown for total/free drive capacity.Unknowndoes not mean0 Bfree. - Physical database size:
minio_pg_database_bytes(andpg_database_size()) includes co-located application tables, B-tree indexes, TOAST tables, and dead MVCC tuples awaitingVACUUM. Deleting objects or unlinking annotations releases logical quota immediately, while physical disk pages become reusable only after background cleanup and PostgreSQLVACUUM.
PostgreSQL inspection queries
Run these read-only queries with a PostgreSQL monitoring role to inspect connection states, long-running transactions (which hold back VACUUM), and total database size:
6.6 - Troubleshooting
When diagnosing failed S3 or SQL requests, record the timestamp, gateway host, binary commit, HTTP status and S3 error code (or SQLSTATE), request ID, bucket, key, and versionId. Strip Authorization headers, presigned URL query strings, passwords, DSNs, and KMS/SSE-C keys before sharing logs.
First checks
Inspect the gateway service status and recent journal logs on Linux:
Then check the database-aware health endpoints (/minio/health/cluster/read and /minio/health/cluster) and verify PostgreSQL recovery and read-only state directly using a protected libpq service entry (~/.pg_service.conf with sslmode=verify-full):
Symptoms, root causes, and actions
| Symptom | Check first | Resolution |
|---|---|---|
| TLS certificate or hostname verification failure | SILO_PG_DSN hostname, certificate SANs, /etc/silo/postgres-ca.crt, and file ownership (root:silo) | Fix certificate SANs or file permissions; keep sslmode=verify-full enabled |
| Gateway refuses to start due to storage setting mismatch | Persisted SILO_PG_SEGMENT_SIZE and SILO_PG_MAX_OBJECT_SIZE in silo.meta | Match the gateway’s environment variables to the initialized store settings; never edit silo.meta manually |
| Read-only standby gateway refuses to start | schema_version on the standby and replication replay lag | Migrate the primary from a writable gateway first and wait for the standby to replay the migration WAL |
HTTP 503 SlowDown (or HTTP 429 TooManyRequests on builds before 1d387725c) under concurrency | Concurrent request limit (min(SILO_PG_MAX_CONNS, memlimit / (2 * segment_size))) and SILO_PG_QUEUE_TIMEOUT | Increase SILO_PG_MAX_CONNS (e.g., to 72 for 64 concurrent clients), ensure gateway RAM and PostgreSQL max_connections are sufficient, and use 1d387725c or later so bursts queue up to SILO_PG_QUEUE_TIMEOUT (5s) |
/minio/health/live is 200, but /minio/health/cluster returns 503 | PostgreSQL connectivity, pg_is_in_recovery(), connection pool exhaustion, or SILO_PG_READ_ONLY=on | Inspect PostgreSQL logs, pg_stat_activity, and minio_pg_* metrics |
S3 AccessDenied | IAM policy Allow/Deny, service-account/STS session policy, SILO_PG_READ_ONLY=on, and iam_and_pg role bindings | Verify IAM permissions on the target key/version and check silo.native_auth_principals and silo_bucket grants if iam_and_pg is enabled |
SQL SQLSTATE 42501 | session_user (whether SET ROLE was used), USAGE on silo_api/silo_bucket, function EXECUTE, and bucket ACL table grants | Connect directly as the application SQL login (app_sql) and grant the required function and bucket ACL privileges |
SQL SQLSTATE 0A000 | Transaction isolation level (Repeatable Read / Serializable), SSE-encrypted object, or unsynchronized bucket policy | Run SQL writes under Read Committed; use the S3 API to read/write encrypted objects |
CompleteMultipartUpload fails | Total assembled size vs. SILO_PG_MAX_OBJECT_SIZE, part sizes (>= 5 MiB except last part), part order, and ETags | Ensure the combined object does not exceed SILO_PG_MAX_OBJECT_SIZE (default 256 MiB, max 1 GiB) |
| IAM requests fail across gateways after failover | Old-primary fencing, revision_token reload, standby replication heartbeats, and host clock skew (<= 500 ms) | Ensure a writable gateway is connected to the promoted primary, writing heartbeats, and NTP keeps primary/standby clocks within 500 ms |
Database disk size stays high after DELETE | Retained historical versions, incomplete multipart uploads, minio_pg_annotation_garbage_bytes, long SQL transactions, and VACUUM | Delete old versions or abort incomplete uploads, verify minio_pg_lifecycle_leader == 1, and check pg_stat_activity for long-running snapshots blocking VACUUM |
HTTP 503 SlowDown vs. HTTP 429 TooManyRequests
Each gateway limits active S3 requests to min(SILO_PG_MAX_CONNS, memlimit / (2 * SILO_PG_SEGMENT_SIZE), api requests_max). With the default SILO_PG_MAX_CONNS=32, bursts above 32 concurrent requests hit admission control:
- Starting with
1d387725confeat/pg-backend(2026-11-08), excess requests wait in an admission queue for up toSILO_PG_QUEUE_TIMEOUT(5sby default) without holding a database connection. If the wait expires, the gateway returns HTTP 503SlowDown, whichboto3and AWS SDK for Go v2 automatically retry with backoff. - In earlier builds, including
299378band the frozen October 8, 2026 local checkpoint (3c7fdc03), admission queueing does not exist: excess requests immediately receive HTTP 429TooManyRequests, which standard S3 SDKs do not retry by default.
See Configuration: Concurrent request limit for capacity sizing steps.
Uncertain writes after network timeouts
A network drop or request timeout can occur after PostgreSQL commits the transaction but before the client receives the HTTP or SQL response. Blindly retrying an unconditional PutObject in a versioned bucket creates a duplicate version.
- Before retrying a timed-out write, check whether the expected key,
versionId, ETag, or business operation ID already exists. - When writing application rows and objects together in one SQL transaction via
silo_api, record an application idempotency key in your business table inside the same transaction so you can query its commit status deterministically.
6.7 - Deploy with Pigsty
The minio_backend: postgres branch in the Pigsty minio Ansible role is pinned to an unpublished coordination commit (5633285b2b8d40321e458026abe2656944674ed3) and depends on the unpublished silo DEB/RPM packages (MVP in progress). Released versions of Pigsty do not yet include this backend branch.
The coordinated Pigsty minio role adds a minio_backend: postgres execution path to minio.yml. It deploys silo systemd services connected to an existing PostgreSQL database without inheriting erasure-coded disk arguments or local volume mounts.
Scope and prerequisites
- The role deploys stateless
silogateways only; it does not create the PostgreSQL cluster, database owner (silo_owner), orsilodatabase, and it does not configure database backups. Complete the database setup in Install first. minio_pg_dsnmust be a single-hostpostgresql://URI with an explicit username, database name,sslmode=verify-full, andsslrootcertmatchingminio_pg_ca_file(located under/etc/silo/). The role rejects multi-host fallback URIs and query parameters that override connection identity.- Certificates used by the gateway must include
127.0.0.1in their IP SANs because the role’s post-start health check probeshttps://127.0.0.1:9000/minio/health/cluster(for writable gateways) or/minio/health/cluster/read(for read-only gateways) with strict TLS verification.
Example two-gateway inventory
Store credentials (vault_silo_root_user, vault_silo_root_password, and URL-encoded vault_silo_pg_dsn) in an encrypted Ansible Vault file (vault.yml), and define the two-gateway silo_pg group in inventory.yml:
Setting minio_buckets: [] and minio_users: [] skips Pigsty’s default pgbackrest backup bucket/user creation so database backups are never stored inside the pgsilo service that depends on that same database.
Deploy the first writable gateway alone (-l 10.10.10.11 -e minio_provision=false) so it initializes the PostgreSQL schema without racing a second node, then run the playbook across the group:
What the role configures
| Component | Behavior in minio_backend: postgres |
|---|---|
| Package & binary verification | Copies the local .deb/.rpm from minio_pg_package_src, verifies minio_pg_package_sha256, installs it, and verifies /usr/bin/silo against minio_pg_binary_sha256 |
| OS account | Runs the service as minio:minio (minio_user defaults to minio, whereas manual DEB installation uses silo:silo) |
| Service & environment | Writes /etc/systemd/system/silo.service and /etc/default/silo (root:minio, mode 0640) with no_log secret protection |
| TLS certificates | Places public.crt and private.key in /home/<minio_user>/.minio/certs/ and the PostgreSQL CA at /etc/silo/postgres-ca.crt |
| Read-only gateways | Setting minio_pg_read_only: true on a standby gateway host configures SILO_PG_READ_ONLY=on, skips bucket/user provisioning, and probes /minio/health/cluster/read |
| Monitoring | Defaults MINIO_PROMETHEUS_AUTH_TYPE=public in the environment template and provides the files/grafana/minio/silo-pg.json dashboard; restrict metrics network access or override to jwt authentication |
Note that re-running minio.yml across nodes does not replace the stop-all-writers procedure required for a schema migration; follow Upgrade whenever schema_version changes.
7 - pgs3: in-process S3
pgs3 is an alternative S3 implementation for PostgreSQL written in Rust with pgrx (0.19.2) under the Apache-2.0 licence. Instead of running an external Go gateway in front of PostgreSQL as pgsilo does, pgs3 loads into PostgreSQL via shared_preload_libraries and serves path-style S3 HTTP requests directly from PostgreSQL background workers.
pgs3 is an early alpha (v0.1.1, commit d841238, 2026-09-03). Its functional and Ceph compatibility suites pass, but small-object latency/throughput and the 100,000-object bucket Fork target do not meet its release gates. Mimus documents pgsilo as the primary S3 path and summarizes pgs3 here for comparison.
How pgs3 works
pgs3 splits protocol framing from storage semantics across two layers inside the PostgreSQL server process:
- PostgreSQL background workers (Rust) own the HTTP listener (
pgs3.listen_addr,pgs3.port,pgs3.workers), verify SigV4 headers and presigned URLs, parseaws-chunkedstreaming payloads, and invoke SQL functions over SPI in short transactions. - SQL semantic layer defines buckets, permanently versioned objects, delete markers, multipart uploads, content-addressed canonical blobs (
pgs3.blob) and chunk extents (blob_extent).
Because identical payloads reference the same canonical blob rows, CopyObject, historical version Restore, and metadata-only bucket Fork share physical bytes through reference counts rather than copying payload bytes. Access keys map to unprivileged PostgreSQL roles, and PostgreSQL row-level security (RLS) enforces tenant isolation inside the database.
pgs3 vs pgsilo
The pgsilo PRD evaluated the in-process background-worker and deduplicating-blob model before choosing an external stateless Silo gateway (ObjectLayer). The two designs make opposite trade-offs:
| Dimension | pgsilo (Silo PostgreSQL backend) | pgs3 (Rust/pgrx extension) |
|---|---|---|
| Status | MVP in progress (feat/pg-backend @ 1d387725c, schema 14) | Research / early alpha (v0.1.1, d841238) |
| Licence | AGPL-3.0-or-later | Apache-2.0 |
| Process model | External stateless Go gateway (silo server) connecting over pgx pools | In-process PostgreSQL background workers (shared_preload_libraries = 'pgs3') |
| PostgreSQL versions | Stock PostgreSQL 16–18 (no extension binary required on the DB host) | PostgreSQL 17 and 18 (16 best-effort); requires installing the pgs3 C/Rust extension |
| Addressing and TLS | Path-style and virtual-host style; native TLS termination | Path-style only; cleartext HTTP only (requires an external TLS reverse proxy) |
| Authentication and authorization | S3 IAM users, groups, policies, service accounts, Basic AssumeRole STS, plus optional IAM AND PostgreSQL native authorization | SigV4 access keys mapped to PostgreSQL roles; PostgreSQL GRANT and default-deny RLS (no IAM policy language or STS) |
| Object storage model | Dedicated per-version bytea segments (8 MiB default); no cross-object deduplication | Content-addressed canonical blobs (pgs3.blob) and chunk extents with reference-counted deduplication |
| Encryption, Lifecycle, Object Lock, Quota | SSE-C and static-key SSE-S3; Preview lifecycle, Object Lock and hard bucket quotas | Not implemented |
| Protocol extensions | Object annotations (?annotation), ZIP member extraction (x-minio-extract), force bucket delete, silo_api SQL functions | SQL historical version Restore and metadata-only bucket Fork |
| Failure and resource isolation | Gateway CPU/memory is isolated from the PostgreSQL server; gateway limits concurrency to 32 connections by default | Background workers share CPU, memory, I/O and connection slots with the PostgreSQL instance |
Current status and validation (v0.1.1)
At v0.1.1 (validated 2026-08-31 on an 18-core Apple M5 Max Docker Desktop arm64 environment with PostgreSQL 17.10 and 18, fsync=on, synchronous_commit=on, 16 workers and 4 MiB default chunk size):
- Passing gates:
- PostgreSQL 17 and 18 SQL semantics, package runtime and
0.1.0 -> 0.1.1extension upgrade. - Client matrix on PostgreSQL 17 and 18: AWS CLI (
s3ands3api),boto3,rclone, DuckDBhttpfs, and a privilegeds3fsFUSE mount (including a 100 MiB, 13-part multipart upload). - Selected Ceph
s3-testscompatibility suite: 195/195 pass (from 209 candidate cases with 14 documented exclusions). - Crash recovery (
SIGKILL), pending blob garbage collection, liveSIGHUPreload, hot-standbyGET/LISTwith write rejection, and deterministic malformed-request fuzz suites. - 8 MiB staged
PUTthroughput (167.894 MiB/s, p50 47.40 ms, target ≥ 150 MiB/s) and 100k-objectLIST/ delimiterLIST(2.358 ms / 9.487 ms, targets < 5 ms / < 10 ms).
- PostgreSQL 17 and 18 SQL semantics, package runtime and
- Failing performance gates:
- Small-object
GET(Gate 12): p50 up to 3.342 ms (target < 0.5 ms) and minimum rate 3,989.933 ops/s at 16 KiB (target ≥ 30,000 ops/s). Content-addressed deduplication requires an extra indexed lookup intopgs3.blobon every small read. - Small-object
PUT(Gate 13): minimum rate 1,555.986 ops/s at 4 KiB (target ≥ 5,000 ops/s). - 100,000-object bucket
Fork(Gate 16): 1,944.071 ms on the authoritative golden image (target < 1,000 ms), emitting 154,178,689 bytes of WAL to update reference counts.
- Small-object
Deliberate exclusions and limitations
- No built-in TLS or virtual-host addressing:
pgs3listens on cleartext HTTP and serves one configured database (pgs3.target_database). Production deployments must terminate TLS in an external reverse proxy (nginx,HAProxy) that preserves the signed path and headers. - No IAM policy language, ACLs, lifecycle or encryption: access control relies entirely on PostgreSQL roles, grants and RLS. Because SigV4 verification requires the secret key, secrets are stored reversibly in the database catalog; backups must be treated as credential-bearing material.
- Whole-object
GETbuffering: full-objectGETcurrently materializes the response through a single SQLbyteaand RustVecbefore writing to the socket. Until response streaming is added, deployments must cap object sizes well below the 5 GiB HTTP parser ceiling. - Composite checksums: SHA-256
COMPOSITEmultipart checksums are verified and stored; non-SHA multipart selections (such as CRC32) verify per-part checksums but do not validate or persist a final composite checksum.
Source code, build instructions and design records (D001–D027) are available at github.com/pgsty/pgs3.
8 - Status
Protocol status- MVP in progress
Target release form- Experimental PostgreSQL storage backend merged into Silo and shipped with standard Silo releases (
linux/amd64andlinux/arm64, DEB and RPM); no standalonepgsiloexecutable Current candidate- Silo branch
feat/pg-backendat1d387725c86e8f81fe86a70c30cf25ce5048b189(2026-11-08, schema 14):299378bplus two fixes,ca158fb6and1d387725c. Companionsilo-pkgatcc22fd9 Public release- None. The candidate has not been pushed, merged into Silo
main, tagged or published. The October 2026 local preview (3c7fdc03) remains an internal ARM64 preview
MVP goal and release form
Since 2026-11-08, the goal for pgsilo is an MVP release candidate that merges into Silo main as an experimental storage backend. Users start PostgreSQL mode by passing a postgres:// or postgresql:// DSN or setting SILO_PG_DSN on the standard silo binary. The full goal is recorded in MVP goal; the Supported, Preview and Not supported tiers are in Compatibility.
The merge into Silo main has three prerequisites:
- The current Silo release completes.
feat/pg-backendis then synced to that release tag, upstream changes to shared files and newObjectOptionssemantics are implemented or explicitly rejected in PostgreSQL mode, and the release checklist runs again. - The four annotation policy actions are public. The server uses
GetObjectAnnotationAction,ListObjectAnnotationsAction,PutObjectAnnotationActionandDeleteObjectAnnotationAction, which exist only in an unpublishedsilo-pkgbranch (cc22fd9). They must be published to the publicsilo-pkg, coordinated with the Server and Console releases, or handled another way. Without them the server does not compile against its publicgo.mod(checked on 2026-11-08). - The user decides the merge. Pushing, merging, publishing packages or images, and deploying each need separate approval.
Release checklist
Verification is proportional to an MVP: each item is a functional or smoke test that completes in minutes, and the whole checklist completes in one to two hours. Long-running stability or endurance runs, full instrumentation matrices, repeated benchmark rounds and root-cause campaigns for rare intermittent failures are not part of the MVP and are not gates after it.
| # | Item |
|---|---|
| 1 | internal/pgstore tests on PostgreSQL 18 and on PostgreSQL 16 |
| 2 | Regular Silo unit tests (go test, no race detector), to show that erasure-coded mode did not regress |
| 3 | mint core once over HTTPS (covers SSE-C) |
| 4 | Ceph s3-tests, 195 pinned cases |
| 5 | Client smoke: mcli, AWS CLI v2, boto3, AWS SDK for Go v2 |
| 6 | Reduced performance smoke that takes minutes; numbers are recorded, not gated |
| 7 | General Silo Console 2.6.0 smoke against PostgreSQL mode |
| 8 | Runtime smoke on linux/amd64 |
Item 2 needs free disk space: when the temporary directory’s disk is nearly full, erasure-coded tests fail in bulk at Silo’s minimum free-space threshold.
Baseline on 299378b (2026-11-08)
On 2026-11-08, an earlier, fuller form of the checklist ran once against feat/pg-backend at 299378b562395989eb666d048b4f6138be7deb25 (schema 14, Go 1.27.3) with PostgreSQL 18.6 and 16.15 containers (fsync=on, synchronous_commit=on). It used race-enabled unit tests, mint core and full over HTTP and HTTPS, and a performance smoke. These are one-off results; they do not apply to newer commits.
| # | Item | Result | Detail (299378b, 2026-11-08) |
|---|---|---|---|
| 1 | internal/pgstore on PG 18 and PG 16 | Pass | 185 top-level / 326 tests pass on both (-race, 0 skip) |
| 2 | cmd and erasure-coded regression | Fail (1 test) | Linux container, -race: 1,515 top-level tests, 1,499 pass, 8 skip, 8 fail. Seven failures were file-permission tests that fail as root and pass when rerun as a non-root user. The remaining failure, TestPGIAMPolicyReadersKeepCompleteSnapshot, was fixed in ca158fb6 (see Fixes). internal/... without pgstore: 511 top-level pass, 4 skip |
| 3 | mint over HTTP and HTTPS | Pass | Core: HTTP 614 pass / 6 NA, HTTPS 644 pass / 6 NA. Full: HTTP 872 pass / 8 NA, HTTPS 947 pass / 7 NA, 0 fail. NA cases are replication, SSE-KMS, and SSE-C over HTTP. One transient container-to-host dial timeout in HTTP minio-go passed 185/185 on rerun |
| 4 | Ceph s3-tests (195) | Pass | 195/195 in 191.6 s (ceph/s3-tests@5522d1c) |
| 5 | Client smoke | Pass | mcli, AWS CLI v2 2.37.9, boto3 1.43.108 and Go SDK: CRUD, 64 MiB multipart, cross-segment Range, 256 MiB read-back, EntityTooLarge at 256 MiB + 1 B |
| 6 | Performance smoke | Recorded | See Performance smoke |
| 7 | Silo Console 2.6.0 | Pass | API and browser: sign-in, bucket creation and listing, 3 MiB upload, download with matching SHA-256, delete |
| 8 | linux/amd64 | Pass (emulated) | All four client suites and the 256 MiB check under x86_64 emulation; not tested on native amd64 hardware |
The mint image was rebuilt from the pinned source and locks with the same 11 fixture revisions used in October 2026, so mint results are not from an unmodified upstream image.
Fixes after the baseline (2026-11-08)
Both fixes are local commits on feat/pg-backend; neither has been pushed.
| Commit | Change |
|---|---|
ca158fb6 | Test only. TestPGIAMPolicyReadersKeepCompleteSnapshot now asserts that cache misses and mutations never merge single stored records, and that a listing or a revision-driven refresh installs the complete snapshot, so added and deleted records appear and disappear together. See Status review and baseline |
1d387725c | When the request budget is full, PostgreSQL mode waits up to SILO_PG_QUEUE_TIMEOUT (5 s by default, 0 s–1 min, 0s disables waiting) without holding a database connection. A disconnecting client stops waiting at once (499). When the wait expires, the gateway answers HTTP 503 SlowDown. Erasure-coded mode still answers HTTP 429 at once |
Verification on 1d387725c (2026-11-08):
cmdIAM-related tests and the new queue tests (no race): 161 top-level pass, 5 skip, 0 fail; the queue test also passed once with-race.internal/pgstore: 185 top-level / 326 pass.- Ceph
s3-tests: 195/195.mintcore over HTTPS: 644 pass, 6 NA, 0 fail. - 64 concurrent clients with the default pool (
SILO_PG_MAX_CONNS=32) and default AWS SDK for Go v2 retries, 90 s per phase:
| Phase | Succeeded | Failed | HTTP 429 / 503 seen | p50 / p95 / p99 / max |
|---|---|---|---|---|
| PUT 4 KiB | 26,625 (295 ops/s) | 0 | 0 / 0 | 210 / 326 / 466 / 1,110 ms |
| GET 4 KiB | 33,288 (369 ops/s) | 0 | 0 / 0 | 162 / 247 / 362 / 591 ms |
With SILO_PG_QUEUE_TIMEOUT=0s for comparison (20 s per phase), the gateway returned 596 (PUT) and 646 (GET) HTTP 503 responses. The SDK retried them; most succeeded, but 160 PUT and 188 GET requests still failed after three attempts. Retries alone do not cover a sustained 64-to-32 overload; the queue does.
Performance smoke on 299378b (2026-11-08)
The 2026-11-08 smoke ran a darwin/arm64 gateway (299378b) on an 18-core Apple Silicon macOS host against PostgreSQL 18.6 in a Docker Desktop VM over port forwarding, using aws-sdk-go-v2 on the same host with default checksums and no retries. These numbers cannot be compared with the October 2026 Lima VM benchmark in the history below.
| Workload | Default pool (SILO_PG_MAX_CONNS=32) | Expanded pool (SILO_PG_MAX_CONNS=72) |
|---|---|---|
| 1 KiB PUT / GET p50 | 7.92 ms / 5.77 ms | 6.08 ms / 5.68 ms |
| 1 MiB PUT / GET p50 | 21.9 ms / 12.6 ms | 21.0 ms / 10.9 ms |
| 64 MiB PUT / GET median | 95.8 MB/s / 234.6 MB/s | 82.9 MB/s / 155.1 MB/s |
| 64-worker 4 KiB PUT (single bucket / spread) | Requests above 32 got HTTP 429 TooManyRequests at once (fixed in 1d387725c) | 350.6 ops/s / 469.1 ops/s (0 errors) |
ListObjectsV2 (1,000 keys) p50 | 10.4 ms | 14.1 ms |
Known issues
As of 1d387725c (2026-11-08):
| Issue | Impact and status |
|---|---|
| Brief HTTP 503 after IAM modifications | When one gateway updates IAM state, requests can briefly return HTTP 503 while caches refresh. Clients should retry HTTP 503. Deferred beyond the MVP. |
Console 2.6.0 /api/v1/admin/site-replication returns HTTP 500 | PostgreSQL mode does not implement site replication and returns NotImplemented. Other Console pages work. |
| Lifecycle worker log noise under load | At peak load, the lifecycle worker logs a one-time lease query timeout or "lifecycle policy changed". Lease takeover and epoch progression continue normally. |
Version string reports DEVELOPMENT.GOGET | Development builds do not inject a version; the Silo release pipeline will. |
Unpublished silo-pkg annotation actions | Merge prerequisite 2 above. Building from source needs silo-pkg at cc22fd9 until the actions are public. |
amd64 tested only under emulation | The 2026-11-08 amd64 smoke ran under x86_64 emulation, not on native hardware. |
Deferred beyond the MVP
- Automatic high availability: define the scope and the validation when it is needed.
- The brief HTTP 503 window during cross-gateway IAM refresh, and Python client throughput.
- Merging the annotation interface into the general Silo Console and promoting Preview features to Supported.
- Objects above 1 GiB, higher throughput, and multi-architecture container images.
Historical local delivery (2026-10-08)
Before the MVP plan was adopted on 2026-11-08, an internal schema 14 preview was frozen locally on 2026-10-08 (recorded at 2026-10-07T22:16:50Z). That build is ARM64-only and will never be pushed, merged, tagged, published or deployed.
| Component | Commit / artifact (2026-10-08 frozen preview) |
|---|---|
| Silo server | 3c7fdc03a27740526e9e6d8b1987a3ed00691948 (schema 14, built with Go 1.27.1) |
| Embedded Console | 3c4469d47a62526e008e25b8d415f2912f76a919 (custom build with annotation UI) |
silo-pkg | 58686c71b9bc70d77ec945488548c140c0f776b0 |
| Pigsty integration | 5633285b2b8d40321e458026abe2656944674ed3 (unpublished local branch) |
| Local ARM64 artifacts | silo-linux-arm64, silo-darwin-arm64, silo_20261007153132.0.0-1PGSTY_arm64.deb, silo-postgresql-source.tar.gz |
What the October 2026 validation on 3c7fdc03 and its preceding schema 13/14 candidates (dca464e5, 7cfea651) established:
- Functional suites: Mint full HTTP (872 pass / 8 NA) and HTTPS (947 pass / 7 NA), Ceph
s3-tests(195/195), 18 configured feature checks, two 10,000-part multipart runs, 32 application integration checks, 28 Console checks (including SQL, usage and TLS), 5 multi-gateway checks, 7 PITR checks, 11 Basic AssumeRole STS checks (including 900-second natural expiration), and 10 Pigsty v7 checks. Core kernel tests passed on PostgreSQL 16.15, 17.11 and 18.6. - Mixed recovery preflight (
3c7fdc03): 1,208.363 active seconds, 24,186 mixed operations, 8 recovery scenarios passed, 418 verified objects, 0 request errors. - 3-round benchmark in a Lima Linux VM (
3c7fdc03): Silo and PostgreSQL 18 shared 4 vCPUs and 8,000,000,000 bytes of memory on a local SSD (fsync=on,synchronous_commit=on,SILO_PG_MAX_CONNS=72), with a separate 4-vCPU / 2 GiB client boundary. Using a 64-worker AWS Go SDK v2 client for the concurrent 4 KiB PUT cases and the pinned Python client for the remaining cases, all 3 rounds (27 rows, 204,024 measured requests, 123,482 mixed operations, 0 errors) passed:hot(single bucket, 64 workers, 4 KiB PUT): 806.963, 660.593, 736.328 ops/s across Rounds 1–3.spread(spread buckets, 64 workers, 4 KiB PUT): 1500.231, 1249.699, 1400.237 ops/s across Rounds 1–3.- Earlier 3-round runs on the same
3c7fdc03candidate that used the Python client for concurrent 4 KiB PUT failed 4 of 27 rows (hot528.203 / 498.072 / 485.675 ops/s andspread537.303 / 476.434 / 493.809 ops/s against the 500 ops/s target).
- 72-hour endurance run (
3c7fdc03) — Canceled, not passed: stopped at the user’s request after approximately 4.05 hours (14,562.377 active seconds, 287,912 operations, 0 request errors). Final post-run verification never executed, and the run is not recorded as a 72-hour pass.
9 - Design
This section documents the engineering rationale and internal architecture of pgsilo: why the project pairs the Silo S3 frontend with a PostgreSQL ObjectLayer backend, how S3 and SQL share a single transactional state machine, and how multi-gateway caches and background workers maintain consistency.
Design documents
| Document | Topic |
|---|---|
| Why a PostgreSQL backend | Target workloads, lessons from pgs3, when to choose PostgreSQL vs. erasure-coded storage, and capacity bounds |
| Design decisions | The ObjectLayer seam, 8 MiB bytea segments, commit_seq version ordering, lock hierarchy, and rejected alternatives |
| Integration with Silo | Auditing erasure-coded assumptions in Silo, .minio.sys persistence, S3 Select snapshots, and why iam_and_pg intersects IAM |
| SQL API design | Separating silo, silo_api, and silo_bucket, session_user security hardening, and per-bucket security_barrier ACL views |
| IAM control plane | Pool isolation, the 5-second freshness lease, standby heartbeats, and the schema 14 revision_token split-brain fix |
| Lifecycle and Object Lock | Database-enforced WORM retention, keyset lifecycle scanning, and epoch-fenced maintenance leases |
| MVP goal | 2026-11-08: ship as an experimental Silo backend; support tiers, release checklist, merge prerequisites |
| Status review and baseline, 2026-11-08 | Why testing did not close, the runtime baseline on 299378b, the IAM snapshot experiment and the request queue fix |
9.1 - Why a PostgreSQL backend
Many small-to-medium applications already run a managed or high-availability PostgreSQL cluster, yet still need an S3 endpoint for user attachments, avatars, PDF exports, or CI artifacts. Running a separate object storage cluster splits operational state across two systems: backups, point-in-time recovery (PITR), database clones, and access control must be coordinated twice and can drift apart.
pgsilo solves this by adding a PostgreSQL ObjectLayer backend to Silo (PGSTY’s fork of MinIO), storing all object data, versions, bucket configurations, multipart uploads, and IAM state inside a single PostgreSQL database.
Lessons from pgs3
Before building pgsilo, PGSTY built pgs3, an in-process PostgreSQL extension in Rust/pgrx that speaks S3 from a background worker. pgs3 (v0.1.1) passed 195 of 195 Ceph s3-tests cases and proved that S3 versioning, delete markers, conditional writes, and multipart semantics map cleanly onto PostgreSQL tables. However, it also exposed three structural trade-offs:
- Protocol surface maintenance: implementing SigV4 variants,
aws-chunkedstreaming, presigned URLs, POST policies, and modern SDK trailing checksums (CRC32C,CRC64NVME) from scratch inside a C/Rust extension is a major ongoing cost. Silo already implements the full HTTP and S3 wire layer. - Write-path deduplication overhead:
pgs3used content-addressed SHA-256 chunk deduplication and reference counting, which added index lookups and row-lock contention on small-object writes.pgsilodrops deduplication: each segment belongs to a single object version or active upload and is deleted by cascade. - Process isolation and managed PostgreSQL compatibility: a compiled extension cannot be installed on locked-down managed PostgreSQL services, and an HTTP parser bug in a background worker runs inside the database process tree.
pgsiloruns as a stateless external Go binary and installs only standard SQL tables and PL/pgSQL functions (PostgreSQL 16+).
The initial October 2026 PRD targeted PostgreSQL 18 as the baseline version, but the implemented schema 14 tables and PL/pgSQL functions avoid PostgreSQL 18-only DDL dependencies and run on PostgreSQL 16, 17, and 18.
Target scenarios vs. anti-patterns
| Priority | User / Scenario | Why pgsilo fits |
|---|---|---|
| P1 | Business apps (Odoo, ERP, CRM) | Invoices, attachments, and business rows are backed up and restored together to the exact same PITR timestamp |
| P1 | Self-hosted Supabase / app platforms | Points Supabase Storage’s S3 backend at the existing PostgreSQL cluster without provisioning dedicated object disks |
| P1 | Local development & CI pipelines | One PostgreSQL database backs both SQL tables and S3 buckets; DROP DATABASE resets the entire test environment |
| P2 | Private / on-premises appliance delivery | Ships S3 storage on customer infrastructure that only permits standard PostgreSQL instances |
| P2 | Transactional SQL + S3 workflows | Reads and writes objects inside Read Committed SQL transactions via silo_api and joins metadata with business tables |
When NOT to use pgsilo (use Silo erasure-coded mode instead):
- Backing up the hosting PostgreSQL cluster itself: never point a PostgreSQL cluster’s own
pgBackRestrepository at apgsiloinstance stored inside that same cluster—if the database fails, the backup is unreachable. - Large objects (
> 256 MiBdefault,> 1 GiBhard ceiling): video archives, LLM weights, and large Parquet lakes belong on erasure-coded disks. - High-throughput observability sinks: continuous high-bandwidth write streams (Loki, Tempo, Mimir, Thanos) or CDN origin workloads.
Silo PostgreSQL mode vs. Silo erasure-coded mode
Both modes ship in the same silo binary and share the same S3 HTTP frontend, SigV4 authentication, IAM engine, and Console:
| Dimension | Silo PostgreSQL mode (pgsilo) | Silo erasure-coded mode |
|---|---|---|
| Startup | SILO_PG_DSN="postgresql://..." silo server | silo server /data{1...4} |
| Recommended scale | <= 200 GB per database, <= 10M object versions, <= 256 MiB per object (max 1 GiB) | Terabytes to petabytes; up to 5 TiB per object |
| Where state lives | 100% in PostgreSQL tables (silo schema) | Local/distributed disks (xl.meta + erasure shards) |
| Unique strengths | Transactional SQL API (silo_api), unified pgBackRest PITR, stateless gateways | High streaming throughput, erasure coding, site replication, remote tiering |
| Rule of thumb | Choose when objects must share backup, PITR, or SQL transactions with relational data | Choose when object volume exceeds 200 GB or sustained write throughput exceeds 50 MB/s |
Capacity and sizing rationale
- Database object volume (
<= 200 GBrecommended): at typicalpgBackRestrestore speeds (200–500 MB/s), a 200 GB database restores in 7–17 minutes, keeping RTO predictable. - Object version count (
<= 10Mversions): at roughly0.6 KBof row and B-tree index metadata per version, 10 million versions occupy ~6 GB of catalog metadata, keepingListObjectsV2and lifecycle index scans fast. - Segment size (
8 MiBdefault,1–64 MiBconfigurable): PostgreSQL TOAST supports values up to 1 GB, but buffering a single largebytearequires 2–3x its size in gateway and backend memory. Splitting objects into 8 MiB rows bounds per-request memory to two segment buffers (16 MiB) regardless of total object size while matching the AWS CLI’s default 8 MiB multipart chunk size.
9.2 - Design decisions
This page summarizes the core architectural decisions behind pgsilo, including how initial design assumptions were refined during implementation and verification.
1. The ObjectLayer seam
Silo’s architecture separates HTTP request parsing, SigV4 authentication, and XML serialization (cmd/) from storage operations via the ObjectLayer interface (44 methods). Below ObjectLayer, the erasure-coded backend uses StorageAPI to read and write reed-solomon shards and binary xl.meta files across disks.
pgsilo implements ObjectLayer directly (internal/pgstore + cmd/object-api-pg*.go) rather than StorageAPI:
- Implementing
StorageAPIwould still run the erasure-coding engine and store opaquexl.metablobs in PostgreSQL, making object metadata unreadable from SQL. - At the
ObjectLayerlevel, 26 methods carry object, bucket, multipart, and system-file semantics, while the remaining 18 erasure-specific methods (disk healing, pool decommissioning, rebalancing, remote tiering) cleanly returnNotImplemented. - Server configuration, IAM users/policies, and bucket metadata (
.minio.sys/*) already read and write throughObjectLayer, so redirecting.minio.systo asilo.sys_filestable persists control-plane state in PostgreSQL automatically.
2. Data model and 8 MiB bytea segments
All buckets share a single set of tables in the private silo schema (silo.meta, silo.buckets, silo.objects, silo.object_segments, silo.uploads, silo.upload_parts, silo.sys_files, plus annotation and control tables):
| Design choice | Rationale |
|---|---|
Shared tables keyed by bucket_id | Creating or deleting a bucket performs ordinary row DML rather than CREATE TABLE ... PARTITION OF, which would acquire an ACCESS EXCLUSIVE lock on the parent table and block concurrent S3 traffic |
key COLLATE "C" | S3 lists keys in raw UTF-8 byte order; C collation lets prefix queries (key >= prefix AND key < upper_bound) use standard B-tree index range scans |
Separate metadata (silo.objects) and payload (silo.object_segments) tables | HEAD, ListObjectsV2, and tag updates never touch segment pages; silo.object_segments tunes autovacuum independently |
Fixed-size bytea segments (8 MiB default) with TOAST lz4 | Bounds per-request gateway memory to 2 * segment_size; PostgreSQL TOAST compresses compressible text/JSON with lz4 (falling back to pglz if built without lz4) and stores incompressible JPEG/PDF segments uncompressed without hurting byte-range slicing |
| No content-addressed deduplication | Every segment row belongs to one object version or one active upload (ON DELETE CASCADE), eliminating refcount hot spots |
3. Version ordering (commit_seq) and lock hierarchy
Early design drafts considered ordering object versions by their auto-increment id or mod_time. Implementation audits identified a flaw: streaming PUT transactions pre-allocate object_id before streaming segments, so two concurrent uploads to the same key can finish in the reverse order of their id allocation, and gateway wall clocks can skew.
To guarantee linearizable version ordering across S3 and SQL writers:
commit_seqordering:object_idis allocated when segment streaming begins, but the version publication order is defined by a dedicatedcommit_seqassigned after acquiring the per-key transaction advisory lock (silo.lock_key). Deleting the latest version promotes the remaining version with the highestcommit_seq.- Strict lock hierarchy: every mutation acquires locks in a fixed order to prevent deadlocks:
- Bucket row lock:
FOR SHAREfor object writes/uploads/deletes;FOR UPDATEfor bucket deletion or bucket configuration changes. - Upload row lock (multipart only):
FOR SHAREforUploadPart;FOR UPDATEforCompleteMultipartUploadandAbortMultipartUpload. - Part advisory lock (multipart
UploadPartonly): serializes concurrent uploads of the same(upload_id, part_no). - Per-key transaction advisory lock:
pg_advisory_xact_lock(1936288879, hashtext(bucket_id || '/' || key))held only during the final metadata publication and precondition check (If-Match/If-None-Match).
- Bucket row lock:
- Shared SQL state machine: S3 gateway writes and
silo_apiSQL functions call the same PL/pgSQL state-transition functions (silo.commit_version,silo.delete_version,silo.complete_upload), ensuring identical versioning, quota, and Object Lock behavior.
4. Read snapshots, CopyObject budgets, and empty-bucket deletion
- Snapshot-isolated reads: multi-segment
GETandSelectObjectContentopen aREPEATABLE READ READ ONLYtransaction before queryingsilo.objects. Even if another client overwrites or deletes the object while segments are streaming, the reader sees a consistent object body until completion or timeout. - Deadlock-free
CopyObjectconnection budget: a server-side copy reads from a source snapshot while writing to a destination transaction. To prevent 16 concurrentCopyObjectcalls from acquiring 16 source connections and deadlocking while waiting for destination connections, the data pool uses a FIFO weighted semaphore that atomically reserves two data connections before opening the source snapshot (which is whydata_connsmust be at least2). - Connection liveness on checkout:
pgxpoolby default only pings connections idle for more than 1 second, which allowed a sub-second PostgreSQL restart to leave stale connections that failed the first S3GETwith HTTP 500.pgsiloenables connection health checks on checkout bounded bySILO_PG_ACQUIRE_TIMEOUT. - Empty-bucket
DeleteBucketwith unfinished multipart uploads: verified against both AWS S3 general-purpose bucket semantics and Silo’s erasure-coded implementation,DeleteBucketacquiresFOR UPDATEon the bucket row, rejects deletion with HTTP 409 if any published object version or delete marker exists, and otherwise cascades deletion of any unfinished multipart uploads and parts in the same transaction.
5. Rejected alternatives
| Alternative | Why it was rejected |
|---|---|
Hooking PostgreSQL at StorageAPI (disk layer) | Still runs erasure coding and stores binary xl.meta blobs, preventing SQL queries and adding unnecessary CPU overhead |
Single unsegmented bytea column per object | Requires buffering the entire object (up to 256 MiB–1 GiB) in both gateway and PostgreSQL backend memory; forces CompleteMultipartUpload to copy and concatenate all parts |
PostgreSQL Large Objects (pg_largeobject) | Stored in a cluster-wide system catalog (pg_largeobject), unfriendly to per-bucket permissions, requires vacuumlo for orphan cleanup, and complicates logical dumps |
| Storing large object bodies on local filesystem | Breaks unified pgBackRest backup, PITR, and stateless gateway failover |
| One PostgreSQL table or partition per bucket | CREATE TABLE ... PARTITION OF requires an ACCESS EXCLUSIVE lock on the parent table, blocking concurrent reads/writes during bucket creation or deletion |
| Content-addressed deduplication and reference counting | Introduces hash-lookup overhead and reference-count row contention on small writes (observed in pgs3) |
| Compiled C or Rust PostgreSQL extension | Cannot be installed on managed PostgreSQL services; standard SQL + PL/pgSQL suffices for all state transitions |
9.3 - Integration with Silo
Replacing the newObjectLayer() constructor in Silo is only the first step of integrating a PostgreSQL backend. Although Silo routes object and configuration storage through ObjectLayer, several startup routines, background workers, HTTP handlers, and IAM entry points in cmd/ implicitly assume a distributed erasure-coded (erasureServerPools) deployment.
This page documents the coupling points identified during the Stage 0 source audit and how pgsilo resolves each one without breaking erasure-coded mode.
Startup, DSN parsing, and concurrency budgets
Subsystem in cmd/ | Original erasure-coded assumption | PostgreSQL backend adaptation |
|---|---|---|
Command-line / env argument parsing (server-main.go, common-main.go) | Requires positional disk directory arguments or MINIO_VOLUMES; normalizes arguments as filesystem paths | Detects SILO_PG_DSN or a single postgres:// / postgresql:// URI before disk parsing; rejects mixing disk paths with PostgreSQL mode; redacts DSN passwords from debug output |
Peer RPC grid (grid.go, internal/grid) | Unconditionally initializes peer-to-peer WebSocket grids and distributed lock grids across globalEndpoints | Skips grid and lock-grid initialization when globalIsPGBackend is set; gateways coordinate solely through PostgreSQL transactions and LISTEN/NOTIFY |
Default request concurrency (handler-api.go: apiConfig.init) | When api requests_max <= 0, computes memory limits using slices.Max(setDriveCounts)—which panics on an empty drive-count slice in PostgreSQL mode | Bounds concurrent S3 requests by min(SILO_PG_MAX_CONNS, memlimit / (2 * SILO_PG_SEGMENT_SIZE), api requests_max) coupled with the SILO_PG_QUEUE_TIMEOUT admission queue |
Bucket metadata batch loader (bucket-metadata-sys.go) | Computes batch step as globalEndpoints.ESCount() * 10, causing an infinite 0-step loop when ESCount() == 0 | Enforces max(1, ...) batch sizing so empty and non-empty bucket catalogs load cleanly on startup |
Deployment identity and readiness (erasure-server-pool.go, server-main.go) | Generates deployment UUID inside newErasureServerPools and logs single-drive parity warnings | Persists a stable deployment_id in silo.meta, publishes setObjectLayer after schema check/migration, suppresses erasure parity warnings, and separates /minio/health/cluster/read from /minio/health/cluster |
Guarding the 20 .(*erasureServerPools) type assertions
A static audit of cmd/ found 20 .(*erasureServerPools) type assertions across 9 files (admin-handlers-pools.go, admin-handlers.go, background-newdisks-heal-ops.go, data-usage.go, erasure-multipart-listing.go, global-heal.go, notification.go, peer-rest-server.go, and site-replication.go), plus several non-assertion handlers that reference erasure-only state:
- Pool decommission, rebalance, and drive healing: all pool status, decommission, rebalance, and heal endpoints return
NotImplementedat the handler boundary in PostgreSQL mode rather than reaching uninitializedglobalAllHealStatepointers. - Replication and remote tiering: background replication resync, site replication, and remote tier transition workers are not started in PostgreSQL mode, while global wrapper pointers remain nil-safe when
DeleteBucketor metrics handlers run. - Admin server and storage info (
madmin):StorageInfoand/minio/metrics/v3/pgreport PostgreSQL database usage, logical bucket quotas, andminio_pg_capacity_known = 0(Unknownexclusive disk capacity in Console) instead of fabricating fake erasure drives.
.minio.sys persistence in silo.sys_files
Silo stores server configuration (config.json and configuration history), IAM users/groups/policies/service accounts, and per-bucket metadata (.minio.sys/buckets/<bucket>/.metadata.bin) as objects inside the reserved .minio.sys bucket.
In PostgreSQL mode, operations on .minio.sys route to silo.sys_files:
- Exact prefix-object delete vs. subtree delete:
deleteConfigpassesDeletePrefix=true, DeletePrefixObject=trueto delete an exact configuration key without deleting adjacent keys sharing that string prefix (avs.ab). - Asynchronous
Walkfor IAM startup:IAMObjectStore.listIAMConfigItemsinvokesObjectLayer.Walkand reads from the returned channel;pgsiloimplements ordered prefix walking oversilo.sys_files(including IAM tombstones) and closes the channel on completion or cancellation. - Read-only standby startup: on a read-only gateway (
SILO_PG_READ_ONLY=onorpg_is_in_recovery() = true), startup loads existing.minio.sysrecords in read-only mode without writing default configuration files or IAM format markers.
SelectObjectContent multi-seek snapshot consistency
In Silo’s SelectObjectContentHandler, the handler first calls GetObjectInfo to inspect the object and then passes a NewObjectReadSeekCloser to the S3 Select engine (especially for Parquet and CSV streams), which invokes GetObjectNInfo repeatedly across seek callbacks without pinning a VersionID.
On an erasure-coded cluster, an in-process read lock prevents local overwrites during the query. In PostgreSQL mode, however, another gateway or a silo_api SQL transaction can overwrite the key or replace a null version between seeks. To prevent S3 Select from splicing bytes from two different object generations, pgsilo pins a single REPEATABLE READ READ ONLY transaction snapshot before the initial metadata lookup and reuses that snapshot across all subsequent seek callbacks until the request closes.
Why iam_and_pg cannot use globalAuthZPlugin directly
Early architecture notes proposed implementing PostgreSQL native authorization (iam_and_pg) by registering an in-process globalAuthZPlugin. Auditing cmd/iam.go (IAMSys.IsAllowed) revealed a critical security flaw with that approach:
When globalAuthZPlugin is non-nil, IAMSys.IsAllowed short-circuits and returns the plugin’s boolean immediately—skipping built-in owner checks, service-account parent and inline policy intersections (IsAllowedServiceAccount), STS session policy restrictions (IsAllowedSTS), and explicit IAM Deny statements.
To preserve full S3 IAM semantics, pgsilo evaluates PostgreSQL native role privileges as an additional AND gate after built-in IAM evaluation succeeds:
- The request must first pass full S3 IAM evaluation (including explicit
Deny, bucket policies, service-account restrictions, and STS session policies). - When
silo.set_native_auth_mode('iam_and_pg')is active, the gateway resolves the authenticated S3 principal (or the parent IAM user for a service account / STS token) insilo.native_auth_principalsand verifies that the bound PostgreSQL role holds the required privilege (SELECT,INSERT,UPDATE,DELETE, orEXECUTEonsilo_api.create_bucket) on the target bucket’ssilo_bucketACL relation. - Both checks must return
allow; a PostgreSQLGRANTnever overrides an S3 IAMDeny.
9.4 - SQL API design
The public silo_api SQL interface and silo_bucket ACL relations are Preview features in the MVP release.
Storing objects inside PostgreSQL unlocks a capability that external object stores cannot provide: applications can read, write, copy, and delete S3 objects inside the same Read Committed SQL transaction as ordinary relational tables. This page explains how pgsilo exposes that SQL interface without compromising the internal version state machine or tenant isolation.
Three-schema separation (silo, silo_api, silo_bucket)
Early design drafts placed public SQL functions directly in the silo schema. Implementation reviews separated the database surface into three schemas:
| Schema | Purpose | Access policy |
|---|---|---|
silo | Private storage tables (buckets, objects, object_segments, sys_files, bucket_acl) and internal SECURITY INVOKER state-machine helpers (commit_version, delete_version, lock_key) | Owned by silo_owner; REVOKE ALL FROM PUBLIC; never granted to application roles |
silo_api | The 11 public SECURITY DEFINER functions (put_object, get_object, read_object, stat_object, list_objects, delete_object, copy_object, create_bucket, bucket_info, list_buckets, drop_bucket) | REVOKE ALL FROM PUBLIC at creation; administrators explicitly GRANT USAGE and per-function EXECUTE to application SQL logins |
silo_bucket | Per-bucket ACL relations (silo_bucket.b_<bucket_id>) created automatically when a bucket is created | Non-updatable security_barrier views carrying SELECT, INSERT, UPDATE, and DELETE grants |
Public silo_api functions return flat RETURNS TABLE (...) columns or bytea rather than composite types from silo.*, so application roles never need USAGE on the private silo schema.
Per-bucket ACL relations (silo_bucket.b_<bucket_id>)
Why represent bucket permissions with a view named b_<bucket_id> in silo_bucket?
- Identifier length and collision safety: S3 bucket names can be up to 63 bytes (and internal table columns allow up to 255 bytes) with dots and hyphens, whereas PostgreSQL identifiers are capped at 63 bytes (
NAMEDATALEN - 1). Naming the relationsilo_bucket.b_<bucket_id>avoids truncation collisions whilesilo.bucket_aclmaps each immutablebucket_idto its exactrelation_oid(regclass). - Non-updatable
security_barrierviews: eachsilo_bucket.b_<bucket_id>view is asecurity_barrier = truejoin oversilo.objectsandsilo.bucketswithoutINSTEAD OFtriggers. GrantingINSERTorDELETEon the view serves purely as an authorization bit checked viahas_table_privilege(session_user_oid, relation_oid, priv) IS TRUE; an application role cannot execute rawINSERT,UPDATE, orDELETEstatements against the view to bypass the version state machine. - Clean lifecycle on bucket recreation: dropping a bucket drops its
silo_bucket.b_<bucket_id>view in the same transaction. Recreating a bucket with the same name allocates a newbucket_idand a new ACL relation with no stale grants carried over.
Caller identity (session_user) and SECURITY DEFINER hardening
Inside a SECURITY DEFINER function, current_user and current_role resolve to the function owner (silo_owner), not the caller. Checking privileges against current_user would grant every caller full owner access.
To prevent privilege escalation:
- Fixed
session_userprincipal: everysilo_apientry point authenticatessession_user(resolved to its role OID) and explicitly verifieshas_function_privilege(session_user_oid, '<function_signature>'::regprocedure, 'EXECUTE') IS TRUE. - Rejecting
SET ROLEand owner logins: ifcurrent_setting('role')is not'none', or ifsession_useris the installation owner (silo_owner) or a member of it, the function rejects the call withSQLSTATE 42501. An unprivileged user cannot wrap asilo_apicall inside their ownSECURITY DEFINERfunction or useSET ROLEto impersonate another role. - Locked
search_path: allsilo_apifunctions setsearch_path = pg_catalog, pg_tempand schema-qualify every table, function, and operator reference so user-created objects inpg_temporpubliccannot hijack execution. - Immediate
REVOKEvisibility: cached PL/pgSQL plans do not always process PostgreSQL catalog invalidation messages before evaluatinghas_table_privilege. Everysilo_apicall first runs a lightweight dynamicEXECUTE 'SELECT 1 FROM silo.meta LIMIT 0'to force syscache invalidation acceptance, ensuring a committedREVOKEtakes effect on the very next statement.
Transactional semantics and synchronized bucket policies
Read Committedwrite contract:put_object,delete_object,copy_object,create_bucket, anddrop_bucketrequireRead Committedisolation. UnderRepeatable ReadorSerializable, a transaction waiting onsilo.lock_keywould still see its pre-lock snapshot and miss a concurrent latest version; write functions therefore reject higher isolation levels withSQLSTATE 0A000.- Deadlock-safe
copy_object:silo_api.copy_objectacquiresFOR SHAREon the source and destination bucket rows in ascendingbucket_idorder, reads the source metadata, segments, and annotations from a single snapshot without holding a source key lock across the destination write, and publishes the destination version atomically. - Policy synchronization (
policy_ready): S3 stores bucket configuration in.minio.sys/buckets/<bucket>/.metadata.bin, while SQL functions inspect structured columns onsilo.buckets(versioning,object_lock,default_sse,policy_ready). Whenever a gateway updates.metadata.bin, it decodes and updates those structured columns in the sameFOR UPDATEtransaction. SQL write functions requirepolicy_ready = true, enforce default Object Lock retention and hard bucket quotas, and reject plaintext writes to buckets with default SSE enabled.
9.5 - IAM control plane
In a multi-gateway pgsilo deployment, gateways cache IAM users, groups, policies, service accounts, STS sessions, and bucket metadata in memory so ordinary S3 requests do not query .minio.sys tables on every packet. However, an unbounded or loosely synchronized cache creates a security gap: a revoked credential or deleted policy could remain usable on another gateway for minutes.
This page explains how pgsilo bounds IAM and control-plane cache staleness to 5 seconds, isolates control traffic from slow object streams, validates standby gateways, and prevents split-brain cache renewal after asynchronous PostgreSQL failover (schema 14).
1. Three-pool connection isolation
If S3 object uploads, IAM refreshes, health checks, and LISTEN notifications shared a single database connection pool, a burst of slow 256 MiB uploads could exhaust all connections and starve health checks or credential revocations.
pgsilo splits each gateway’s connection budget (SILO_PG_MAX_CONNS, default 32) into three isolated pools:
| Pool | Default size | Configurable range | Responsibilities |
|---|---|---|---|
Control pool (SILO_PG_CONTROL_CONNS) | 4 | 1–64 | Atomic IAM snapshot reloads, bucket metadata refreshes, revision polling, and /minio/health/cluster* probes |
Coordination pool (SILO_PG_COORD_CONNS) | 2 | 2–64 | One dedicated LISTEN silo_control_rev connection plus serialized IAM control-plane write transactions |
Data pool (MAX - CONTROL - COORD) | 26 | >= 2 | Streaming S3 object reads, writes, multipart uploads, and 2-connection CopyObject reservations |
Data-pool saturation never borrows connections from the control or coordination pools.
2. Serialized IAM mutations and atomic snapshot reloads
Silo’s upstream IAMObjectStore loads users, groups, policy mappings, and STS tokens across separate file reads and merges partial maps in memory. Against a shared PostgreSQL database, separate reads could observe a half-applied multi-file IAM update.
pgsilo replaces both sides of the IAM persistence lifecycle:
- Serialized IAM writes: every administrative IAM mutation acquires a connection from the coordination pool, begins a
READ COMMITTEDtransaction, takes a fixed global IAM transaction advisory lock, performs the compare/merge andsilo.sys_filesupdates inside that single transaction, and bumpssilo.sys_revisionbeforeCOMMIT. If the connection drops, the lock and file mutations roll back together. - Single-snapshot IAM reload: when a gateway reloads IAM state, it opens a
REPEATABLE READ READ ONLYtransaction on the control pool, readssilo.sys_revisionand all IAM records fromsilo.sys_filesin one consistent snapshot (bounded by file count and byte limits), decodes the complete identity and policy graph, and swaps the in-memory IAM cache atomically.
3. The 5-second freshness lease
Every gateway enforces a hard 5-second lease on its installed IAM snapshot:
- Monotonic start-of-query anchor: the 5-second timer starts at the monotonic wall-clock instant before the gateway sends its database observation query (
SELECT revision, revision_token, pg_is_in_recovery() ...), not when a slow query finishes. - 1-second polling +
LISTEN/NOTIFYhints: gateways pollsilo.sys_revisionevery 1 second and also subscribe toLISTEN silo_control_rev. ANOTIFYwakes the poller immediately, but notifications are never trusted as a durable stream; listener connect or reconnect always forces a full snapshot reload. - Fail-closed expiration: before authorizing any IAM-dependent S3 or admin request, the middleware checks whether the current snapshot lease is still valid. If the lease has expired and a shared refresh cannot verify database authority within the deadline, the gateway fails closed with HTTP
503rather than evaluating stale permissions.
4. Physical standby freshness and the 500 ms clock contract
Polling silo.sys_revision on a physical PostgreSQL standby is not sufficient by itself: if streaming replication is paused or lagging by 10 minutes, the standby still returns a valid-looking old revision row.
To bound staleness on read-only standby gateways (SILO_PG_READ_ONLY=on):
- A writable gateway connected to the primary periodically writes a timestamped authority heartbeat row that replicates through WAL without incrementing
silo.sys_revisionor triggering full IAM reloads. - Primary and standby host clocks must stay synchronized within 500 milliseconds.
- When a standby gateway polls its replica database, it subtracts
(now - heartbeat_timestamp) + 500 msfrom the 5-second lease budget. If replication stalls, the primary writable gateway stops, or clock skew exceeds bounds, the standby lease expires within 5 seconds and IAM-authenticated requests fail closed (503).
5. Schema 14: revision_token for divergent failover histories
Testing asynchronous PostgreSQL failover exposed a subtle split-brain edge case with integer revisions:
- Suppose the primary is at
revision = 42. An administrator revokes a user’s policy (revision = 43), and Gateway A cachesrevision = 43. - Before WAL for
revision = 43replicates to the standby, the primary crashes and the standby is promoted atrevision = 42. - On the newly promoted primary, an unrelated control-plane change (such as creating a bucket) increments
revisionfrom42to43. - Gateway A polls the new primary, sees
revision = 43(equal to its cached integer43), and—if it checked only the integer—would renew its lease while holding a divergent IAM state from the old timeline.
The Schema 14 fix (revision_token):
Schema 14 adds a revision_token uuid column to the singleton silo.sys_revision row, updated by a BEFORE UPDATE trigger to a fresh random UUID (gen_random_uuid()) whenever revision changes.
- Gateways record
(revision, revision_token, in_recovery)alongside every installed IAM snapshot. - A poll renews the 5-second lease only if both
revisionandrevision_tokenmatch the installed snapshot andin_recoveryhas not changed. - After an asynchronous failover, even if the promoted primary reaches the same integer
revision = 43, itsrevision_tokenUUID differs, immediately forcing every gateway to discard its old timeline cache and perform a fullREPEATABLE READreload.
9.6 - Lifecycle and Object Lock
Object Lock (GOVERNANCE / COMPLIANCE retention and legal hold) and bucket lifecycle rules (version expiration, expired delete-marker cleanup, and incomplete multipart upload abort) are Preview features in the MVP release.
In Silo’s erasure-coded backend, lifecycle expiration and Object Lock checks rely on the distributed disk scanner (NSScanner), in-memory expiry queues, and handler-level pre-checks. Directly enabling those paths on a shared PostgreSQL backend would fail in four ways:
- MultiDelete TOCTOU window: Silo’s
DeleteObjectshandler pre-checked Object Lock retention before calling the backend delete loop, leaving a race window where a concurrent request could enable a legal hold or extend retention before the row was deleted. - Unbounded version slices in
Evaluator.Eval: the upstream lifecycle evaluator expects all versions of a key in a single in-memory slice, which would allocate unbounded gateway memory on keys with deep version histories. - Subtree vs. exact-key delete mismatch: erasure-coded lifecycle
DeleteAllpassesDeletePrefix=true, DeletePrefixObject=trueto delete all versions of an exact key, which a naive prefix delete would misinterpret as deleting an entire/key subtree. - Missing
AbortIncompleteMultipartUploadrule wiring: upstream rule structs lacked completeAbortIncompleteMultipartUploadevaluation fields and relied on a global stale-upload timer rather than per-bucket prefix and initiation-age rules.
This page describes how pgsilo implements authoritative Object Lock enforcement and fenced lifecycle execution directly in PostgreSQL.
1. Authoritative Object Lock in the database state machine
Rather than trusting unvalidated JSON headers in user_defined, pgsilo stores normalized lock columns on silo.objects (retention_mode, retain_until, legal_hold) and default retention settings on silo.buckets (synchronized transactionally whenever .metadata.bin is saved under the bucket FOR UPDATE lock):
- Database UTC clock: all retention expiration checks compare
retain_untilagainst PostgreSQL’sclock_timestamp()inside the key lock, ensuring S3 requests,silo_apiSQL calls, and background lifecycle workers agree on a single clock. - Every mutation path shares one check:
- Single
DeleteObjectand batchDeleteObjects: each key deletion runs inside the per-key advisory lock (silo.lock_key), re-reading the target version’sretention_mode,retain_until, andlegal_holdatomically so no TOCTOU window exists between pre-check and deletion. PutObjectMetadata(?retention/?legal-hold): modifies retention and legal hold in place on the target version without creating a new version or altering the object ETag. ShorteningCOMPLIANCEretention or switchingCOMPLIANCEtoGOVERNANCEbefore expiration is rejected even for the S3 root user.- Governance bypass: requires both an explicit
x-amz-bypass-governance-retention: trueheader ands3:BypassGovernanceRetentionauthorization evaluated per target version (plusUPDATEon the bucket ACL relation underiam_and_pg). Governance bypass never overridesCOMPLIANCEretention or an activelegal_hold. - SQL
silo_apiintegration:silo_api.put_objectandcopy_objectautomatically apply default bucket retention on object-lock buckets, whilesilo_api.delete_objectenforces retention and legal hold with no governance bypass parameter. - Force bucket deletion blocked:
DELETE /{bucket}withx-minio-force-deleteis rejected with HTTP405on any object-lock-enabled bucket, even when the bucket is empty.
- Single
2. Streaming keyset lifecycle scanner and executor
Instead of running the erasure-coded NSScanner, writable pgsilo gateways run a PostgreSQL-native lifecycle worker covering four rule actions (remote storage tiering Transition and RestoreObject are rejected at configuration time):
- Current version expiration (
ExpirationbyDaysorDate): deletes the current object in an unversioned bucket, inserts a delete marker in a versioned bucket (without duplicating an existing latest delete marker), or applies null-version expiration in a suspended bucket. - Noncurrent version expiration (
NoncurrentVersionExpiration): computes noncurrent age from the creation timestamp of the version’s successor (noncurrent_since), not the old version’s ownmod_time, and preserves at leastNewerNoncurrentVersionsnewer historical versions before deleting eligible versions. - Expired object delete marker cleanup (
ExpiredObjectDeleteMarker): removes a current delete marker when it is the only remaining version row for that key. - Incomplete multipart upload cleanup (
AbortIncompleteMultipartUpload): matches active uploads insilo.uploadsby rule prefix andinitiatedage and aborts them atomically, cascading deletion of uploaded parts and segments.
To keep memory bounded, the scanner iterates over buckets and keys using keyset pagination ((key COLLATE "C", commit_seq) for objects and (key, initiated, upload_id) for multipart uploads) reading only metadata columns—never decrypting or loading SSE-C / SSE-S3 object bodies.
Before executing any deletion or marker insertion, the worker locks the target key (silo.lock_key), re-reads the current version chain and bucket lifecycle configuration revision, and re-verifies Object Lock protections. If a concurrent PUT, tag change, legal hold, or rule update occurred after the scan pass, the stale candidate becomes a safe no-op.
3. Multi-gateway maintenance leases and epoch fencing
When multiple writable gateways share a PostgreSQL primary, only one gateway should execute background lifecycle and annotation cleanup at a time, and a partitioned or paused leader must never commit stale deletions after another gateway takes over.
pgsilo coordinates background workers through a database lease table (silo.TryLifecycleLock) rather than a long-lived session advisory lock on the coordination pool:
- Short-transaction lease claims and renewals: a writable primary gateway claims or renews the maintenance lease in a short transaction using PostgreSQL’s clock. Whenever a different gateway takes over an expired lease, the database increments a monotonic
epochcounter. - Transactional epoch fencing: every destructive lifecycle or annotation-cleanup batch locks the lease row (
FOR SHARE) inside the same transaction as the object/annotation deletion and verifies that(owner_id, epoch)still matches the worker’s lease and has not expired. If a new leader has incrementedepoch, the old worker’s transaction aborts before committing. - Standby and read-only safety: gateways with
SILO_PG_READ_ONLY=onor connected to a database wherepg_is_in_recovery() = truenever claim the maintenance lease. Lease ownership and errors are exported at/minio/metrics/v3/pgviaminio_pg_lifecycle_leaderandminio_pg_lifecycle_errors_total.
9.7 - Status review and baseline, 2026-11-08
Date- 2026-11-08
Applies to- Frozen local delivery
3c7fdc03; baseline on299378b; fixes up to1d387725c(all on Silo branchfeat/pg-backend, not pushed) Finding- The feature scope was broad and well tested in October, but the evidence was split across candidates and the current source had never run. A GA-level gate set had kept testing open.
Led to- MVP goal
Replaces- Nothing; this is a review record
State before the review
Candidate identity was split. No single commit carried complete runtime evidence:
| Commit | What had run |
|---|---|
dca464e5 (2026-10-07, schema 14) | All functional gates: mint full HTTP 872 pass / 8 NA and HTTPS 947 pass / 7 NA, Ceph s3-tests 195/195, pgstore kernel 185 top-level / 326 tests on PostgreSQL 16, 17 and 18, cmd and erasure-coded regression 1,336 top-level / 6,913 tests, 32 application checks, 28 Console checks, 10 Pigsty checks, 35 upgrade and recovery checks, 11 STS, 15 native authorization, 36 A/Z and 5 multi-gateway checks |
3c7fdc03 (2026-10-07, frozen delivery) | Eight files (+99/−34) after dca464e5. Focused regression tests, the formal 3-round performance run (with SILO_PG_MAX_CONNS=72 and a Go SDK client for the 64-concurrency rows) and a 20-minute mixed preflight |
299378b (2026-10-26) | October upstream sync plus two review fixes: 158 files, +19,000/−2,035 lines after 3c7fdc03. Compiled and vetted only; no test had been executed |
The frozen delivery was not publishable. 3c7fdc03 was based on Silo code from 2026-09-26 and lacked the October upstream fixes (IAM credential boundaries, scoped STS revocation, Object Lock authorization and others), built for ARM64 only, and reported the version DEVELOPMENT.GOGET. It had never been pushed.
Source entry points were broken. The working checkouts the delivery records pointed to had been removed, the documented compile script referred to missing paths, and the October test environment no longer existed.
The fork kept drifting. Against the synced upstream (RELEASE.2026-10-25), the backend added about 17,200 production lines (Go store, 14 SQL migrations, gateway code), modified 79 upstream production files (+1,922/−425), and added about 22,400 test lines. By 2026-11-08 Silo main had 138 further commits; 16 of the files they changed were also modified by the backend, including new ObjectOptions semantics.
Why testing did not close
- The goal was GA-level. It required stages 0–5,
mintfull, every application integration, HA, PITR and performance gates, and a 72-hour endurance run on the frozen candidate, with any later change to a persistence or concurrency path requiring the affected endurance to run again. - Every change produced a new candidate. At least six candidates followed each other, and results were never carried across candidates without a fresh run.
- The performance gate measured the client. The 64-concurrency 4 KiB PUT target of 500 ops/s failed repeatedly with the Python client and passed only after the concurrency rows switched to the Go SDK.
- Most failures came from the test harness. Of 14 preflight runs, 2 passed, 11 failed (mostly fixture errors such as port timing, parameter encoding and credential limits; one real race, later fixed) and 1 was stopped. Of about 45 performance-related runs, 1 was a formal pass and about 25 tested the harness itself.
- Evidence outgrew the work. The run directory held 29,823 files (5.8 GB), including 95 self-verification receipts and 342 review documents.
- A real defect arrived late. On 2026-10-07 an IAM cache defect after failover (same revision, different content) led to schema 14 and a rerun of almost every gate.
- The endurance run came last. It could start only after everything else passed, and it was stopped at the user’s request after about 4.05 hours. It is not a 72-hour pass.
Decision
Three release forms were compared. Merging into Silo as an experimental backend was chosen, because it stops the fork drift and reuses the Silo release pipeline. A standalone release would make the drift permanent. An extension-only release is not possible, because the project has no PostgreSQL extension. The goal itself is recorded in MVP goal.
Runtime baseline on 299378b
The release checklist ran on 299378b on 2026-11-08 with PostgreSQL 18.6 and 16.15. Seven items passed: pgstore on both versions, mint core and full over HTTP and HTTPS (no failures; full-mode counts match October), Ceph 195/195, four client smokes, the Silo Console 2.6.0 smoke and an amd64 smoke under emulation. The cmd regression had one failing test. Details and the performance numbers are on Status.
Two environment effects were separated from product results: erasure-coded tests fail in bulk when the temporary directory’s disk is nearly full, and seven file-permission tests fail when run as root.
IAM snapshot assertion
TestPGIAMPolicyReadersKeepCompleteSnapshot failed in every run. Its last assertion, added during the October sync and never executed, expected a policy written directly with pgstore.PutSystem to stay outside the cache after ListPolicies. A control experiment wrote one policy and deleted another installed policy directly in storage, then compared two paths:
| Group | Operation | Added policy visible | Deleted policy visible | Installed / stored revision | Cache replaced |
|---|---|---|---|---|---|
| Start | — | No | Yes | 2 / 4 | — |
| A | ListPolicies only | Yes | No | 4 / 4 | Yes |
| B | DeletePolicy only | No | Yes | 2 / 5 | No |
The user, group, service-account and temporary-account list paths neither reloaded nor merged records.
Conclusion: PutSystem and DeleteSystem advance the stored revision, so the record was not outside it. In PostgreSQL mode, a policy listing reloads the complete snapshot at the stored revision and replaces the cache: additions and deletions appear together, and nothing is merged record by record. The behavior was the same on 3c7fdc03. Commit ca158fb6 rewrote the assertion to test that invariant, including the deleted record; product code was not changed.
Request queue
In PostgreSQL mode the request budget equals SILO_PG_MAX_CONNS (32 by default). Above it, builds up to 299378b answered HTTP 429 TooManyRequests at once, and the default retry rules of the AWS SDK for Go v2 and boto3 do not cover that response, so ordinary 64-client bursts failed.
Commit 1d387725c makes a request wait up to SILO_PG_QUEUE_TIMEOUT (5 s by default) for a free slot without holding a database connection, stops waiting when the client disconnects, and answers HTTP 503 SlowDown when the wait expires. Erasure-coded mode is unchanged. With the default pool, 64 clients ran PUT and GET for 90 s each with no failed request; with the wait disabled, the SDK retried the 503 responses but 160 PUT and 188 GET requests still failed. Ceph 195/195 and mint core over HTTPS (644 pass, 6 NA) showed no regression. Numbers are on Status.
What remained open
- Merge prerequisites: the Silo release, the public
silo-pkgannotation actions, and the user’s decision. - Release engineering: formal version string,
amd64andarm64builds, DEB and RPM. - Known issues listed on Status.
9.8 - MVP goal
Date- 2026-11-08, approved by the user
Applies to- Silo branch
feat/pg-backendfrom299378bonward; current candidate1d387725c Replaces- The completion criteria of the original development goal (stages 0–5 up to a GA-level release candidate, including a 72-hour endurance run) and the 2026-10-08 local delivery freeze
Status- Current
Decision
The only completion criterion is an MVP release candidate. When it is reached, work stops and the result is reported; later phases do not start automatically. The stages and the GA-level release candidate of the original goal remain a roadmap after the MVP, not a completion criterion.
The reasons are recorded in Status review and baseline: by 2026-11-08 the feature work was broad, but no single commit carried complete runtime evidence, and a GA-level gate set kept the testing from closing.
Release form
pgsilomerges into Silomainas an experimental PostgreSQL storage backend and ships with standard Silo releases. Apostgres://orpostgresql://DSN, orSILO_PG_DSN, selects PostgreSQL mode.- There is no standalone
pgsiloexecutable and no SQL-only release. An extension-only release was rejected: the project has no PostgreSQL extension, because the gateway installs and migrates the schema itself. - The frozen local delivery
3c7fdc03stays an internal ARM64 preview and is not published.
Support tiers
| Tier | Scope |
|---|---|
| Supported | One PostgreSQL primary with one or more writable gateways; PostgreSQL 16–18; linux/amd64 and linux/arm64 |
| Supported | Bucket and object CRUD, ListObjects V1/V2, versions and delete markers, conditional requests, Range, copy, tagging, multipart upload, checksums, presigned URLs, POST policy, CORS |
| Supported | IAM users, groups, policies and service accounts; SSE-C and static-key SSE-S3; object backup through PostgreSQL backup and PITR |
| Preview | SQL transaction API, PostgreSQL native authorization, STS, lifecycle, Object Lock, quotas, annotations and ZIP extraction, hot standby gateways |
| Not supported | SSE-KMS and external KMS, replication, tiering, erasure-coded disk management, S2 compression, etcd IAM, objects above 1 GiB, high-throughput workloads, RPO guarantees under automatic HA |
The MVP uses the general Silo Console, without an annotation interface. Preview features ship with the release but may change without compatibility guarantees. The current tier table is on Compatibility.
Working principles
- Scope freeze. Only the listed work items and fixes for MVP-blocking problems. No new features, test layers, evidence formats or infrastructure.
- Proportional verification. Only functional and smoke tests that finish in minutes; the whole release checklist finishes in one to two hours. Long-running stability or endurance runs, full instrumentation matrices, repeated benchmark rounds, consistency tests that need a large external environment to be rebuilt, and diagnostic campaigns for rare intermittent failures are not done and are not gates after the MVP. The user raises them separately if needed.
- Honest results. Each check is recorded as pass, fail or not applicable, with the command and the location of the raw output. A failure is fixed or listed as a known issue with a statement of whether it blocks; the user decides. Failures are never hidden or silently waived.
- Performance. The MVP publishes measured baseline numbers and the test environment. There is no SLA, and performance does not block the release.
- Authorization. Local commits with DCO sign-off are allowed. Pushing, merging into Silo
main, publishing packages or images, and deploying sites each need separate approval.
Release checklist
The checklist runs in full once the release candidate is frozen; during development only the items affected by a change run.
| # | Item |
|---|---|
| 1 | internal/pgstore tests on PostgreSQL 18 and on PostgreSQL 16 |
| 2 | Regular Silo unit tests (go test, no race detector) to show that erasure-coded mode did not regress |
| 3 | mint core once over HTTPS (covers SSE-C) |
| 4 | Ceph s3-tests, 195 pinned cases |
| 5 | Client smoke: mcli, AWS CLI v2, boto3, AWS SDK for Go v2 |
| 6 | Reduced performance smoke that takes minutes; numbers are recorded only |
| 7 | General Silo Console 2.6.0 smoke against PostgreSQL mode |
| 8 | Runtime smoke on linux/amd64 |
Items 2, 3 and 6 were narrowed on 2026-11-08 from an earlier draft that asked for race-enabled regression, mint full over both HTTP and HTTPS, and a 20-minute mixed preflight.
Merge prerequisites
- The current Silo release is published.
feat/pg-backendis then synced to that release tag; upstream changes to files the backend also modifies, and newObjectOptionssemantics such asDeleteAllVersions, are implemented or explicitly rejected in PostgreSQL mode; the checklist runs again. - The four annotation policy actions the server uses are published in the public
silo-pkg, coordinated with the Server and Console releases, or handled another way. This needs the user’s approval. - The user decides the merge.
Work items
| # | Work item | State on 2026-11-08 |
|---|---|---|
| 1 | Restore a working source checkout of feat/pg-backend that contains no unpublished Silo main commits, and repair broken build paths | Done |
| 2 | Set up a lean test environment with PostgreSQL and gateways; rebuild the pinned mint and Ceph inputs | Done |
| 3 | Run the release checklist on 299378b to catch problems from the October upstream sync | Done; see Status. Two fixes followed in ca158fb6 and 1d387725c |
| 4 | Sync to the Silo release and rerun the checklist | Waiting for the Silo release |
| 5 | Release engineering (formal version string, amd64/arm64 builds, DEB and RPM) and release notes stating the experimental status, tiers, mint fixture revisions and not-applicable cases | Not started |
Deferred beyond the MVP
- Automatic high availability: define the scope and the validation when it is needed.
- The brief HTTP 503 window after an IAM change on another gateway, and Python client throughput.
- The annotation interface in the general Console, and promoting Preview features to Supported.
- Objects above 1 GiB, higher throughput, multi-architecture container images, and running the test harness in CI.