Developers

Removing Ledger State from SQL Databases in 22.1

Author

Garand Tyson

Publishing date

Starting in the stellar-core 22.1 release, SQL will no longer be supported for most ledger state and transaction history. In particular, the following tables will be dropped:

  • ACCOUNT
  • TRUSTLINE
  • DATA
  • CLAIMABLE_BALANCE
  • LIQUIDITY_POOL
  • CONTRACT_DATA
  • CONTRACT_CODE
  • CONFIG_SETTING
  • TTL
  • TXSETHISTORY
  • TXHISTORY

These tables have been deprecated for several releases, but could still be enabled via the DEPRECATED_SQL_LEDGER_STATE configuration option. stellar-core 22.0 will be the final package that supports the DEPRECATED_SQL_LEDGER_STATE, meaning these tables will be dropped unconditionally starting in 22.1. The DEPRECATED_SQL_LEDGER_STATE config option will be ignored in 22.1 then removed in 23.0.

Additionally, the --in memory mode flag is no longer supported starting in 22.1. If this flag is set, it will be ignored and the validator will start in BucketListDB mode. The flag will be removed entirely in 23.0.

Accessing Ledger State

To support ledger state queries, stellar-core 22.0 introduces a high throughput HTTP query server with the `getledgerentryraw` endpoint. Pipelines that currently rely on direct access to stellar-core SQL tables for ledger state access should transition to this new endpoint. `getledgerentryraw` is capable of arbitrary key-value loads with benchmarks similar to SQL. When testing over `localhost`, the endpoint was capable of serving 20,000 requests per second with an average roundtrip latency of 500µs. By default, the stellar-core HTTP query server and `getledgerentryraw` will be disabled. For more information on enabling and using this endpoint, please refer to the “HTTP Query Server” section of the stellar-core command docs. While the interface is a simple HTTP POST query, the StellarCoreClient additionally provides a Go interface for interacting with this endpoint but is not necessary.

Transaction and Transaction Set History

While the `getledgerentryraw` can be used to query for ledger state, stellar-core will no longer store or expose transaction and transaction set history. If this information is required, it is recommended to either run an RPC or Horizon node or query public history archives.

Questions? Comments? Please raise them on the Stellar Dev Discord #validator channel.