Skip to content

MINOR: Migrate verificationAllTransactionComplete from EOS system test to smoke test#20718

Merged
mjsax merged 7 commits intoapache:trunkfrom
RaidenE1:migrate_eos
Nov 24, 2025
Merged

MINOR: Migrate verificationAllTransactionComplete from EOS system test to smoke test#20718
mjsax merged 7 commits intoapache:trunkfrom
RaidenE1:migrate_eos

Conversation

@RaidenE1
Copy link
Copy Markdown
Contributor

@RaidenE1 RaidenE1 commented Oct 16, 2025

Migrate verificationAllTransactionComplete and add
VerificationResult to smoke test utils and make
verificationAllTransactionComplete return VerificationResult to
avoid extra exception handling

Refactor the verify() method since it has complexity problem:

  • Extracted preVerifyTransactions: Encapsulates the logic for
    verifying EOS transactions before processing records.
  • Extracted pollAndCollect: Isolates the consumer polling loop,
    partition assignment, and event collection logic.
  • Extracted reportAndFinalize: Handles the calculation of results,
    console reporting, and final verification assertions.
  • Introduced PollResult: A private static helper class used to
    pass state (events, processed counts, results) between the polling and
    reporting phases.

Reviewers: Matthias J. Sax matthias@confluent.io

@github-actions github-actions Bot added triage PRs from the community streams tests Test fixes (including flaky tests) labels Oct 16, 2025
@github-actions
Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

Copy link
Copy Markdown
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Overall LGTM. A few minor comments to simplify further: think we can just use a single consumer instead of creating two.

consumer.seekToBeginning(partitions);
// Verify all transactions are finished before proceeding with data verification
if (eosEnabled) {
final Properties txnProps = new Properties();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems this are the same config we setup above for props. Seems we could just reuse the ones from above?

txnProps.put(ConsumerConfig.ISOLATION_LEVEL_CONFIG, IsolationLevel.READ_COMMITTED.toString());

final VerificationResult txnResult;
try (final KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<>(txnProps)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seem we are creating a consumer here, and also below. Could we re-use the same consumer? Ie use a top level try (final KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<>(...)) and nest if (eosEnabled) block inside this try-catch, as well as the other verification we do later?

@github-actions github-actions Bot removed needs-attention triage PRs from the community labels Nov 6, 2025
consumer.seekToBeginning(partitions);
private static VerificationResult preVerifyTransactions(final String kafka, final boolean eosEnabled) {
if (!eosEnabled) {
return null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we return null? Might be easier to return a VerificationResult with passed == true?

System.out.println("FAILED");
return txnResult;
}
return null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As above -- why do we convert a "passed" into null ? Kinda confusing.

final int maxRecordsPerKey,
final boolean eosEnabled) {
final VerificationResult txnResult = preVerifyTransactions(kafka, eosEnabled);
if (txnResult != null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not seem to be easy to reason about? If txnResult is not null and passed, we only know that all transactions completed, but we cannot stop the verification yet -- we could only exit early if we get a "false" VerifcationResult.

This code does only make sense if one knows how preVerifyTransactions works, and it would return null for "passed == true" case, but it make the code hard to ready.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense, updated

@mjsax mjsax merged commit a162393 into apache:trunk Nov 24, 2025
32 of 34 checks passed
@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 24, 2025

Thanks for the PR. Merged to trunk.

TaiJuWu pushed a commit to TaiJuWu/kafka that referenced this pull request Dec 3, 2025
…est to smoke test (apache#20718)

Migrate `verificationAllTransactionComplete` and add
`VerificationResult` to smoke test utils and make
`verificationAllTransactionComplete` return `VerificationResult` to
avoid extra exception handling.

Reviewers: Matthias J. Sax <matthias@confluent.io>
mjsax pushed a commit that referenced this pull request Dec 4, 2025
After #6382, the system test
streams_eos_test.py is redundant. As in
#20718, the verification logic has
already been migrated, so we only need to delete the related system
tests

Reviewers: Matthias J. Sax <matthias@confluent.io>
shashankhs11 pushed a commit to shashankhs11/kafka that referenced this pull request Dec 15, 2025
…est to smoke test (apache#20718)

Migrate `verificationAllTransactionComplete` and add
`VerificationResult` to smoke test utils and make
`verificationAllTransactionComplete` return `VerificationResult` to
avoid extra exception handling.

Reviewers: Matthias J. Sax <matthias@confluent.io>
shashankhs11 pushed a commit to shashankhs11/kafka that referenced this pull request Dec 15, 2025
After apache#6382, the system test
streams_eos_test.py is redundant. As in
apache#20718, the verification logic has
already been migrated, so we only need to delete the related system
tests

Reviewers: Matthias J. Sax <matthias@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved streams tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants