Commit Graph

6608 Commits

Author SHA1 Message Date
Colin Patrick McCabe 92688ef82c MINOR: improve the Kafka RPC code generator (#7340)
Move the generator checkstyle suppressions to a special section, rather
than mixing them in with the other sections.  For generated code, do not
complain about variable names or cyclic complexity.

FieldType.java: remove isInteger since it isn't used anywhere.  This way, we
don't have to decide whether a UUID is an integer or not (there are arguments
for both choices).  Add FieldType#serializationIsDifferentInFlexibleVersions
and FieldType#isVariableLength.

HeaderGenerator: add the ability to generate static imports.  Add
IsNullConditional, VersionConditional, and ClauseGenerator as easier ways of
generating "if" statements.
2019-09-25 11:58:54 -04:00
Colin Patrick McCabe 1d7f0b7c58
MINOR: Improve the org.apache.kafka.common.protocol code (#7344)
Add UUID to the list of types documented in Type#toHtml.

Type, Protocol, ArrayOf: use Type#isArray and Type#arrayElementType rather than typecasting to handle arrays.  This is cleaner.  It will also make it easier for us to add compact arrays (as specified by KIP-482) as a new array type distinct from the old array type.

Add MessageUtil#byteBufferToArray, as well as a test for it.  We will need this for handling tagged fields of type "bytes".

Schema#Visitor: we don't need a separate function overload for visiting arrays. We can just call "visit(Type field)".

TestUUID.json: reformat the JSON file to match the others.

ProtocolSerializationTest: improve the error messages on failure.  Check that each type has the name we expect it to have.

Reviewers: David Arthur <mumrah@gmail.com>, José Armando García Sancio <jsancio@gmail.com>, Vikas Singh <soondenana@users.noreply.github.com>
2019-09-25 08:20:51 -07:00
Guozhang Wang d112ffd8d8
KAFKA-8880: Docs on upgrade-guide (#7385)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2019-09-24 19:32:14 -07:00
A. Sophie Blee-Goldman 74f8ae1303 KAFKA-8179: do not suspend standby tasks during rebalance (#7321)
Some work needs to be done in Streams before we can incorporate cooperative rebalancing. 

This PR lays the groundwork for it by doing some refactoring, including a behavioral change that affects eager ("normal") rebalancing as well: will no longer suspend standbys in onPartitionsRevoked, instead we just close any that were reassigned in onPartitionsAssigned

Reviewers: Bruno Cadonna <bruno@confluent.io>, Boyang Chen <boyang@confluent.io>, John Roesler <vvcephei@users.noreply.github.com>, Guozhang Wang <wangguoz@gmail.com>
2019-09-24 15:33:03 -07:00
Bruno Cadonna ad3b8437fd KAFKA-8580: Compute RocksDB metrics (#7263)
A metric recorder runs in it own thread and regularly records RocksDB metrics from
RocksDB's statistics. For segmented state stores the metrics are aggregated over the
segments.

Reviewers: John Roesler <vvcephei@users.noreply.github.com>, A. Sophie Blee-Goldman <sophie@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
2019-09-24 13:29:08 -07:00
Guozhang Wang bcc023773f
KAFKA-8880: Add overloaded function of Consumer.committed (#7304)
1. Add the overloaded functions.
2. Update the code in Streams to use the batch API for better latency (this applies to both active StreamsTask for initialize the offsets, as well as the StandbyTasks for updating offset limits).
3. Also update all unit test to replace the deprecated APIs.

Reviewers: Christopher Pettitt <cpettitt@confluent.io>, Kamal Chandraprakash  <kamal.chandraprakash@gmail.com>, Bill Bejeck <bill@confluent.io>
2019-09-24 13:23:27 -07:00
Matthias J. Sax 1ae0956892
HOTFIX: fix Kafka Streams upgrade note for broker backward compatibility (#7363)
Reviewer: Guozhang Wang <guozhang@confluent.io>
2019-09-24 09:54:30 -07:00
Rajini Sivaram 0d31272b35
KAFKA-8848; Update system tests to use new AclAuthorizer (#7374)
Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2019-09-24 10:30:17 +01:00
khairy bc4fd676e5 MINOR: remove unnecessary null check (#7299)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2019-09-23 21:04:26 -07:00
Florian Hussonnois beac4c7534 KAFKA-6958: Overload methods for group and windowed stream to allow to name operation name using the new Named class (#6413)
This is the last PR for the KIP-307.
NOTE : PR 6412 should be merge first
Thanks a lot for the review.

Reviewers: John Roesler <john@confluent.io>, Bill Bejeck <bbejeck@gmail.com>
2019-09-23 13:11:56 -04:00
Guozhang Wang b4035610b8
KAFKA-8086: Use 1 partition for offset topic when possible (#7356)
I realized some flaky tests failed at setup or calls that tries to create offset topics, and I think using one partition and one replica would be sufficient in these cases.

Reviewers: Bill Bejeck <bill@confluent.io>
2019-09-23 09:24:32 -07:00
Bruno Cadonna e98e239a0c KAFKA-8859: Refactor cache-level metrics (#7367)
Cache-level metrics are refactor according to KIP-444:

tag client-id changed to thread-id
name hitRatio changed to hit-ratio
made backward compatible by using streams config built.in.metrics.version

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Bill Bejeck <bbejeck@gmail.com>
2019-09-23 07:12:45 -07:00
Guozhang Wang d91a94e7bf
KAFKA-8609: Add consumer rebalance metrics (#7347)
Adding the following metrics in:

1. AbstractCoordinator (for both consumer and connect)
* rebalance-latency-avg
* rebalance-latency-max
* rebalance-total
* rebalance-rate-per-hour
* failed-rebalance-total
* failed-rebalance-rate-per-hour
* last-rebalance-seconds-ago

2. ConsumerCoordinator
* partition-revoked-latency-avg
* partition-revoked-latency-max
* partition-assigned-latency-avg
* partition-assigned-latency-max
* partition-lost-latency-avg
* partition-lost-latency-max

Reviewers: Bruno Cadonna <bruno@confluent.io>, A. Sophie Blee-Goldman <sophie@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2019-09-20 17:50:12 -07:00
Kamal Chandraprakash 8001aff304 KAFKA-8892: Display the sorted configs in Kafka Configs Help Command.
Author: Kamal Chandraprakash <kamal.chandraprakash@gmail.com>

Reviewers: Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>

Closes #7319 from kamalcph/KAFKA-8892
2019-09-20 23:51:06 +05:30
John Roesler c955828095 MINOR: the code generator should be able to set the java package (#7355)
Reviewers: Colin P. McCabe <cmcabe@apache.org>
2019-09-20 09:25:19 -07:00
Matthias J. Sax e85d671dee
MINOR: replace `late` with `out-of-order` in JavaDocs and docs (#7274)
Reviewers: Bill Bejeck <bill@confluent.io>, John Roesler <john@confluent.io>
2019-09-19 18:28:24 -07:00
Guozhang Wang a0470726c4 MINOR: Move Murmur3 to Streams 2019-09-19 16:38:18 -07:00
Adam Bellemare 2d0cd2ef54 MINOR: Murmur3 Hash with Guava dependency
Part of supporting KIP-213 ( https://cwiki.apache.org/confluence/display/KAFKA/KIP-213+Support+non-key+joining+in+KTable ). Murmur3 hash is used as a hashing mechanism in KIP-213 for the large range of uniqueness. The Murmur3 class and tests are ported directly from Apache Hive, with no alterations to the code or dependencies.

Author: Adam Bellemare <adam.bellemare@wishabi.com>

Reviewers: John Roesler <vvcephei@users.noreply.github.com>, Ismael Juma <ismael@juma.me.uk>, Guozhang Wang <wangguoz@gmail.com>

Closes #7271 from bellemare/murmur3hash
2019-09-19 15:36:32 -07:00
Stanislav Kozlovski 8aff871b0d MINOR: Fix bug where we would incorrectly load partition reassignment info from ZK (#7334)
Reviewers: Ismael Juma <ismael@juma.me.uk>, Colin P. McCabe <cmccabe@apache.org>
2019-09-19 14:50:30 -07:00
Stanislav Kozlovski 3825ff3866 MINOR: Send latest LeaderAndIsr version (#7351)
KIP-455 (18d4e57f6e) bumped the LeaderAndIsr version to 3 but did not change the Controller code to actually send the new version. The ControllerChannelManagerTest had a bug which made it assert wrongly, hence why it did not catch it. This patch fixes said test.
Because the new fields in LeaderAndIsr are not used yet, the gap was not caught by integration tests either.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-09-19 14:42:14 -07:00
Richard Yu 73c6bd8ac9 [KAFKA-7994] Improve Stream time accuracy for restarts and rebalances (#6694)
Reviewers: Bruno Cadonna <bruno@confluent.io>, A. Sophie Blee-Goldman <sophie@confluent.io>, Boyang Chen <boyang@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2019-09-19 11:50:25 -07:00
Jason Gustafson d9d3d3b710
MINOR: Add last modified time and deletion horizon to clear log message (#7357)
It's useful to know when the cleaner runs what the last modified time
of the segment and the deletion horizon is. The current log message
only allows you to infer that one is greater than the other.

Reviewers: Jun Rao <junrao@gmail.com>
2019-09-19 08:50:59 -07:00
Manikumar Reddy fe2797a9fa MINOR: Update authorizer start-up check to handle end point with ephemeral port
Author: Manikumar Reddy <manikumar.reddy@gmail.com>

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>

Closes #7350 from omkreddy/checkstartup
2019-09-19 20:43:28 +05:30
Ismael Juma f718c5e1e1
MINOR: Update dependencies for Kafka 2.4 (part 2) (#7333)
Upgrade to Gradle 5.6.2 as a step towards Gradle 6.0 (necessary
for Java 13 support).

https://docs.gradle.org/5.5.1/release-notes.html
https://docs.gradle.org/5.6.2/release-notes.html

The other updates are mostly bug fixes:

* Scala 2.13.1: https://github.com/scala/scala/releases/tag/v2.13.1
* Scala 2.12.10: https://github.com/scala/scala/releases/tag/v2.12.10
* Jetty 9.4.20: https://www.eclipse.org/lists/jetty-announce/msg00133.html
* SLF4J 1.7.28: adds Automatic-Module-Name in MANIFEST.MF
* Bouncy castle 1.63: https://www.bouncycastle.org/releasenotes.html
* zstd 1.4.3: https://github.com/facebook/zstd/releases/tag/v1.4.3

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2019-09-18 12:51:47 -07:00
Randall Hauch ada35d5ff4 Add recent versions of Kafka to the matrix of ConnectDistributedTest (#7024)
Reviewers: Arjun Satish <arjun@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2019-09-18 10:21:21 -07:00
Lucas Bradstreet f3ded39a05 KAFKA-8841; Reduce overhead of ReplicaManager.updateFollowerFetchState (#7324)
This PR makes two changes to code in the ReplicaManager.updateFollowerFetchState path, which is in the hot path for follower fetches. Although calling ReplicaManager.updateFollowerFetch state is inexpensive on its own, it is called once for each partition every time a follower fetch occurs.

1. updateFollowerFetchState no longer calls maybeExpandIsr when the follower is already in the ISR. This avoid repeated expansion checks. 
2. Partition.maybeIncrementLeaderHW is also in the hot path for ReplicaManager.updateFollowerFetchState. Partition.maybeIncrementLeaderHW calls Partition.remoteReplicas four times each iteration, and it performs a toSet conversion. maybeIncrementLeaderHW now avoids generating any intermediate collections when updating the HWM.

**Benchmark results for Partition.updateFollowerFetchState on a r5.xlarge:**
Old:
```
  1288.633 ±(99.9%) 1.170 ns/op [Average]
  (min, avg, max) = (1287.343, 1288.633, 1290.398), stdev = 1.037
  CI (99.9%): [1287.463, 1289.802] (assumes normal distribution)
```

New (when follower fetch offset is updated):
```
  261.727 ±(99.9%) 0.122 ns/op [Average]
  (min, avg, max) = (261.565, 261.727, 261.937), stdev = 0.114
  CI (99.9%): [261.605, 261.848] (assumes normal distribution)
```

New (when follower fetch offset is the same):
```
  68.484 ±(99.9%) 0.025 ns/op [Average]
  (min, avg, max) = (68.446, 68.484, 68.520), stdev = 0.023
  CI (99.9%): [68.460, 68.509] (assumes normal distribution)
```

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
2019-09-18 09:11:39 -07:00
vinoth chandar 15d69b7856 KAFKA-8913: Document topic based configs & ISR settings for Streams apps (#7346)
Reviewer: Matthias J. Sax <matthias@confluent.io>
2019-09-17 17:36:59 -07:00
A. Sophie Blee-Goldman 9ba898edc7 remove unused import (#7345)
Remove unused import that's slipping past checkstyle somehow

Reviewers: Matthias J. Sax <mjsax@apache.org>, Christopher Pettitt <cpettitt@confluent.io>
2019-09-17 14:29:46 -07:00
Stanislav Kozlovski dcfd31c552 MINOR: Remove duplicate definition of transactional.id.expiration.ms config (#7245)
Reviewers: Bob Barrett <bob.barrett@outlook.com>, Apurva Mehta <apurva@confluent.io>, Ismael Juma <ismael@juma.me.uk>
2019-09-17 14:28:22 -07:00
vinoth chandar 4962c8193e KAFKA-8839 : Improve streams debug logging (#7258)
* log lock acquistion failures on the state store
* Document required uniqueness of state.dir path
* Move bunch of log calls around task state changes to DEBUG
* More readable log messages during partition assignment

Reviewers: Matthias J. Sax <mjsax@apache.org>, A. Sophie Blee-Goldman <sophie@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
2019-09-17 09:46:40 -07:00
Stanislav Kozlovski 935b280540 MINOR: Default to 5 partitions of the __consumer_offsets topic in Streams integration tests (#7331)
Given that the tests do not create clusters larger than 3, we do not gain much by creating 50 partitions for that topic. Reducing it should slightly increase test startup and shutdown speed.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Guozhang Wang <wangguoz@gmail.com>, Bill Bejeck <bbejeck@gmail.com>
2019-09-17 09:43:39 -07:00
Bruno Cadonna bab3e082dc KAFKA-8859: Expose built-in streams metrics version in `StreamsMetricsImpl` (#7323)
The streams config built.in.metrics.version is needed to add metrics in
a backward-compatible way. However, not in every location where metrics are
added a streams config is available to check built.in.metrics.version. Thus,
the config value needs to be exposed through the StreamsMetricsImpl object.

Reviewers: John Roesler <vvcephei@users.noreply.github.com>, Guozhang Wang <wangguoz@gmail.com>
2019-09-16 21:48:25 -07:00
David Jacot c5dfb90b46 MINOR: Cleanup scala warnings (#7335)
This patch removes a few warnings: mainly unused imports or vars.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-09-16 13:26:20 -07:00
Colin Patrick McCabe fbd06ec00c
MINOR: add unsigned varint support (#7338)
Support reading and writing unsigned varints.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-09-16 13:13:06 -07:00
David Jacot e24d0e22ab KAFKA-8730; Add API to delete consumer offsets (KIP-496) (#7276)
This adds an administrative API to delete consumer offsets of a group as well as extends the mechanism to expire offsets of consumer groups.

It makes the group coordinator aware of the set of topics a consumer group (protocol type == 'consumer') is actively subscribed to, allowing offsets of topics which are not actively subscribed to by the group to be either expired or administratively deleted. The expiration rules remain the same.

For the other groups (non-consumer), the API allows to delete offsets when the group is empty and the expiration remains the same.

Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Jason Gustafson <jason@confluent.io>
2019-09-13 16:49:25 -07:00
Mickael Maison ac385c4c3a KAFKA-8474; Use HTML lists for config layout (#6870)
Replace the `<table>` elements by `<ul>` so the full page width can be used for the configuration descriptions instead of only a very narrow column. I moved the other fields (Type, Default Value, etc) below each entry.

Reviewers: Boyang Chen <boyang@confluent.io>, Jason Gustafson <jason@confluent.io>
2019-09-13 15:48:36 -07:00
cpettitt-confluent 83c7c0158f KAFKA-8755: Fix state restore for standby tasks with optimized topology (#7238)
Key changes include:

1. Moves general offset limit updates down to StandbyTask.
2. Updates offsets for StandbyTask at most once per commit and only when we need and updated offset limit to make progress.
3. Avoids writing an 0 checkpoint when StandbyTask.update is called but we cannot apply any of the records.
4. Avoids going into a restoring state in the case that the last checkpoint is greater or equal to the offset limit (consumer committed offset). This needs special attention please. Code is in
StoreChangelogReader.
5. Does update offset limits initially for StreamTask because it provides a way to prevent playing to many records from the changelog (also the input topic with optimized topology).

NOTE: this PR depends on KAFKA-8816, which is under review separately. Fortunately the changes involved are few. You can focus just on the KAFKA-8755 commit if you prefer.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Guozhang Wang <wangguoz@gmail.com>
2019-09-13 15:45:29 -07:00
John Roesler 6530600e6b MINOR: Add UUID type to Kafka API code generation (#7291)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2019-09-13 11:36:58 -07:00
Boyang Chen 23708b77db KAFKA-8355: add static membership to range assignor (#7014)
The purpose of this PR is to add static membership support for range assignor. More details for the motivation in here.

Similar to round robin assignor, if we are capable of persisting member identity across generations, we will reach a much more stable assignment.

Reviewers: John Roesler <vvcephei@users.noreply.github.com>, Guozhang Wang <wangguoz@gmail.com>, Bruno Cadonna <bruno@confluent.io>
2019-09-12 09:57:22 -07:00
huxi d3559f628b KAFKA-8875; CreateTopic API should check topic existence before replication factor (#7298)
If the topic already exists, `handleCreateTopicsRequest` should return TopicExistsException even given an invalid config (replication factor for instance).

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Jason Gustafson <jason@confluent.io>
2019-09-11 14:24:27 -07:00
Bruno Cadonna 6a3a580399 KAFKA-8856: Add Streams config for backward-compatible metrics (#7279)
Reviewers: John Roesler <vvcephei@users.noreply.github.com>, Guozhang Wang <wangguoz@gmail.com>
2019-09-11 11:01:39 -07:00
Rajini Sivaram 6882b3b760
KAFKA-8886; Make Authorizer create/delete API asynchronous (#7316)
Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2019-09-11 16:56:56 +01:00
Stanislav Kozlovski 18d4e57f6e KAFKA-8345 (KIP-455): Controller and KafkaApi changes (part 3/4) (#7128)
Implement the revisions to the controller state machine and reassignment logic needed for KIP-455.

Add the addingReplicas and removingReplicas field to the topics ZNode.

Deprecate the methods initiating a reassignment via direct ZK access in KafkaZkClient.

Add ControllerContextTest, and add some test cases to ReassignPartitionsClusterTest.

Add a note to upgrade.html recommending not initiating reassignments during an upgrade.

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Viktor Somogyi <viktorsomogyi@gmail.com>
2019-09-10 22:19:44 -07:00
Jason Gustafson 41b89a6ecf
MINOR: Add api version to uncaught exception message (#7311)
When we have an unhandled exception in the request handler, we print some details about the request such as the api key and payload. It is also useful to see the version of the request which is not always apparent from the request payload.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2019-09-10 19:08:42 -07:00
Guozhang Wang a043edb559
KAFKA-8817: Remove timeout for the whole test (#7313)
I bumped into this flaky test while working on another PR. It's a bit different from the reported PR, where it actually timed out at parsing localhost:port already. I think what we should really test is that the closing call can complete, so I removed the whole test timeout and add the timeout for the shutdown latch instead.

Reviewers: Jason Gustafson <jason@confluent.io>, cpettitt-confluent <53191309+cpettitt-confluent@users.noreply.github.com>
2019-09-10 19:01:10 -07:00
Stanislav Kozlovski 7012fa3262 KAFKA-8747; Add atomic counter to fix flaky testEventQueueTime test (#7320)
This patch adds an atomic counter in the test to ensure we have processed all the events before we assert the metrics. There was a race condition with the previous assertion, which asserted that the event queue is empty before checking the metrics.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-09-10 17:29:15 -07:00
cpettitt-confluent 18246e509e KAFKA-8878: Fix flaky test AssignedStreamsTasksTest#shouldCloseCleanlyWithSuspendedTaskAndEOS (#7302)
The previous approach to testing KAFKA-8412 was to look at the logs and
determine if an error occurred during close. There was no direct way to
detect than an exception occurred because the exception was eaten in
AssignedTasks.close. In the PR for that ticket (#7207) it was
acknowledged that this was a brittle way to test for the exception. We
now see occasional failures because an unrelated ERROR level log entry
is made while closing the task.

This change eliminates the brittle log checking by rethrowing any time
an exception occurs in close, even when a subsequent unclean close
succeeds. This has the potential benefit of uncovering other supressed
exceptions down the road.

I've verified that even with us rethrowing on closeUnclean that all
tests pass.

Reviewers: Matthias J. Sax <mjsax@apache.org>,  Bill Bejeck <bbejeck@gmail.com>
2019-09-10 16:37:34 -04:00
wineandcheeze d54285f0c0 KAFKA-8889: Log the details about error (#7317)
We need stacktrace of the error to understand the root cause and to trouble shoot the underlying problem.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2019-09-09 22:26:53 -07:00
Boyang Chen e59e4caadc KAFKA-8222 & KIP-345 part 5: admin request to batch remove members (#7122)
This PR adds supporting features for static membership. It could batch remove consumers from the group with provided group.instance.id list.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2019-09-09 13:06:47 -07:00
Vikas Singh 312e4db590 MINOR. implement --expose-ports option in ducker-ak (#7269)
This change adds a command line option to the `ducker-ak up' command to enable exposing ports from docker containers. The exposed ports will be mapped to the ephemeral ports on the host. The option is called `expose-ports' and can take either a single value (like 5005) or a range (like 5005-5009). This port will then exposed from each docker container that ducker-ak sets up.

Reviewers: Colin P. McCabe <cmccabe@apache.org>, José Armando García Sancio <jsancio@users.noreply.github.com>
2019-09-09 07:57:29 -07:00