-
v0.6.6 Stable
released this
2026-02-27 08:51:22 +00:00 | 1 commits to main since this releaseVSKI v0.6.6
Features
Replica Identification and Routing
Replicas can now identify themselves with a unique ID and public URL, enabling proper routing by load balancer and workflow executors.
How It Works
- Replica Identification: Replicas send
X-Replica-IdandX-Replica-Public-Urlheaders to master during sync - Master Tracking: Master stores known replicas in
_known_replicastable with their public URLs - Response Headers: Replicas include
X-Replica-Idheader in all response - Client SDK: Client automatically captures
X-Replica-Idfrom responses and includes it in subsequent request - Workflow Routing: Workers can specify
replicaIdwhen subscribing to workflows to route job to specific replicas
Incremental Sync
Replicas now use SQLite changesets for incremental synchronization instead of full database downloads, dramatically reducing sync time and bandwidth.
How it Works
- Initial Sync: Fresh replicas download the full database from master
- Session Reset: After full download, replica resets master's session to ensure clean changeset tracking
- Schema Comparison: Replicas compute and compare schema hashes with master before attempting incremental sync
- Schema Migration: If schemas differ, replica fetches master schema and applies migrations (CREATE TABLE, ALTER TABLE, indexes, triggers, views)
- Changeset Application: After schema sync, replicas apply changesets for data changes (INSERT, UPDATE, DELETE)
- Automatic Fallback: If replica has no replication state, it downloads full database
Schema Synchronization
When schema changes are detected (new collections, field changes, indexes), replicas automatically migrate their schema:
- Hash-Based Detection: Schema hashes are computed from
sqlite_master(tables, indexes, triggers, views) - Schema Fetch: Replica fetches full schema from master via
/api/replica/schema-sync - Diff Computation: Replica computes schema diff (new tables, altered tables, new/dropped indexes, triggers, views)
- Migration Application: Replica applies schema migrations:
CREATE TABLEfor new collectionsALTER TABLE ADD COLUMNfor new fields (columns are never deleted or renamed)CREATE INDEX,CREATE TRIGGER,CREATE VIEWfor new objectsDROP INDEX,DROP TRIGGER,DROP VIEWfor removed objects- Tables are never dropped on replica
Configuration
# Replica server configuration REPLICA_MODE=replica REPLICA_ID=my-replica-001 # Unique identifier for this replica PUBLIC_URL=https://replica.example.com # Public URL for routing MASTER_URL=https://master.example.com SYNC_INTERVAL=60New Admin Endpoints
Endpoint Description GET /api/admin/known-replicasList all known replicas that have synced with master GET /api/admin/known-replicas?with_public_url=trueFilter replicas by presence of public URL Client SDK
// Health check endpoint const isHealthy = await client.health(); // Get list of known replicas from master const replicas = await client.replicas.listKnown(); // Filter by those with public URLs const publicReplicas = await client.replicas.listKnown({ withPublicUrl: true }); // Client automatically captures replicaId from responses const records = await client.collection('posts').getList(1, 10); console.log(client.replicaId); // Set from X-Replica-Id header // Route workflow to specific replica await client.workflow.start('my-workflow', { arg1: 'value' }, { replicaId: 'replica-001' });Web Dashboard
- Connection modal displays known replicas with their IDs for allowing quick switching between master and replica servers
- Health check endpoint used for connectivity verification
Cron Job Handling on Replicas
Cron jobs are now properly disabled on replicas to prevent duplicate execution and data conflicts.
Behavior on Replicas
- HTTP cron jobs: Always skipped on replicas (would cause duplicate external calls)
- SQL cron jobs: Skipped for replicated databases (all databases except
statsandworkflows) - SQL cron jobs on non-replicated databases: Execute normally (e.g., cleanup jobs on
statsorworkflows)
This ensures that:
- Replicas don't trigger duplicate HTTP webhooks
- SQL jobs don't conflict with master's data (replicated DBs are read-only)
- System maintenance jobs on non-replicated databases still run
New Environment Variables
Variable Default Description REPLICA_ID(none) Unique identifier for this replica instance PUBLIC_URL(none) Public URL for routing requests to this replica Technical Details
New Replica API Endpoints
Endpoint Method Description /api/replica/schema-syncGET Get full schema from master for migration (internal) /api/replica/reset-sessionPOST Reset master's SQLite session after full download (internal) Files Changed
internal/replica/syncer.go- Incremental sync logic, schema comparison and migration, hash-based change detectioninternal/replica/session_manager.go- Session management,ResetSession()method, schema hash computation,GetFullSchema()internal/api/replica.go-ResetSessionendpoint,SchemaSyncendpoint, changeset generationinternal/config/config.go- AddedReplicaIDandPublicURLconfig fieldsinternal/replica/middleware.go- AddedX-Replica-IdtoReplicaStatusMiddlewareinternal/replica/types.go- AddedKnownReplicastructinternal/replica/registry.go- AddedUpsertKnownReplica,ListKnownReplicaswith filterinternal/db/db.go- Added_known_replicastable schemainternal/app/bootstrap.go- Passcfg.ReplicaIDto syncer and middleware, configure cron replica modeinternal/services/cron.go- Added replica mode support, skip jobs on replicated databasesclient/src/client.ts- AddedreplicaIdproperty,health()method, capture from response headersclient/src/types.ts- AddedreplicaIdtoWorkflowOptionsclient/src/api/replicas.ts- New namespace for known replicas managementweb/lib/sdk.tsx- Use/healthendpoint for connectivity checkweb/components/layout/ConnectionBadge.tsx- Display known replicas in server list
Breaking Changes
None
Migration
No migration required. The
_known_replicastable is created automatically on startup.Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads
-
vski
0 downloads ·
2026-02-27 08:51:26 +00:00 · 6.5 MiB -
vski-standalone
0 downloads ·
2026-02-27 08:51:26 +00:00 · 6.7 MiB
- Replica Identification: Replicas send