Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Feature/mst shared limit #2230

Open
wants to merge 5 commits into
base: feature/shared-storage-limit
Choose a base branch
from

Conversation

MBoldyrev
Copy link
Contributor

Description of the Change

Reworked completed MST batches propagation to PCS:

  • completed batches are sent to an instance of MstToPcsPropagation
  • MstToPcsPropagation tries to pass them to PCS
  • if PCS rejects them, MstToPcsPropagation waits till a notification with available room for transactions and resends the fitting batches

MstToPcsPropagation uses the same shared limit with the rest MST batches storages, which prevents new batches from being accepted until previously accepted either expire or come to PCS.

Benefits

Solves the memory growth problem.

Possible Drawbacks

Usage Examples or Tests [optional]

Please see mst_to_psc_propagation_test.

Alternate Designs [optional]

@MBoldyrev MBoldyrev added needs-review pr awaits review from maintainers mst multisignature transactions labels Apr 16, 2019
@MBoldyrev MBoldyrev self-assigned this Apr 16, 2019
Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
Copy link
Contributor

@igor-egorov igor-egorov left a comment

Choose a reason for hiding this comment

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

Thanks! Cool

if (not pcs_->propagate_batch(moved_batch->get())) {
if (not pending_batches_.insert(std::move(moved_batch))) {
log_->critical(
"Dropped a completed MST batch because no place left in storage: {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually, space is used in that context (even if place is more technically correct because it is internals that are not an object of interest for the external interface user).

Suggested change
"Dropped a completed MST batch because no place left in storage: {}",
"Dropped a completed MST batch because no space left in storage: {}",


bool MstToPcsPropagation::InternalStorage::insert(BatchPtr batch) {
pending_batches.emplace_back(std::move(batch));
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unconditional return type 🤔

auto completed_batches = batches_.move([this, &state_update, &rhs_batch](
auto &storage)
-> std::vector<BatchPtr> {
auto corresponding = storage.batches.right.find(rhs_batch);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be very glad if you will use any other variable name instead of "corresponding". Hope this is possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
mst multisignature transactions needs-review pr awaits review from maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants