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

Ordering Service Batch Support #1586

Merged
merged 19 commits into from
Jul 25, 2018
Merged

Ordering Service Batch Support #1586

merged 19 commits into from
Jul 25, 2018

Conversation

Akvinikym
Copy link
Contributor

Description of the Change

In this pull request support for transaction batches in ordering service was added, which ends the batch pipeline, as after it they go into proposal. Also, one can pay attention that ordering service now accepts only batches, no single transactions anymore (except those which are wrapped into batches).

Benefits

Ends batch pipeline.

Possible Drawbacks

None

@Akvinikym Akvinikym requested review from kamilsa and nickaleks July 23, 2018 08:23
@l4l l4l added needs-review pr awaits review from maintainers new-feature labels Jul 23, 2018
log_->info("Queue size is {}", queue_.unsafe_size());
void OrderingServiceImpl::onBatch(
shared_model::interface::TransactionBatch &&batch) {
current_size_.fetch_add(batch.transactions().size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Race condition related to several concurrent batches

@l4l l4l removed the new-feature label Jul 24, 2018
batch->transactions().end(),
[this, &proto_proposal](auto &tx) {
*proto_proposal.add_transactions() =
static_cast<shared_model::proto::Transaction *>(tx.get())
Copy link
Contributor

Choose a reason for hiding this comment

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

std::static_pointer_cast

#include <rxcpp/rx.hpp>
#include <shared_mutex>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please reorganize includes as follows:

  1. std includes
  2. third party
  3. ours

@@ -157,7 +143,8 @@ TEST_F(OrderingServiceTest, ValidWhenProposalSizeStrategy) {
fake_transport->subscribe(ordering_service);

for (size_t i = 0; i < tx_num; ++i) {
ordering_service->onTransaction(getTx());
auto batch = framework::batch::createValidBatch(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

if you add "namespace framework" you can make it one liner

.WillRepeatedly(Return(true));
EXPECT_CALL(*fake_persistent_state, loadProposalHeight())
.Times(1)
.WillOnce(Return(boost::optional<size_t>(15)));
Copy link
Contributor

Choose a reason for hiding this comment

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

please make 15 a constant. Even better is to replace with expession (batch1.size + batch2.size)

@Akvinikym Akvinikym dismissed stale reviews from kamilsa and nickaleks July 25, 2018 10:02

Fixed

@Akvinikym Akvinikym requested review from kamilsa and nickaleks July 25, 2018 10:03
@Akvinikym Akvinikym changed the base branch from feature/og-os-batch-support to develop July 25, 2018 10:04
log_->info("Queue size is {}", queue_.unsafe_size());
void OrderingServiceImpl::onBatch(
shared_model::interface::TransactionBatch &&batch) {
std::shared_lock<std::shared_timed_mutex> batch_prop_lock(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add comments about why this mutex is necessary

@Akvinikym Akvinikym merged commit 3fb5953 into develop Jul 25, 2018
@Akvinikym Akvinikym deleted the feature/os-batch-support branch July 25, 2018 11:36
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
l4l pushed a commit that referenced this pull request Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-review pr awaits review from maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants