-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metadata to local_channels table #1724
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
That sounds reasonable, these are good reasons to go down that route. |
Move it to the `db` package (it was in the `payments` package for historical reasons but doesn't deal only with payment anymore). Better typing for channel lifecycle event.
Here is the rationale for implementing channel metadata as additional columns in the `local_channels` table of the `channels` db, as opposed to a dedicated `channel_metadata` table of a `audit` db: 1) There is a migration to do (in the `local_channels` table, no less!), but it's just a table migration, as opposed to a data migration, if we had to populate a new table in a separate database. 2) We don't need to worry about creating a new metadata line when a new channel is created (compared to doing add-or-update stuff). It's only _updating_ optional columns in a best-effort manner. 3) We don't need to worry about inconsistencies between two tables located in two separated databases (that's a big one). 4) We may want to use the metadata during operations, not just for audit purposes. For example to close channels that have stayed unused for a long time. 5) The audit db is an append-only log of events and shouldn't be used for anything else. There is no `UPDATE` sql statement in `*AuditDb.scala`. The `channel_metadata` would break that heuristic.
t-bast
reviewed
Mar 10, 2021
eclair-core/src/main/scala/fr/acinq/eclair/db/DbEventHandler.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/db/SqliteChannelsDbSpec.scala
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1724 +/- ##
==========================================
- Coverage 86.30% 86.22% -0.08%
==========================================
Files 151 151
Lines 11701 11781 +80
Branches 501 498 -3
==========================================
+ Hits 10098 10158 +60
- Misses 1603 1623 +20
|
t-bast
approved these changes
Mar 10, 2021
tompro
pushed a commit
to tompro/eclair
that referenced
this pull request
Mar 21, 2021
* rename `Auditor` to `DbEventHandler` Move it to the `db` package (it was in the `payments` package for historical reasons but doesn't deal only with payment anymore). Better typing for channel lifecycle event. * add meta info to local_channels table Here is the rationale for implementing channel metadata as additional columns in the `local_channels` table of the `channels` db, as opposed to a dedicated `channel_metadata` table of a `audit` db: 1) There is a migration to do (in the `local_channels` table, no less!), but it's just a table migration, as opposed to a data migration, if we had to populate a new table in a separate database. 2) We don't need to worry about creating a new metadata line when a new channel is created (compared to doing add-or-update stuff). It's only _updating_ optional columns in a best-effort manner. 3) We don't need to worry about inconsistencies between two tables located in two separated databases (that's a big one). 4) We may want to use the metadata during operations, not just for audit purposes. For example to close channels that have stayed unused for a long time. 5) The audit db is an append-only log of events and shouldn't be used for anything else. There is no `UPDATE` sql statement in `*AuditDb.scala`. The `channel_metadata` would break that heuristic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(First commit is a refactor/cleanup and can be reviewed independently).
Here is the rationale for implementing channel metadata as additional
columns in the
local_channels
table of thechannels
db, as opposedto a dedicated
channel_metadata
table of aaudit
db:local_channels
table, no less!),but it's just a table migration, as opposed to a data migration, if we
had to populate a new table in a separate database.
channel is created (compared to doing add-or-update stuff). It's only
updating optional columns in a best-effort manner.
located in two separated databases (that's a big one).
audit purposes. For example to close channels that have stayed unused
for a long time.
for anything else. There is no
UPDATE
sql statement in*AuditDb.scala
. Thechannel_metadata
would break that heuristic.