Commit Graph

1203 Commits

Author SHA1 Message Date
Yash Mayya 6e72986949
KAFKA-14784: Connect offset reset REST API (#13818)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-23 13:27:46 -04:00
Mickael Maison 3c059133d3
MINOR: Fix generated client ids for Connect (#13896)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-06-21 21:44:14 +02:00
Greg Harris 3b72b0abb1
MINOR: Optimize runtime of MM2 integration tests by batching transactions (#13816)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-21 14:51:54 -04:00
minjian.cai d751c13950
MINOR: Fix typos for connect (#13885)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-20 16:16:16 -04:00
Chris Egerton 73dd51e137
Revert "MINOR: Reduce MM2 integration test flakiness due to missing dummy offset commits (#13838)" (#13864)
Reviewers: Josep Prat <josep.prat@aiven.io>

Reverts commit 505c7b6487.
2023-06-16 12:10:26 -04:00
Chris Egerton e1d59920f4
KAFKA-15059: Remove pending rebalance check when fencing zombie source connector tasks (#13819)
Discovered while researching KAFKA-14718

Currently, we perform a check during zombie fencing that causes the round of zombie fencing to fail when a rebalance is pending (i.e., when we've detected from a background poll of the config topic that a new connector has been created, that an existing connector has been deleted, or that a new set of connector tasks has been generated).

It's possible but not especially likely that this check causes issues when running vanilla Kafka Connect. Even when it does, it's easy enough to restart failed tasks via the REST API.

However, when running MirrorMaker 2 in dedicated mode, this check is more likely to cause issues as we write three connector configs to the config topic in rapid succession on startup. And in that mode, there is no API to restart failed tasks aside from restarting the worker that they are hosted on.

In either case, this check can lead to test flakiness in integration tests for MirrorMaker 2 both in dedicated mode and when deployed onto a vanilla Kafka Connect cluster.

This check is not actually necessary, and we can safely remove it. Copied from Jira:

>If the worker that we forward the zombie fencing request to is a zombie leader (i.e., a worker that believes it is the leader but in reality is not), it will fail to finish the round of zombie fencing because it won't be able to write to the config topic with a transactional producer.

>If the connector has just been deleted, we'll still fail the request since we force a read-to-end of the config topic and refresh our snapshot of its contents before checking to see if the connector exists.

>And regardless, the worker that owns the task will still do a read-to-end of the config topic and verify that (1) no new task configs have been generated for the connector and (2) the worker is still assigned the connector, before allowing the task to process any data.

In addition, while waiting on a fix for KAFKA-14718 that adds more granularity for diagnosing failures in the DedicatedMirrorIntegrationTest suite (#13284), some of the timeouts in that test are bumped to work better on our CI infrastructure.

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Yash Mayya <yash.mayya@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2023-06-16 11:58:36 +02:00
Greg Harris 505c7b6487
MINOR: Reduce MM2 integration test flakiness due to missing dummy offset commits (#13838)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-06-15 12:02:32 +02:00
Gantigmaa Selenge 930744c3a8
KAFKA-14709: Move content in connect/mirror/README.md to the docs (#13650)
Most of the contents in the README.md was already covered in the docs therefore only had to add the section for Exactly Once support.

Reviewers: Luke Chen <showuon@gmail.com>
2023-06-15 10:16:52 +08:00
Chris Egerton 6b128d7e30
KAFKA-14006: Parameterize WorkerConnectorTest suite (#12307)
Reviewers: Sagar Rao <sagarmeansocean@gmail.com>, Christo Lolov <lolovc@amazon.com>, Kvicii <kvicii.yu@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2023-06-08 11:20:35 -04:00
Greg Harris c8cb85274e
MINOR: Refactor DelegatingClassLoader to emit immutable PluginScanResult (#13771)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-06 09:37:57 -04:00
Chris Egerton 17fd30e6b4
MINOR: Fix flaky DistributedHerderTest cases related to zombie fencing (#13806)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-06-05 15:50:54 -04:00
Yash Mayya 383a8d6114
MINOR: Handle the config topic read timeout edge case in DistributedHerder's stopConnector method (#13750)
Reviewers: Chris Egerton
2023-06-05 11:10:59 -04:00
Yash Mayya fca7ee7270
MINOR: Remove reference to 'offset backing store' from exception message in KafkaBasedLog (#13810)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-05 10:04:17 -04:00
Yash Mayya 8e60368d90
MINOR: Re-introduce Transformation import to fix TransformationChain Javadoc (#13808)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-05 09:43:03 -04:00
Greg Harris 6678f1b66a
KAFKA-14863: Fix failing tests for invalid plugins that are no longer visible (#13805)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-03 12:55:20 -04:00
Yash Mayya 02fb4b882b
KAFKA-15012: Allow leading zeros in numeric fields while deserializing JSON messages using the JsonConverter (#13800)
Reviewers: Sagar Rao <sagarmeansocean@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-06-02 11:20:37 -04:00
Greg Harris 89581a738f
KAFKA-14863: Hide plugins with invalid constructors during plugin discovery (#13467)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-02 11:09:43 -04:00
Yash Mayya 9bb2f78d53
KAFKA-15034: Improve performance of the ReplaceField SMT; add JMH benchmark (#13776)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-01 15:14:31 -04:00
Greg Harris 6846f51445
MINOR: Remove spurious warning about plugin.path config provider usage when null (#13783)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-05-31 12:57:58 -04:00
vamossagar12 03ab563206
MINOR: Fixing typo in ExactlyOnceWorkerSourceTask#committableRecords (#13755)
Co-authored-by: Sagar Rao <sagarrao@Sagars-MacBook-Pro.local>

Reviewers: Yash Mayya <yash.mayya@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2023-05-31 16:26:31 +02:00
Greg Harris 1957be19d9
KAFKA-8713: JsonConverter replace.null.with.default should prevent emitting default for Struct fields (#13781)
Co-authored-by: GeunJae Jeon <krespo>
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-05-31 15:48:03 +02:00
Greg Harris 9aac5ff1fe
MINOR: Move plugin path parsing from DelegatingClassLoader to PluginUtils (#13334)
Reviewers: Chaitanya Mukka <chaitanya.mvs2007@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-05-26 12:36:00 -04:00
Greg Harris 2ec6b5e1e2
KAFKA-14789: Prevent mis-attributing classpath plugins, allow discovery of classpath RestExtension and ConfigProvider (#13356)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-05-26 12:17:07 -04:00
Yash Mayya 7ff2dbb107
KAFKA-14368: Connect offset write REST API (#13465)
Reviewers: Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2023-05-26 12:08:06 -04:00
Greg Harris dc00832b96
KAFKA-14654: Connector classes should statically initialize with plugin classloader (#13165)
Reviewers: Chaitanya Mukka <chaitanya.mvs2007@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-05-25 10:22:44 -04:00
Sungyun Hur 916e801010
MINOR: Fix whitespace typo in Connect Config docs (#13752)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Yash Mayya <yash.mayya@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-05-24 21:48:47 +02:00
Andras Katona 5b3b385881
KAFKA-13504: Retry connect internal topics' creation in case of InvalidReplicationFactorException (#11565)
In case the Kafka Broker cluster and the Kafka Connect cluster is started together and Connect would want to create its topics, there's a high chance to fail the creation with InvalidReplicationFactorException.

---------

Co-authored-by: Daniel Urban <durban@cloudera.com>

Reviewers: Daniel Urban <durban@cloudera.com>, Mickael Maison <mickael.maison@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Chris Egerton <chrise@aiven.io>, Laszlo Hunyadi <laszlo.istvan.hunyady@gmail.com>
2023-05-24 11:05:02 +02:00
Chris Egerton a14e73a036
KAFKA-14980: Fix MirrorSourceConnector source consumer configuration (#13723)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Josep Prat <josep.prat@aiven.io>
2023-05-19 14:45:01 +02:00
Dániel Urbán f17fb75b2d
KAFKA-14978 ExactlyOnceWorkerSourceTask should remove parent metrics (#13690)
Reviewers: Chris Egerton <chrise@aiven.io>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2023-05-10 16:41:52 +02:00
Yash Mayya 59ba9dbbc9
KAFKA-14974: Restore backward compatibility in KafkaBasedLog (#13688)
`KafkaBasedLog` is a widely used utility class that provides a generic implementation of a shared, compacted log of records in a Kafka topic. It isn't in Connect's public API, but has been used outside of Connect and we try to preserve backward compatibility whenever possible. KAFKA-14455 modified the two overloaded void `KafkaBasedLog::send` methods to return a `Future`. While this change is source compatible, it isn't binary compatible. We can restore backward compatibility simply by renaming the new Future returning send methods, and reinstating the older send methods to delegate to the newer methods.

This refactoring changes no functionality other than restoring the older methods.

Reviewers: Randall Hauch <rhauch@gmail.com>
2023-05-09 07:28:45 -05:00
vamossagar12 86daf8ce65
KAFKA-14913: Using ThreadUtils.shutdownExecutorServiceQuietly to close executors in Connect Runtime (#13594)
#13557 introduced a utils method to close executors silently. This PR leverages that method to close executors in connect runtime. There was duplicate code while closing the executors which isn't the case with this PR.

Note that there are a few more executors used in Connect runtime but their close methods don't follow this pattern of shutdown, await and shutdown. Some of them have some logic like executor like Worker, so not changing at such places.

---------

Co-authored-by: Sagar Rao <sagarrao@Sagars-MacBook-Pro.local>

Reviewers: Daniel Urban <durban@cloudera.com>, Yash Mayya <yash.mayya@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2023-05-08 16:39:47 +02:00
Christo Lolov f44ee4fab7
MINOR: Remove unnecessary code in client/connect (#13259)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-05-02 17:39:31 +02:00
Yash Mayya 4773961a44
MINOR: Fix Javadoc for configureAdminResources in Connect's RestServer (#13635)
Reviewers: Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-05-01 12:21:09 -04:00
vamossagar12 007c0d375a
KAFKA-14929: Fixing flaky test putTopicStateRetriableFailure (#13634)
Co-authored-by: Sagar Rao <sagarrao@Sagars-MacBook-Pro.local>

Reviewers: Daniel Urban <durban@cloudera.com>, Justine Olshan <jolshan@confluent.io>, Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2023-04-26 14:23:56 +02:00
Greg Harris baf127a663
KAFKA-14666: Add MM2 in-memory offset translation index for offsets behind replication (#13429)
Reviewers: Daniel Urban <durban@cloudera.com>, Chris Egerton <chrise@aiven.io>
2023-04-26 03:30:13 -04:00
Yash Mayya 4780dc773f
KAFKA-14933: Document Connect's log level REST APIs from KIP-495 (#13636)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Manyanda Chitimbo <manyanda.chitimbo@gmail.com>
2023-04-25 17:50:35 +02:00
Greg Harris 7061475445
KAFKA-14905: Reduce flakiness in MM2 ForwardingAdmin test due to admin timeouts (#13575)
Reduce flakiness of `MirrorConnectorsWithCustomForwardingAdminIntegrationTest`

Reviewers: Josep Prat <jlprat@apache.org>
2023-04-21 21:55:41 +02:00
Dimitar Dimitrov e14dd8024a
KAFKA-14821 Implement the listOffsets API with AdminApiDriver (#13432)
We are handling complex workflows ListOffsets by chaining together MetadataCall instances and ListOffsetsCall instances, there are many complex and error-prone logic. In this PR we rewrote it with the `AdminApiDriver` infra, notable changes better than old logic:
1. Retry lookup stage on receiving `NOT_LEADER_OR_FOLLOWER` and `LEADER_NOT_AVAILABLE`, whereas in the past we failed the partition directly without retry.
2. Removing class field `supportsMaxTimestamp` and calculating it on the fly to avoid the mutable state, this won't change any behavior of  the client.
3. Retry fulfillment stage on `RetriableException`, whereas in the past we just retry fulfillment stage on `InvalidMetadataException`, this means we will retry on `TimeoutException` and other `RetriableException`.

We also `handleUnsupportedVersionException` to `AdminApiHandler` and `AdminApiLookupStrategy`, they are used to keep consistency with old logic, and we can continue improvise them. 

Reviewers: Ziming Deng <dengziming1993@gmail.com>, David Jacot <djacot@confluent.io>
2023-04-20 11:29:27 +08:00
Dániel Urbán 454b72161a
KAFKA-14902: KafkaStatusBackingStore retries on a dedicated background thread to avoid stack overflows (#13557)
KafkaStatusBackingStore uses an infinite retry logic on producer send, which can lead to a stack overflow.
To avoid the problem, a background thread was added, and the callback submits the retry onto the background thread.
2023-04-18 09:40:14 +02:00
Greg Harris f252c75bf3
MINOR: Fix regression in MM2 task forwarding introduced by KAFKA-14783 (#13548)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-04-13 09:50:02 -04:00
dorwi 9c0caca660
MINOR: update the connect task metrics documentation (#13494)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-04-12 12:08:07 -04:00
Chris Egerton e49a5a265f
KAFKA-14783 (KIP-875): New STOPPED state for connectors (#13424)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Yash Mayya <yash.mayya@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-04-11 09:37:26 -04:00
Gantigmaa Selenge 751a8af1f0
KAFKA-14420: Use incrementalAlterConfigs API for syncing topic configurations in MirrorMaker 2 (KIP-894) (#13373)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-04-10 11:55:49 -04:00
Chris Egerton 5e820571de
MINOR: Fix base ConfigDef in AbstractHerder::connectorPluginConfig (#13466)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-04-04 11:57:42 +02:00
Yash Mayya 970dea60e8
KAFKA-14785 (KIP-875): Connect offset read REST API (#13434)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-04-02 13:09:33 -04:00
Dániel Urbán 0aa365add8
KAFKA-14838: Add flow/connector/task/role information to MM2 Kafka client.id configs (#13458)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-03-31 10:50:11 -04:00
Jorge Esteban Quilcate Otoya 5afedd9ac3
KAFKA-14843: Include Connect framework properties when retrieving connector config definitions (#13445)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2023-03-28 11:26:23 -04:00
hudeqi f7ea9cfb50
KAFKA-14837/14842:Avoid the rebalance caused by the addition and deletion of irrelevant groups for MirrorCheckPointConnector (#13446)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-03-28 09:19:52 -04:00
Greg Harris 3c4fb01ba8
MINOR: Refactor Mirror integration tests to reduce duplication (#13428)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-03-24 16:18:26 +01:00
Chaitanya Mukka 3c25b311cb
KAFKA-14814: Skip Connect target state updates when the configs store has same state (#13426)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-03-23 11:23:38 -04:00
Mickael Maison 1d8f79964e
KAFKA-14740: Add source tag to MirrorSourceMetrics - KIP-911 (#13420)
New add.source.alias.to.metrics setting to add the source cluster alias to the MirrorSourceConnector metrics

Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-03-21 19:16:04 +01:00
Mickael Maison 1b278c4e55
KAFKA-8713: Allow using null for field in JsonConverter (KIP-581) (#13419)
Add a new configuration replace.null.with.default to allow using null instead of the default value.

Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-03-21 17:57:28 +01:00
Greg Harris 897ced12ee
KAFKA-14797: Emit offset sync when offset translation lag would exceed max.offset.lag (#13367)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-03-21 09:31:08 -04:00
Zheng-Xian Li ccda370e95
KAFKA-6891: send.buffer.bytes should be allowed to set -1 in KafkaConnect (#13398)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2023-03-21 16:45:40 +08:00
Chris Egerton e427897c67
KAFKA-14816: Only load SSL properties when issuing cross-worker requests to HTTPS URLs (#13415)
This fixes a regression introduced in #12828, which caused workers to start unconditionally loading (and therefore validating) SSL-related properties when issuing REST requests to other workers. That was fine for the most part, but caused unnecessary failures when workers were configured with invalid SSL-related properties and their REST API used HTTP instead of HTTPS.

Reviewers: Ian McDonald <imcdonald@confluent.io>, Greg Harris <greg.harris@aiven.io>, Yash Mayya <yash.mayya@gmail.com>, Justine Olshan <jolshan@confluent.io>
2023-03-20 08:32:01 -07:00
Mickael Maison 34ec6bdef8
MINOR: Log consumer groups mirrored by checkpoint tasks (#13389)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-03-16 14:22:36 +01:00
Hector Geraldino 7bf1906132
KAFKA-14809 Fix logging conditional on WorkerSourceTask (#13386)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-03-16 08:39:31 -04:00
Chris Egerton 404a833df7
KAFKA-14799: Ignore source task requests to abort empty transactions (#13379)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2023-03-14 15:10:29 -04:00
Yash Mayya 4608070db1
MINOR: Fix error check in Connect Worker zombie fencing (#13392) 2023-03-14 12:09:52 -04:00
Chris Egerton 39d41e5aac
KAFKA-14781: Downgrade MM2 log message severity when no ACL authorizer is configured on source broker (#13351)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-03-08 10:25:55 -05:00
Mickael Maison 71fa008b45
KAFKA-14745: Cache the ReplicationPolicy instance in MirrorConnectorConfig (#13328)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-03-03 12:14:17 +01:00
Greg Harris 3109e9c843
KAFKA-14649: Isolate failures during plugin path scanning to single plugin classes (#13182)
Reviewers: Christo Lolov <christo_lolov@yahoo.com>, Chris Egerton <chrise@aiven.io>
2023-03-02 15:10:01 -05:00
Greg Harris b0e28351ec
MINOR: Refactor task change logic to AbstractHerder, reuse for standalone mode. (#13287)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-03-02 09:53:52 -05:00
Greg Harris 7322f4cd55
MINOR: reformat ClusterConfigState constructions in Abstract & DistributedHerder (#13286)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-28 12:50:44 -05:00
Greg Harris f586fa59d3
KAFKA-14671: Refactor PredicatedTransformation to not implement Transformation (#13184)
Reviewers: Christo Lolov <christololov@gmail.com>, Yash Mayya <yash.mayya@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-02-28 11:23:19 -05:00
Yash Mayya 8dd697b05f
KAFKA-14732: Use an exponential backoff retry mechanism while reconfiguring connector tasks (#13276)
Reviewers: Chaitanya Mukka <chaitanya.mvs2007@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-02-28 10:36:34 -05:00
Hector Geraldino a1b8586a57
KAFKA-14659 source-record-write-[rate|total] metrics should exclude filtered records (#13193)
Reviewers: Christo Lolov <christololov@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-02-28 09:40:18 -05:00
Greg Harris 867fb295d0
KAFKA-14742: Throttle connectors in ExactlyOnceSourceIntegrationTest to fix flakey OOMEs (#13291)
KAFKA-14742: Throttle connectors in ExactlyOnceSourceIntegrationTest to fix flakey OOMEs
fixup: rename config constant, use meaningful constant names in EOSIT

Signed-off-by: Greg Harris <greg.harris@aiven.io>

Reviewers: Edoardo Comar <edocomar@gmail.com>
2023-02-28 10:21:36 +00:00
Hector Geraldino 5f9d01668c
KAFKA-14060: Replace EasyMock and PowerMock with Mockito in AbstractWorkerSourceTaskTest (#13191)
Reviewers: Christo Lolov <christololov@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-02-27 09:25:21 -05:00
Mickael Maison 8d7d563231
MINOR: Remove duplicate empty string check (#13145)
Reviewers: Chris Egerton <fearthecellos@gmail.com>, Christo Lolov <christololov@gmail.com>
2023-02-27 14:49:12 +01:00
Greg Harris a54a34a11c
KAFKA-12468, KAFKA-13659, KAFKA-12566: Fix MM2 causing negative downstream lag, syncing stale offsets, and flaky integration tests (#13178)
KAFKA-12468: Fix negative lag on down consumer groups synced by MirrorMaker 2

KAFKA-13659: Stop syncing consumer groups with stale offsets in MirrorMaker 2

KAFKA-12566: Fix flaky MirrorMaker 2 integration tests

Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-17 17:25:17 -05:00
Chris Egerton 38e4311622
MINOR: Fix PluginInfoTest for Connect (#13266)
Reviewers: Kamal Chandraprakash <kchandraprakash@uber.com>

Note: Merged without committer review in order to fix the build on trunk
2023-02-17 10:31:32 -05:00
Greg Harris aea6090ce4
KAFKA-14727: Enable periodic offset commits for EOS source tasks (#13262)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-16 18:51:34 -05:00
Christo Lolov ba0c5b0902
MINOR: Simplify JUnit assertions in tests; remove accidental unnecessary code in tests (#13219)
* assertEquals called on array
* Method is identical to its super method
* Simplifiable assertions
* Unused imports

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-02-16 16:13:31 +01:00
Greg Harris 958bc0601c
KAFKA-5756: Wait for concurrent source task offset flush to complete before starting next flush (#13208)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-02-15 21:29:20 -05:00
Dániel Urbán b9754747d6
KAFKA-14653: Use raw properties instead of post-resolution properties for MirrorMaker connectors(#13163)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-14 16:36:34 -05:00
Chris Egerton 8cfafba279
KAFKA-14021: Implement new KIP-618 APIs in MirrorSourceConnector (#12366)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-13 10:09:14 -05:00
Chris Egerton f93d5af839
KAFKA-15086, KAFKA-9981: Intra-cluster communication for Mirror Maker 2 (#13137)
Reviewers: Daniel Urban <durban@cloudera.com>, Greg Harris <greg.harris@aiven.io>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2023-02-09 10:50:07 -05:00
Christo Lolov a0a9b6ffea
MINOR: Remove unnecessary code (#13210)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-02-07 17:37:45 +01:00
Yash Mayya 8f00782be7
MINOR: Connect Javadocs improvements (#13120)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-02-06 12:07:53 +01:00
Chris Egerton 9ab689f7d4
KAFKA-14610: Publish Mirror Maker 2 offset syncs in task commit() method (#13181)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-02-06 10:53:58 +01:00
Yash Mayya 6e2b86597d
MINOR: Update incorrect / misleading comment regarding rebalance exceptions in WorkerSinkTask (#13194)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-03 09:00:08 -05:00
Yash Mayya a3cf8b54e0
KAFKA-14455: Kafka Connect create and update REST APIs should surface failures while writing to the config topic (#12984)
Reviewers: Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2023-02-02 11:03:38 -05:00
Chris Egerton 17559d581e
KAFKA-14645: Use plugin classloader when retrieving connector plugin config definitions (#13148)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-01-30 18:06:02 +01:00
Nikolay 26119bae90
KAFKA-14463 Close ConnectorClientConfigOverridePolicy instances (#13144)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-01-23 21:38:37 -05:00
vamossagar12 cfbd8979bc
KAFKA-14311: Cleanly cleanly stop connectors/tasks on Connect worker shutdown (#12802)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-01-23 14:15:59 -05:00
Chris Egerton a382acd31d
KAFKA-13709 (follow-up): Avoid mention of 'exactly-once delivery' or 'delivery guarantees' in Connect (#13106) 2023-01-13 09:19:29 -05:00
emilnkrastev 6e7e2e08a9
KAFKA-12558: Do not prematurely mutate internal partition state in Mirror Maker 2 (#11818)
Reviewers: Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2023-01-10 09:46:25 -05:00
csolidum ad94dc2134
KAFKA-14545: Make MirrorCheckpointTask.checkpoint handle null OffsetAndMetadata gracefully (#13052)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-01-04 12:02:52 +01:00
Yash Mayya a286891566
KAFKA-6586: Refactor ConnectDistributed and ConnectStandalone to re-use shared logic (#12947)
Reviewers: Christo Lolov  <christo_lolov@yahoo.com>, Chris Egerton <chrise@aiven.io>
2022-12-21 13:13:56 -05:00
Shekhar Rajak 2dcf306ef8
KAFKA-14132: Replace EasyMock and PowerMock with Mockito in connect/runtime/ErrorHandlingTaskTest (#12735)
Reviewers: Divij Vaidya <divijvaidya13@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-12-21 11:41:03 -05:00
Mickael Maison 429a2570b0
MINOR: Don't throw if MirrorMaker topics already exist (#13005)
Reviewers: Luke Chen <showuon@gmail.com>
2022-12-20 14:33:32 +01:00
Chris Egerton dd76872264
KAFKA-13709: Add docs for exactly-once support in Connect (#12941)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-12-15 11:20:49 -05:00
Greg Harris 526af63cfe
KAFKA-13881: Add Connect package infos (#12937)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-12-13 09:39:10 -05:00
Greg Harris 83732489ab
KAFKA-14443: Close topic creation Admin clients in MM2 connectors (#12955)
Reviewers: Omnia G H Ibrahim <o.g.h.ibrahim@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-12-07 16:59:46 -05:00
Yash Mayya b6fb95e4c4
KAFKA-14342: Clear offsets for connector source partitions on tombstone messages (#12800)
Reviewers: Sagar Rao <sagarmeansocean@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-12-06 09:25:41 -05:00
Patrik Marton 1c10d107fe
KAFKA-14293: Basic Auth filter should set the SecurityContext after a successful login (#12846)
Reviewers: Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2022-12-05 09:38:40 -05:00
Mickael Maison 8bb89c4beb
MINOR: Fix compilation issue in FileStreamSourceConnector (#12938)
Fix compilation failure introduced in https://github.com/apache/kafka/pull/12355.

Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-12-01 13:01:12 -08:00
Chris Egerton e11b515ef3
KAFKA-14017: Implement new KIP-618 APIs in FileStreamSourceConnector (#12355)
Reviewers: Yash Mayya <yash.mayya@gmail.com>,  Maison <mickael.maison@gmail.com>
2022-12-01 11:20:55 -05:00
Mickael Maison 40af3a7450
KAFKA-14413: Separate MirrorMaker configurations for each connector (#12899)
Reviewers: Luke Chen <showuon@gmail.com>, Chris Egerton <fearthecellos@gmail.com>, Christo Lolov  <christo_lolov@yahoo.com>
2022-11-30 18:37:37 +01:00
Chris Egerton 548348c9e7
KAFKA-13731: Allow standalone workers to be started without providing any connector configurations (#11890)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2022-11-30 11:49:24 -05:00
Greg Harris 3799125c2f
KAFKA-14339 : Do not perform producerCommit on serializationError when trying offsetWriter flush (#12920)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-29 19:06:30 -05:00
Greg Harris d3ee9341cc
KAFKA-12476: Prevent herder tick thread from sleeping excessively after slow operations (#12876)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-29 09:40:39 -05:00
Greg Harris cc77a38d28
KAFKA-12610: Implement PluginClassLoader::getResource and getResources (#12805)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-23 08:37:51 -05:00
Dan Stelljes 93dd6ce21a
KAFKA-13586: Prevent exception thrown during connector update from crashing distributed herder (#12295)
Reviewers: Kvicii <kvicii.yu@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-11-18 09:49:52 -05:00
Greg Harris 31c69ae932
KAFKA-14346: Remove hard-to-mock javax.crypto calls (#12866)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-17 18:10:17 -05:00
Greg Harris fca5bfe13c
KAFKA-14346: Remove hard-to-mock RestClient calls (#12828)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-17 17:51:54 -05:00
Greg Harris 7a93d5c833
KAFKA-14346: Replace static mocking of WorkerConfig::lookupKafkaClusterId (#12839)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-11-17 10:32:39 +01:00
David Jacot c2fc36f331
MINOR: Handle JoinGroupResponseData.protocolName backward compatibility in JoinGroupResponse (#12864)
This is a small refactor extracted from https://github.com/apache/kafka/pull/12845. It basically moves the logic to handle the backward compatibility of `JoinGroupResponseData.protocolName` from `KafkaApis` to `JoinGroupResponse`.

The patch adds a new unit test for `JoinGroupResponse` and relies on existing tests as well.

Reviewers: Justine Olshan <jolshan@confluent.io>, Jason Gustafson <jason@confluent.io>
2022-11-16 12:43:00 -08:00
Christo Lolov 1894856d0e
KAFKA-13414: Replace PowerMock/EasyMock with Mockito in connect.storage.KafkaOffsetBackingStoreTest (#12418)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-15 16:30:52 -05:00
vamossagar12 09da44ed80
KAFKA-12495: Exponential backoff retry to prevent rebalance storms when worker joins after revoking rebalance (#12561)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Luke Chen <showuon@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-11-15 16:26:21 -05:00
Omnia G H Ibrahim 46bee5bcf3
KAFKA-13401: KIP-787 - MM2 manage Kafka resources with custom Admin implementation. (#12577)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Tom Bentley <tombentley@users.noreply.github.com>

Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
Co-authored-by: oibrahim3 <omnia@apple.com>
2022-11-15 11:21:24 +01:00
Chris Egerton bb84476215
KAFKA-14098: Add meaningful client IDs for Connect workers (#12544)
Reviewers: Greg Harris <greg.harris@aiven.io>, Mickael Maison <mickael.maison@gmail.com>
2022-11-08 10:22:30 -05:00
Christo Lolov 4af5dae05c
KAFKA-14132: Replace PowerMock and EasyMock with Mockito in connect tests (#12823)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-07 11:34:55 -05:00
Greg Harris 98ed31c95b
KAFKA-14346: Remove difficult to mock Plugins.compareAndSwapLoader usages (#12817)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-11-07 09:37:24 -05:00
Omnia G H Ibrahim 9608f3a2e7
KAFKA-14344: Build EmbeddedKafkaCluster with common configs used for all clients (#12804)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-11-07 11:11:16 +01:00
Chris Egerton 14c36c7539
KAFKA-14058: Migrate ExactlyOnceWorkerSourceTaskTest from EasyMock and Powermock to Mockito (#12409)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-11-03 12:42:08 -04:00
Matthew de Detrich 9ab140d541
KAFKA-14132; Replace EasyMock with Mockito ConnectorsResourceTest (#12725)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-10-31 20:08:41 -04:00
Greg Harris 98bf375b6f
KAFKA-13989: Errors while evaluating connector type should return UNKNOWN (#12789)
Reviewers: Igor Soarez <i@soarez.me>, Chris Egerton <chrise@aiven.io>
2022-10-31 16:54:32 -04:00
Greg Harris f7304db6d2
KAFKA-14338: Use MockTime in RetryUtilTest to eliminate flakiness (#12791)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-10-29 06:38:24 -04:00
(+ (* 1 2 3 4) 5 6 7) 61f48a9f63
KAFKA-14314: Add check for null upstreamTopic (#12769)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
Co-authored-by: John Krupka <john.krupka@united.com>
2022-10-28 17:28:26 +02:00
Chris Egerton 18e60cb000
KAFKA-12497: Skip periodic offset commits for failed source tasks (#10528)
Also moves the Streams LogCaptureAppender class into the clients module so that it can be used by both Streams and Connect.

Reviewers: Nigel Liang <nigel@nigelliang.com>, Kalpesh Patel <kpatel@confluent.io>, John Roesler <vvcephei@apache.org>, Tom Bentley <tbentley@redhat.com>
2022-10-13 10:15:42 -04:00
Alexandre Garnier 62914129c7
KAFKA-14099 - Fix request logging in connect (#12434)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-10-12 10:28:55 -04:00
Ramesh a6b60e7cf3
KAFKA-12965 - Graceful clean up of task error metrics (#10910)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-10-12 09:59:52 -04:00
Matthew de Detrich ba0f105e2f
MINOR: Use LEADER_URL variable in ConnectorsResourceTest (#12722)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-10-07 10:18:31 -04:00
Matthew de Detrich de05665876
KAFKA-14283: Fix connector creation Auth tests (#12721)
Reviewers: Sagar Rao <sagarmeansocean@gmail.com>, Chris Egerton <chrise@aiven.io>
2022-10-07 10:14:15 -04:00
Divij Vaidya 9b2e290423
KAFKA-14132: Replace PowerMock/Easymock with Mockito for WorkerMetricsGroupTest (#12677)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-23 16:14:09 -04:00
Jordan Bull 8ddc9509cf
KAFKA-13927: Fix sink task offset tracking during exception retries (#12566)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-20 13:46:35 -04:00
Federico Valeri 6d463c1733
MINOR: Update offset.storage.topic description (#12656)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-19 13:21:59 -04:00
Rens Groothuijsen b09cadcaa7
KAFKA-13985: Skip committing MirrorSourceTask records without metadata (#12602)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-15 09:55:44 -04:00
Yash Mayya bdf2cdb27f
KAFKA-14132: Migrate some Connect tests from EasyMock/PowerMock to Mockito (#12615)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-14 11:00:32 -04:00
Nandini Anagondi 21eae2f29a
MINOR: Use MessageDigest equals when comparing signature (#11516)
The motivation for this change is to guard against timing attacks when using InternalRequestSignature.equals()

Pros of this PR

    if the InternalRequestSignature.equal() method could be used for a timing attack, then this PR fixes a security vulnerability

Cons of this PR

    MessageDigest.isEquals() is slower than Arrays.equal since the former is time constant i.e. it runs for a fixed time irrespective of the length of original signature. The execution time of MessageDigest.isEquals() is a function of length of the byte array that it is being tested against.

Even if InternalRequestSignature.equals() is not being used anywhere in code today where it may cause a timing attack, we should still guard against the possibility where a future change might start using it (especially in an open source project where changes might be contributed & reviewed by multiple group of people). The downside of slower equality comparison over a signature is risk worth accepting given the upside we get to safeguard future use cases.

Co-authored-by: Nandini Krishna Anagondi <nandini@mac.local>

Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <diviv@amazon.com>,  Karan Kumar <karankumar1100@gmail.com>, Andrew Eugene Choi <andrew.choi@uwaterloo.ca>
2022-09-14 21:06:43 +08:00
Divij Vaidya d4fc3186b4
MINOR: Replace usage of File.createTempFile() with TestUtils.tempFile() (#12591)
Why
Current set of integration tests leak files in the /tmp directory which makes it cumbersome if you don't restart the machine often.

Fix
Replace the usage of File.createTempFile with existing TestUtils.tempFile method across the test files. TestUtils.tempFile automatically performs a clean up of the temp files generated in /tmp/ folder.

Reviewers: Luke Chen <showuon@gmail.com>, Ismael Juma <mlists@juma.me.uk>
2022-09-13 08:44:21 +08:00
Chris Egerton 897bf4741c
KAFKA-14143: Exactly-once source connector system tests (#11783)
Also includes a minor quality-of-life improvement to clarify why some internal REST requests to workers may fail while that worker is still starting up.

Reviewers: Tom Bentley <tbentley@redhat.com>, Luke Chen <showuon@gmail.com>, José Armando García Sancio <jsancio@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2022-09-08 15:13:43 -04:00
Yash Mayya 0c97be53fa
KAFKA-13952 fix RetryWithToleranceOperator to respect infinite retries configuration (#12478)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-08 10:14:04 -04:00
Yash Mayya 9b947a5ca3
MINOR: Fix usage of @see in IncrementalCooperativeAssignor doc comments (#12606)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-09-08 11:27:06 +02:00
Yash Mayya c359558826
KAFKA-14015: Reconfigure tasks if configs have been changed for restarted connectors in standalone mode(#12568)
Reviewers: Chris Egerton <chrise@aiven.io>
2022-09-06 09:05:21 -04:00
Mickael Maison d606eb46ef
MINOR: Small javadoc/code cleanups in connect api and transforms (#12558)
Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <diviv@amazon.com>
2022-08-29 09:44:56 +02:00
Mickael Maison 0507597597
KAFKA-10360: Allow disabling JMX Reporter (KIP-830) (#12046)
This implements KIP-830: https://cwiki.apache.org/confluence/display/KAFKA/KIP-830%3A+Allow+disabling+JMX+Reporter
It adds a new configuration `auto.include.jmx.reporter` that can be set to false to disable the JMX Reporter. This configuration is deprecated and will be removed in the next major version.

Reviewers: Tom Bentley <tbentley@redhat.com>, Christo Lolov <christo_lolov@yahoo.com>
2022-08-24 18:30:31 +02:00
Divij Vaidya 4b310d1fe1
KAFKA-13133: Replace EasyMock and PowerMock with Mockito for AbstractHerderTest (#12473)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Yash Mayya <yash.mayya@gmail.com>

Co-authored-by: wycccccc <493172422@qq.com>
Co-authored-by: wycccccc <43372856+wycccccc@users.noreply.github.com>
2022-08-23 17:49:38 +02:00
Mickael Maison 4bd3fd840d
KAFKA-14160: Streamline clusterId retrieval in Connect (#12536)
Cache the Kafka cluster Id once it has been retrieved to avoid creating many Admin clients at startup.

Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-23 17:09:22 +02:00
Yash Mayya 6df57679d0
KAFKA-14162: Stop adding immutable maps/lists to record keys/values in HoistField and MaskField SMTs (#12502)
Reviewers:  Sagar Rao <sagarmeansocean@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2022-08-23 10:22:02 -04:00
Yash Mayya ddb7fdd88f
KAFKA-14133: Replace EasyMock with Mockito in WorkerCoordinatorTest and RootResourceTest (#12509)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Dalibor Plavcic <dalibor.os@proton.me>
2022-08-22 20:17:34 +02:00
Yash Mayya 519d8ac5b9
KAFKA-14147: Prevent deferredTaskUpdates map from growing monotonically in KafkaConfigBackingStore (#12490)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-22 10:13:43 -04:00
Chris Egerton 73e8d5dd5b
MINOR: Remove unused ShutdownableThread class and ineffective ThreadedTest class (#12410)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Christo Lolov <christo_lolov@yahoo.com>
2022-08-18 12:08:03 +02:00
Kvicii d8e93c368d
KAFKA-13971:Atomicity violations caused by improper usage of ConcurrentHashMap (#12277)
Reviewers: Divij Vaidya <diviv@amazon.com>, Chris Egerton <fearthecellos@gmail.com>
2022-08-17 12:32:24 -04:00
Yash Mayya 18142bff4b
KAFKA-13809: Propagate full connector configuration to tasks in FileStream connectors (#12450)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-15 15:25:29 -04:00
Divij Vaidya 9a3a34cab0
KAFKA-13060: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest.java (#12484)
This PR is created on top of #10904 and includes commits from original author for attribution. 

## Testing
1. `./gradlew connect:runtime:unitTest --tests WorkerGroupMemberTest` is successful.
2. Verified that test is run as part of `./gradlew connect:runtime:unitTest` (see report in the PR)

Reviewers: Ismael Juma <ismael@juma.me.uk>

Co-authored-by: Chun-Hao Tang <tang7526@gmail.com>
2022-08-10 06:45:07 -07:00
Yash Mayya 465d8fa94f
KAFKA-14134: Replace EasyMock with Mockito for WorkerConnectorTest (#12472)
Reviewers: Divij Vaidya <diviv@amazon.com>, Chris Egerton <fearthecellos@gmail.com>
2022-08-09 10:10:47 -04:00
venkatteki a02c8d336a
KAFKA-13546: Do not fail connector validation if default topic creation group is explicitly specified (#11615)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-02 14:03:57 -04:00
nicolasguyomar 31ff6d7f8a
MINOR: Stop logging 404s at ERROR level in Connect
Catches valid 404 exceptions, triggered by any HTTP request to a nonexistent path on the Connect REST API, higher in the code to not to log an ERROR log which can be seen as a false alarm

Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-01 08:48:35 -04:00
Mickael Maison 1cc1e776f7
KAFKA-14095: Improve handling of sync offset failures in MirrorMaker (#12432)
We should not treat UNKNOWN_MEMBER_ID as an unexpected error in the Admin client. In MirrorMaker, check the result of committing offsets and log an useful error message in case that failed with UNKNOWN_MEMBER_ID.

Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-08-01 12:59:41 +02:00
Yash Mayya 517e4d9278
MINOR: Update comment on verifyTaskGenerationAndOwnership method in DistributedHerder
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2022-07-28 17:18:35 -04:00
vamossagar12 3ddb62316f
KAFKA-14012: Add warning to closeQuietly documentation about method references of null objects (#12321)
Reviewers: Kvicii <42023367+Kvicii@users.noreply.github.com>, Chris Egerton <fearthecellos@gmail.com>
2022-07-28 16:44:19 -04:00
Chris Egerton 9e74f91e56
KAFKA-14089: Only check for committed seqnos after disabling exactly-once support in Connect integration test (#12429)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-07-28 17:18:09 +02:00
vamossagar12 0c5f5a7f8b
KAFKA-14007: Close header converters during Connect task shutdown (#12309)
The HeaderConverter interface extends Closeable, but we weren't closing them anywhere before. This change causes header converters to be closed as part of task shutdown.

Reviewers: Kvicii <42023367+Kvicii@users.noreply.github.com>, Chris Egerton <fearthecellos@gmail.com>
2022-07-27 22:31:07 -04:00
Hao Li 6ac58ac6fc
MINOR: remove unnecessary test stubbing (#12445)
Reviewers: John Roesler <vvcephei@apache.org>
2022-07-26 21:21:11 -05:00
Christo Lolov 25b914750d
KAFKA-13982: Move WorkerConfigTransformerTest to use Mockito (#12422) 2022-07-26 09:39:27 -04:00
Christo Lolov 6b76c01cf8
KAFKA-13158: Migrate ConnectClusterStateImpl to Mockito (#12423)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2022-07-25 19:47:08 +02:00
Chris Egerton 71d225d7c2
KAFKA-14093: Use single-worker Connect cluster when testing fenced leader recovery (#12433)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-07-25 15:30:38 +02:00
Elkhan Eminov ed77bebcaf
KAFKA-13702: Connect RestClient overrides response status code on request failure (#12320)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2022-07-20 11:29:00 +02:00
Shawn eee40200df
KAFKA-14024: Consumer keeps Commit offset in onJoinPrepare in Cooperative rebalance (#12349)
In KAFKA-13310, we tried to fix a issue that consumer#poll(duration) will be returned after the provided duration. It's because if rebalance needed, we'll try to commit current offset first before rebalance synchronously. And if the offset committing takes too long, the consumer#poll will spend more time than provided duration. To fix that, we change commit sync with commit async before rebalance (i.e. onPrepareJoin).

However, in this ticket, we found the async commit will keep sending a new commit request during each Consumer#poll, because the offset commit never completes in time. The impact is that the existing consumer will be kicked out of the group after rebalance timeout without joining the group. That is, suppose we have consumer A in group G, and now consumer B joined the group, after the rebalance, only consumer B in the group.

Besides, there's also another bug found during fixing this bug. Before KAFKA-13310, we commitOffset sync with rebalanceTimeout, which will retry when retriable error until timeout. After KAFKA-13310, we thought we have retry, but we'll retry after partitions revoking. That is, even though the retried offset commit successfully, it still causes some partitions offsets un-committed, and after rebalance, other consumers will consume overlapping records.

Reviewers: RivenSun <riven.sun@zoom.us>, Luke Chen <showuon@gmail.com>
2022-07-20 10:03:43 +08:00
Christopher L. Shannon 8142822633
KAFKA-14079 - Ack failed records in WorkerSourceTask when error tolerance is ALL (#12415)
Make sure to ack all records where produce failed, when a connector's `errors.tolerance` config property is set to `all`. Acking is essential so that the task will continue to commit future record offsets properly and remove the records from internal tracking, preventing a memory leak.

(cherry picked and slightly modified from commit 63e06aafd0)

Reviewers: Chris Egerton <fearthecellos@gmail.com>, Randall Hauch <rhauch@gmail.com>
2022-07-18 17:07:20 -05:00
Chris Egerton 3ae1afa438
KAFKA-10000: Integration tests (#11782)
Implements embedded end-to-end integration tests for KIP-618, and brings together previously-decoupled logic from upstream PRs.

Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>, Mickael Maison <mickael.maison@gmail.com>
2022-07-06 10:35:05 +08:00
Chris Egerton ec22af94a6
KAFKA-13613: Remove hard dependency on HmacSHA256 algorithm for Connect (#11894)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-07-05 12:34:23 +02:00
Chris Egerton d00b7875e0
KAFKA-13987: Isolate REST request timeout changes in Connect integration tests (#12291)
This causes the artificial reductions in the Connect REST request timeout to be more isolated. Specifically, they now only take place in the tests that need them (instead of any tests that happen to be running after the reduction has taken place and before it has been reset), and they are only performed for the requests that are expected to time out, before being immediately reset. This should help reduce spurious test failures (especially in slow environments like Jenkins) for all Connect integration tests that interact with the REST API, not just the BlockingConnectorTest test suite.

Reviewers: Bruno Cadonna <cadonna@apache.org>
2022-06-23 16:56:53 +02:00
Chris Egerton b7b7615db3
KAFKA-10000: Per-connector offsets topics (#11781)
Implements support for per-connector offsets topics as described in KIP-618.

Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>
2022-06-21 15:58:17 +08:00
Guozhang Wang 39a555ba94
KAFKA-13846: Use the new addMetricsIfAbsent API (#12287)
Use the newly added function to replace the old addMetric function that may throw illegal argument exceptions.

Although in some cases concurrency should not be possible they do not necessarily remain always true in the future, so it's better to use the new API just to be less error-prone.

Reviewers: Bruno Cadonna <cadonna@apache.org>
2022-06-14 16:04:26 -07:00
vamossagar12 5cab11cf52
KAFKA-13846: Adding overloaded metricOrElseCreate method (#12121)
Reviewers: David Jacot <djacot@confluent.io>, Justine Olshan <jolshan@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
2022-06-13 10:36:39 -07:00
Chris Egerton 9e8ef8bb31
KAFKA-10000: Exactly-once source tasks (#11780)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Tom Bentley <tbentley@redhat.com>
2022-06-13 16:25:29 +02:00
Chris Egerton 6853d63e4d
KAFKA-10000: Zombie fencing logic (#11779)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-06-10 14:35:35 +02:00
Mickael Maison 4a06458633
KAFKA-13780: Generate OpenAPI file for Connect REST API (#12067)
New gradle task `connect:runtime:genConnectOpenAPIDocs` that generates `connect_rest.yaml` under `docs/generated`.
This task is executed when `siteDocsTar` runs.
2022-06-10 11:35:22 +02:00
Chris Egerton 603502bf5f
KAFKA-10000: Use transactional producer for leader-only writes to the config topic (#11778)
Implements the behavior described in KIP-618: using a transactional producer for writes to the config topic that should only be performed by the leader of the cluster.

Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>
2022-06-07 15:16:48 +08:00
Chris Egerton a110f1fe85
KAFKA-10000: Add new preflight connector config validation logic (#11776)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, Tom Bentley <tbentley@redhat.com>
2022-06-02 11:57:50 +02:00
Chris Egerton 61df3034fe
KAFKA-12657: Increase timeouts in Connect integration tests (#12191)
As an initial step to address the notoriously flaky BlockingConnectorTest test suite, we can try increasing test timeouts.

This approach may not be sufficient, and even if it is, it's still suboptimal. Although it may address flakiness on Jenkins, it will make genuine failures harder to detect when testing local changes. Additionally, if the workload on Jenkins continues to increase, we'll probably have to bump these timeouts in the future again at some point.

Potential next steps, for this PR and beyond:

    Stop leaking threads that block during test runs
    Instead of artificially reducing the REST request timeout at the beginning of every test, reduce it selectively right before issuing a REST request that is expected to time out, and then immediately reset it.
    Eliminate artificial reduction of the REST request timeout entirely, as it may be negatively impacting other Connect integration tests that are being run concurrently.
    Test repeatedly on Jenkins, ideally at least 50 times
    Gather information on the number of CPU cores available to each Jenkins node and the distribution of how many threads are allocated over a given time period (maybe a day?); this is especially relevant since local testing indicates that these tests all do much better when parallelism is reduced, which shouldn't be too surprising considering that each Connect integration test spins up separate threads for at least one Zookeeper node, one Kafka broker, one Connect worker, and usually at least one connector and one task.

I'd like to test these changes as a first step before investigating any of the above (except maybe items 1 and 2, which should be fairly straightforward). To trigger new runs I plan on pushing empty commits or, if those do not trigger new Jenkins runs, dummy commits. If this is objectionable let me know and hopefully we can find a suitable alternative.

Reviewers: Kvicii <Karonazaba@gmail.com>, Bruno Cadonna <cadonna@apache.org>
2022-06-02 10:21:07 +02:00
Colin Patrick McCabe 4c9eeef5b2
MINOR: add timeouts to streams integration tests (#12216)
Reviewers: David Arthur <mumrah@gmail.com>
2022-05-31 14:22:13 -07:00
nicolasguyomar 6efde847ca
MINOR: Replace left single quote with single quote in Connect worker's log message (#12201)
Minor change to use ' and not LEFT SINGLE QUOTATION MARK in this log message, as it's the only place we are using such a quote and it can break ingestion pipelines

Reviewers: Kvicii <Karonazaba@gmail.com>, Divij Vaidya <diviv@amazon.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2022-05-25 10:40:46 -07:00
Mickael Maison cdd19a5326
KAFKA-12635: Don't emit checkpoints for partitions without offset-syncs (#11748)
Reviewers: Luke Chen <showuon@gmail.com>,  Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Dániel Urbán <urb.daniel7@gmail.com>, Federico Valeri <fedevaleri@gmail.com>
2022-05-16 17:44:14 +02:00
Chris Egerton 7268284699
KAFKA-10000: Add all public-facing config properties (#11775)
Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>, Andrew Eugene Choi <andrew.choi@uwaterloo.ca>
2022-05-12 14:45:53 +08:00
Mickael Maison 989d3ce07f
MINOR: Small cleanups in connect/mirror (#12113)
Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <divijvaidya13@gmail.com>
2022-05-10 14:49:56 +08:00
RivenSun df507e56e2
KAFKA-13793: Add validators for configs that lack validators (#12010)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Luke Chen <showuon@gmail.com>, Chris Egerton <fearthecellos@gmail.com>, Christo Lolov <lolovc@amazon.com>, Divij Vaidya <divijvaidya13@gmail.com>
2022-05-09 20:29:17 +02:00
Chris Egerton 1278e385c0
KAFKA-13763: Refactor IncrementalCooperativeAssignor for improved unit testing (#11983)
The goals here include:

1. Create an overloaded variant of the IncrementalCooperativeAssignor::performTaskAssignment method that is more testing friendly
2. Simplify the parameter list for the IncrementalCooperativeAssignor::handleLostAssignments method, which in turn simplifies the logic for testing this class
3. Capture repeated Java 8 streams logic in simple, reusable, easily-verifiable utility methods added to the ConnectUtils class

Reviewers: Luke Chen <showuon@gmail.com>
2022-05-09 21:43:47 +08:00
Chris Egerton a586c94af1
KAFKA-10000: Add new source connector APIs related to exactly-once support (KIP-618) (#11773)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Reviewers: Tom Bentley <tbentley@redhat.com>, Hector Geraldino <hgeraldino@bloomberg.net>, Andrew Eugene Choi <andrew.choi@uwaterloo.ca>
2022-05-06 11:13:59 +02:00
Rajani Karuturi a673f21242
KAFKA-12380 shutdown Executor in Connect's Worker when closed (#11955)
When the worker is stopped, it does not shutdown this executor. This PR fixes the issue.

Reviewers: Luke Chen <showuon@gmail.com>
2022-04-29 13:35:25 +08:00
Chris Egerton b9fc893546
MINOR: Correct Connect docs on connector/task states (#11914)
The `DESTROYED` state is represented internally as a tombstone record when running in distributed mode and by the removal of the connector/task from the in-memory status map when running in standalone mode. As a result, it will never appear to users of the REST API, and we should remove mention of it from our docs so that developers creating tooling against the REST API don't write unnecessary logic to account for that state.

Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-04-13 12:51:34 +02:00
Chris Egerton 88e5f133b5
KAFKA-13763: Improve unit testing coverage and flexibility for IncrementalCooperativeAssignor (#11974)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-04-05 21:42:08 +02:00
sunshujie1990 8e205b503a
KAFKA-13719: Fix connector restart cause duplicate tasks (#11869)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Luke Chen <showuon@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
Co-authored-by: Chris Egerton <fearthecellos@gmail.com>
2022-03-30 14:58:58 +02:00
Randall Hauch ce88389227
KAFKA-13770: Restore compatibility with KafkaBasedLog using older Kafka brokers (#11946)
The `retryEndOffsets(…)` method in `TopicAdmin` recently added (KAFKA-12879, #11797) to allow the `KafkaBasedLog.start()` method to retry any failures reading the last offsets for a topic. However, this introduce a regression when talking to older brokers (0.10.x or earlier).

The `KafkaBasedLog` already had logic that expected an `UnsupportedVersionException` thrown by the admin client when a Kafka API is not available on an older broker, but the new retry logic in `TopicAdmin` did not account for this and wrapped the exception, thereby breaking the `KafkaBasedLog` logic and preventing startup.

The fix is to propagate this `UnsupportedVersionException` from the `TopicAdmin.retryEndOffsets(…)` method. Added a new unit test that first replicated the problem before the fix, and verified the fix corrects the problem.
2022-03-24 21:40:10 -05:00
Konstantine Karantasis 6ce69021fd
KAFKA-13759: Disable idempotence by default in producers instantiated by Connect (#11933)
With AK 3.0, idempotence was enabled by default in Kafka producers. However, if idempotence is enabled, Connect won't be able to communicate via its producers with Kafka brokers older than version 0.11. Perhaps more importantly, for brokers older than version 2.8 the IDEMPOTENT_WRITE ACL is required to be granted to the principal of the Connect worker.

Therefore this commit disables producer idempotence by default to all the producers instantiated by Connect. Users can still choose to enable producer idempotence by explicitly setting the right worker and/or connector properties.

The changes were tested via existing unit, integration and system tests.

Reviewers: Randall Hauch <rhauch@gmail.com>
2022-03-23 15:03:52 -07:00
Konstantine Karantasis b60f4464ac
Revert "KAFKA-7077: Use default producer settings in Connect Worker (#11475)" (#11932)
This reverts commit 76cf7a5793.

Connect already allows users to enable idempotent producers for connectors and the Connect workers. Although Kafka producers enabled idempotency by default in 3.0, due to compatibility requirements and the fact that [KIP-318](https://cwiki.apache.org/confluence/display/KAFKA/KIP-318%3A+Make+Kafka+Connect+Source+idempotent) hasn't been explicitly approved, the changes here are reverted. A separate commit will explicitly disable idempotency in producers instantiated by Connect by default until KIP-318 is approved and scheduled for release.
2022-03-22 17:19:29 -07:00
Chris Egerton 43bf464232
KAFKA-13497: Add trace logging to RegexRouter (#11903)
This patch adds runtime logging to the RegexRouter to show exactly which topics get routed where.

Reviewers: David Jacot <djacot@confluent.io>
2022-03-18 10:27:49 +01:00
dengziming 3dacdc5694
MINOR: Replace EasyMock with Mockito in connect:file (#11471)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2022-03-17 17:30:37 +01:00
Guozhang Wang cad4985a0a
MINOR: Disable those flaky tests (#11895)
I collected a list of the most flaky tests observed lately, checked / created their corresponding tickets, and mark them as ignored for now. Many of these failures are:

0. Failing very frequently in the past (at least in my observations).
1. not investigated for some time.
2. have a PR for review (mostly thanks to @showuon !), but not reviewed for some time.

Since 0), these tests failures are hindering our development; and from 1/2) above, people are either too busy to look after them, or honestly the tests are not considered as providing values since otherwise people should care enough to panic and try to resolve. So I think it's reasonable to disable all these tests for now. If we later learned our lesson a hard way, it would motivate us to tackle flaky tests more diligently as well.

I'm only disabling those tests that have been failed for a while, and if for such time no one have been looking into them, I'm concerned that just gossiping around about those flakiness would not bring people's attention to them either. So my psychological motivation is that "if people do not care about those failed tests for weeks (which, is not a good thing! :P), let's teach ourselves the lesson a hard way when it indeed buries a bug that bites us, or not learn the lesson at all --- that indicates those tests are indeed not valuable". For tests that I only very recently saw I did not disable them.

Reviewers: John Roesler <vvcephei@apache.org>, Matthias J. Sax <mjsax@apache.org>, Luke Chen <showuon@gmail.com>, Randall Hauch <rhauch@gmail.com>
2022-03-14 21:32:28 -07:00
Liam Clarke-Hutchinson 76cf7a5793
KAFKA-7077: Use default producer settings in Connect Worker (#11475)
Reviewers: Luke Chen <showuon@gmail.com>
2022-03-15 11:20:18 +08:00
Liam Clarke-Hutchinson 7f284497cb
KAFKA-13438: Replace EasyMock and PowerMock with Mockito in WorkerTest (#11817)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-03-14 13:03:41 +01:00
Randall Hauch d2d49f6421
KAFKA-12879: Remove extra sleep (#11872) 2022-03-09 15:11:46 -06:00
Philip Nee ddcee81043
KAFKA-12879: Addendum to reduce flakiness of tests (#11871)
This is an addendum to the KAFKA-12879 (#11797) to fix some tests that are somewhat flaky when a build machine is heavily loaded (when the timeouts are too small).

- Add an if check to void sleep(0)
- Increase timeout in the tests
2022-03-09 14:37:48 -06:00
Philip Nee 28393be6d7
KAFKA-12879: Revert changes from KAFKA-12339 and instead add retry capability to KafkaBasedLog (#11797)
Fixes the compatibility issue regarding KAFKA-12879 by reverting the changes to the admin client from KAFKA-12339 (#10152) that retry admin client operations, and instead perform the retries within Connect's `KafkaBasedLog` during startup via a new `TopicAdmin.retryEndOffsets(..)` method. This method delegates to the existing `TopicAdmin.endOffsets(...)` method, but will retry on `RetriableException` until the retry timeout elapses.

This change should be backward compatible to the KAFKA-12339 so that when Connect's `KafkaBasedLog` starts up it will retry attempts to read the end offsets for the log's topic. The `KafkaBasedLog` existing thread already has its own retry logic, and this is not changed.

Added more unit tests, and thoroughly tested the new `RetryUtil` used to encapsulate the parameterized retry logic around any supplied function.
2022-03-09 12:39:28 -06:00
Mickael Maison 029a14b530
KAFKA-13510: Connect APIs to list all connector plugins and retrieve their configs (#11572)
Implements KIP-769: https://cwiki.apache.org/confluence/display/KAFKA/KIP-769%3A+Connect+APIs+to+list+all+connector+plugins+and+retrieve+their+configuration+definitions

Reviewers: Tom Bentley <tbentley@redhat.com>, Chris Egerton <fearthecellos@gmail.com>
2022-03-03 14:28:50 +01:00
Marc Löhe 14faea4aab
KAFKA-8659: fix SetSchemaMetadata failing on null value and schema (#7082)
Make SetSchemaMetadata SMT ignore records with null value and valueSchema or key and keySchema.

The transform has been unit tested for handling null values gracefully while still providing the necessary validation for non-null values.

Reviewers: Konstantine Karantasis<konstantine@confluent.io>, Bill Bejeck <bbejeck@apache.org>
2022-03-01 10:10:43 -05:00
Chris Egerton 6f09c3f88b
KAFKA-10000: Utils methods for overriding user-supplied properties and dealing with Enum types (#11774)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-02-23 14:49:30 +01:00
Chris Egerton 6bef673197
KAFKA-10000: Add new metrics for source task transactions (#11772)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-02-23 14:48:43 +01:00
Julien Chanaud a5bb45c11a
KAFKA-13511: Add support for different unix precisions in TimestampConverter SMT (#11575)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Tom Bentley <tbentley@redhat.com>
2022-02-22 17:17:16 +01:00
Mickael Maison 576496a1ca
MINOR: Improve Connect docs (#11642)
- Fix indendation of code blocks
- Add links to all SMTs and Predicates

Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>
2022-02-22 20:49:53 +08:00
Chris Egerton 4d036ee871
MINOR: Clarify logging behavior with errors.log.include.messages property (#11758)
The docs are a little misleading and some users can be confused about the exact behavior of this property.
2022-02-21 07:55:04 -06:00
Chris Egerton c7586cc38d
KAFKA-13669; Demote empty offset commit messages for source tasks to DEBUG level (#11770)
Lower the log level of a message in `WorkerSourceTask` which indicates that no messages have been produced by the task since it is spammy and causing users confusion.

Reviewers: Jason Gustafson <jason@confluent.io>
2022-02-16 17:50:58 -08:00
Mickael Maison 8047ba3800
MINOR: Small cleanups in connect:runtime (#11756)
Reviewers: Jason Gustafson <jason@confluent.io>
2022-02-16 20:02:25 +01:00
David Jacot c8fbe26f3b
KAFKA-13435; Static membership protocol should let the leader skip assignment (KIP-814) (#11688)
This patch implements KIP-814 as described here: https://cwiki.apache.org/confluence/display/KAFKA/KIP-814%3A+Static+membership+protocol+should+let+the+leader+skip+assignment.

Reviewers: Luke Chen <showuon@gmail.com>, Artem Livshits <alivshits@confluent.io>, Jason Gustafson <jason@confluent.io>
2022-02-14 11:55:38 +01:00
Mickael Maison f9201666a1
MINOR: Small cleanups in mirror/mirror-client (#11749)
Reviewers: Jason Gustafson <jason@confluent.io>
2022-02-14 10:17:54 +01:00
lhunyady 03af63d076
KAFKA-13306: Null connector config value passes validation, but fails creation (#11333)
This patch adds null value check to the connector config validation, and extends unit tests to cover this functionality.

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <chrise@confluent.io>, Boyang Chen <bchen11@outlook.com>, Andras Katona <akatona@cloudera.com>
2022-02-11 16:14:06 +01:00
RivenSun 4b468a9d81
KAFKA-13310 : KafkaConsumer cannot jump out of the poll method, and the… (#11340)
Title: KafkaConsumer cannot jump out of the poll method, and cpu and traffic on the broker side increase sharply
description: The local test has been passed, the problem described by jira can be solved

JIRA link : https://issues.apache.org/jira/browse/KAFKA-13310

Reviewers: Luke Chen <showuon@gmail.com>, Guozhang Wang <wangguoz@gmail.com>
2022-02-08 23:05:42 -08:00
Luke Chen e6db0ca48c
KAFKA-13598: enable idempotence producer by default and validate the configs (#11691)
In v3.0, we changed the default value for `enable.idempotence` to true, but we didn't adjust the validator and the `idempotence` enabled check method. So if a user didn't explicitly enable idempotence, this feature won't be turned on. This patch addresses the problem, cleans up associated logic, and fixes tests that broke as a result of properly applying the new default. Specifically it does the following:

1. fix the `ProducerConfig#idempotenceEnabled` method, to make it correctly detect if `idempotence` is enabled or not
2. remove some unnecessary config overridden and checks due to we already default `acks`, `retries` and `enable.idempotence` configs.
3. move the config validator for the idempotent producer from `KafkaProducer` into `ProducerConfig`. The config validation should be the responsibility of `ProducerConfig` class.
4. add an `AbstractConfig#hasKeyInOriginals` method, to avoid `originals` configs get copied and only want to check the existence of the key. 
5. fix many broken tests. As mentioned, we didn't actually enable idempotence in v3.0. After this PR, there are some tests broken due to some different behavior between idempotent and non-idempotent producer.
6. add additional tests to validate configuration behavior

Reviewers: Kirk True <kirk@mustardgrain.com>, Ismael Juma <ismael@juma.me.uk>, Mickael Maison <mimaison@users.noreply.github.com>, Jason Gustafson <jason@confluent.io>
2022-02-05 10:53:27 -08:00
Lucas Bradstreet 756fa1c7f3
MINOR: allocate 2MB to offset map in connect EmbeddedKafkaCluster (#11619)
EmbeddedKafkaCluster in other projects use 2MB for their offset map to reduce
memory consumption in test runs. Generally we allocate multiple of these offset maps,
one for each broker.

Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Ismael Juma <ismael@juma.me.uk>
2022-02-02 06:10:07 -08:00
Knowles Atchison, Jr 9f2f63e3a1
KAFKA-13348: Allow Source Tasks to Handle Producer Exceptions (KIP-779) (#11382)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2022-01-27 19:17:59 +01:00
Lucas Bradstreet b4602e88ef
MINOR: Timeout waitForBlock in connect BlockingConnectorTest (#11595)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2021-12-15 15:25:16 +01:00
Mickael Maison f6360d1dc1
KAFKA-13414: Replace Powermock/EasyMock by Mockito in connect.storage (#11450)
I've skipped the following classes as they use powermock to stub/access private and static fields/methods:
- KafkaConfigBackingStoreTest
- KafkaOffsetBackingStoreTest

Those will require some refactoring and will be updated in a separate PR.

Reviewers: Tom Bentley <tbentley@redhat.com>, dengziming <dengziming1993@gmail.com>
2021-12-09 15:06:37 +01:00
Chris Egerton f875576f21
KAFKA-13469: Block for in-flight record delivery before end-of-life source task offset commit (#11524)
Although committing source task offsets without blocking on the delivery of all in-flight records is beneficial most of the time, it can lead to duplicate record delivery if there are in-flight records at the time of the task's end-of-life offset commit.

A best-effort attempt is made here to wait for any such in-flight records to be delivered before proceeding with the end-of-life offset commit for source tasks. Connect will block for up to offset.flush.timeout.ms milliseconds before calculating the latest committable offsets for the task and flushing those to the persistent offset store.

Author: Chris Egerton <chrise@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2021-11-30 10:35:50 -06:00
Chris Egerton e8dcbb99bb
KAFKA-13472: Correct last-committed offsets tracking for sink tasks after partial revocation (#11526)
The `WorkerSinkTask.lastCommittedOffsets` field is now added to (via `Map::putAll`) after a successful offset commit, instead of being completely overwritten. In order to prevent this collection from growing indefinitely, elements are removed from it after topic partitions are revoked from the task's consumer.

Two test cases are added to `WorkerSinkTaskTest`:

- A basic test to verify the "rewind for redelivery" behavior when a task throws an exception from `SinkTask::preCommit`; surprisingly, no existing test cases appear to cover this scenario
- A more sophisticated test to verify this same behavior, but with a few rounds of cooperative consumer rebalancing beforehand that expose a bug in the current logic for the `WorkerSinkTask` class

The `VerifiableSinkTask` class is also updated to only flush the requested topic partitions in its `flush` method. This is technically unrelated to the issue addressed by this PR and can be moved to a separate PR if necessary; including it here as the original context for identifying this bug was debugging failed system tests and the logic in this part of the tests was originally suspected as a cause of the test failure.

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-11-29 11:26:08 -08:00
Mickael Maison a989149731
KAFKA-13200: Fix MirrorMaker2 connector version (#11212)
Use the Kafka version instead of hardcoding it to 1.

Reviewers: Tom Bentley <tbentley@redhat.com>, Luke Chen <showuon@gmail.com>
2021-11-29 16:37:51 +01:00
Lee Dongjin ef94af1e8a
KAFKA-13397: MirrorMaker should not mirror topics ending with `.internal` (#11431)
When running in dedicated mode, Connect runtimes are configured to use the `.internal` suffix for their topics. 

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Omnia G H Ibrahim <o.g.h.ibrahim@gmail.com>
2021-11-17 18:14:02 +01:00
Randall Hauch 9ea9f0f8fc Revert "MINOR: Remove redundant argument from TaskMetricsGroup#recordCommit (#9642)"
This reverts commit 047ad654da.
2021-11-16 09:39:51 -06:00
Ed B 8318786b72
KAFKA-13255: Use config.properties.exclude when mirroring topics (#11401)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-11-15 11:45:48 +01:00
Jorge Esteban Quilcate Otoya 214b59b3ec
KAFKA-13429: ignore bin on new modules (#11415)
Reviewers: John Roesler <vvcephei@apache.org>
2021-11-10 14:36:24 -06:00
Chris Egerton 39b1bf4ee3
KAFKA-12487: Add support for cooperative consumer protocol with sink connectors (#10563)
Currently, the `WorkerSinkTask`'s consumer rebalance listener (and related logic) is hardcoded to assume eager rebalancing, which means that all partitions are revoked any time a rebalance occurs and then the set of partitions included in `onPartitionsAssigned` is assumed to be the complete assignment for the task. Not only does this cause failures when the cooperative consumer protocol is used, it fails to take advantage of the benefits provided by that protocol.

These changes alter framework logic to not only not break when the cooperative consumer protocol is used for a sink connector, but to reap the benefits of it as well, by not revoking partitions unnecessarily from tasks just to reopen them immediately after the rebalance has completed.

This change will be necessary in order to support [KIP-726](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=177048248), which currently proposes that the default consumer partition assignor be changed to the `CooperativeStickyAssignor`.

Two integration tests are added to verify sink task behavior with both eager and cooperative consumer protocols, and new and existing unit tests are adopted as well.

Reviewers: Nigel Liang <nigel@nigelliang.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-11-10 11:14:50 -08:00
Chris Egerton c1bdfa125d
KAFKA-12226: Commit source task offsets without blocking on batch delivery (#11323)
Replaces the current logic for committing source offsets, which is batch-based and blocks until the entirety of the current batch is fully written to and acknowledged by the broker, with a new non-blocking approach that commits source offsets for source records that have been "fully written" by the producer. The new logic consider a record fully written only if that source record and all records before it with the same source partition have all been written to Kafka and acknowledged.

This new logic uses a deque for every source partition that a source task produces records for. Each element in that deque is a SubmittedRecord with a flag to track whether the producer has ack'd the delivery of that source record to Kafka. Periodically, the worker (on the same thread that polls the source task for records and transforms, converts, and dispatches them to the producer) polls acknowledged elements from the beginning of each of these deques and collects the latest offsets from these elements, storing them in a snapshot that is then committed on the separate source task offset thread.

The behavior of the `offset.flush.timeout.ms property` is retained, but essentially now only applies to the actual writing of offset data to the internal offsets topic (if running in distributed mode) or the offsets file (if running in standalone mode). No time is spent during `WorkerSourceTask::commitOffsets` waiting on the acknowledgment of records by the producer.

This behavior also does not change how the records are dispatched to the producer nor how the producer sends or batches those records.

It's possible that memory exhaustion may occur if, for example, a single Kafka partition is offline for an extended period. In cases like this, the collection of deques in the SubmittedRecords class may continue to grow indefinitely until the partition comes back online and the SubmittedRecords in those deques that targeted the formerly-offline Kafka partition are acknowledged and can be removed. Although this may be suboptimal, it is no worse than the existing behavior of the framework in these cases.

Author: Chris Egerton <chrise@confluent.io>
Reviewed: Randall Hauch <rhauch@gmail.com>
2021-11-07 11:39:04 -06:00
Omnia G H Ibrahim 400d39bb0e
KAFKA-10777: Add additional configuration to control MirrorMaker 2 internal topics naming convention - KIP-690 (#11220)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-10-11 16:35:12 +02:00
Chris Egerton a9ffabc447
MINOR: Improve decimal scale mismatch error message in Connect (#11384)
Use term Decimal, rather than BigDecimal.

Reviewers: Tom Bentley <tbentley@redhat.com>
2021-10-08 10:15:37 +01:00
Kevin Zhang db42afd6e2
MINOR: Fix the format string supplied to CustomRequestLogger (#11359)
Fix the format string supplied to CustomRequestLogger. It was previously missing the
brackets required to delineate the unit of time being recorded.

See https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/server/CustomRequestLog.html

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-09-30 13:02:31 -07:00
dengziming 509c1653fd
MINOR: Replace EasyMock with Mockito in connect:basic-auth-extension (#11321)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-09-23 05:08:06 -07:00
CHUN-HAO TANG 5193223389
KAFKA-13101: Replace EasyMock and PowerMock with Mockito for RestServerTest (#11074)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-09-06 11:20:38 -07:00
CHUN-HAO TANG 81667e2bf5
KAFKA-13066: Replace EasyMock with Mockito for FileStreamSinkConnectorTest (#11027)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-09-06 08:22:34 -07:00
Andras Katona 0093b19e2e
KAFKA-9747: Creating connect reconfiguration URL safely (#11174)
* URL wasn't urlencoded when forwarded reconfiguration to leader connect worker
* handling previously swallowed errors in connect RestClient

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>

Co-authored-by: Andras Katona  <akatona@cloudera.com>
Co-authored-by: Daniel Urban <durban@cloudera.com>
2021-09-02 10:09:55 +02:00
dengziming 1d22b0d706
KAFKA-10774; Admin API for Describe topic using topic IDs (#9769)
Reviewers: Justine Olshan <jolshan@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>, Satish Duggana <satishd@apache.org>, Rajini Sivaram <rajinisivaram@googlemail.com>
2021-08-28 09:00:36 +01:00
Chris Egerton 79788ca042
KAFKA-12305: Fix Flatten SMT for array types (#10074)
Reviewers: Nigel Liang <nigel@nigelliang.com>, Tom Bentley <tbentley@redhat.com>
2021-08-03 13:53:54 +01:00
Konstantine Karantasis f6f6e52c74
KAFKA-13139: Empty response after requesting to restart a connector without the tasks results in NPE (#11132)
Even after the implementation of KIP-745 it makes sense to return a response code of 204 NO CONTENT when the request is to restart the connector but not the tasks. 

This maintains the current behavior for this existing REST call and is also aligned with the description in the RFC: 
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5

Reviewers: Kalpesh Patel <kpatel@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-07-27 13:47:16 -07:00
A. Sophie Blee-Goldman 8b1eca1c58
KAFKA-13126: guard against overflow when computing `joinGroupTimeoutMs` (#11111)
Setting the max.poll.interval.ms to MAX_VALUE causes overflow when computing the joinGroupTimeoutMs and results in the JoinGroup timeout being set to the request.timeout.ms instead, which is much lower.

This can easily make consumers drop out of the group, since they must rejoin now within 30s (by default) yet have no obligation to almost ever call poll() given the high max.poll.interval.ms, especially when each record takes a long time to process or the `max.poll.records` is also very large. We just need to check for overflow and fix it to Integer.MAX_VALUE when it occurs.

Reviewers: Luke Chen <showuon@gmail.com>, John Roesler <vvcephei@apache.org>
2021-07-23 16:22:41 -07:00
Michael Carter 0314801a8e
KAFKA-9887 fix failed task or connector count on startup failure (#8844)
Moved the responsibility for recording task and connector startup and failure metrics from the invocation code
into the status listener. The reason behind this is that the WorkerTasks (and subclasses) were either not propagating exceptions upwards, or were unable to do so easily because they were running on completely different threads.

Also split out WorkerMetricsGroup from being an inner class into being a standard class. This was to make sure
the Data Abstraction Count checkStyle rule was not violated.

Author: Michael Carter <michael.carter@instaclustr.com>
Reviewers: Chris Egerton <chrise@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-07-20 17:39:26 -05:00
Chris Egerton e01c8a1cae
KAFKA-13017: Remove excessive logging for sink task deserialization errors (#10945)
[Jira](https://issues.apache.org/jira/browse/KAFKA-13017)

Reverts https://github.com/apache/kafka/pull/7496, which added `ERROR`-level logging for deserialization errors in sink tasks even when connectors had logging for these errors disabled.

No information is lost by this change that cannot be retained in an opt-in fashion by setting `errors.log.enable` and `errors.log.include.messages` to `true` in a connector config.

Reviewers: Arjun Satish <arjun@confluent.io>, Tom Bentley <tbentley@redhat.com>
2021-07-16 15:40:17 +01:00
Greg Harris efd09c2daf
KAFKA-7421: Ensure Connect's PluginClassLoader and DelegatingClassLoader are truly parallel capable and resolve deadlock occurrences (#8259)
* Adds SynchronizationTest class for concurrency testing of the classloading isolation mechanism
* Adds a test which deterministically reproduced a deadlock between simultaneous upward (Plugin -> Delegating) & downward (Delegating -> Plugin) class loading operations.
* Makes PluginClassLoader parallel capable, resolving the above deadlock by allowing multiple threads to concurrently use the PluginClassLoader.
* Makes DelegatingClassLoader parallel capable to allow parallel loading of classes from the parent loader (usually the system class loader)

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>, Tom Bentley <tbentley@redhat.com>, Randall Hauch <rhauch@gmail.com>
2021-07-14 10:38:15 -07:00
Alexander Iskuskov efe6029f9c
KAFKA-10675: Add schema name to ConnectSchema.validateValue() error message (#9541)
The following error message
`org.apache.kafka.connect.errors.DataException: Invalid Java object for schema type INT64: class java.lang.Long for field: "moderate_time"`
can be confusing because java.lang.Long is acceptable type for schema INT64.

In fact, in this case `org.apache.kafka.connect.data.Timestamp` is used but this info is not logged.

Reviewers: Randall Hauch <rhauch@gmail.com>, Chris Egerton <chrise@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-07-09 22:35:02 -07:00
Tom Bentley 862f814cc3
KAFKA-7613: Enable -Xlint:rawtypes for connect, fixing warnings (#8571)
Reviewers: Konstantine Karantasis <konstantine@confluent.io>
2021-07-07 17:24:31 +01:00
Chris Egerton cad2f5e120
KAFKA-12717: Remove internal Connect converter properties (KIP-738) (#10854)
Removed Connect Distributed worker's internal converter properties.

Author: Chris Egerton <chrise@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2021-07-01 21:02:24 -05:00
Mickael Maison f5d5f654db
KAFKA-12663: Update FindCoordinator to support batch lookups (KIP-699) (#10743)
This implements KIP-699: https://cwiki.apache.org/confluence/display/KAFKA/KIP-699%3A+Update+FindCoordinator+to+resolve+multiple+Coordinators+at+a+time

It updates FindCoordinator request and response to support resolving multiple coordinators at a time. If a broker does not support the new FindCoordinator version, clients can revert to the previous behaviour and use a request for each coordinator.

Reviewers: David Jacot <djacot@confluent.io>, Tom Bentley <tbentley@redhat.com>, Sanjana Kaundinya <skaundinya@gmail.com>
2021-07-01 22:05:03 +01:00
Ryanne Dolan 93f57370c6
KAFKA-9726: Add IdentityReplicationPolicy to MirrorMaker2 (#10652)
This new policy enables active/passive, one-way replication without renaming topics, similar to MM1. This implementation is described in KIP-382 (adopted), originally as "LegacyReplicationPolicy".

This enables operators to migrate from MM1 to MM2 without re-architecting their replication flows, and enables some additional use-cases for MM2. For example, operators may wish to "upgrade" their Kafka clusters by mirroring everything to a completely new cluster. Such a migration would have been difficult with either MM1 or MM2 previously.

When using IdentityReplicationPolicy, operators should be aware that MM2 will not be able to detect cycles among replicated topics. A misconfigured topology may result in replicating the same records back-and-forth or in an infinite loop. However, we don't prevent this behavior, as some use-cases involve filtering records (via SMTs) to prevent cycles.

Reviewers: Mickael Maison <mickael.maison@gmail.com>

Co-authored-by: Ryanne Dolan <rdolan@twitter.com>
Co-authored-by: Matthew de Detrich <mdedetrich@gmail.com>
Co-authored-by: Ivan Yurchenko <ivanyu@aiven.io>
2021-07-01 09:21:27 +01:00
kpatelatwork 527ba111c7
KAFKA-4793: Connect API to restart connector and tasks (KIP-745) (#10822)
Implements KIP-745 https://cwiki.apache.org/confluence/display/KAFKA/KIP-745%3A+Connect+API+to+restart+connector+and+tasks to change connector REST API to restart a connector and its tasks as a whole.

Testing strategy 
- [x]  Unit tests added for all possible combinations of onlyFailed and includeTasks
- [x]  Integration tests added for all possible combinations of onlyFailed and includeTasks
- [x]  System tests for happy path 

Reviewers: Randall Hauch <rhauch@gmail.com>, Diego Erdody <erdody@gmail.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-06-30 21:13:07 -07:00
Mickael Maison 3c4be0b57a
KAFKA-12379: Allow configuring the location of the offset-syncs topic with MirrorMaker2 (#10221)
This commit implements KIP-716. It introduces a new setting `offset-syncs.topic.location` that allows specifying where the offset-syncs topic is created.

Reviewers: Tom Bentley <tbentley@redhat.com>, Edoardo Comar <ecomar@uk.ibm.com>
2021-06-29 21:33:59 +01:00
kpatelatwork 5652ef1af0
KAFKA-12482 Remove deprecated rest.host.name and rest.port configs (#10841)
Remove the `rest.host.name` and `rest.port` Connect worker configs that were deprecated in KIP-208 and AK 1.1.

Author: Kalpesh Patel <kalpeshpatel.india@gmail.com>
Reviewers: Randall Hauch <rhauch@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>, wenbingshen <oliver.shen999@gmail.com>
2021-06-23 09:20:04 -05:00
Randall Hauch b285662bda
KAFKA-12904: Corrected the timeout for config validation REST API resource (#10834)
The constant is specified in milliseconds, and so the MILLISECOND time unit should be used instead of SECONDS.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2021-06-22 09:15:13 -05:00
Randall Hauch c8684d883b
KAFKA-12483: Enable client overrides in connector configs by default (KIP-722) (#10336)
Changes the default value for the `connector.client.config.override.policy` worker configuration property from `None` to `All`. Modified unit tests to verify all policies still work, and that by default connectors can override all client policies.
See https://cwiki.apache.org/confluence/display/KAFKA/KIP-722%3A+Enable+connector+client+overrides+by+default

Updated the documentation for the worker's client overrides policy to mention the new default.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2021-06-22 09:12:11 -05:00
Randall Hauch be5889d1d1
MINOR: Use MessageDigest equals when comparing signature (#10898) 2021-06-18 09:53:23 -05:00
Ismael Juma d27a84f70c
KAFKA-12945: Remove port, host.name and related configs in 3.0 (#10872)
They have been deprecated since 0.10.0. Full list of removes configs:
* port
* host.name
* advertised.port
* advertised.host.name

Also adjust tests to take the removals into account. Some tests were
no longer relevant and have been removed.

Finally, took the chance to:
* Clean up unnecessary usage of `KafkaConfig$.MODULE$` in
related files.
* Add missing `Test` annotations to `AdvertiseBrokerTest` and
make necessary changes for the tests to pass.

Reviewers: David Jacot <djacot@confluent.io>, Luke Chen <showuon@gmail.com>
2021-06-17 05:32:34 -07:00
Viktor Somogyi-Vass 8a50a5204d
KAFKA-12922: MirrorCheckpointTask should close topic filter (#10849)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

Co-authored-by: Daniel Urban <durban@cloudera.com>
2021-06-10 17:17:42 +01:00
Matthew de Detrich 56d9482462
KAFKA-12819: Add assert messages to MirrorMaker tests plus other quality of life improvements (#10762)
Reviewers: Ryanne Dolan <ryannedolan@gmail.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-05-26 23:21:45 -07:00
Boyang Chen e4f2f6f6e8
KAFKA-12260: Avoid hitting NPE for partitionsFor (#10017)
Remove null pointer from the public partitionsFor API.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-05-25 23:59:30 -07:00
Daniel 0c707b1fcc
KAFKA-12522: Cast SMT should allow null value records to pass through (#10375)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Lee Dongjin <dongjin@apache.org>, Chris Egerton  <fearthecellos@gmail.com>
2021-05-21 11:34:45 +01:00
Chia-Ping Tsai 8a574adcae
MINOR: remove unnecessary placeholder from WorkerSourceTask#recordSent (#10659)
Reviewers: Tom Bentley <tbentley@redhat.com>
2021-05-10 10:22:26 +01:00
Luke Chen 91b3be44a2
MINOR: replace deprecated Class.newInstance() to new one (#10610)
* replace deprecated Class.newInstance() to class.getDeclaredConstructor().newInstance()
* throw ReflectiveOperationException to cover all other exceptions

Reviewers: Tom Bentley <tbentley@redhat.com>
2021-05-07 14:16:58 +01:00
Chris Egerton ebd4748eba
MINOR: Stop logging raw record contents above TRACE level in WorkerSourceTask (#10630)
Reviewers: Tom Bentley <tbentley@redhat.com>
2021-05-06 09:57:45 +01:00
Chris Egerton 9ba583f6d6
KAFKA-12252 and KAFKA-12262: Fix session key rotation when leadership changes (#10014)
Author: Chris Egerton <chrise@confluent.io>
Reviewers: Greg Harris <gregh@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-05-05 16:11:15 -05:00
Luke Chen ab06aef2b8
KAFKA-12284: increase request timeout to make tests reliable (#10547)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-04-28 23:56:48 +08:00
kpatelatwork 4de5f12671
KAFKA-12704: Improve cache access during connector class instantiation in config validations (#10580)
Concurrent requests to validate endpoint for the same connector type calls AbstractHerder::getConnector to get the cached connector instances and if the connector hasn't been cached yet then there is a race condition in the AbstractHerder::getConnector method that potentially fails to detect that an instance of the connector has already been created and, as a result, can create another instance

Existing tests are present with enough coverage so no new tests are added.

Reviewers: Chris Egerton <chrise@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-04-21 22:12:04 -07:00
Luke Chen 523d63df98
KAFKA-12700: override toString method to show correct value in doc (#10574)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-04-22 11:41:09 +08:00
Lee Dongjin d3538ed0ab
MINOR: Remove unthrown exceptions, fix typo, etc. (#10402)
Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Ryanne Dolan <ryannedolan@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2021-04-21 10:40:01 +08:00
Tom Bentley f8f1769256
KIP-145: Add SMTs, HeaderFrom, DropHeaders and InsertHeader (#9549)
These SMTs were originally specified in KIP-145 but never implemented
at the time.

HeaderTo is not included since its original specification doesn't deal with
the fact that there can be >1 header with the same name, but a field can only
have a single value (which could be an array, but not if the headers for
the given name had different schemas).

Reviewers: Chris Egerton <chrise@confluent.io>, Mickael Maison <mickael.maison@gmail.com>
2021-04-16 15:11:25 +01:00
Ismael Juma 89933f21f2
KAFKA-12612: Remove `checksum` from ConsumerRecord/RecordMetadata for 3.0 (#10470)
The methods have been deprecated since 0.11 without replacement since
message format 2 moved the checksum to the record batch (instead of the
record).

Unfortunately, we did not deprecate the constructors that take a checksum
(even though we intended to) so we cannot remove them. I have deprecated
them for removal in 4.0 and added a single non deprecated constructor to
`ConsumerRecord` and `RecordMetadata` that take all remaining parameters.
`ConsumerRecord` could do with one additional convenience constructor, but
that requires a KIP and hence should be done separately.

Also:
* Removed `ChecksumMessageFormatter`, which is technically not public
API, but may have been used with the console consumer.
* Updated all usages of `ConsumerRecord`/`RecordMetadata` constructors
to use the non deprecated ones.
* Added tests for deprecated `ConsumerRecord/`RecordMetadata`
constructors.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, David Jacot <djacot@confluent.io>
2021-04-14 14:38:37 -07:00
kpatelatwork 10308b7a52
KAFKA-9988: Suppress uncaught exceptions in log messages during Connect task shutdown (#10503)
Uncaught exceptions logged during task stop were misleading because the task is already on its way of being shutdown.

The suppression of exception causes a change in behavior as the caller method now calls `statusListener.onShutdown` instead of `statusListener.onFailure` which is the right behavior. A new test was added to test the right behavior for uncaught exception during shutdown and existing test was modified to test uncaught exception during normal execution.

Reviewers: Chris Egerton <chrise@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-04-12 08:06:18 -07:00
Luke Chen f863749c51
KAFKA-12283: disable flaky testMultipleWorkersRejoining to stabilize build (#10408)
Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2021-04-02 14:48:36 -07:00
Chris Egerton aea059a07b
KAFKA-12474: Handle failure to write new session keys gracefully (#10396)
If a distributed worker fails to write (or read back) a new session key to/from the config topic, it dies. This fix softens the blow a bit by instead restarting the herder tick loop anew and forcing a read to the end of the config topic until the worker is able to successfully read to the end.

At this point, if the worker was able to successfully write a new session key in its first attempt, it will have read that key back from the config topic and will not write a new key during the next tick iteration. If it was not able to write that key at all, it will try again to write a new key (if it is still the leader).

Verified with new unit tests for both cases (failure to write, failure to read back after write).

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Greg Harris <gregh@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-04-01 12:26:01 -05:00
Ismael Juma 2342ec1d1c
KAFKA-12600: Remove deprecated config value `default` for client config `client.dns.lookup` (#10458)
The config has been deprecated since Kafka 2.6 (released ~1 year before
3.0), but it was the default before it got deprecated. As such, it's
reasonably unlikely that people would have set it explicitly.

Given the confusing `default` name even though it's _not_ the default, I
think we should remove it in 3.0.

Also remove `ClientDnsLookup.DEFAULT` (not public API), which unlocks
a number of code simplications.

Reviewers: David Jacot <djacot@confluent.io>
2021-04-01 07:59:59 -07:00
wenbingshen e0cbd0fa66
MINOR: Remove duplicate definition about 'the' from kafka project (#10370)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-03-23 10:44:55 +08:00
Lev Zemlyanov 1fb8bd9c44
KAFKA-10070: parameterize Connect unit tests to remove code duplication (#10299)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-03-19 14:03:36 +00:00
Guozhang Wang 2387d191fc
KAFKA-12352: Make sure all rejoin group and reset state has a reason (#10232)
1. Create a reason string to be used for INFO log entry whenever we request re-join or reset generation state.
2. Some minor cleanups.

Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>
2021-03-15 09:24:38 -07:00
Luke Chen 4e60ad72fb
MINOR: Improve error message in MirrorConnectorsIntegrationBaseTest (#10268)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-03-12 12:14:53 +00:00
bmaidics 0dbafce8dd
MINOR: Add missing unit tests for Mirror Connect (#10192)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>
2021-03-12 11:32:17 +00:00
Lee Dongjin e6f8f5d0ae
MINOR: Remove unused variables, methods, parameters, unthrown exceptions, and fix typos (#9457)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com
2021-03-10 13:21:30 +08:00
Luke Chen 8d6ae33ac5
KAFKA-10192: Increase max time to wait for worker to start in some integration tests (#10118)
Author: Luke Chen <showuon@gmail.com>
Reviewers: Chris Egerton <chrise@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-03-09 11:03:41 -06:00
Sven Erik Knop f06a47a7bb
KAFKA-12170: Fix for Connect Cast SMT to correctly transform a Byte array into a string (#9950)
Cast SMT transformation for bytes -> string.
Without this fix, the conversion becomes ByteBuffer.toString(), which always gives this useless result:
    "java.nio.HeapByteBuffer[pos=0 lim=4 cap=4]"

With this change, the byte array is converted into a base64 string of the byte buffer content.

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Randall Hauch <rhauch@gmail.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-03-03 22:17:49 +00:00
Luke Chen f6929637b9
KAFKA-12284: Wait for mirrored topics to be created (#10185)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-03-03 19:20:08 +00:00
Chris Egerton a63e5be419
KAFKA-10340: Proactively close producer when cancelling source tasks (#10016)
Close the producer in `WorkerSourceTask` when the latter is cancelled. If the broker do not autocreate the topic, and the connector is not configured to create topics written by the source connector, then the `WorkerSourceTask` main thread will block forever until the topic is created, and will not stop if cancelled or scheduled for shutdown by the worker.

Expanded an existing unit test for the WorkerSourceTask class to ensure that the producer is closed when the task is abandoned, and added a new integration test that guarantees that tasks are still shut down even when their producers are trying to write to topics that do not exist.

Author: Chris Egerton <chrise@confluent.io>
Reviewed: Greg Harris <gregh@confluent.io>, Randall Hauch <rhauch@gmail.com>
2021-03-01 10:03:34 -06:00
Dhruvil Shah cc088c5abe
KAFKA-12254: Ensure MM2 creates topics with source topic configs (#10217)
MM2 creates new topics on the destination cluster with default configurations. It has an async periodic task to refresh topic configurations from the source to destination. However, this opens up a window where the destination cluster has data produced to it with default configurations. In the worst case, this could cause data loss if the destination topic is created without the right cleanup.policy. This commit fixes the above issue by ensuring that the right configurations are supplied to AdminClient#createTopics when MM2 creates topics on the destination cluster.

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>
2021-03-01 09:30:30 +00:00
tinawenqiao 4c0be2080d
KAFKA-10449: Add some important parameter desc in connect-distributed.properties (#9235)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-02-26 11:02:44 +00:00
Chris Egerton bc04c335fc
KAFKA-12361; Use default request.timeout.ms value for Connect producers (#10178)
Connect uses a high request timeout as a holdover from the days prior to KIP-91 when this was required to guarantee records would not get timed out in the accumulator. Having a high request timeout makes it harder for the producer to gracefully handle unclean connection terminations, which might happen in the case of sudden broker death.

Reducing that value to the default of 30 seconds should address that issue, without compromising the existing delivery guarantees of the Connect framework. Since the delivery timeout is still set to a very-high value, this change shouldn't make it more likely for `Producer::send` to throw an exception and fail the task.

Reviewers: Jason Gustafson <jason@confluent.io>
2021-02-23 18:32:42 -08:00
CHUN-HAO TANG 954c090ffc
MINOR: apply Utils.isBlank to code base (#10124)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-02-20 11:44:29 +08:00
Randall Hauch 1c31176ae1
KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException (#10158)
Refactored the KafkaBasedLog logic to read end offsets into a separate method to make it easier to test. Also changed the TopicAdmin.endOffsets method to throw the original UnsupportedVersionException, LeaderNotAvailableException, and TimeoutException rather than wrapping, to better conform with the consumer method and how the KafkaBasedLog retries those exceptions.

Added new tests to verify various scenarios and errors.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2021-02-19 14:43:32 -06:00
Randall Hauch c75a73862a
KAFKA-12340: Fix potential resource leak in Kafka*BackingStore (#10153)
These Kafka*BackingStore classes used in Connect have a recently-added deprecated constructor, which is not used within AK. However, this commit corrects a AdminClient resource leak if those deprecated constructors are used outside of AK. The fix simply ensures that the AdminClient created by the “default” supplier is always closed when the Kafka*BackingStore is stopped.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2021-02-19 11:49:56 -06:00
Chris Egerton b58b944e70
KAFKA-12303: Fix handling of null values by Flatten SMT (#10073)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gregh@confluent.io>
2021-02-18 15:01:49 +00:00
iczellion 38ec258c66
MINOR: Fix Typo in MirrorMaker README file (#10144)
Fix Typo in metric name of MirrorMaker README file from 'replication-latecny-ms' to 'replication-latency-ms'

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Eric Beaudet <galpha@gmail.com>
2021-02-18 09:54:02 +00:00
Randall Hauch 1d4f69be34
KAFKA-12326: Corrected regresion in MirrorMaker 2 executable introduced with KAFKA-10021 (#10122)
Fixes the recent change to the `MirrorMaker` class (used only in the MirrorMaker 2 executable) that uses a `SharedTopicAdmin` client as part of Connect, so that the correct properties into the `SharedTopicAdmin`.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2021-02-12 16:53:29 -06:00
Ismael Juma ad541b9759
MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference (#10080)
We don't need or use the additional functionality provided by
AtomicReference.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, David Arthur <mumrah@gmail.com>
2021-02-10 07:12:06 -08:00
Randall Hauch 982ea2f6a4
KAFKA-10021: Changed Kafka backing stores to use shared admin client to get end offsets and create topics (#9780)
The existing `Kafka*BackingStore` classes used by Connect all use `KafkaBasedLog`, which needs to frequently get the end offsets for the internal topic to know whether they are caught up. `KafkaBasedLog` uses its consumer to get the end offsets and to consume the records from the topic.

However, the Connect internal topics are often written very infrequently. This means that when the `KafkaBasedLog` used in the `Kafka*BackingStore` classes is already caught up and its last consumer poll is waiting for new records to appear, the call to the consumer to fetch end offsets will block until the consumer returns after a new record is written (unlikely) or the consumer’s `fetch.max.wait.ms` setting (defaults to 500ms) ends and the consumer returns no more records. IOW, the call to `KafkaBasedLog.readToEnd()` may block for some period of time even though it’s already caught up to the end.

Instead, we want the `KafkaBasedLog.readToEnd()` to always return quickly when the log is already caught up. The best way to do this is to have the `KafkaBackingStore` use the admin client (rather than the consumer) to fetch end offsets for the internal topic. The consumer and the admin API both use the same `ListOffset` broker API, so the functionality is ultimately the same but we don't have to block for any ongoing consumer activity.

Each Connect distributed runtime includes three instances of the `Kafka*BackingStore` classes, which means we have three instances of `KafkaBasedLog`. We don't want three instances of the admin client, and should have all three instances of the `KafkaBasedLog` share a single admin client instance. In fact, each `Kafka*BackingStore` instance currently creates, uses and closes an admin client instance when it checks and initializes that store's internal topic. If we change `Kafka*BackingStores` to share one admin client instance, we can change that initialization logic to also reuse the supplied admin client instance.

The final challenge is that `KafkaBasedLog` has been used by projects outside of Apache Kafka. While `KafkaBasedLog` is definitely not in the public API for Connect, we can make these changes in ways that are backward compatible: create new constructors and deprecate the old constructors. Connect can be changed to only use the new constructors, and this will give time for any downstream users to make changes.

These changes are implemented as follows:
1. Add a `KafkaBasedLog` constructor to accept in its parameters a supplier from which it can get an admin instance, and deprecate the old constructor. We need a supplier rather than just passing an instance because `KafkaBasedLog` is instantiated before Connect starts up, so we need to create the admin instance only when needed. At the same time, we'll change the existing init function parameter from a no-arg function to accept an admin instance as an argument, allowing that init function to reuse the shared admin instance used by the `KafkaBasedLog`. Note: if no admin supplier is provided (in deprecated constructor that is no longer used in AK), the consumer is still used to get latest offsets.
2. Add to the `Kafka*BackingStore` classes a new constructor with the same parameters but with an admin supplier, and deprecate the old constructor. When the classes instantiate its `KafkaBasedLog` instance, it would pass the admin supplier and pass an init function that takes an admin instance.
3. Create a new `SharedTopicAdmin` that lazily creates the `TopicAdmin` (and underlying Admin client) when required, and closes the admin objects when the `SharedTopicAdmin` is closed.
4. Modify the existing `TopicAdmin` (used only in Connect) to encapsulate the logic of fetching end offsets using the admin client, simplifying the logic in `KafkaBasedLog` mentioned in #1 above. Doing this also makes it easier to test that logic.
5. Change `ConnectDistributed` to create a `SharedTopicAdmin` instance (that is `AutoCloseable`) before creating the `Kafka*BackingStore` instances, passing the `SharedTopicAdmin` (which is an admin supplier) to all three `Kafka*BackingStore objects`, and finally always closing the `SharedTopicAdmin` upon termination. (Shutdown of the worker occurs outside of the `ConnectDistributed` code, so modify `DistributedHerder` to take in its constructor additional `AutoCloseable` objects that should be closed when the herder is closed, and then modify `ConnectDistributed` to pass the `SharedTopicAdmin` as one of those `AutoCloseable` instances.)
6. Change `MirrorMaker` similarly to `ConnectDistributed`.
7. Change existing unit tests to no longer use deprecated constructors.
8. Add unit tests for new functionality.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2021-02-09 11:09:41 -06:00
dengziming 3769bc21b5
MINOR: replace hard-coding utf-8 with StandardCharsets.UTF_8 (#10079)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-02-09 10:06:01 +08:00
Lev Zemlyanov 07843cfbf4
KAFKA-10834: Remove redundant type casts in Connect (#10053)
Cleanup up to remove redundant type casts in Connect and use the diamond operator when needed 

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-04 17:08:56 -08:00
Mickael Maison b78fa9cea2
KAFKA-10833: Expose task configurations in Connect REST API (KIP-661) (#9726)
This PR adds a new REST endpoint to Connect: GET /{connector}/tasks-config, that returns the configuration of all tasks for the connector.

Details in: 
https://cwiki.apache.org/confluence/display/KAFKA/KIP-661%3A+Expose+task+configurations+in+Connect+REST+API

Co-authored-by: Mickael Maison <mickael.maison@gmail.com>
Co-authored-by: Oliver Dineen <dineeno@uk.ibm.com>

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-04 17:01:07 -08:00
Lev Zemlyanov c19a35d1b7
KAFKA-10835: Replace Runnable and Callable overrides with lambdas in Connect (#9867)
Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-04 09:15:49 -08:00
Randall Hauch 5eb8a238e2
KAFKA-12270: Handle race condition when Connect tasks attempt to create topics (#10032)
When a source connector is configured to create missing topics has multiple tasks that generate records for the same topic, it is possible that multiple tasks may simultaneously describe the topic, find it does not exist, and attempt to create the task. One of those create topic requests will succeed, and the other concurrent tasks will receive the response from the topic admin as having not created the task and will fail unnecessarily.

This change corrects the logic by moving the `TopicAdmin` logic to create a topic to a new `createOrFindTopics(…)` method that returns the set of created topic names and the set of existing topic names. This allows the existing `createTopics(…)` and `createTopic(…)` methods to retain the same behavior, but also allows the `WorkerSourceTask` to know from its single call to this new method whether the topic was created or was found to exist.

This adds one unit test and modifies several unit tests in `WorkerSourceTaskWithTopicCreationTest` that use mocks to verify the behavior, and modifies several existing unit tests for `TopicAdminTest` to ensure the logic of the new method is as expected.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2021-02-03 18:29:55 -06:00
Yilong Chang c64241f9c2
KAFKA-12259: Use raw config to infer the connector type when returning a connector status response (#10040)
Problem: when calling the connect status endpoint, a 500 error is returned, e.g.
```
{
  "error_code": 500,
  "message": "Could not read properties from file /tmp/somefile.properties"
}
```
when any of the connectors has an exception from the config provider. This is because the `AbstractHerder` is trying to use the resolved config to infer the type of the connector. However, only the `connector.class` is needed from the config to infer if a specific connector is of source or sink type. The endpoint should still return the status of the connector instead of a 500 error.

This change uses the raw config from the config backing store to retrieve the connector class to avoid any variable resolution.

Unit tests have been updated to reflect this change.

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-03 15:39:32 -08:00
Chris Egerton 0fe9fde376
KAFKA-10895: Gracefully handle invalid JAAS configs (follow up fix) (#9987)
Fixes a regression introduced by https://github.com/apache/kafka/pull/9806 in the original fix for KAFKA-10895

It was discovered that if an invalid JAAS config is present on the worker, invoking Configuration::getConfiguration throws an exception. The changes from #9806 cause that exception to be thrown during plugin scanning, which causes the worker to fail even if it is not configured to use the basic auth extension at all.

This follow-up handles invalid JAAS configurations more gracefully, and only throws them if the worker is actually configured to use the basic auth extension, at the time that the extension is instantiated and configured.

Two unit tests are added.

Reviewers: Greg Harris <gregh@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-03 13:51:03 -08:00
Colin Patrick McCabe 772f2cfc82
MINOR: Replace BrokerStates.scala with BrokerState.java (#10028)
Replace BrokerStates.scala with BrokerState.java, to make it easier to use from Java code if needed.  This also makes it easier to go from a numeric type to an enum.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-02-03 13:41:38 -08:00
Ramesh Krishnan M e260f64a9c
KAFKA-10413: Allow for even distribution of lost/new tasks when multiple Connect workers join at the same time (#9319)
First issue: When more than one workers join the Connect group the incremental cooperative assignor revokes and reassigns at most average number of tasks per worker.
Side-effect: This results in the additional workers joining the group stay idle and would require more future rebalances to happen to have even distribution of tasks.
Fix: As part of task assignment calculation following a deployment, the reassignment of tasks are calculated by revoking all the tasks above the rounded up (ceil) average number of tasks.

Second issue: When more than one worker is lost and rejoins the group at most one worker will be re assigned with the lost tasks from all the workers that left the group.
Side-effect: In scenarios where more than one worker is lost and rejoins the group only one among them gets assigned all the partitions that were lost in the past. The additional workers that have joined would not get any task assigned to them until a rebalance that happens in future.
Fix: As part fo lost task re assignment all the new workers that have joined the group would be considered for task assignment and would be assigned in a round robin fashion with the new tasks.

Testing strategy : 
* System testing in a Kubernetes environment completed
* New integration tests to test for balanced tasks
* Updated unit tests. 

Co-authored-by: Rameshkrishnan Muthusamy <rameshkrishnan_muthusamy@apple.com>
Co-authored-by: Randall Hauch <rhauch@gmail.com>
Co-authored-by: Konstantine Karantasis <konstantine@confluent.io>

Reviewers: Randall Hauch <rhauch@gmail.com>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-02-02 12:04:06 -08:00
Ismael Juma bf4afae8f5 MINOR: Fix MirrorMakerConfigTest build failures 2021-01-28 18:32:35 -08:00
Julien Chanaud a63094930f
KAFKA-10710; MM2 - Create herders only if source->target.enabled=true and heartbeats are disabled (#9589)
By default Mirror Maker 2 creates herders for all the possible combinations even if the "links" are not enabled.

This is because the beats are emitted from the "opposite" herder.
If there is a replication flow from A to B and heartbeats are required, 2 herders are needed :

- A->B for the MirrorSourceConnector
- B->A for the MirrorHeartbeatConnector

The MirrorHeartbeatConnector on B->A emits beats into topic heartbeats on cluster A.
The MirrorSourceConnector on A->B then replicates whichever topic is configured as well as heartbeats.

In cases with multiple clusters (10 and more), this leads to an incredible amount of connections, file descriptors and configuration topics created in every target clusters that are not necessary.

With this code change, we will leverage the top level property "emit.heartbeats.enabled" which defaults to "true".
We skip creating the A->B herder whenever A->B.emit.heartbeats.enabled=false (defaults to true) and A->B.enabled=false (defaults to false). 

Existing users will not see any change and if they depend on these "opposites" herders for their monitoring, it will still work.
New users with more complex use case can change this property and fine tune their heartbeat generation.

Reviewers: Ryanne Dolan <ryannedolan@gmail.com>,  Sanjana Kaundinya <skaundinya@gmail.com>, Jason Gustafson <jason@confluent.io>
2021-01-28 14:52:51 -08:00
Chia-Ping Tsai 923dea34b8
KAFKA-10658 ErrantRecordReporter.report always return completed futur… (#9525)
Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-01-28 14:12:54 +08:00
Geordie fb6c7beb29
MINOR: Remove redundant casting and if condition from ConnectSchema (#9959)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-27 14:52:33 +08:00
Chris Egerton 8bdab2e4cf
MINOR: Remove outdated comment in Connect's WorkerCoordinator (#9805)
Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2021-01-27 14:50:01 +08:00
Greg Harris f572545611
KAFKA-10763: Fix incomplete cooperative rebalances preventing connector/task revocations (#9765)
When two cooperative rebalances take place soon after one another, a prior rebalance may not complete before the next rebalance is started.
Under Eager rebalancing, no tasks would have been started, so the subsequent onRevoked call is intentionally skipped whenever rebalanceResolved was false.
Under Incremental Cooperative rebalancing, the same logic causes the DistributedHerder to skip stopping all of the connector/task revocations which occur in the second rebalance.
The DistributedHerder still removes the revoked connectors/tasks from its assignment, so that the DistributedHerder and Worker have different knowledge of running connectors/tasks.
This causes the connector/task instances that would have been stopped to disappear from the rebalance protocol, and left running until their workers are halted, or they fail.
Connectors/Tasks which were then reassigned to other workers by the rebalance protocol would be duplicated, and run concurrently with zombie connectors/tasks.
Connectors/Tasks which were reassigned back to the same worker would encounter exceptions in Worker, indicating that the connector/task existed and was already running.

* Added test for revoking and then reassigning a connector under normal circumstances
* Added test for revoking and then reassigning a connector following an incomplete cooperative rebalance
* Changed expectRebalance to make assignment fields mutable before passing them into the DistributedHerder
* Only skip revocation for the Eager protocol, and never skip revocation for incremental cooperative protocols

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-01-26 10:17:05 -08:00
Luke Chen 45b7a0a334
KAFKA-12229: Restore original class loader in integration tests using EmbeddedConnectCluster during shutdown (#9942)
Fixes errors such as: 
```
java.lang.NullPointerException at 
org.apache.kafka.connect.mirror.MirrorSourceConnector.listTopics(MirrorSourceConnector.java:348) at 
org.apache.kafka.connect.mirror.MirrorSourceConnector.findSourceTopicPartitions(MirrorSourceConnector.java:192) at 
org.apache.kafka.connect.mirror.MirrorSourceConnectorTest.testRefreshTopicPartitionsTopicOnTargetFirst(MirrorSourceConnectorTest.java:222)
```

It was a difficult to debug issue due to class loading interference between the Connect worker and Mockito. Digging into the Mockito, found it's not about JUnit 5, it's because of the class loader. In Mockito, we rely on the class loader to generate the proxy instance ([source](https://github.com/mockito/mockito/blob/release/3.x/src/main/java/org/mockito/internal/creation/bytebuddy/SubclassBytecodeGenerator.java#L91)) to intercept the method call, and if the class loader is not expected, we'll generate the wrong proxy instance (with wrong class path). We set the class loader during connector start to resolve conflicting dependencies ([KIP-146](https://cwiki.apache.org/confluence/display/KAFKA/KIP-146+-+Classloading+Isolation+in+Connect)), so we should set it back to the original class loader after connector stop in tests (`EmbeddedConnectCluster` is only used in tests) for the following Mockito works as expected.

So, there's an interference of integration tests with unit tests when Connect integration tests run before the MM2 unit tests, and that will cause the Mockito used in unit tests not work as expected.

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-01-25 19:36:57 -08:00
Chia-Ping Tsai f2ac0c62ef
KAFKA-12221 remove PowerMock from connect-json module and connect-transforms module (#9924)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-19 00:05:44 +08:00
Geordie 462be6da9b
KAFKA-12196: Migrate connect:api module to JUnit 5 (#9909)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2021-01-17 19:17:47 -08:00
CHUN-HAO TANG 962b69b5b3
KAFKA-12200: Migrate connect:file module to JUnit 5 (#9917)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2021-01-17 17:01:51 -08:00
Chia-Ping Tsai e0ebb1d202
KAFKA-12202 Migrate connect:mirror module to JUnit 5 (#9894)
1. Replace junit 4 APIs by junit 5
2. Remove the dependencies of junit 4 from `EmbeddedKafkaCluster`

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-16 09:30:04 -08:00
dengziming 4126cfd049
KAFKA-12197: Migrate connect:transforms module to JUnit 5 (#9907)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-16 07:17:37 -08:00
dengziming 3e6c6f5950
KAFKA-12198: Migrate connect:json module to JUnit 5 (#9890)
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
2021-01-16 03:14:08 +08:00
Chia-Ping Tsai 0c92b8398d
KAFKA-12203 Migrate connect:mirror-client module to JUnit 5 (#9889)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-15 13:42:07 +08:00
Ismael Juma a68c14190e
KAFKA-12201: Migrate connect:basic-auth-extensio module to JUnit 5 (#9892)
Also:
* Remove unused powermock dependency
* Remove "examples" from the JUnit 4 list since one module was already
converted and the other has no tests

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-14 15:43:47 -08:00
Ning Zhang 2cde6f61b8
KAFKA-10304: Refactor MM2 integration tests (#9224)
Co-authored-by: Ning Zhang <nzhang1220@fb.com>
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2021-01-14 14:48:17 +00:00
Chris Egerton 7455b70102
KAFKA-10895: Attempt to prevent JAAS config from being overwritten for basic auth filter in Connect (#9806)
If a connector, converter, etc. invokes [Configuration::setConfiguration](https://docs.oracle.com/javase/8/docs/api/javax/security/auth/login/Configuration.html#setConfiguration-javax.security.auth.login.Configuration-), it will cause the Connect basic auth filter to use that JAAS config instead of the one configured at startup with the `-Djava.security.auth.login.config` JVM property. This can cause requests to the worker to succeed initially but start to be rejected after the JVM's global JAAS config is altered.

To alleviate this the current PR instructs the Connect Worker to cache the JVM's global JAAS configuration at the beginning (as soon as the `BasicAuthSecurityRestExtension` class is loaded), and use that for all future authentication. 

Existing tests for the JAAS basic auth filter are modified to work with the new internal logic. The `testEmptyCredentialsFile` test is corrected to actually operate on an empty credentials file (instead of a non-existent credentials file, which it currently operates on). A new test is added to ensure that, even if the global JAAS config is overwritten, the basic auth filter will use the first one it could find.

Reviewers: Greg Harris <gregh@confluent.io>, Konstantine Karantasis <k.karantasis@gmail.com>
2021-01-11 21:20:57 -08:00
dengziming 119a2d9127
MINOR: Substitute assertEquals(null) with assertNull (#9852)
Reviewers: David Jacot <djacot@confluent.io>
2021-01-10 20:06:37 +01:00
Chia-Ping Tsai 913a019d6c
MINOR: replace test "expected" parameter by assertThrows (#9520)
This PR includes following changes.

1. @Test(expected = Exception.class) is replaced by assertThrows
2. remove reference to org.scalatest.Assertions
3. change the magic code from 1 to 2 for testAppendAtInvalidOffset to test ZSTD
4. rename testMaybeAddPartitionToTransactionXXXX to testNotReadyForSendXXX
5. increase maxBlockMs from 1s to 3s to avoid unexpected timeout from TransactionsTest#testTimeout

Reviewers: Ismael Juma <ismael@confluent.io>
2021-01-10 20:20:13 +08:00
dengziming 0e91d053f3
MINOR: rename @returns to @return (#9808)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-03 21:04:28 +08:00
Chris Egerton afa5423356
MINOR: Fix connector startup error logging (#9784)
If a connector fails on startup, the original cause of the error gets discarded by the framework and the only message that gets logged looks like this:

```
[2020-12-04 16:46:30,464] ERROR [Worker clientId=connect-1, groupId=connect-cluster] Failed to start connector 'conn-1' (org.apache.kafka.connect.runtime.distributed.DistributedHerder)
org.apache.kafka.connect.errors.ConnectException: Failed to start connector: conn-1
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder.lambda$startConnector$5(DistributedHerder.java:1297)
        at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:258)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startConnector(DistributedHerder.java:1321)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder.access$1400(DistributedHerder.java:127)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder$13.call(DistributedHerder.java:1329)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder$13.call(DistributedHerder.java:1325)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
```

The changes here should cause the original cause of the connector startup failure to be logged as well.

```
[2020-12-30 09:56:35,481] ERROR [test-connector|worker] [Worker clientId=connect-1, groupId=connect-cluster] Failed to start connector 'conn-1' (org.apache.kafka.connect.runtime.distributed.DistributedHerder:599)
org.apache.kafka.connect.errors.ConnectException: Failed to start connector: conn-1
	at org.apache.kafka.connect.runtime.distributed.DistributedHerder.lambda$startConnector$4(DistributedHerder.java:1298)
	at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:294)
	at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startConnector(DistributedHerder.java:1322)
	at org.apache.kafka.connect.runtime.distributed.DistributedHerder.processConnectorConfigUpdates(DistributedHerder.java:597)
	at org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:416)
	at org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:294)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.kafka.connect.errors.ConnectException: Failed to find any class that implements
```

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-30 23:06:29 +08:00
APaMio 1670362236
MINOR: Replace Collection.toArray(new T[size]) by Collection.toArray(new T[0]) (#9750)
This PR is based on the research of https://shipilev.net/blog/2016/arrays-wisdom-ancients

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-21 17:38:33 +08:00
Tom Bentley 67150b815e
KAFKA-10846: Grow buffer in FileSourceStreamTask only when needed (#9735)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-18 12:01:38 +08:00
Anastasia Vela 1a10c3445e
KAFKA-10525: Emit JSONs with new auto-generated schema (KIP-673) (#9526)
This patch updates the request logger to output request and response payloads in JSON. Payloads are converted to JSON based on their auto-generated schema.

Reviewers:  Lucas Bradstreet <lucas@confluent.io>, David Mao <dmao@confluent.io>, David Jacot <djacot@confluent.io>
2020-12-15 14:33:36 +01:00
Ismael Juma 1f98112e99
MINOR: Remove connection id from Send and consolidate request/message utils (#9714)
Connection id is now only present in `NetworkSend`, which is now
the class used by `Selector`/`NetworkClient`/`KafkaChannel` (which
works well since `NetworkReceive` is the class used for
received data).

The previous `NetworkSend` was also responsible for adding a size
prefix. This logic is already present in `SendBuilder`, but for the
minority of cases where `SendBuilder` is not used (including
a number of tests), we now have `ByteBufferSend.sizePrefixed()`.

With regards to the request/message utilities:
* Renamed `toByteBuffer`/`toBytes` in `MessageUtil` to
`toVersionPrefixedByteBuffer`/`toVersionPrefixedBytes` for clarity.
* Introduced new `MessageUtil.toByteBuffer` that does not include
the version as the prefix.
* Renamed `serializeBody` in `AbstractRequest/Response` to
`serialize` for symmetry with `parse`.
* Introduced `RequestTestUtils` and moved relevant methods from
`TestUtils`.
* Moved `serializeWithHeader` methods that were only used in
tests to `RequestTestUtils`.
* Deleted `MessageTestUtil`.

Finally, a couple of changes to simplify coding patterns:
* Added `flip()` and `buffer()` to `ByteBufferAccessor`.
* Added `MessageSizeAccumulator.sizeExcludingZeroCopy`.
* Used lambdas instead of `TestCondition`.
* Used `Arrays.copyOf` instead of `System.arraycopy` in `MessageUtil`.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Jason Gustafson <jason@confluent.io>
2020-12-09 11:15:58 -08:00
APaMio c5575801b7
MINOR: Using primitive data types for loop index (#9705)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-09 10:44:55 +08:00
Ismael Juma 6f27bb02da
KAFKA-10818: Skip conversion to `Struct` when serializing generated requests/responses (#7409)
Generated request/response classes have code to serialize/deserialize directly to
`ByteBuffer` so the intermediate conversion to `Struct` can be skipped for them.
We have recently completed the transition to generated request/response classes,
so we can also remove the `Struct` based fallbacks.

Additional noteworthy changes:
* `AbstractRequest.parseRequest` has a more efficient computation of request size that
relies on the received buffer instead of the parsed `Struct`.
* Use `SendBuilder` for `AbstractRequest/Response` `toSend`, made the superclass
implementation final and removed the overrides that are no longer necessary.
* Removed request/response constructors that assume latest version as they are unsafe
outside of tests.
* Removed redundant version fields in requests/responses.
* Removed unnecessary work in `OffsetFetchResponse`'s constructor when version >= 2.
* Made `AbstractResponse.throttleTimeMs()` abstract.
* Using `toSend` in `SaslClientAuthenticator` instead of `serialize`.
* Various changes in Request/Response classes to make them more consistent and to
rely on the Data classes as much as possible when it comes to their state.
* Remove the version argument from `AbstractResponse.toString`.
* Fix `getErrorResponse` for `ProduceRequest` and `DescribeClientQuotasRequest` to
use `ApiError` which processes the error message sent back to the clients. This was
uncovered by an accidental fix to a `RequestResponseTest` test (it was calling
`AbstractResponse.toString` instead of `AbstractResponse.toString(short)`).

Rely on existing protocol tests to ensure this refactoring does not change 
observed behavior (aside from improved performance).

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-07 15:39:57 -08:00
Randall Hauch 8db3b1a09a
KAFKA-10811: Correct the MirrorConnectorsIntegrationTest to correctly mask the exit procedures (#9698)
Normally the `EmbeddedConnectCluster` class masks the `Exit` procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the `MirrorConnectorsIntegrationTest` uses two `EmbeddedConnectCluster` instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the `MirrorConnectorsIntegrationTest` class should mask the `Exit` procedures and instruct the `EmbeddedConnectClusters` instances (via the existing builder method) to not mask the procedures.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2020-12-07 09:34:34 -06:00
Chris Egerton 4f2f08eb00
KAFKA-10792: Prevent source task shutdown from blocking herder thread (#9669)
Changes the `WorkerSourceTask` class to only call `SourceTask::stop` from the task thread when the task is actually stopped (via `Source:task::close` just before `WorkerTask::run` completes), and only if an attempt has been made to start the task (which will not be the case if it was created in the paused state and then shut down before being started). This prevents `SourceTask::stop` from being indirectly invoked on the herder's thread, which can have adverse effects if the task is unable to shut down promptly.

Unit tests are tweaked where necessary to account for this new logic, which covers some edge cases mentioned in PR #5020 that were unaddressed up until now.

The existing integration tests for blocking connectors are expanded to also include cases for blocking source and sink tasks. Full coverage of every source/sink task method is intentionally omitted from these expanded tests in order to avoid inflating test runtime (each one adds an extra 5 seconds at minimum) and because the tests that are added here were sufficient to reproduce the bug with source task shutdown.

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Nigel Liang <nigel@nigelliang.com>, Tom Bentley <tbentley@redhat.com>, Randall Hauch <rhauch@gmail.com>
2020-12-04 11:48:23 -06:00
ArunParthiban-ST cc1aa3b83d
KAFKA-10770: Remove duplicate defination of Metrics#getTags (#9659)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-12-01 13:10:22 +08:00
Tom Bentley 0df461582c
KAFKA-10720: Document prohibition on header mutation by SMTs (#9597)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
2020-11-26 22:39:41 +00:00
abc863377 5200eaab25
MINOR: Remove unnecessary statement from WorkerConnector#doRun (#9653)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-11-25 22:48:02 +08:00
abc863377 047ad654da
MINOR: Remove redundant argument from TaskMetricsGroup#recordCommit (#9642)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-11-24 15:02:56 +08:00
Samuel Cantero 1625984149
MINOR: Allow Checkpoints for consumers using static partition assignments (#9545)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2020-11-19 15:01:22 +00:00
Chris Egerton 83f75464c2
MINOR: Include connector name in error message (#9599)
Reviewers: Randall Hauch <rhauch@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2020-11-18 15:25:21 +08:00
abc863377 aafab199e3
MINOR: Initialize ConnectorConfig constructor with emptyMap and avoid instantiating a new Map (#9603)
The map passed as an argument remains read-only and therefore can be initialized using Collections#emptyMap instead of being passed a new Map instance. 

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2020-11-17 09:51:12 -08:00
Ivan Yurchenko ec3feb4f09
MINOR: move connectorConfig to AbstractHerder (#6820)
StandaloneHerder and DistributedHerder have identical implementations of connectorConfig (apart from one line of logging). This commit moves the common implementation of connectorConfig to AbstractHerder.

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2020-11-04 11:20:11 +08:00
Matthias J. Sax cf78fbe41e
MINOR: improve `null` checks for headers (#9513)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Luke Chen @showuon
2020-10-29 16:45:43 -07:00
xakassi f38ebbaa5b
KAFKA-10426: Deadlock in DistributedHerder during session key update. (#9431)
DistributedHerder goes to updateConfigsWithIncrementalCooperative() synchronized method and called configBackingStore.snapshot() which take a lock on internal object in KafkaConfigBackingStore class.

Meanwhile KafkaConfigBackingStore in ConsumeCallback inside synchronized block on internal object gets SESSION_KEY record and calls updateListener.onSessionKeyUpdate() which take a lock on DistributedHerder.

This results to a deadlock.

To avoid this, updateListener with new session key should be called outside synchronized block as it's done, for example, for updateListener.onTaskConfigUpdate(updatedTasks).

Co-authored-by: Taisiia Goltseva <tado0618@netcracker.com>

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2020-10-20 09:05:30 -07:00
Xavier Léauté 60d002f9eb
KAFKA-10572 mirror-maker config changes for KIP-629 (#9429)
Author: Xavier Léauté <xavier@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2020-10-20 09:15:14 -05:00
jackyoh 8f96c3450f
MINOR: Remove unnecessary assertion from ConnectHeader (#9452)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2020-10-20 13:58:02 +08:00
Mickael Maison 270881cd65
KAFKA-10332: Update MM2 refreshTopicPartitions() logic (#9343)
Trigger task reconfiguration when:
- topic-partitions are created or deleted on source cluster
- topic-partitions are missing on target cluster

Authors: Mickael Maison <mickael.maison@gmail.com>, Edoardo Comar <ecomar@uk.ibm.com>
Reviewer: Randall Hauch <rhauch@gmail.com>
2020-10-19 10:51:44 -05:00
Samuel Cantero cf202cb6ac
MINOR: Fix consumer/producer properties override (#9313)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ryanne Dolan <ryannedolan@gmail.com>
2020-10-16 18:17:03 +02:00
Randall Hauch 9e0bf0bd2a
KAFKA-10600: Connect should not add error to connector validation values for properties not in connector’s ConfigDef (#9425)
Connect should not always add an error to configuration values in validation results that don't have a `ConfigKey` defined in the connector's `ConfigDef`, and any errors on such configuration values included by the connector should be counted in the total number of errors. Added more unit tests for `AbstractHerder.generateResult(...)`.

Author: Randall Hauch <rhauch@gmail.com>
Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2020-10-16 09:14:43 -05:00
Cyrus Vafadari 432be58a7c
MINOR: Use debug level logging for noisy log messages in Connect (#8918)
Author: Cyrus Vafadari <cyrus@confluent.io>
Reviewers: Chris Egerton <chrise@confluent.io>, Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
2020-10-16 09:10:41 -05:00
Tom Bentley 775a08876a
KAFKA-10602: Make RetryWithToleranceOperator thread safe (#9422)
ErrantRecordReporter uses a RetryWithToleranceOperator instance, which is necessarily stateful, having a ProcessingContext of which there's supposed to be one per task. That ProcessingContext is used by both RetryWithToleranceOperator.executeFailed() and execute(), so it's not enough to just synchronize executeFailed().

So make all public methods of RetryWithToleranceOperator synchronized so that RetryWithToleranceOperator is now threadsafe.

Tested with the addition of a multithreaded test case that fails consistently if the methods are not properly synchronized. 

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2020-10-15 11:54:46 -07:00
Luke Chen c217788e69
KAFKA-10340: Improve trace logging under connector based topic creation (#9149)
Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2020-10-15 11:14:54 -07:00
Benoit Maggi da6871943f
KAFKA-10611: Merge log error to avoid double error (#9407)
When using an error tracking system, two error log messages result into two different alerts.
It's best to group the logs and have one error with all the information.

For example when using with Sentry, this double line of log.error will create 2 different Issues. One can merge the issues but it will be simpler to have a single error log line.

Signed-off-by: Benoit Maggi <benoit.maggi@gmail.com>

Reviewers: Ewen Cheslack-Postava <me@ewencp.org>, Konstantine Karantasis <k.karantasis@gmail.com>
2020-10-14 20:16:24 -07:00
Xavier Léauté eab61cad2c
KAFKA-10573 Update connect transforms configs for KIP-629 (#9403)
Changes the Connect `ReplaceField` SMT's configuration properties, deprecating and replacing `blacklist` with `exclude`, and `whitelist` with `include`. The old configurations are still allowed (ensuring backward compatibility), but warning messages are written to the log to suggest users change to `include` and `exclude`.

This is part of KIP-629.

Author: Xavier Léauté <xvrl@apache.org>
Reviewer: Randall Hauch <rhauch@gmail.com>
2020-10-13 18:13:44 -05:00
Xavier Léauté 26e9058aa0 MINOR internal KIP-629 changes to methods and variables
cc gwenshap

Author: Xavier Léauté <xvrl@apache.org>

Reviewers: Gwen Shapira

Closes #9405 from xvrl/minor-kip-629-vars
2020-10-13 14:52:04 -07:00
Chris Egerton 0a93d2b1af
KAFKA-10574: Fix infinite loop in Values::parseString (#9375)
Fix infinite loop in Values::parseString

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
2020-10-12 11:42:42 -05:00