Skip to content
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

Make read-only ledger state const #4602

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

marta-lokhova
Copy link
Contributor

@marta-lokhova marta-lokhova commented Jan 2, 2025

Improve access to ledger state, to better support parallelization changes in #4543

Note that management of SorobanNetworkConfig is still not great, as currently LM manages multiple versions of the config. Ideally, soroban network config lives inside of the state snapshot (either BucketList snapshot or LedgerTxn), but this was too tricky to implement at this time due to how network config is currently implemented. We may need to clean this up later.

This change also partially addresses #4318

src/bucket/BucketSnapshotManager.cpp Outdated Show resolved Hide resolved
src/ledger/LedgerManagerImpl.cpp Show resolved Hide resolved
src/ledger/LedgerManagerImpl.h Show resolved Hide resolved
src/main/QueryServer.cpp Outdated Show resolved Hide resolved
src/transactions/TransactionUtils.h Outdated Show resolved Hide resolved
Copy link
Contributor

@SirTyson SirTyson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of the interface where we maintain two separate copies of SorobanNetworkConfigSettings at the LedgerManager level, as it sometimes unclear which method to use and can lead to tricky bugs (such as with background eviction). Given that the network settings are part of ledger state, I would still prefer threads to maintain a canonical snapshot and route all ledger based queries through that snapshot, including LedgerEntry, ledger header, and network setting accesses. That being said, I wanna get you unstuck, and am fine with this approach in the interim as we move towards more thread safety in general. To merge this I do think it would be good to clean up the new snapshot interface a bit, specifically with the maybeUpdateSnapshot issues I raised + atomic snapshot swaps.

src/bucket/BucketListSnapshotBase.cpp Outdated Show resolved Hide resolved
src/bucket/BucketSnapshotManager.cpp Outdated Show resolved Hide resolved
src/bucket/BucketSnapshotManager.cpp Outdated Show resolved Hide resolved
src/ledger/LedgerManager.h Show resolved Hide resolved
@marta-lokhova
Copy link
Contributor Author

@dmkozh @SirTyson thanks for taking a look! I believe your comments are addressed now.

Copy link
Contributor

@SirTyson SirTyson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, looking good! One minor bug and a bunch of small nitpicky cleanups.

src/bucket/BucketSnapshotManager.cpp Outdated Show resolved Hide resolved
src/bucket/BucketSnapshotManager.cpp Outdated Show resolved Hide resolved
src/bucket/BucketSnapshotManager.h Show resolved Hide resolved
src/bucket/test/BucketIndexTests.cpp Outdated Show resolved Hide resolved
src/ledger/LedgerManagerImpl.cpp Outdated Show resolved Hide resolved
src/ledger/LedgerStateSnapshot.h Show resolved Hide resolved
src/main/QueryServer.cpp Outdated Show resolved Hide resolved
src/transactions/TransactionFrame.cpp Outdated Show resolved Hide resolved
SirTyson
SirTyson previously approved these changes Jan 3, 2025
Copy link
Contributor

@SirTyson SirTyson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SirTyson SirTyson added this pull request to the merge queue Jan 3, 2025
Merged via the queue into stellar:master with commit 7a4110a Jan 3, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants