-
Notifications
You must be signed in to change notification settings - Fork 421
Remove lazy
flag from {KVStore,KVStoreSync}::remove
#4116
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
Conversation
👋 Thanks for assigning @joostjager as a reviewer! |
85df008
to
466f04e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I mean I'm definitely open to this, but the claim that it has no utility is obviously somewhat dubious given FilesystemStore
does use it. Avoiding the fsync
when removing in the FS Store is a pretty nontrivial speedup, and given we're about to start calling remove
in the background processor (for lightning-liquidity
pruning), it seems like a nice thing to have.
ISTM, though, that in fact ~all our removes are lazy, so arguably we could just make it the default.
In any case, I agree its a bit confusing wrt ordering requirements, but maybe we could clarify it somewhat by being explicit that lazy
has no impact on any ordering requirements or any other logic and it only means that the file is allowed to re-appear after a crash?
Do you think it makes a meaningful difference in practice? What should be thought of, removal of a channel with a large number of updates? If it's just theoretical, I'd also favor doing only the atomic one always. |
Avoiding an All of that is somewhat speculative, of course. Given we're moving towards async in most places, I wouldn't mind dropping the lazy flag generally for monitor-removal, but I am somewhat concerned about the LSPS persistence stuff trying to remove + fsync a bunch of stuff in parallel in the same folder at the same time. Maybe we don't anticipate much churn in the persisted state for LSPS*? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I am in favor of simplifying things. Especially if the benefits of keeping lazy are not all that clear in practice.
Did a brief scan for lightning-liquidity removes. It seems that's only happening when a client has no more channels and also isn't connected. Doesn't look very impactful to do a sync remove in that case, but leaving final judgement to @tnull
e109229
to
dce16bf
Compare
Rebased to address silent conflicts, have yet to look into why fuzzer previously failed: https://github.com/lightningdevkit/rust-lightning/actions/runs/17969992988/job/51110133106?pr=4116 |
dce16bf
to
09f9621
Compare
Fixed, thanks for the hint @joostjager . |
I think it should be fine for now, at least until we gain more insight into user data that indicates otherwise. Note that in the LSPS context a |
The utility of the `lazy` flag was always not entirely clear mod some cloud environments where you actually could save an explicit call in some scenarios by batching the remove with subsequent calls. However, given the recent addition of the async `KVStore` introduced addtional ordering constraints its unclear how implementation could actually still benefit from the 'eventual' consistency properties originally envisioned. As the `lazy` flag then just amounts to a bunch of additonal complexity everywhere, we here simply drop it from the `KVStore`/`KVStoreSync` interfaces, simplifying implementations on both ends.
09f9621
to
561da4c
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4116 +/- ##
==========================================
+ Coverage 88.53% 88.54% +0.01%
==========================================
Files 179 179
Lines 134329 134300 -29
Branches 134329 134300 -29
==========================================
- Hits 118923 118918 -5
+ Misses 12656 12618 -38
- Partials 2750 2764 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright
This is trivial, landing. |
Alternative to #4113.
The utility of the
lazy
flag was always not entirely clear mod some cloud environments where you actually could save an explicit call in some scenarios by batching the remove with subsequent calls. However, given the recent addition of the asyncKVStore
introduced addtional ordering constraints its unclear how implementation could actually still benefit from the 'eventual' consistency properties originally envisioned.As the
lazy
flag then just amounts to a bunch of additonal complexity everywhere, we here simply drop it from theKVStore
/KVStoreSync
interfaces, simplifying implementations on both ends.