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

Simulate transaction application #2179

Merged
merged 6 commits into from
Jul 11, 2019

Conversation

jonjove
Copy link
Contributor

@jonjove jonjove commented Jul 2, 2019

This PR adds a simulate mode to stellar-core which permits replay of transactions from a history archive at an increased number of operations per ledger. This will be useful for testing the performance characteristics of stellar-core.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v5.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

Copy link
Contributor

@MonsieurNicolas MonsieurNicolas left a comment

Choose a reason for hiding this comment

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

only a few minor changes needed

src/catchup/simulation/HistoryArchiveStream.cpp Outdated Show resolved Hide resolved
computeContentsHash(Hash const& previousLedgerHash,
std::vector<TransactionEnvelope> transactions)
{
std::sort(
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a bit unfortunate that we're duplicating a lot of code from TxSetFrame, can we instead just have a TxSetFrame member that we use to delegate all those things?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difficulty here is closely related to #2163. I see three options here:

  1. Leave it as is
  2. Implement a static template function in TxSetFrame that computes the contents hash, with a signature like
template <typename T>
computeContentsHash(
    Hash const& previousLedgerHash,
    std::vector<T> transactions,
    std::function<bool(T const&, T const&)> comp,
    std::function<xdr::opaque_vec<>(T const&)> toOpaque);
  1. Construct an instance of TxSetFrame to compute the hash

Given the choices, I prefer 1 or 3. We are already doing something quite like 3 in ApplyTransactionsWork::getNextLedgerFromHistoryArchive where we construct an instance of TxSetFrame to get the apply order. My main issue with 3 is that I don't like constructing such a substantial object just to destroy it immediately (I don't like doing it for the apply order either). Let me know what you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah 3 seems fine for now, the performance impact of it should go away when #2163 is done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

src/main/CommandLine.cpp Outdated Show resolved Hide resolved
src/main/CommandLine.cpp Outdated Show resolved Hide resolved
src/main/CommandLine.cpp Outdated Show resolved Hide resolved
src/main/CommandLine.cpp Outdated Show resolved Hide resolved

FileTransferInfo info(
mDownloadDir, HISTORY_FILE_TYPE_LEDGER,
mHistoryManager.nextCheckpointLedger(ledgerSeq + 1) - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use checkpointContainingLedger() method for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jonjove jonjove force-pushed the simulate-transaction-application branch 2 times, most recently from a1a6574 to 7a988c2 Compare July 10, 2019 14:45
@MonsieurNicolas MonsieurNicolas added this to In progress in v11.3.0 via automation Jul 10, 2019
@MonsieurNicolas
Copy link
Contributor

r+ fc1e49dbe57c8df0dc94a3918e280cac8e9e19c1

@jonjove jonjove force-pushed the simulate-transaction-application branch from fc1e49d to 92b8531 Compare July 11, 2019 13:43
@MonsieurNicolas
Copy link
Contributor

r+ 92b8531

latobarita added a commit that referenced this pull request Jul 11, 2019
Simulate transaction application

Reviewed-by: MonsieurNicolas
@latobarita latobarita merged commit 92b8531 into stellar:master Jul 11, 2019
v11.3.0 automation moved this from In progress to Done Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v11.3.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants