Skip to content
Snippets Groups Projects
  1. Feb 25, 2019
  2. Feb 12, 2019
    • Alex Diachenko's avatar
      KAFKA-7799; Use httpcomponents-client in RestServerTest. · ec42e037
      Alex Diachenko authored
      The test `org.apache.kafka.connect.runtime.rest.RestServerTest#testCORSEnabled` assumes Jersey client can send restricted HTTP headers(`Origin`).
      
      Jersey client uses `sun.net.www.protocol.http.HttpURLConnection`.
      `sun.net.www.protocol.http.HttpURLConnection` drops restricted headers(`Host`, `Keep-Alive`, `Origin`, etc) based on static property `allowRestrictedHeaders`.
      This property is initialized in a static block by reading Java system property `sun.net.http.allowRestrictedHeaders`.
      
      So, if classloader loads `HttpURLConnection` before we set `sun.net.http.allowRestrictedHeaders=true`, then all subsequent changes of this system property won't take any effect(which happens if `org.apache.kafka.connect.integration.ExampleConnectIntegrationTest` is executed before `RestServerTest`).
      To prevent this, we have to either make sure we set `sun.net.http.allowRestrictedHeaders=true` as early as possible or do not rely on this system property at all.
      
      This PR adds test dependency on `httpcomponents-client` which doesn't depend on `sun.net.http.allowRestrictedHeaders` system property. Thus none of existing tests should interfere with `RestServerTest`.
      
      Author: Alex Diachenko <sansanichfb@gmail.com>
      
      Reviewers: Randall Hauch, Konstantine Karantasis, Gwen Shapira
      
      Closes #6236 from avocader/KAFKA-7799
      ec42e037
  3. Jan 31, 2019
  4. Jan 29, 2019
    • Matthias J. Sax's avatar
      MINOR: Update usage of deprecated API (#6146) · 1fa02d5a
      Matthias J. Sax authored
      Reviewers: Guozhang Wang <guozhang@confluent.io>, Ismael Juma <ismael@confluent.io>, Jorge Quilcate Otoya <quilcate.jorge@gmail.com>, John Roesler <john@confluent.io>, Bill Bejeck <bill@confluent.io>
      1fa02d5a
  5. Jan 25, 2019
    • Tom Bentley's avatar
      KAFKA-5692: Change PreferredReplicaLeaderElectionCommand to use Admin… (#3848) · 269b6527
      Tom Bentley authored
      See also KIP-183.
      
      This implements the following algorithm:
      
      AdminClient sends ElectPreferredLeadersRequest.
      KafakApis receives ElectPreferredLeadersRequest and delegates to
      ReplicaManager.electPreferredLeaders()
      ReplicaManager delegates to KafkaController.electPreferredLeaders()
      KafkaController adds a PreferredReplicaLeaderElection to the EventManager,
      ReplicaManager.electPreferredLeaders()'s callback uses the
      delayedElectPreferredReplicasPurgatory to wait for the results of the
      election to appear in the metadata cache. If there are no results
      because of errors, or because the preferred leaders are already leading
      the partitions then a response is returned immediately.
      In the EventManager work thread the preferred leader is elected as follows:
      
      The EventManager runs PreferredReplicaLeaderElection.process()
      process() calls KafkaController.onPreferredReplicaElectionWithResults()
      KafkaController.onPreferredReplicaElectionWithResults()
      calls the PartitionStateMachine.handleStateChangesWithResults() to
      perform the election (asynchronously the PSM will send LeaderAndIsrRequest
      to the new and old leaders and UpdateMetadataRequest to all brokers)
      then invokes the callback.
      
      Reviewers: Colin P. McCabe <cmccabe@apache.org>, Jun Rao <junrao@gmail.com>
      269b6527
  6. Jan 24, 2019
    • Colin Patrick McCabe's avatar
      KAFKA-7793: Improve the Trogdor command line. (#6133) · a79d6dcd
      Colin Patrick McCabe authored
      
      * Allow the Trogdor agent to be started in "exec mode", where it simply
      runs a single task and exits after it is complete.
      
      * For AgentClient and CoordinatorClient, allow the user to pass the path
      to a file containing JSON, instead of specifying the JSON object in the
      command-line text itself.  This means that we can get rid of the bash
      scripts whose only function was to load task specs into a bash string
      and run a Trogdor command.
      
      * Print dates and times in a human-readable way, rather than as numbers
      of milliseconds.
      
      * When listing tasks or workers, output human-readable tables of
      information.
      
      * Allow the user to filter on task ID name, task ID pattern, or task
      state.
      
      * Support a --json flag to provide raw JSON output if desired.
      
      Reviewed-by: default avatarDavid Arthur &lt;mumrah@gmail.com&gt;, Stanislav Kozlovski <stanislav_kozlovski@outlook.com>
      a79d6dcd
  7. Jan 21, 2019
  8. Jan 14, 2019
    • Arjun Satish's avatar
      KAFKA-7503: Connect integration test harness · 69d8d2ea
      Arjun Satish authored
      Expose a programmatic way to bring up a Kafka and Zk cluster through Java API to facilitate integration tests for framework level changes in Kafka Connect. The Kafka classes would be similar to KafkaEmbedded in streams. The new classes would reuse the kafka.server.KafkaServer classes from :core, and provide a simple interface to bring up brokers in integration tests.
      
      Signed-off-by: Arjun Satish <arjunconfluent.io>
      
      Author: Arjun Satish <arjun@confluent.io>
      Author: Arjun Satish <wicknicks@users.noreply.github.com>
      
      Reviewers: Randall Hauch <rhauch@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>
      
      Closes #5516 from wicknicks/connect-integration-test
      69d8d2ea
    • Matthias J. Sax's avatar
      MINOR: code cleanup (#6054) · 82d1db63
      Matthias J. Sax authored
      Reviewers: Bill Bejeck <bill@confluent.io>, John Roesler <john@confluent.io>, Guozhang Wang <guozhang@confluent.io>, Ryanne Dolan <ryannedolan@gmail.com>, Ismael Juma <ismael@confuent.io>
      82d1db63
  9. Jan 12, 2019
    • Colin Patrick McCabe's avatar
      KAFKA-7609; Add Protocol Generator for Kafka (#5893) · 71e85f5e
      Colin Patrick McCabe authored
      This patch adds a framework to automatically generate the request/response classes for Kafka's protocol. The code will be updated to use the generated classes in follow-up patches. Below is a brief summary of the included components:
      
      **buildSrc/src**
      The message generator code is here.  This code is automatically re-run by gradle when one of the schema files changes.  The entire directory is processed at once to minimize the number of times we have to start a new JVM.  We use Jackson to translate the JSON files into Java objects.
      
      **clients/src/main/java/org/apache/kafka/common/protocol/Message.java**
      This is the interface implemented by all automatically generated messages.
      
      **clients/src/main/java/org/apache/kafka/common/protocol/MessageUtil.java**
      Some utility functions used by the generated message code.
      
      **clients/src/main/java/org/apache/kafka/common/protocol/Readable.java, Writable.java, ByteBufferAccessor.java**
      The generated message code uses these classes for writing to a buffer.
      
      **clients/src/main/message/README.md**
      This README file explains how the JSON schemas work.
      
      **clients/src/main/message/\*.json**
      The JSON files in this directory implement every supported version of every Kafka API.  The unit tests automatically validate that the generated schemas match the hand-written schemas in our code.  Additionally, there are some things like request and response headers that have schemas here.
      
      **clients/src/main/java/org/apache/kafka/common/utils/ImplicitLinkedHashSet.java**
      I added an optimization here for empty sets.  This is useful here because I want all messages to start with empty sets by default prior to being loaded with data.  This is similar to the "empty list" optimizations in the `java.util.ArrayList` class.
      
      Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Ismael Juma <ismael@juma.me.uk>, Bob Barrett <bob.barrett@outlook.com>, Jason Gustafson <jason@confluent.io>
      71e85f5e
  10. Nov 27, 2018
  11. Oct 26, 2018
  12. Oct 15, 2018
  13. Oct 09, 2018
    • Ismael Juma's avatar
      KAFKA-7439; Replace EasyMock and PowerMock with Mockito in clients module · 578205ca
      Ismael Juma authored
      Development of EasyMock and PowerMock has stagnated while Mockito
      continues to be actively developed. With the new Java release cadence,
      it's a problem to depend on libraries that do bytecode manipulation
      and are not actively maintained. In addition, Mockito is also
      easier to use.
      
      While updating the tests, I attempted to go from failing test to
      passing test. In cases where the updated test passed on the first
      attempt, I artificially broke it to ensure the test was still doing its
      job.
      
      I included a few improvements that were helpful while making these
      changes:
      
      1. Better exception if there are no nodes in `leastLoadedNodes`
      2. Always close the producer in `KafkaProducerTest`
      3. requestsInFlight producer metric should not hold a reference to
      `Sender`
      
      Finally, `Metadata` is no longer final so that we don't need
      `PowerMock` to mock it. It's an internal class, so it's OK.
      
      Author: Ismael Juma <ismael@juma.me.uk>
      
      Reviewers: Viktor Somogyi <viktorsomogyi@gmail.com>, Dong Lin <lindong28@gmail.com>
      
      Closes #5691 from ijuma/kafka-7438-mockito
      578205ca
  14. Sep 13, 2018
  15. Sep 11, 2018
    • Anna Povzner's avatar
      KAFKA-7044; Fix Fetcher.fetchOffsetsByTimes and NPE in describe consumer group (#5627) · e2ec2d79
      Anna Povzner authored
      A call to `kafka-consumer-groups --describe --group ...` can result in NullPointerException for two reasons:
      1)  `Fetcher.fetchOffsetsByTimes()` may return too early, without sending list offsets request for topic partitions that are not in cached metadata.
      2) `ConsumerGroupCommand.getLogEndOffsets()` and `getLogStartOffsets()` assumed that endOffsets()/beginningOffsets() which eventually call Fetcher.fetchOffsetsByTimes(), would return a map with all the topic partitions passed to endOffsets()/beginningOffsets() and that values are not null. Because of (1), null values were possible if some of the topic partitions were already known (in metadata cache) and some not (metadata cache did not have entries for some of the topic partitions). However, even with fixing (1), endOffsets()/beginningOffsets() may return a map with some topic partitions missing, when list offset request returns a non-retriable error. This happens in corner cases such as message format on broker is before 0.10, or maybe in cases of some other errors. 
      
      Testing:
      -- added unit test to verify fix in Fetcher.fetchOffsetsByTimes() 
      -- did some manual testing with `kafka-consumer-groups --describe`, causing NPE. Was not able to reproduce any NPE cases with DescribeConsumerGroupTest.scala,
      
      Reviewers: Jason Gustafson <jason@confluent.io>
      e2ec2d79
  16. Aug 31, 2018
    • John Roesler's avatar
      MINOR: single Jackson serde for PageViewTypedDemo (#5590) · d57fe1b0
      John Roesler authored
      Previously, we depicted creating a Jackson serde for every pojo class, which becomes a burden in practice. There are many ways to avoid this and just have a single serde, so we've decided to model this design choice instead.
      
      Reviewers: Viktor Somogyi <viktorsomogyi@gmail.com>, Bill Bejeck <bill@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
      d57fe1b0
  17. Aug 18, 2018
    • Ismael Juma's avatar
      KAFKA-7308: Fix rat and checkstyle config for Java 11 support (#5529) · b282b2ab
      Ismael Juma authored
      Relative paths in Gradle break when the Gradle daemon is used
      unless user.dir can be changed while the process is running.
      Java 11 disallows this, so we use project paths instead.
      
      Verified that rat and checkstyle work with Java 11 after these
      changes.
      
      Reviewers: Dong Lin <lindong28@gmail.com>
      b282b2ab
  18. Aug 06, 2018
  19. Aug 03, 2018
  20. Jul 19, 2018
  21. Jul 09, 2018
  22. Jul 06, 2018
    • Rajini Sivaram's avatar
      KAFKA-7136: Avoid deadlocks in synchronized metrics reporters (#5341) · 1f8527b3
      Rajini Sivaram authored
      We need to use the same lock for metric update and read to avoid NPE and concurrent modification exceptions. Sensor add/remove/update are synchronized on Sensor since they access lists and maps that are not thread-safe. Reporters are notified of metrics add/remove while holding (Sensor, Metrics) locks and reporters may synchronize on the reporter lock. Metric read may be invoked by metrics reporters while holding a reporter lock. So read/update cannot be synchronized using Sensor since that could lead to deadlock. This PR introduces a new lock in Sensor for update/read.
      Locking order:
      
      - Sensor#add: Sensor -> Metrics -> MetricsReporter
      - Metrics#removeSensor: Sensor -> Metrics -> MetricsReporter
      - KafkaMetric#metricValue: MetricsReporter -> Sensor#metricLock
      - Sensor#record: Sensor -> Sensor#metricLock
      
      
      Reviewers: Jun Rao <junrao@gmail.com>, Guozhang Wang <wangguoz@gmail.com>
      1f8527b3
  23. Jun 19, 2018
    • Ismael Juma's avatar
      KAFKA-2983: Remove Scala consumers and related code (#5230) · cc4dce94
      Ismael Juma authored
      - Removed Scala consumers (`SimpleConsumer` and `ZooKeeperConsumerConnector`)
      and their tests.
      - Removed Scala request/response/message classes.
      - Removed any mention of new consumer or new producer in the code
      with the exception of MirrorMaker where the new.consumer option was
      never deprecated so we have to keep it for now. The non-code
      documentation has not been updated either, that will be done
      separately.
      - Removed a number of tools that only made sense in the context
      of the Scala consumers (see upgrade notes).
      - Updated some tools that worked with both Scala and Java consumers
      so that they only support the latter (see upgrade notes).
      - Removed `BaseConsumer` and related classes apart from `BaseRecord`
      which is used in `MirrorMakerMessageHandler`. The latter is a pluggable
      interface so effectively public API.
      - Removed `ZkUtils` methods that were only used by the old consumers.
      - Removed `ZkUtils.registerBroker` and `ZKCheckedEphemeral` since
      the broker now uses the methods in `KafkaZkClient` and no-one else
      should be using that method.
      - Updated system tests so that they don't use the Scala consumers except
      for multi-version tests.
      - Updated LogDirFailureTest so that the consumer offsets topic would
      continue to be available after all the failures. This was necessary for it
      to work with the Java consumer.
      - Some multi-version system tests had not been updated to include
      recently released Kafka versions, fixed it.
      - Updated findBugs and checkstyle configs not to refer to deleted
      classes and packages.
      
      Reviewers: Dong Lin <lindong28@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
      cc4dce94
  24. Jun 06, 2018
  25. May 30, 2018
    • Robert Yokota's avatar
      KAFKA-6886: Externalize secrets from Connect configs (KIP-297) · 08e8facd
      Robert Yokota authored
      This commit allows secrets in Connect configs to be externalized and replaced with variable references of the form `${provider:[path:]key}`, where the "path" is optional.
      
      There are 2 main additions to `org.apache.kafka.common.config`: a `ConfigProvider` and a `ConfigTransformer`.  The `ConfigProvider` is an interface that allows key-value pairs to be provided by an external source for a given "path".  An a TTL can be associated with the key-value pairs returned from the path.  The `ConfigTransformer` will use instances of `ConfigProvider` to replace variable references in a set of configuration values.
      
      In the Connect framework, `ConfigProvider` classes can be specified in the worker config, and then variable references can be used in the connector config.  In addition, the herder can be configured to restart connectors (or not) based on the TTL returned from a `ConfigProvider`.  The main class that performs restarts and transformations is `WorkerConfigTransformer`.
      
      Finally, a `configs()` method has been added to both `SourceTaskContext` and `SinkTaskContext`.  This allows connectors to get configs with variables replaced by the latest values from instances of `ConfigProvider`.
      
      Most of the other changes in the Connect framework are threading various objects through classes to enable the above functionality.
      
      Author: Robert Yokota <rayokota@gmail.com>
      Author: Ewen Cheslack-Postava <me@ewencp.org>
      
      Reviewers: Randall Hauch <rhauch@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>
      
      Closes #5068 from rayokota/KAFKA-6886-connect-secrets
      08e8facd
    • Magesh Nandakumar's avatar
      KAFKA-6776: ConnectRestExtension Interfaces & Rest integration (KIP-285) · 98094954
      Magesh Nandakumar authored
      This PR provides the implementation for KIP-285 and also a reference implementation for authenticating BasicAuth credentials using JAAS LoginModule
      
      Author: Magesh Nandakumar <magesh.n.kumar@gmail.com>
      
      Reviewers: Randall Hauch <rhauch@gmail.com>, Arjun Satish <wicknicks@users.noreply.github.com>, Konstantine Karantasis <konstantine@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>
      
      Closes #4931 from mageshn/KIP-285
      98094954
  26. May 26, 2018
    • Ron Dagostino's avatar
      KAFKA-6562: OAuth Authentication via SASL/OAUTHBEARER (KIP-255) (#4994) · 8c5d7e04
      Ron Dagostino authored
      This KIP adds the following functionality related to SASL/OAUTHBEARER:
      
      1) Allow clients (both brokers when SASL/OAUTHBEARER is the inter-broker protocol as well as non-broker clients) to flexibly retrieve an access token from an OAuth 2 authorization server based on the declaration of a custom login CallbackHandler implementation and have that access token transparently and automatically transmitted to a broker for authentication.
      
      2) Allow brokers to flexibly validate provided access tokens when a client establishes a connection based on the declaration of a custom SASL Server CallbackHandler implementation.
      
      3) Provide implementations of the above retrieval and validation features based on an unsecured JSON Web Token that function out-of-the-box with minimal configuration required (i.e. implementations of the two types of callback handlers mentioned above will be used by default with no need to explicitly declare them).
      
      4) Allow clients (both brokers when SASL/OAUTHBEARER is the inter-broker protocol as well as non-broker clients) to transparently retrieve a new access token in the background before the existing access token expires in case the client has to open new connections.
      8c5d7e04
  27. May 22, 2018
    • Ismael Juma's avatar
      KAFKA-4423: Drop support for Java 7 (KIP-118) and update deps (#5046) · e70a191d
      Ismael Juma authored
      * Set --source, --target and --release to 1.8.
      * Build Scala 2.12 by default.
      * Remove some conditionals in the build file now that Java 8
      is the minimum version.
      * Bump the version of Jetty, Jersey and Checkstyle (the newer
      versions require Java 8).
      * Fixed issues uncovered by the new version if Checkstyle.
      * A couple of minor updates to handle an incompatible source
      change in the new version of Jetty.
      * Add dependency to jersey-hk2 to fix failing tests caused
      by Jersey upgrade.
      * Update release script to use Java 8 and to take into account
      that Scala 2.12 is now built by default.
      * While we're at it, bump the version of Gradle, Gradle plugins,
      ScalaLogging, JMH and apache directory api.
      * Minor documentation updates including the readme and upgrade
      notes. A number of Streams Java 7 examples can be removed
      subsequently.
      e70a191d
  28. Apr 23, 2018
    • John Roesler's avatar
      KAFKA-6376; refactor skip metrics in Kafka Streams · ed51b2cd
      John Roesler authored
      * unify skipped records metering
      * log warnings when things get skipped
      * tighten up metrics usage a bit
      
      ### Testing strategy:
      Unit testing of the metrics and the logs should be sufficient.
      
      Author: John Roesler <john@confluent.io>
      
      Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
      
      Closes #4812 from vvcephei/kip-274-streams-skip-metrics
      ed51b2cd
  29. Apr 16, 2018
    • Colin Patrick McCabe's avatar
      KAFKA-6696 Trogdor should support destroying tasks (#4759) · 832b096f
      Colin Patrick McCabe authored
      Implement destroying tasks and workers.  This means erasing all record of them on the Coordinator and the Agent.
      
      Workers should be identified by unique 64-bit worker IDs, rather than by the names of the tasks they are implementing.  This ensures that when a task is destroyed and re-created with the same task ID, the old workers will be not be treated as part of the new task instance.
      
      Fix some return results from RPCs.  In some cases RPCs were returning values that were never used.  Attempting to re-create the same task ID with different arguments should fail.  Add RequestConflictException to represent HTTP error code 409 (CONFLICT) for this scenario.
      
      If only one worker in a task stops, don't stop all the other workers for that task, unless the worker that stopped had an error.
      
      Reviewers: Anna Povzner <anna@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
      832b096f
  30. Apr 11, 2018
  31. Apr 07, 2018
  32. Mar 20, 2018
    • Anna Povzner's avatar
      Trogdor's ProducerBench does not fail if topics exists (#4673) · 5c24295d
      Anna Povzner authored
      Added configs to ProducerBenchSpec:
      topicPrefix: name of topics will be of format topicPrefix + topic index. If not provided, default is "produceBenchTopic".
      partitionsPerTopic: number of partitions per topic. If not provided, default is 1.
      replicationFactor: replication factor per topic. If not provided, default is 3.
      
      The behavior of producer bench is changed such that if some or all topics already exist (with topic names = topicPrefix + topic index), and they have the same number of partitions as requested, the worker uses those topics and does not fail. The producer bench fails if one or more existing topics has number of partitions that is different from expected number of partitions.
      
      Added unit test for WorkerUtils -- for existing methods and new methods.
      
      Fixed bug in MockAdminClient, where createTopics() would over-write existing topic's replication factor and number of partitions while correctly completing the appropriate futures exceptionally with TopicExistsException.
      
      Reviewers: Colin P. Mccabe <cmccabe@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
      5c24295d
  33. Mar 16, 2018
  34. Feb 26, 2018
  35. Feb 23, 2018
  36. Feb 04, 2018
    • Konstantine Karantasis's avatar
      KAFKA-6288: Broken symlink interrupts scanning of the plugin path · 17aaff36
      Konstantine Karantasis authored
      Submitting a fail safe fix for rare IOExceptions on symbolic links.
      
      The fix is submitted without a test case since it does seem easy to reproduce such type of failures (just having a broken symbolic link does not reproduce the issue) and it's considered pretty low risk.
      
      If accepted, needs to be ported at least to 1.0, if not 0.11
      
      Author: Konstantine Karantasis <konstantine@confluent.io>
      
      Reviewers: Randall Hauch <rhauch@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>
      
      Closes #4481 from kkonstantine/KAFKA-6288-Broken-symlink-interrupts-scanning-the-plugin-path
      17aaff36
    • Rajini Sivaram's avatar
      KAFKA-6246; Dynamic update of listeners and security configs (#4488) · 4019b21d
      Rajini Sivaram authored
      Dynamic update of listeners as described in KIP-226. This includes:
        - Addition of new listeners with listener-prefixed security configs
        - Removal of existing listeners
        - Password encryption
        - sasl.jaas.config property for broker's JAAS config prefixed with listener and mechanism name
      4019b21d
Loading