Automated Script: /migrations/004_deprecated_sql_ledger_state.sh
Adds DEPRECATED_SQL_LEDGER_STATE=false to stellar-core.cfg, required by stellar-core 21.x.
Changes:
- Inserts
DEPRECATED_SQL_LEDGER_STATE=falseafter theDATABASE=line instellar-core.cfg
Context: stellar-core 21.x introduced the DEPRECATED_SQL_LEDGER_STATE setting and requires it to be explicitly set. Nodes upgrading from 20.x will fail to start without it.
New containers (v1.1-p21.2+) already include this setting — no migration needed.
✅ Requirements:
- Container running
- Root or stellar user access
- ~1 minute
- No service restart is performed — stellar-core must be restarted manually if it is already running
- Backup is created at
/opt/stellar/migration_backups/
/migrations/004_deprecated_sql_ledger_state.shExpected output:
YYYY-MM-DD HH:MM:SS [004] [INFO] Starting migration: Add DEPRECATED_SQL_LEDGER_STATE=false
YYYY-MM-DD HH:MM:SS [004] [INFO] Backup created: /opt/stellar/migration_backups/stellar-core.cfg.YYYYMMDD_HHMMSS
YYYY-MM-DD HH:MM:SS [004] [OK] DEPRECATED_SQL_LEDGER_STATE=false added after DATABASE line
YYYY-MM-DD HH:MM:SS [004] [OK] Verification passed
YYYY-MM-DD HH:MM:SS [004] [OK] Migration completed successfully
grep 'DEPRECATED_SQL_LEDGER_STATE' /opt/stellar/core/etc/stellar-core.cfg✅ You should see:
DEPRECATED_SQL_LEDGER_STATE=false
Then restart stellar-core to apply the change:
supervisorctl restart stellar-core# Stop stellar-core
supervisorctl stop stellar-core
# Find backup
ls /opt/stellar/migration_backups/
# Restore (replace timestamp)
cp /opt/stellar/migration_backups/stellar-core.cfg.YYYYMMDD_HHMMSS \
/opt/stellar/core/etc/stellar-core.cfg
# Restart
supervisorctl start stellar-corevi /opt/stellar/core/etc/stellar-core.cfgFind the DATABASE= line and add the setting directly below it:
DEPRECATED_SQL_LEDGER_STATE=falseThen restart:
supervisorctl restart stellar-core- Safe to run multiple times? Yes, script is idempotent — if the setting already exists, it is skipped.
- Does this cause downtime? The script itself does not restart services. You need to restart stellar-core manually for the change to take effect.
- Why is this needed? stellar-core 21.x dropped the legacy SQL ledger state feature and requires the flag to be explicitly disabled to confirm the operator is aware of the change.
- What if stellar-core won't start? Check logs:
tail -f /opt/stellar/core/stellar-core.log