Overview
Thesync and endsync commands work together to manage data source synchronization. These commands are critical when resynchronizing a Kafka data stream after failures or when setting up a new data source.
When to Use Sync Commands
Use these commands when:- Re-streaming a complete snapshot after a Kafka failure
- A source database becomes unsynchronized with Metadb
- Setting up a new data source for the first time
- Recovering from replication slot issues
metadb sync
Begins synchronization with a data source, preparing the database to accept a fresh snapshot of data.Syntax
Options
Name of the data source to synchronize. Must match a configured data source.
Path to the Metadb data directory.
Do not prompt for confirmation before starting synchronization.
Enable verbose output during synchronization.
Enable extremely verbose output (requires
METADB_DEV=on).What It Does
- Puts the database into synchronizing mode
- Pauses periodic transforms and external SQL
- Prepares to accept a complete data snapshot
- Marks existing data for potential cleanup
The
sync command should be run before starting the server to stream new data. This may take some time to complete.Example Workflow
metadb endsync
Completes synchronization by removing old data that was not refreshed during the sync process.Syntax
Options
Name of the data source to finish synchronizing.
Path to the Metadb data directory.
Do not prompt for confirmation before ending synchronization.
Enable verbose output.
Enable extremely verbose output (requires
METADB_DEV=on).What It Does
- Removes old data that wasn’t refreshed by the new stream
- Exits synchronizing mode
- Resumes periodic transforms and external SQL
- Returns database to normal operation
When to Run endsync
Runendsync after the snapshot has finished streaming. Metadb helps you determine the right time:
- Watch for “source snapshot complete (deadline exceeded)” in the log
- Check snapshot status with the
list statuscommand - Generally better to run too late than too early
Example Workflow
Complete Resynchronization Procedure
Follow this procedure when resynchronizing a failed Kafka data stream:1. Update Data Source Configuration
Update the data source with new Kafka topics and consumer group:2. Stop and Sync
3. Start Streaming
4. Monitor Progress
Watch the log file for snapshot completion:5. Complete Synchronization
Initial Synchronization for New Sources
When creating a new data source withcreate data source, Metadb automatically enters synchronizing mode:
Troubleshooting
Snapshot Taking Too Long
- Check Kafka connectivity and consumer group status
- Verify no timeout issues in source database
- Monitor replication slot lag
Missing Records After endsync
If you ranendsync too early:
- Re-run the full sync procedure
- Wait longer for snapshot completion next time
Old Records Not Removed
If old deleted records persist:- Ensure
endsyncwas run and completed successfully - Check logs for errors during endsync
Until a failed stream is re-streamed using this procedure, the Metadb database may remain unsynchronized with the source.
