From 2115e338ca803cba2a5a7244c8b90f9f26d1e131 Mon Sep 17 00:00:00 2001 From: 84adam <84adam@gmail.com> Date: Wed, 22 Feb 2023 22:04:57 -0700 Subject: [PATCH] docs: add notes on contents of Postgres DB as Key-Value store to Postgres.md --- docs/postgres.md | 20 ++++++++++++++++++++ docs/release-notes/release-notes-0.16.0.md | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/docs/postgres.md b/docs/postgres.md index da03c2730..582c97159 100644 --- a/docs/postgres.md +++ b/docs/postgres.md @@ -45,3 +45,23 @@ might be slow for unexpected reasons. ## Important note about replication In case a replication architecture is planned, streaming replication should be avoided, as the master does not verify the replica is indeed identical, but it will only forward the edits queue, and let the slave catch up autonomously; synchronous mode, albeit slower, is paramount for `lnd` data integrity across the copies, as it will finalize writes only after the slave confirmed successful replication. + +## What is in the database? + +At present, the Postgres Database functions as a Key-Value Store, much as Bolt DB does. Some values are TLV-encoded while others are not. More schema will be introduced over time. At present the schema for each table/relation is simply: `key`, `value`, `parent_id`, `id`, `sequence`. + +List of tables/relations: + +``` + List of relations + Schema | Name | Type | Owner +--------+------------------+-------+---------- + public | channeldb_kv | table | lndadmin + public | decayedlogdb_kv | table | lndadmin + public | macaroondb_kv | table | lndadmin + public | towerclientdb_kv | table | lndadmin + public | towerserverdb_kv | table | lndadmin + public | walletdb_kv | table | lndadmin +``` + +Notably, Invoice DB is maintained separately alongside the LND node. diff --git a/docs/release-notes/release-notes-0.16.0.md b/docs/release-notes/release-notes-0.16.0.md index 4b033687c..5d0660807 100644 --- a/docs/release-notes/release-notes-0.16.0.md +++ b/docs/release-notes/release-notes-0.16.0.md @@ -498,6 +498,10 @@ in the lnwire package](https://github.com/lightningnetwork/lnd/pull/7303) [`tools`](https://github.com/lightningnetwork/lnd/pull/7254) and golangci issue where [it cannot fetch commits](https://github.com/lightningnetwork/lnd/pull/7374). + +* [Update Postgres.md](https://github.com/lightningnetwork/lnd/pull/7442) + to clarify how the database is currently used as a Key-Value store, but + in the future will have new schema introduced. ### Integration test @@ -519,6 +523,7 @@ refactor the itest for code health and maintenance. # Contributors (Alphabetical Order) +* Adam Anderson * Alejandro Pedraza * Alyssa Hertig * Andras Banki-Horvath