subsystem-summary-of-database
Database Subsystem — Technical Summary
Overview
The database subsystem provides the persistence layer for stellar-core, wrapping the SOCI C++ database-access library to manage connections to SQLite or PostgreSQL backends. It handles schema versioning/migration, connection pooling for worker threads, metrics collection, and a dual-database architecture (main + misc) for SQLite to avoid write-lock contention.
Key Files
- Database.h / Database.cpp — Core
Databaseclass; connection management, schema migration, pooling, metrics. - DatabaseTypeSpecificOperation.h — Visitor pattern for backend-specific (SQLite vs PostgreSQL) code paths.
- DatabaseConnectionString.h / .cpp — Utility to redact passwords from connection strings for logging.
- DatabaseUtils.h / .cpp — Helper for batch-deleting old ledger entries from tables.
Key Classes and Data Structures
Database (inherits NonMovableOrCopyable)
More from stellar/stellar-core
running-tests
running tests at various levels from smoke tests to full suite to randomized tests
1subsystem-summary-of-test
read this skill for a token-efficient summary of the test subsystem
1subsystem-summary-of-scp
read this skill for a token-efficient summary of the scp subsystem
1running-make-to-build
how to run make correctly to get a good build, and otherwise understand the build system
1subsystem-summary-of-history
read this skill for a token-efficient summary of the history subsystem
1subsystem-summary-of-invariant
read this skill for a token-efficient summary of the invariant subsystem
1