You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove legacy channel codecs and DB migrations (#3150)
* Remove legacy channel codecs
We remove legacy channel codecs (versions earlier than v5). We also
remove the corresponding DB migrations: if node operators try to
upgrade from a version of eclair that is older than v0.13, we tell
them to first run the v0.13 version to migrate their channel data.
We regenerate serialization backwards-compatibility test vectors
based on anchor outputs or taproot channel types.
* Check channels DB version early
We check the channels DB version before running any DB migration, to
ensure that node operators can safely run the v0.13 release first.
Otherwise we may have started migrating an unrelated table to a newer
version that isn't included in the v0.13 release, which would thus
fail at start-up.
* Remove migration from `sqlite` to `postgres`
We now expect users to directly use `postgres` if they expect their node
to become large. The `sqlite` option should only be used for small nodes
for individuals, where it is performant enough.
Running multiple Eclair processes connected to the same database can lead to data corruption and loss of funds.
44
-
That's why Eclair supports database locking mechanisms to prevent multiple Eclair instances from accessing one database together.
42
+
43
+
Running multiple Eclair processes connected to the same database can lead to data corruption and loss of funds.
44
+
That's why Eclair supports database locking mechanisms to prevent multiple Eclair instances from accessing one database together.
45
45
46
46
Use `postgres.lock-type` parameter to set the locking schemes.
47
47
48
-
Lock type | Description
49
-
---|---
50
-
`lease` | At the beginning, Eclair acquires a lease for the database that expires after some time. Then it constantly extends the lease. On each lease extension and each database transaction, Eclair checks if the lease belongs to the Eclair instance. If it doesn't, Eclair assumes that the database was updated by another Eclair process and terminates. Note that this is just a safeguard feature for Eclair rather than a bulletproof database-wide lock, because third-party applications still have the ability to access the database without honoring this locking scheme.
51
-
`none` | No locking at all. Useful for tests. DO NOT USE ON MAINNET!
48
+
Lock type | Description
49
+
-----------|----------------
50
+
`lease` | At the beginning, Eclair acquires a lease for the database that expires after some time. Then it constantly extends the lease. On each lease extension and each database transaction, Eclair checks if the lease belongs to the Eclair instance. If it doesn't, Eclair assumes that the database was updated by another Eclair process and terminates. Note that this is just a safeguard feature for Eclair rather than a bulletproof database-wide lock, because third-party applications still have the ability to access the database without honoring this locking scheme.
51
+
`none`| No locking at all. Useful for tests. DO NOT USE ON MAINNET!
There are two main configuration parameters for the lease locking scheme: `lease.interval` and `lease.renew-interval`.
60
60
`lease.interval` defines lease validity time. During the lease time no other node can acquire the lock, except the lease holder.
61
-
After that time the lease is assumed expired, any node can acquire the lease. So that only one node can update the database
62
-
at a time. Eclair extends the lease every `lease.renew-interval` until terminated.
61
+
After that time the lease is assumed expired, any node can acquire the lease. So that only one node can update the database at a time. Eclair extends the lease every `lease.renew-interval` until terminated.
63
62
64
-
```
63
+
```conf
65
64
eclair.db.postgres.lease {
66
65
interval = 30 seconds // Default: 5 minutes
67
66
renew-interval = 10 seconds // Default: 1 minute
@@ -70,75 +69,38 @@ eclair.db.postgres.lease {
70
69
71
70
### Backups and replication
72
71
73
-
The PostgreSQL driver doesn't support Eclair's built-in online backups. Instead, you should use the tools provided
74
-
by PostgreSQL.
72
+
The PostgreSQL driver doesn't support Eclair's built-in online backups. Instead, you should use the tools provided by PostgreSQL.
75
73
76
74
#### Backup/Restore
77
75
78
-
For nodes with infrequent channel updates its easier to use `pg_dump` to perform the task.
76
+
For nodes with infrequent channel updates its easier to use `pg_dump` to perform the task.
79
77
80
-
It's important to stop the node to prevent any channel updates while a backup/restore operation is in progress. It makes
81
-
sense to back up the database after each channel update, to prevent restoring an outdated channel's state and consequently
82
-
losing the funds associated with that channel.
78
+
It's important to stop the node to prevent any channel updates while a backup/restore operation is in progress. It makes sense to back up the database after each channel update, to prevent restoring an outdated channel's state and consequently losing the funds associated with that channel.
83
79
84
80
For more information about backup refer to the official PostgreSQL documentation: https://www.postgresql.org/docs/current/backup.html
85
81
86
82
#### Replication
87
83
88
84
For busier nodes it isn't practical to use `pg_dump`. Fortunately, PostgreSQL provides built-in database replication which makes the backup/restore process more seamless.
89
85
90
-
To set up database replication you need to create a main database, that accepts all changes from the node, and a replica database.
91
-
Once replication is configured, the main database will automatically send all the changes to the replica.
86
+
To set up database replication you need to create a main database, that accepts all changes from the node, and a replica database.
87
+
Once replication is configured, the main database will automatically send all the changes to the replica.
92
88
In case of failure of the main database, the node can be simply reconfigured to use the replica instead of the main database.
93
89
94
-
PostgreSQL supports [different types of replication](https://www.postgresql.org/docs/current/different-replication-solutions.html).
95
-
The most suitable type for an Eclair node is [synchronous streaming replication](https://www.postgresql.org/docs/current/warm-standby.html#SYNCHRONOUS-REPLICATION),
96
-
because it provides a very important feature, that helps keep the replicated channel's state up to date:
90
+
PostgreSQL supports [different types of replication](https://www.postgresql.org/docs/current/different-replication-solutions.html).
91
+
The most suitable type for an Eclair node is [synchronous streaming replication](https://www.postgresql.org/docs/current/warm-standby.html#SYNCHRONOUS-REPLICATION), because it provides a very important feature, that helps keep the replicated channel's state up to date:
97
92
98
93
> When requesting synchronous replication, each commit of a write transaction will wait until confirmation is received that the commit has been written to the write-ahead log on disk of both the primary and standby server.
99
94
100
-
Follow the official PostgreSQL high availability documentation for the instructions to set up synchronous streaming replication: https://www.postgresql.org/docs/current/high-availability.html
95
+
Follow the official PostgreSQL [high availability documentation](https://www.postgresql.org/docs/current/high-availability.html) for the instructions to set up synchronous streaming replication.
101
96
102
97
### Safeguard to prevent accidental loss of funds due to database misconfiguration
103
98
104
99
Using Eclair with an outdated version of the database or a database created with another seed might lead to loss of funds.
105
100
106
-
Every time Eclair starts, it checks if the Postgres database connection settings have changed since the last start.
107
-
If in fact the settings have changed, Eclair stops immediately to prevent potentially dangerous
108
-
but accidental configuration changes to come into effect.
109
-
110
-
Eclair stores the latest database settings in the `${data-dir}/last_jdbcurl` file, and compares its contents with the database settings from the config file.
111
-
112
-
The node operator can force Eclair to accept new database
113
-
connection settings by removing the `last_jdbcurl` file.
114
-
115
-
### Migrating from Sqlite to Postgres
116
-
117
-
Eclair supports migrating your existing node from Sqlite to Postgres. Note that the opposite (from Postgres to Sqlite) is not supported.
118
-
119
-
:warning: Once you have migrated from Sqlite to Postgres there is no going back!
120
-
121
-
To migrate from Sqlite to Postgres, follow these steps:
122
-
1. Stop Eclair
123
-
2. Edit `eclair.conf`
124
-
1. Set `eclair.db.postgres.*` as explained in the section [Connection Settings](#connection-settings).
125
-
2. Set `eclair.db.driver=dual-sqlite-primary`. This will make Eclair use both databases backends. All calls to sqlite will be replicated in postgres.
126
-
3. Set `eclair.db.dual.migrate-on-restart=true`. This will make Eclair migrate the data from Sqlite to Postgres at startup.
127
-
4. Set `eclair.db.dual.compare-on-restart=true`. This will make Eclair compare Sqlite and Postgres at startup. The result of the comparison is displayed in the logs.
128
-
3. Delete the file `~/.eclair/last_jdbcurl`. The purpose of this file is to prevent accidental change in the database backend.
129
-
4. Start Eclair. You should see in the logs:
130
-
1.`migrating all tables...`
131
-
2.`migration complete`
132
-
3.`comparing all tables...`
133
-
4.`comparison complete identical=true` (NB: if `identical=false`, contact support)
134
-
5. Eclair should then finish startup and operate normally. Data has been migrated to Postgres, and Sqlite/Postgres will be maintained in sync going forward.
135
-
6. Edit `eclair.conf` and set `eclair.db.dual.migrate-on-restart=false` but do not restart Eclair yet.
136
-
7. We recommend that you leave Eclair in dual db mode for a while, to make sure that you don't have issues with your new Postgres database. This a good time to set up [Backups and replication](#backups-and-replication).
137
-
8. After some time has passed, restart Eclair. You should see in the logs:
138
-
1.`comparing all tables...`
139
-
2.`comparison complete identical=true` (NB: if `identical=false`, contact support)
140
-
9. At this point we have confidence that the Postgres backend works normally, and we are ready to drop Sqlite for good.
141
-
10. Edit `eclair.conf`
142
-
1. Set `eclair.db.driver=postgres`
143
-
2. Set `eclair.db.dual.compare-on-restart=false`
144
-
11. Restart Eclair. From this moment, you cannot go back to Sqlite! If you try to do so, Eclair will refuse to start.
101
+
Every time Eclair starts, it checks if the Postgres database connection settings have changed since the last start.
102
+
If in fact the settings have changed, Eclair stops immediately to prevent potentially dangerous but accidental configuration changes to come into effect.
103
+
104
+
Eclair stores the latest database settings in the `${data-dir}/last_jdbcurl` file, and compares its contents with the database settings from the config file.
105
+
106
+
The node operator can force Eclair to accept new database connection settings by removing the `last_jdbcurl` file.
Copy file name to clipboardExpand all lines: docs/release-notes/eclair-vnext.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,11 @@
6
6
7
7
<insertchanges>
8
8
9
+
### Remove support for legacy channel codecs
10
+
11
+
We remove the code used to deserialize channel data from versions of eclair prior to v0.13.
12
+
Node operators running a version of `eclair` older than v0.13 must first upgrade to v0.13 to migrate their channel data, and then upgrade to the latest version.
13
+
9
14
### Update minimal version of Bitcoin Core
10
15
11
16
With this release, eclair requires using Bitcoin Core 29.1.
0 commit comments