-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
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]>
7c6af63
to
2f2438a
Compare
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unnecessary, right?
There was a problem hiding this comment.
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 ... |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- 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.
- 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) { ... }
Signed-off-by: Andrey Koltsov <[email protected]>
Signed-off-by: Andrey Koltsov <[email protected]>
Signed-off-by: AndreyKoltsov1997 <[email protected]>
Signed-off-by: AndreyKoltsov1997 <[email protected]>
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.