Skip to content

Make native SQL mandatory on sqlite/postgres backends, remove --db.use-native-sql opt-out #10787

@ziggie1984

Description

@ziggie1984

Related to #9964 (bbolt deprecation / sqlite as default backend).

Background

LND currently exposes --db.use-native-sql (default false) on sqlite/postgres backends. When unset, invoices, graph, and payments are persisted via KV-on-SQL emulation; when set, they use native SQL schemas. With #6288 (invoices), the graph SQL epic, and #7920 (payments) all landed, every subsystem that has a native schema is now production-ready, and KV-on-SQL is strictly the slower / less-typed of the two paths.

Proposal

Stop offering KV-on-SQL as a runtime option. Concretely:

  1. In lncfg.DB.Validate(), force UseNativeSQL = true whenever the backend is sqlite or postgres. Bolt and etcd remain unaffected (they keep their existing KV path).
  2. Deprecate --db.use-native-sql for one release (logged warning when set explicitly on an SQL backend, ignored otherwise), then remove it.
  3. Drop the bitcoind-sqlite / bitcoind-postgres non-nativesql rows from .github/workflows/main.yml — their nativesql=true counterparts already exercise the only remaining SQL code path.
  4. Migrate or delete unit tests that exercise KV-on-SQL on a SQL backend (audit needed).
  5. Keep --db.skip-native-sql-migration — it's still the escape hatch for migration failures, orthogonal to this change.

Why separate from #9964

#9964 covers what backend new nodes choose by default and when bbolt is blocked for new init. This issue covers the persistence shape used within a chosen SQL backend. They're tightly coupled (defaulting new nodes to sqlite is most useful when sqlite is automatically on the native path) but distinct enough to review and ship independently.

Milestone

v0.22.0, alongside #9964.

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseRelated to the database/storage of LNDenhancementImprovements to existing features / behaviour

    Projects

    Status

    Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions