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

Issue #66: Load isn't getting generated in case transaction size is higher than 1 #67

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

AndreyKoltsov1997
Copy link

Fixes #66
Add handling of consumer / producer readiness probe from OpenMessaging Framework side in case the size of transaction had been set to value greater than 1.

koltsa and others added 4 commits June 22, 2021 20:34
Signed-off-by: koltsa <[email protected]>
Signed-off-by: AndreyKoltsov1997 <[email protected]>
…igher-than-one' of https://github.com/AndreyKoltsov1997/openmessaging-benchmark into issue-66-load-isnt-getting-generated-in-case-txn-size-higher-than-one
Signed-off-by: AndreyKoltsov1997 <[email protected]>
@AndreyKoltsov1997 AndreyKoltsov1997 force-pushed the issue-66-load-isnt-getting-generated-in-case-txn-size-higher-than-one branch from 7c6af63 to 2f2438a Compare June 22, 2021 17:47
@@ -25,6 +25,7 @@
import io.pravega.client.stream.Transaction;
import io.pravega.client.stream.TransactionalEventStreamWriter;
import io.pravega.client.stream.TxnFailedException;
import org.checkerframework.checker.nullness.Opt;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks unnecessary, right?

Copy link
Author

Choose a reason for hiding this comment

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

I agree. Removed in 6e73409

}

/**
* Implements writer probe in case of transaction via populating it with ...
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: maybe you can remove the dots.

@@ -63,6 +64,9 @@ public PravegaBenchmarkTransactionProducer(String streamName, EventStreamClientF
@Override
public CompletableFuture<Void> sendAsync(Optional<String> key, byte[] payload) {
try {
if (this.probeRequested(key)) {
this.probeTransaction(key, payload, this.eventsPerTransaction);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this return the future here? probeTransaction returns CompletableFuture.completedFuture(null), but seems to be never used. I think that this could be reworked as follows to prevent duplicating logic:

if (transaction == null) {
    transaction = transactionWriter.beginTxn();
}
if (this.probeRequested(key)) {
    // Populate transaction with the sufficient amount of events
    for (int i = 0; i < eventsPerTxn; i++) {
        transaction.writeEvent(key.get(), ByteBuffer.wrap(payload));
    }
}

Now, I assume that ++eventCount >= eventsPerTransaction is going to be true, so the commit will be invoked, right? This means that we can get rid of probeTransaction method. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I think that totally makes sense.
There're 2 reasons why I've put the probe of transaction into a separate method:

  1. Clarification. At least for me, that was initially unclear that OpenMessaging framework requests a probe of producer prior to load generation, that's why I've put it into docstrings. However, that could be changed with a single-line comment.
  2. Prevention of writing an extra event. We'd write additional event outside of probeness context. However, since we'd write sufficient amount of events with probeness payload into transaction, additional event wouldn't fail it.
if (transaction == null) { ... }
if (includeTimestampInEvent) { ... }

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.

Load isn't getting generated in case transaction size is higher than 1.
2 participants