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

KAFKA-5362: Add Streams EOS system test with repartitioning topic #3310

Conversation

mjsax
Copy link
Member

@mjsax mjsax commented Jun 13, 2017

No description provided.

@mjsax
Copy link
Member Author

mjsax commented Jun 13, 2017

Call for review @bbejeck @enothereska @dguy @guozhangwang

@mjsax
Copy link
Member Author

mjsax commented Jun 13, 2017

@asfbot
Copy link

asfbot commented Jun 13, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5196/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jun 13, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5212/
Test FAILed (JDK 7 and Scala 2.11).

@mjsax
Copy link
Member Author

mjsax commented Jun 13, 2017

Branch builder failed before starting the test... retriggered at https://jenkins.confluent.io/job/system-test-kafka-branch-builder-2/324/

@mjsax mjsax force-pushed the kafka-5362-add-eos-system-tests-for-streams-api branch from 71afa21 to 435d821 Compare June 14, 2017 16:02
@mjsax
Copy link
Member Author

mjsax commented Jun 14, 2017

Failing system test was due to broker bug that got fixed. Rebased and rerunning system test now: https://jenkins.confluent.io/job/system-test-kafka-branch-builder-2/326/

@asfbot
Copy link

asfbot commented Jun 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5306/
Test PASSed (JDK 7 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jun 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5290/
Test PASSed (JDK 8 and Scala 2.12).

@mjsax
Copy link
Member Author

mjsax commented Jun 14, 2017

System test passed: https://jenkins.confluent.io/job/system-test-kafka-branch-builder-2/328/
(seems you need to schedule a new build -- rerunning a failed one after a rebase seems to use the old version and does not pick up the change)

if (withRepartitioning) {
final KStream<String, Integer> repartitionedData = data.through("repartition");

repartitionedData.process(SmokeTestUtil.printProcessorSupplier("repartition"));
Copy link
Contributor

Choose a reason for hiding this comment

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

While checking the SmokeTestUtil code: some of the static variables are not used any more and hence can be removed.


final KGroupedStream<String, Integer> groupedData2 = repartitionedData.groupByKey();
// max
groupedData2
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: groupedData2 -> groupedDataAfterRepartition

private static boolean receivedAllRecords(final Map<String, Map<TopicPartition, List<ConsumerRecord<byte[], byte[]>>>> receivedRecords,
final Map<TopicPartition, Long> committedOffsets,
final boolean withRepartitioning) {
if (receivedRecords == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would never happen now since the passed in recordPerTopicPerPartition is always initialized.

// repartition -> max, cnt

final Map<String, List<String>> inputToOutputTopics = new HashMap<>();
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This bracket seems not necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I used it to scope the initialization for inputToOutputTopics -- this make the code more readable IMHO as you can easily see where the initialization code "ends".


final TopicPartition outputTp = new TopicPartition(outputTopic, partition);
final List<ConsumerRecord<byte[], byte[]>> records = received.get(outputTp);
if (records == null || records.size() < offset) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check records.size() < offset seems a bit sketchy to me. Basically we are assuming that the input topic data's starting offset is always 0, and there is no "holes" in the topic partitions so that the offset indicates the number of records we can read from the input topic.

Maybe a more robust way to do that would be

  1. read the input topics data and optionally repartition based on withRepartitioning, stop when the current record's offset is equal to or larger than the committed offset, and remember the number of records;
  2. read the output topics (again optionally repartition) from the beginning to the end (use seekTo), and check that the number of records are the same as the number of records read from the input.

Then we do not need to truncate, and also in verification we do not need to check list size again since they are already checked here.

@mjsax mjsax force-pushed the kafka-5362-add-eos-system-tests-for-streams-api branch from 435d821 to 5866817 Compare June 16, 2017 05:03
@mjsax
Copy link
Member Author

mjsax commented Jun 16, 2017

Updated. Retriggered branch builder: https://jenkins.confluent.io/job/system-test-kafka-branch-builder-2/329/

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5370/
Test FAILed (JDK 8 and Scala 2.12).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5385/
Test FAILed (JDK 7 and Scala 2.11).

@mjsax
Copy link
Member Author

mjsax commented Jun 16, 2017

Branch builder failed with

Exception in thread "main" java.lang.RuntimeException: Result verification failed for ConsumerRecord(topic = min, partition = 3, offset = 4046, CreateTime = 1497609794842, serialized key size = 2, serialized value size = 4, headers = RecordHeaders(headers = [], isReadOnly = false), key = [B@4f69385e, value = [B@4f3cc0d) expected <47,3854> but was <47,3854>

Note the expected <47,3854> but was <47,3854> -- ??? Will just rerun it again. System tests did pass locally.

New run at: https://jenkins.confluent.io/job/system-test-kafka-branch-builder-2/330/

@mjsax
Copy link
Member Author

mjsax commented Jun 16, 2017

Retest this please.

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5394/
Test FAILed (JDK 8 and Scala 2.12).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5409/
Test FAILed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5412/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5397/
Test PASSed (JDK 8 and Scala 2.12).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5400/
Test PASSed (JDK 8 and Scala 2.12).

@asfgit
Copy link

asfgit commented Jun 16, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5415/
Test PASSed (JDK 7 and Scala 2.11).

throw new RuntimeException("Result verification failed for " + receivedRecord + " expected <" + key + "," + value + "> but was <" + receivedKey + "," + receivedValue + ">");
}
}
} catch (final NullPointerException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should check that inputRecords.hasNext is false after the for loop, or any manners to make sure that pairing lists have the same size.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto elsewhere.

@@ -383,7 +403,84 @@ private static void verifySum(final Map<TopicPartition, List<ConsumerRecord<byte
sum += value;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if (sum = value) else (sum += value)

Integer max = currentMinPerKey.get(key);
if (max == null) {
max = value;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if (max = value) else (max = Math.max).

}
}
} catch (final NullPointerException e) {
System.err.println(inputPerTopicPerPartition);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we print both input and output partition lists, and also print as Error found: input is ... output is ....

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just thinking about this twice, a NPE should not happen here any more as we reworked the code. IMHO, we can just remove the whole try-catch-block. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

@asfgit
Copy link

asfgit commented Jun 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5430/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Jun 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5415/
Test PASSed (JDK 8 and Scala 2.12).

@ijuma
Copy link
Contributor

ijuma commented Jun 20, 2017

What is the status of this?

@guozhangwang
Copy link
Contributor

I'm putting this on hold until #3375 is merged, since we also saw a couple local test failures with it and suspected it is due to the same root cause.

@mjsax mjsax force-pushed the kafka-5362-add-eos-system-tests-for-streams-api branch from 0c5d9db to 7ee5752 Compare June 25, 2017 00:09
@asfgit
Copy link

asfgit commented Jun 25, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5676/
Test FAILed (JDK 8 and Scala 2.12).

@asfgit
Copy link

asfgit commented Jun 25, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5690/
Test FAILed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Jun 25, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/5691/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Jun 25, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5677/
Test PASSed (JDK 8 and Scala 2.12).

@mjsax
Copy link
Member Author

mjsax commented Jun 25, 2017

Updated. Branch builder passed: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/937/

@guozhangwang
Copy link
Contributor

LGTM! Merged to trunk and 0.11.0.

@asfgit asfgit closed this in 2265834 Jun 25, 2017
asfgit pushed a commit that referenced this pull request Jun 25, 2017
Author: Matthias J. Sax <matthias@confluent.io>

Reviewers: Guozhang Wang <wangguoz@gmail.com>

Closes #3310 from mjsax/kafka-5362-add-eos-system-tests-for-streams-api

(cherry picked from commit 2265834)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>
@mjsax mjsax deleted the kafka-5362-add-eos-system-tests-for-streams-api branch June 26, 2017 18:23
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.

5 participants