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

In memory testing #4562

Merged
merged 2 commits into from
Dec 13, 2024
Merged

In memory testing #4562

merged 2 commits into from
Dec 13, 2024

Conversation

SirTyson
Copy link
Contributor

@SirTyson SirTyson commented Nov 27, 2024

Description

Resolves #4501 and partially resolves #4502

This PR removes --in-memory. Specifically, core will not crash if this flag is passed in for Horizon compatibility reasons, but will ignore it and related flags.

Additionally, --in-memory has been cannibalized to use in testing. Previously, any test that committed changes directly to the root ltx was incompatible with BucketListDB and required SQL. This is an issue, as we are deprecating SQL for ledger state, and it would not make sense to maintain this SQL overhead for testing only. While I've removed most of the in-memory code, I've saved the bits regarding the never committing ledger root to use for the direct ltx commit test cases. Thus we remove the test dependency for SQL.

In order to properly test the orderbook, the in-memory testing mode still maintains and queries a SQL database just for offers (similar to what BucketListDB does).

Originally I did one PR for removing SQL, --in-memory and mandating background eviction. This was way to big to merge but may be helpful in providing context on what changes are in flight after this PR: #4504.

Currently everything works except for the "herder externalizes values" test. With BucketListDB testing mode, nodes can be restarted, but direct ltx commits are not supported. With the in-memory mode testing, ltx can be committed to directly, but nodes can not be restarted.

For all tests except for "herder externalizes values", this if fine. However, "herder externalizes values" is the only test that both directly commits to the ltx and restarts nodes. In particular, the setupUpgradeAtNextLedger function directly commits to the ltx. I've seperated the test into two helper functions, one that doesn't require restart and one that does. I think that the restart test doesn't actually require an upgrade to occur. I think the test just used upgrades in order to populate ledgers with some meaningful, detectable work to make sure externalized ledgers aren't applied several times. If the upgrade operation is not integral to this test, we can probably find a workaround. Alternatively, we can maybe go through the full upgrade arming process with BucketListDB support instead of cutting corners with direct ltx commits. I'm not well versed in herder tests though, so I've left the failing test as is. If we can remove the upgrade and check the condition some other way, this is the path of least resistance.

Test has been fixed to use upgrades compatible with BucketListDB.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@dmkozh
Copy link
Contributor

dmkozh commented Nov 27, 2024

I think the test just used upgrades in order to populate ledgers with some meaningful,

I don't think that's the reason, the upgrade is there to make sure that ledgers with upgrades can be externalized out of order (that's important due to how config changes impact the internal core state). #4012 is the issue for which this has been introduced. So I don't think we should remove this.

Alternatively, we can maybe go through the full upgrade arming process with BucketListDB support instead of cutting corners with direct ltx commits.

Yeah, I think that's the right course of the action.

Copy link
Contributor

@bboston7 bboston7 left a comment

Choose a reason for hiding this comment

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

I agree with @dmkozh that the upgrade-specific logic seems important to test here.

Alternatively, we can maybe go through the full upgrade arming process with BucketListDB support instead of cutting corners with direct ltx commits.

I think this is a good idea even independent of the details of this specific test. When possible, avoiding the corner-cutting should lead to a more realistic and better overall test IMO.

src/ledger/InMemoryLedgerTxn.h Outdated Show resolved Hide resolved
src/main/CommandLine.cpp Show resolved Hide resolved
src/main/CommandLine.cpp Show resolved Hide resolved
src/main/CommandLine.cpp Show resolved Hide resolved
@SirTyson
Copy link
Contributor Author

Got the test to work with BucketList friendly upgrades and pushed some cleanups around BUILD_TESTS flags, should be good to go now.

@SirTyson SirTyson force-pushed the in-memory-testing branch 2 times, most recently from 4605954 to 76a92d9 Compare December 2, 2024 02:08
@SirTyson SirTyson requested a review from bboston7 December 2, 2024 16:56
Copy link
Contributor

@bboston7 bboston7 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 fixes! I don't have permissions to mark comment threads as "resolved" in this repo, but you can consider all of my comments resolved.

dmkozh
dmkozh previously approved these changes Dec 10, 2024
Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

In general this looks good -- it's hard to understand the motive exactly and the exact nature of the repurposing that's going on here (had to chat with you) so I think some additional comments would be good, but I think that's about all. A couple other nits I was curious about noted along the way. Happy to try to get it landed quickly so you don't need to keep rebasing.

docs/integration.md Outdated Show resolved Hide resolved
src/herder/test/HerderTests.cpp Show resolved Hide resolved
src/herder/test/HerderTests.cpp Show resolved Hide resolved
src/herder/test/HerderTests.cpp Outdated Show resolved Hide resolved
src/main/ApplicationImpl.h Outdated Show resolved Hide resolved
src/main/Config.h Show resolved Hide resolved
src/main/test/ExternalQueueTests.cpp Show resolved Hide resolved
src/main/test/ApplicationUtilsTests.cpp Show resolved Hide resolved
src/ledger/LedgerManagerImpl.cpp Outdated Show resolved Hide resolved
graydon
graydon previously approved these changes Dec 10, 2024
Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@marta-lokhova marta-lokhova left a comment

Choose a reason for hiding this comment

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

Looks good overall, a few comments/questions

src/main/Config.cpp Show resolved Hide resolved
src/simulation/Simulation.cpp Show resolved Hide resolved
src/main/ApplicationImpl.cpp Show resolved Hide resolved
src/main/ApplicationUtils.cpp Outdated Show resolved Hide resolved
src/main/test/ApplicationUtilsTests.cpp Outdated Show resolved Hide resolved
src/main/ApplicationImpl.cpp Show resolved Hide resolved
src/herder/test/HerderTests.cpp Show resolved Hide resolved
src/main/ApplicationUtils.cpp Show resolved Hide resolved
@SirTyson SirTyson enabled auto-merge December 13, 2024 00:57
@SirTyson SirTyson added this pull request to the merge queue Dec 13, 2024
Merged via the queue into stellar:master with commit e3c7a81 Dec 13, 2024
13 checks passed
@SirTyson SirTyson deleted the in-memory-testing branch December 13, 2024 21:02
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.

Deprecate SQL for Ledger state Deprecate --in-memory mode
5 participants