Commit Graph

40 Commits

Author SHA1 Message Date
Sanskar Jhajharia 27383970b6
MINOR: Cleanup Connect Module (1/n) (#19869)
CI / build (push) Waiting to run Details
Now that Kafka support Java 17, this PR makes some changes in connect
module. The changes in this PR are limited to only some files. A future
PR(s) shall follow.
The changes mostly include:
- Collections.emptyList(), Collections.singletonList() and
Arrays.asList() are replaced with List.of()
- Collections.emptyMap() and Collections.singletonMap() are replaced
with Map.of()
- Collections.singleton() is replaced with Set.of()

Sub modules targeted: api, basic-auth-extensions, file, json, mirror,
mirror-client

Reviewers: Ken Huang <s7133700@gmail.com>, TengYao Chi
<kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-07-11 00:35:41 +08:00
xijiu 8bdd73c803
KAFKA-19137 Use `StandardCharsets.UTF_8` instead of `StandardCharsets.UTF_8.name()` (#19464)
Replace `StandardCharsets.UTF_8.name()` with `StandardCharsets.UTF_8` to
avoid UnsupportedEncodingException and optimize the related code at the
same time.

Reviewers: Ken Huang <s7133700@gmail.com>, PoAn Yang
<payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2025-04-15 23:44:00 +08:00
TengYao Chi b37b89c668
KAFKA-9366 Upgrade log4j to log4j2 (#17373)
This pull request replaces Log4j with Log4j2 across the entire project, including dependencies, configurations, and code. The notable changes are listed below:

1. Introduce Log4j2 Instead of Log4j
2. Change Configuration File Format from Properties to YAML
3. Adds warnings to notify users if they are still using Log4j properties, encouraging them to transition to Log4j2 configurations

Co-authored-by: Lee Dongjin <dongjin@apache.org>

Reviewers: Luke Chen <showuon@gmail.com>, Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-12-14 01:14:31 +08:00
gongxuanzhang 79b9c44acd
KAFKA-10787 Apply spotless to connect module (#16299)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-12 22:19:47 +08:00
Sanskar Jhajharia e974914ca5
MINOR: Code Cleanup - Connect Module (#16066)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-05-31 04:55:00 +08:00
Mickael Maison 7b1c777b33
MINOR: Various cleanups in connect (#15734)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-04-17 20:47:25 +08:00
Mickael Maison eccfb03e9a
MINOR: Small cleanups in Connect (#15128)
Reviewers: Divij Vaidya <diviv@amazon.com>
2024-01-05 11:00:10 +01:00
Yash Mayya 88b554fdbd
KAFKA-15179: Add integration tests for the file sink and source connectors (#14279)
Reviewers: Ashwin Pankaj <apankaj@confluent.io>, Chris Egerton <chrise@aiven.io>
2023-09-07 12:24:13 -04:00
Yash Mayya 7802c264c9
MINOR: Allow writing tombstone offsets for arbitrary partitions in the FileStreamSourceConnector (#14234)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-08-17 14:13:53 -04:00
Greg Harris ff4fed5cbe
KAFKA-15031: Add plugin.discovery to Connect worker configuration (KIP-898) (#14055)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-08-08 10:06:35 -07:00
Yash Mayya 0b025b7711
KAFKA-15121: Implement the alterOffsets method in the FileStreamSourceConnector and the FileStreamSinkConnector (#13945)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-07-18 10:37:51 -04: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
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
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
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
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
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
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
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
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
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
Konstantine Karantasis 5d2bf6328e MINOR: FileStreamSinkTask should create file if it doesn't exist (#5406)
A recent change from `new FileOutputStream` to `Files.newOutputStream` missed the `CREATE` flag (which is necessary in addition to `APPEND`).

Reviewers: Ismael Juma <ismael@juma.me.uk>
2018-07-20 21:01:10 -07:00
Ismael Juma 7a74ec62d2
MINOR: Avoid FileInputStream/FileOutputStream (#5281)
They rely on finalizers (before Java 11), which create
unnecessary GC load. The alternatives are as easy to
use and don't have this issue.

Also use FileChannel directly instead of retrieving
it from RandomAccessFile whenever possible
since the indirection is unnecessary.

Finally, add a few try/finally blocks.

Reviewers: Colin Patrick McCabe <colin@cmccabe.xyz>, Rajini Sivaram <rajinisivaram@googlemail.com>
2018-06-27 01:00:05 -07:00
Konstantine Karantasis ee352be9c8 MINOR: Fix bug introduced by adding batch.size without default in FileStreamSourceConnector (#4579)
https://github.com/apache/kafka/pull/4356 added `batch.size` config property to `FileStreamSourceConnector` but the property was added as required without a default in config definition (`ConfigDef`). This results in validation error during connector startup. 

Unit tests were added for both `FileStreamSourceConnector` and `FileStreamSinkConnector` to avoid such issues in the future.

Reviewers: Randall Hauch <rhauch@gmail.com>, Jason Gustafson <jason@confluent.io>
2018-02-16 18:30:12 -08:00
Study ecf0ab42c1 KAFKA-4335: Add batch.size to FileStreamSource connector to prevent OOM
When the source file of `FileStreamSource` is a large file, `FileStreamSourceTask.poll()` will result in OOM. This pull request added `batch.size` parameter which can restrict the poll size.

*More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.*

*Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.*

Author: Study <ph.study@gmail.com>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #4356 from phstudy/KAFKA-4335
2018-01-05 18:31:53 -08:00
Ismael Juma ffd8f18a12 KAFKA-4501; Fix EasyMock and disable PowerMock tests under Java 9
- EasyMock 3.5 supports Java 9.

- Fixed issues in `testFailedSendRetryLogic` and
`testCreateConnectorAlreadyExists` exposed by new EasyMock
version. The former was passing `anyObject` to
`andReturn`, which doesn't make sense. This was leaving
behind a global `any` matcher, which caused a few issues in
the new version. Fixing this meant that the correlation ids had
to be updated to actually match. The latter was missing a
couple of expectations that the previous version of EasyMock
didn't catch.

- Removed unnecessary PowerMock dependency from 3 tests.

- Disabled remaining PowerMock tests when running with Java 9
until https://github.com/powermock/powermock/issues/783 is
in a release.

- Once we merge this PR, we can enable tests in the Java 9 builds
in Jenkins.

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

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>

Closes #3845 from ijuma/kafka-4501-easymock-powermock-java-9
2017-09-13 18:18:54 +01:00
Vahid Hashemian f87d58b796 MINOR: Code Cleanup
Clean up includes:

- Switching try-catch-finally blocks to try-with-resources when possible
- Removing some seemingly unnecessary `SuppressWarnings` annotations
- Resolving some Java warnings
- Closing unclosed Closable objects
- Removing unused code

Author: Vahid Hashemian <vahidhashemian@us.ibm.com>

Reviewers: Balint Molnar <balintmolnar91@gmail.com>, Guozhang Wang <wangguoz@gmail.com>, Matthias J. Sax <matthias@confluent.io>, Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>

Closes #3222 from vahidhashemian/minor/code_cleanup_1706
2017-07-19 10:51:28 -07:00
ppatierno 198a43d846 KAFKA-5412: Using connect-console-sink/source.properties raises an exception related to "file" property not found
Author: ppatierno <ppatierno@live.com>

Reviewers: Randall Hauch <rhauch@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #3279 from ppatierno/kafka-5412
2017-06-19 09:22:19 -07:00
Colin P. Mccabe 5a2fcdd6d4 KAFKA-4894; Fix findbugs "default character set in use" warnings
Author: Colin P. Mccabe <cmccabe@confluent.io>

Reviewers: Jun Rao <junrao@gmail.com>

Closes #2683 from cmccabe/KAFKA-4894
2017-03-20 13:52:35 -07:00
Matthias J. Sax d0e436c471 MINOR: improve license header check by providing head file instead of (prefix) header regex
Author: Matthias J. Sax <matthias@confluent.io>

Reviewers: Jason Gustafson <jason@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #2303 from mjsax/licenseHeader
2017-02-28 12:35:04 -08:00
Shikhar Bhushan 2f90488323 KAFKA-3209: KIP-66: single message transforms
Besides API and runtime changes, this PR also includes 2 data transformations (`InsertField`, `HoistToStruct`) and 1 routing transformation (`TimestampRouter`).

There is some gnarliness in `ConnectorConfig` / `ConfigDef` around creating, parsing and validating a dynamic `ConfigDef`.

Author: Shikhar Bhushan <shikhar@confluent.io>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #2299 from shikhar/smt-2017
2017-01-12 16:14:53 -08:00
leisore ebed7ce360 MINOR: Delete unused code in FileStreamSourceTask
Author: leisore <leisore@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #1433 from leisore/master
2016-05-26 23:21:20 -07:00
dan norwood 62253539d8 MINOR: add logfilename to error message when file missing
ewencp

Author: dan norwood <norwood@confluent.io>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #1307 from norwood/log-filename-when-missing-file
2016-05-03 10:21:57 -07:00
Liquan Pei c07d017227 KAFKA-3315: Add REST and Connector API to expose connector configuration
Author: Liquan Pei <liquanpei@gmail.com>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #964 from Ishiihara/expose-connector-config
2016-03-17 13:26:02 -07:00
Jason Gustafson f7d019ed40 KAFKA-3093: Add Connect status tracking API
Author: Jason Gustafson <jason@confluent.io>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #920 from hachikuji/KAFKA-3093
2016-02-23 22:47:31 -08:00
glikson bde49e3711 MINOR: Use "new line" delimeters in a portable way in a unit test
This fixes failure of the FileStreamSinkTaskTest unit test on Windows

Signed-off-by: glikson <gliksonil.ibm.com>

Author: glikson <glikson@il.ibm.com>

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #708 from glikson/file-ut-newline
2015-12-22 17:07:15 -08:00
manasvigupta a0d21407cb KAFKA-3009; Disallow star imports
Summary of code changes
------------------------------------
1) Added a new Checkstyle rule to flag any code using star imports
2) Fixed ALL existing code violations using star imports

Testing
-----------
Local build was successful
ALL JUnits ran successfully on local.

ewencp - Request you to please review changes. Thank you !

I state that the contribution is my original work and I license the work to the project under the project's open source license.

Author: manasvigupta <manasvigupta@yahoo.co.in>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #700 from manasvigupta/KAFKA-3009
2015-12-21 13:30:59 -08:00
Ewen Cheslack-Postava f2031d4063 KAFKA-2774: Rename Copycat to Kafka Connect
Author: Ewen Cheslack-Postava <me@ewencp.org>

Reviewers: Gwen Shapira

Closes #456 from ewencp/kafka-2774-rename-copycat
2015-11-08 22:11:03 -08:00