Commit Graph

784 Commits

Author SHA1 Message Date
Matthias J. Sax ccf4bd5f46
MINOR: Add 3.7 to Kafka Streams system tests (#15443)
Reviewers: Bruno Cadonna <bruno@confluent.io>
2024-03-06 12:02:58 -08:00
Cheng-Kai, Zhang 8f5bb8cfb3
KAFKA-16252: Fix the documentation and adjust the format (#15473)
Currently, there are few document files generated automatically like the task genConnectMetricsDocs
However, the unwanted log information also added into it.
And the format is not aligned with other which has Mbean located of the third column.

I modified the code logic so the format could follow other section in ops.html
Also close the log since we take everything from the std as a documentation

Reviewers: Luke Chen <showuon@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-03-06 17:19:54 +08:00
Nikolay eea369af94
KAFKA-14588 Log cleaner configuration move to CleanerConfig (#15387)
In order to move ConfigCommand to tools we must move all it's dependencies which includes KafkaConfig and other core classes to java. This PR moves log cleaner configuration to CleanerConfig class of storage module.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-03-05 18:11:56 +08:00
Ismael Juma 2c0cab39ae
MINOR: Remove unnecessary easymock/powermock dependencies (#15460)
These projects don't actually use easymock/powermock.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-03-03 23:31:57 -08:00
Almog Gavra 1c9f360f4a
KAFKA-15215: migrate StreamedJoinTest to Mockito (#15424)
Migrate StreamedJoinTest to Mockito

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, 
Divij Vaidya <diviv@amazon.com>
2024-02-26 18:52:25 -08:00
Nikolay 88c5543ccf
KAFKA-14589: [1/3] Tests of ConsoleGroupCommand rewritten in java (#15256)
This PR is part of #14471
Is contains some of ConsoleGroupCommand tests rewritten in java.
Intention of separate PR is to reduce changes and simplify review.

Reviewers: Luke Chen <showuon@gmail.com>
2024-02-13 11:02:36 +08:00
Matthias Berndt adbffcacb4
MINOR: Remove collections-compat dependency for streams module when on Scala 2.13 (#15239)
Reviewers: Divij Vaidya <diviv@amazon.com>, Josep Prat <jlprat@apache.org>

---------

Co-authored-by: Matthias Berndt <matthias.berndt@ttmzero.com>
2024-02-09 11:57:32 +01:00
Apoorv Mittal b35c62ef92
MINOR: Downgrade version of shadow jar plugin (#15308)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Andrew Schofield <aschofield@confluent.io>
2024-02-02 18:32:03 +01:00
Matthias J. Sax 93712eca15
KAFKA-15594: Add version 3.6 to Kafka Streams system tests (#15151)
Reviewers: Walker Carlson <wcarlson@confluent.io>
2024-01-26 14:59:24 -08:00
Omnia Ibrahim 62ce551826
KAFKA-15853: Move KafkaConfig.Defaults to server module (#15158)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
, David Jacot <djacot@confluent.io>, Nikolay <NIzhikov@gmail.com>
2024-01-22 15:29:11 +01:00
David Jacot a8203f9c7a
KAFKA-14505; [4/N] Wire transaction verification (#15142)
This patch wires the transaction verification in the new group coordinator. It basically calls the verification path before scheduling the write operation. If the verification fails, the error is returned to the caller.

Note that the patch uses `appendForGroup`. I suppose that we will move away from using it when https://github.com/apache/kafka/pull/15087 is merged.

Reviewers: Justine Olshan <jolshan@confluent.io>
2024-01-11 04:58:57 -08:00
Vedarth Sharma 116762fdce
KAFKA-16016: Add docker wrapper in core and remove docker utility script (#15048)
Migrates functionality provided by utility to Kafka core. This wrapper will be used to generate property files and format storage when invoked from docker container.

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-01-08 18:07:38 +05:30
Apoorv Mittal 8a76c16a02
MINOR: Fix shadow jar publishing for the clients module (#15127)
The PR fixes the publishing of kafka-clients artifact to remote maven. The kafka-clients jar was recently shadowed which would publish the artifacts to the local maven repo successfully but would throw an error when publishing to remote maven. (as part of the release process)

The issue triggers only with publishMavenJavaPublicationToMavenRepository due to signing. Generating signed asc files error out for shadowed release artifacts as the module name (clients) differs from the artifact name (kafka-clients).

The fix is basically to explicitly define artifact of shadowJar to signing and publish plugin. project.shadow.component(mavenJava) previously outputs the name as client-<version>-all.jar though the classifier and archivesBaseName are already defined correctly in :clients and shadowJar construction.
2024-01-08 10:42:49 +01:00
Jason Gustafson 599e22b842
MINOR: Move Raft io thread implementation to Java (#15119)
This patch moves the `RaftIOThread` implementation into Java. I changed the name to `KafkaRaftClientDriver` since the main thing it does is drive the calls to `poll()`. There shouldn't be any changes to the logic.

Reviewers: José Armando García Sancio <jsancio@apache.org>
2024-01-05 09:27:36 -08:00
Fiore Mario Vitale 314de9f23c
KAFKA-15996: Improve JsonConverter performance (#14992)
Improve JsonConverter performance by using afterBurnModule of Jackson library.

Reviewers: Divij Vaidya <diviv@amazon.com>, Mickael Maison <mickael.maison@gmail.com>
2023-12-24 21:47:12 +01:00
Nikolay 45bd19f2ef
KAFKA-14588: Move ConfigType to server-common (#14867)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-12-22 18:35:27 +01:00
Michael Westerby ccb36fe0c7
KAFKA-15358: Added QueuedReplicaToDirAssignments metric (#14942)
Reviewers: Igor Soarez <i@soarez.me>, Ron Dagostino <rdagostino@confluent.io>
2023-12-12 03:17:00 -05:00
Vedarth Sharma 0cd2be8718
KAFKA-15879: Add documentation and examples for docker image (#14938)
Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2023-12-12 10:29:05 +05:30
Colin Patrick McCabe 32fdb8d173
KAFKA-15956: MetadataShell must take the log directory lock when reading (#14899)
MetadataShell should take an advisory lock on the .lock file of the directory it is reading from.
Add an integration test of this functionality in MetadataShellIntegrationTest.java.

Note: in build.gradle, I had to add some dependencies on server-common's test files in order to use
MockFaultHandler, etc.

MetadataBatchLoader.java: fix a case where a log message was incorrect.  The intention was to print
the number equivalent to (offset + index).  Instead it was printing the offset, followed by the
index. So if the offset was 100 and the index was 1, 1001 would be printed rather than 101.

Co-authored-by: Igor Soarez <i@soarez.me>
Reviewers: David Arthur <mumrah@gmail.com>, José Armando García Sancio <jsancio@apache.org>
2023-12-10 19:18:34 -08:00
Matthew de Detrich 964e73178b
KAFKA-14132; Replace EasyMock with Mockito in StandaloneHerderTest (#12728)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-12-07 10:01:17 -05:00
Vedarth Sharma eec1530da0
KAFKA-15445: Add JVM Docker image (#14552)
This PR aims to add Apache Kafka JVM Docker image as per the following KIP - https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka

Reviewers:  Ismael Juma <ismael@juma.me.uk>, Ashwin Pankaj <apankaj@confluent.io>, Manikumar Reddy <manikumar.reddy@gmail.com>, Sanjay Awatramani <sawatramani@confluent.io>, 
Nikita Konev
2023-12-06 15:59:13 +05:30
Nikolay 783698c525
KAFKA-15645: Move ReplicationQuotasTestRig to tools module (#14588)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Justine Olshan <jolshan@confluent.io>, Taras Ledkov <tledkov@apache.org>
2023-12-05 10:03:33 +01:00
Bruno Cadonna 75572f904b
KAFKA-15555: Ensure wakeups are handled correctly in poll() (#14746)
We need to be careful when aborting a long poll with wakeup() since the
consumer might never return records if the poll is interrupted after the
consumer position has been updated but the records have not been returned
to the caller of poll().

This PR avoid wake-ups during this critical period.

Reviewers: Philip Nee <pnee@confluent.io>, Kirk True <ktrue@confluent.io>, Lucas Brutschy <lbrutschy@confluent.io>
2023-11-23 10:53:17 +01:00
Ismael Juma df78204e05
KAFKA-15854: Move Java classes from `kafka.server` to the `server` module (#14796)
We only move Java classes that have minimal or no dependencies on Scala classes in this PR.

Details:
* Configured `server` module in build files.
* Changed `ControllerRequestCompletionHandler` to be an interface since it has no implementations.
* Cleaned up various import control files.
* Minor build clean-ups for `server-common`.
* Disabled `testAssignmentAggregation` when executed with Java 8, this is an existing issue (see #14794).

For broader context on this change, please check:
* KAFKA-15852: Move server code from `core` to `server` module

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-11-19 22:09:19 -08:00
Igor Soarez 0390d5b1a2
KAFKA-15355: Message schema changes (#14290)
Reviewers: Christo Lolov <lolovc@amazon.com>, Colin P. McCabe <cmccabe@apache.org>, Proven Provenzano <pprovenzano@confluent.io>, Ron Dagostino <rdagostino@confluent.io>
2023-11-02 09:46:05 -04:00
Apoorv Mittal b850b46cf9
KAFKA-15668: Adding Opentelmetry shadowed library (KIP-714) (#14618)
Part of KIP-714.

The PR comprises of changes to include opentlemetry library as defined in KIP-714. The libraries are shadowed to prevent conflicts.

Co-authored-by: Xavier Léauté <xl+github@xvrl.net>

Reviewers: Andrew Schofield <aschofield@confluent.io>, Xavier Léauté <xavier@confluent.io>, Walker Carlson <wcarlson@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2023-11-01 21:53:24 -07:00
Apoorv Mittal ad2677bb7b
KAFKA-15614: Define interfaces and classes for client telemetry (#14575)
This PR for KIP-714 - KAFKA-1564 lays out interfaces and classes for capturing client telemetry metrics.

Below image defines interaction of different classes among them interfaces have been included in the PR.

Reviewers: Walker Carlson <wcarlson@apache.org>, Matthias J. Sax <matthias@confluent.io>, Andrew Schofield <andrew_schofield@uk.ibm.com>, Kirk True <ktrue@confluent.io>, Philip Nee <pnee@confluent.io>, Jun Rao <junrao@gmail.com>,
2023-10-26 15:06:38 -05:00
Mickael Maison 8b9f6d17f2
KAFKA-15093: Add 3.5 Streams upgrade system tests (#14602)
Reviewers: Matthias J. Sax <mjsax@apache.org>
2023-10-23 13:26:50 +02:00
shuoer86 27a155c80a
MINOR: Fix typos in build.gradle, tests and trogdor (#14574)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, hudeqi <1217150961@qq.com>
2023-10-23 12:30:57 +02:00
Mickael Maison 9c77c17c4e
KAFKA-15664: Add 3.4 Streams upgrade system tests (#14601)
Reviewers: Luke Chen <showuon@gmail.com>,  Matthias J. Sax <mjsax@apache.org>
2023-10-23 10:33:59 +02:00
Greg Harris ffcb6d4a1a
KAFKA-14767: Fix missing commitId build error after git gc (#13315)
git gc moves commit hashes from individual .git/refs/heads/ to .git/packed-refs which is not read
by the determineCommitId function.

Replace the existing lookup within the .git directory with a GrGit lookup that handles packed and
unpacked refs transparently.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-10-22 11:08:01 -07:00
Jeff Kim abee8f711c
KAFKA-14519; [1/N] Implement coordinator runtime metrics (#14417)
Implements the following metrics:

kafka.server:type=group-coordinator-metrics,name=num-partitions,state=loading
kafka.server:type=group-coordinator-metrics,name=num-partitions,state=active
kafka.server:type=group-coordinator-metrics,name=num-partitions,state=failed
kafka.server:type=group-coordinator-metrics,name=event-queue-size
kafka.server:type=group-coordinator-metrics,name=partition-load-time-max
kafka.server:type=group-coordinator-metrics,name=partition-load-time-avg
kafka.server:type=group-coordinator-metrics,name=thread-idle-ratio-min
kafka.server:type=group-coordinator-metrics,name=thread-idle-ratio-avg
The PR makes these metrics generic so that in the future the transaction coordinator runtime can implement the same metrics in a similar fashion.

Also, CoordinatorLoaderImpl#load will now return LoadSummary which encapsulates the start time, end time, number of records/bytes.

Co-authored-by: David Jacot <djacot@confluent.io>

Reviewers:  Ritika Reddy <rreddy@confluent.io>, Calvin Liu <caliu@confluent.io>, David Jacot <djacot@confluent.io>, Justine Olshan <jolshan@confluent.io>
2023-10-17 16:06:23 -07:00
Omnia G.H Ibrahim 9af1e74b5e
KAFKA-14596: Move TopicCommand to tools (#13201)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Federico Valeri <fedevaleri@gmail.com>
2023-10-17 11:40:15 +02:00
Hector Geraldino 4150595b0a
KAFKA-14684: Replace EasyMock/PowerMock with Mockito in WorkerSinkTaskThreadedTest (#14505)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Christo Lolov <christololov@gmail.com>
2023-10-16 11:24:52 +02:00
Ismael Juma 4cf86c5d2f
KAFKA-15492: Upgrade and enable spotbugs when building with Java 21 (#14533)
Spotbugs was temporarily disabled as part of KAFKA-15485 to support Kafka build with JDK 21. This PR upgrades the spotbugs version to 4.8.0 which adds support for JDK 21 and enables it's usage on build again.

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-10-12 14:09:10 +02:00
Arnout Engelen 1983ebebc7
MINOR: fix dependencycheck warnings (#14476)
Add suppressions and skip benchmarking/testing projects

Reviewers: Josep Prat <josep.prat@aiven.io>
2023-10-11 16:18:19 +02:00
atu-sharm c223a9c376
KAFKA-15521: Refactor build.gradle to align gradle swagger plugin with swagger dependencies (#14473)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-10-09 12:30:46 +02:00
Nikolay e90f82b62a
MINOR: Fix dependency issue in tools module (#14475)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-10-03 18:03:38 +02:00
Omnia G.H Ibrahim 7553d3f562
KAFKA-14593: Move LeaderElectionCommand to tools (#13204)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Federico Valeri <fedevaleri@gmail.com>
2023-10-03 11:59:56 +02:00
Nikolay 8f8dbad564
KAFKA-14595 ReassignPartitionsIntegrationTest rewritten in java (#14456)
This PR is part of #13247
It contains ReassignPartitionsIntegrationTest rewritten in java.
Goal of PR is reduce changes size in main PR.

Reviewers: Taras Ledkov  <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
2023-10-02 13:22:17 -07:00
Arnout Engelen dcd8c7d05f
MINOR: suppress dependencycheck warning for CVE-2023-35116 (#14460)
Like in most projects, this attack cannot be achieved by an external
attacker in Kafka.

Reviewers: Josep Prat <josep.prat@aiven.io>
2023-10-02 18:38:29 +02:00
Mickael Maison 4ba9cfd9d9
MINOR: Fix build failure in genConnectOpenAPIDocs (#14464)
Reviewers: Yash Mayya <yash.mayya@gmail.com>
2023-09-29 13:51:39 +02:00
Ismael Juma 99e6f12dd0
KAFKA-15485: Support Java 21 (3/3) (#14433)
* Update CI to build with Java 21 instead of Java 20
* Disable spotbugs when building with Java 21 as it doesn't support it yet (filed KAFKA-15492 for
   addressing this)
* Disable SslTransportLayerTest.testValidEndpointIdentificationCN with Java 21 (same as Java 20)

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-09-25 05:17:08 -07:00
Ismael Juma d1ad1d7b70
MINOR: Upgrade gradle, plugins and test libraries (#14431)
To prepare Java 21 support, upgrade gradle, its plugins and test libraries.
Release notes for major and minor updates included below.

The highlight is faster Java compilation by not shutting down the daemon at the end of the build.
Gradle's internal performance tests show up to a 30% build time improvement for builds that are
dominated by compiling Java sources.

Mockito turns out to be a complex case where we use one of 3 different versions depending on
the Scala and Java versions used. In addition, the default mocking strategy changed from `subclass`
to `inline` in Mockito 5.0. We now use `inline` across the board (we previously used both `subclass`
and `inline`). See comments in the relevant parts of the code for more details.

* Gradle 8.3 release notes: https://docs.gradle.org/8.3/release-notes.html
* jmh 1.37: virtual thread support and various bug fixes
* JUnit 5.10.0 release notes: https://junit.org/junit5/docs/5.10.0/release-notes/index.html
* Mockito 5.x release notes:
  * https://github.com/mockito/mockito/releases/tag/v5.0.0
  * https://github.com/mockito/mockito/releases/tag/v5.1.0
  * https://github.com/mockito/mockito/releases/tag/v5.2.0
  * https://github.com/mockito/mockito/releases/tag/v5.3.0
  * https://github.com/mockito/mockito/releases/tag/v5.4.0
  * https://github.com/mockito/mockito/releases/tag/v5.5.0
* EasyMock 5.2.0 release notes: https://github.com/easymock/easymock/releases/tag/easymock-5.2.0

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-09-24 06:01:28 -07:00
Tyler Bertrand eea1854479
KAFKA-15476: Resolves cache misses in checkstyle (#14344)
Resolves cache misses in checkstyle tasks due to absolute paths in configProperties.

Sets configDirectory extension property, which is made available by the checkstyle plugin as ${config_loc} in the checkstyle xml files, as shown in the Checkstyle Gradle docs. The absolute paths set in configProperties are then replaced by relative paths from configDirectory. Because the header and suppression config file names are static and only referenced once, these were removed from configProperties and the file names are given directly in checkstyle.xml

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-09-19 10:51:57 +02: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
Gantigmaa Selenge 180dcd3969
KAFKA-15294: Publish remote storage configs (#14266)
This change does the following:

1. Make RemoteLogManagerConfigs that are implemented public

2. Add tasks to generate html docs for the configs

3. Include config docs in the main site

Reviewers: Divij Vaidya <diviv@amazon.com>, Luke Chen <showuon@gmail.com>, Christo Lolov <lolovc@amazon.com>, Satish Duggana <satishd@apache.org>
2023-08-28 10:35:11 +02:00
Kamal Chandraprakash 6492164d9c
KAFKA-15167: Tiered Storage Test Harness Framework (#14116)
`TieredStorageTestHarness` is a base class for integration tests exercising the tiered storage functionality. This uses  `LocalTieredStorage` instance as the second-tier storage system and `TopicBasedRemoteLogMetadataManager` as the remote log metadata manager.

Co-authored-by: Alexandre Dupriez <alexandre.dupriez@gmail.com>
Co-authored-by: Kamal Chandraprakash <kamal.chandraprakash@gmail.com>
2023-08-20 17:15:52 +05:30
Greg Harris a9efca0bf6
KAFKA-14759: Move Mock, Schema, and Verifiable connectors to new test-plugins module (#13302)
Reviewers: Hector Geraldino <hgeraldino@gmail.com>, Chris Egerton <chrise@aiven.io>
2023-08-16 10:30:24 -07:00
Greg Harris f5655d31d3
KAFKA-15030: Add connect-plugin-path command-line tool (#14064)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-08-11 12:05:51 -07:00
bachmanity1 f137da04fa
KAFKA-14132: Replace Easymock & Powermock with Mockito in KafkaBasedLogTest (#14153)
Reviewers: Yash Mayya <yash.mayya@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-08-11 10:50:37 +02:00
Federico Valeri 8de3e0436a
KAFKA-15239: Fix system tests using producer performance service (#14092)
Reviewers: Greg Harris <greg.harris@aiven.io>
2023-08-10 14:23:43 -07:00
Yash Mayya f2ebd333e8
KAFKA-13187: Replace EasyMock / PowerMock with Mockito in DistributedHerderTest (#14102)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-08-10 16:47:30 -04:00
Luke Chen 748175ce62
KAFKA-15189: only init remote topic metrics when enabled (#14133)
Only initialize remote topic metrics when system-wise remote storage is enabled to avoid impacting performance for existing brokers. Also add tests.

Reviewers: Divij Vaidya <diviv@amazon.com>, Kamal Chandraprakash <kamal.chandraprakash@gmail.com>
2023-08-05 13:00:16 +08:00
Christo Lolov 7ecf5183dd
KAFKA-14661: Upgrade Zookeeper to 3.8.1 (#13260)
Reviewers: Divij Vaidya <diviv@amazon.com>, Mickael Maison <mickael.maison@gmail.com>
2023-08-01 16:10:39 +02:00
Said Boudjelda 8135b6dfd8
KAFKA-15235: Fix broken coverage reports since migration to Gradle 8.x (#14075)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-07-26 19:52:02 +02:00
Said Boudjelda e5fb9b61fb
MINOR: upgrade version of gradle plugin (ben-manes.versions) to 0.47.0 (#14098)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-07-26 19:12:27 +02:00
Greg Harris 125dbb9286
KAFKA-14760: Move ThroughputThrottler from tools to clients, remove tools dependency from connect-runtime (#13313)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-07-20 12:58:48 -07:00
Gantigmaa Selenge 5cb2504c49
KAFKA-14669: Use the generated docs for MirrorMaker configs in the doc (#13658)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-07-18 11:27:19 -04:00
Abhijeet Kumar fd3b1137d2
KAFKA-14953: Add tiered storage related metrics (#13944)
* KAFKA-14953: Adding RemoteLogManager metrics
In this PR, I have added the following metrics that are related to tiered storage mentioned in[ KIP-405](https://cwiki.apache.org/confluence/display/KAFKA/KIP-405%3A+Kafka+Tiered+Storage).
|Metric|Description|
|-----------------------------------------|--------------------------------------------------------------|
| RemoteReadRequestsPerSec                    | Number of remote storage read requests per second               |
| RemoteWriteRequestsPerSec                    | Number of remote storage write requests per second              |
| RemoteBytesInPerSec                                | Number of bytes read from remote storage per second           |
| RemoteReadErrorsPerSec                          | Number of remote storage read errors per second                   |
| RemoteBytesOutPerSec                             | Number of bytes copied to remote storage per second            |
| RemoteWriteErrorsPerSec                          | Number of remote storage write errors per second                   |
| RemoteLogReaderTaskQueueSize             | Number of remote storage read tasks pending for execution.  |
| RemoteLogReaderAvgIdlePercent             | Average idle percent of the remote storage reader thread pool|
| RemoteLogManagerTasksAvgIdlePercent | Average idle percent of RemoteLogManager thread pool          |

Added unit tests for all the rate metrics.

Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <diviv@amazon.com>, Kamal Chandraprakash<kamal.chandraprakash@gmail.com>, Jorge Esteban Quilcate Otoya <quilcate.jorge@gmail.com>, Staniel Yao<yaolixinylx@gmail.com>, hudeqi<1217150961@qq.com>, Satish Duggana <satishd@apache.org>
2023-07-18 20:16:19 +05:30
Omnia G H Ibrahim 0c6b1a4e9a
KAFKA-14737: Move kafka.utils.json to server-common (#13585)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Federico Valeri <fedevaleri@gmail.com>
2023-07-18 11:02:40 +02:00
Clay Johnson 451fff8937
MINOR: Capture build scans on ge.apache.org to benefit from deep build insights (#13676)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>, Divij Vaidya <diviv@amazon.com>
2023-07-12 10:47:32 +02:00
Satish Duggana 7e2f878713
KAFKA-14522 Rewrite/Move of RemoteIndexCache to storage module. (#13275)
KAFKA-14522 Rewrite and Move of RemoteIndexCache to storage module.
Cleanedup index file suffix usages and other minor cleanups

Reviewers: Jun Rao <junrao@gmail.com>, Ismael Juma <ismael@juma.me.uk>, Luke Chen <showuon@gmail.com>, Divij Vaidya <diviv@amazon.com>, Kamal Chandraprakash<kamal.chandraprakash@gmail.com>, Jorge Esteban Quilcate Otoya <quilcate.jorge@gmail.com>
2023-07-11 23:55:23 +05:30
Hector Geraldino 6368d14a1d
KAFKA-14059 Replace PowerMock with Mockito in WorkerSourceTaskTest (#13383)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-07-10 12:58:54 -04:00
hudeqi 8be601d051
MINOR: Move TROGDOR.md to trogdor module (#13979)
Reviewers: Divij Vaidya <diviv@amazon.com>

---------

Co-authored-by: Deqi Hu <deqi.hu@shopee.com>
2023-07-10 18:11:21 +02:00
Ismael Juma 1f4cbc5d53
MINOR: Add JDK 20 CI build and remove some branch builds (#12948)
It's good for us to add support for Java 20 in preparation for Java 21 - the next LTS.

Given that Scala 2.12 support has been deprecated, a Scala 2.12 variant is not included.

Also remove some branch builds that add load to the CI, but have
low value: JDK 8 & Scala 2.13 (JDK 8 support has been deprecated),
JDK 11 & Scala 2.12 (Scala 2.12 support has been deprecated) and
JDK 17 & Scala 2.12 (Scala 2.12 support has been deprecated).

A newer version of Mockito (4.9.0 -> 4.11.0) is required for Java 20 support, but we
only use it with Scala 2.13+ since it causes compilation errors with Scala 2.12. Similarly,
we upgrade easymock when the Java version is 16 or newer as it's incompatible
with powermock (which doesn't support Java 16 or newer).

Filed KAFKA-15117 for a test that fails with Java 20 (SslTransportLayerTest.testValidEndpointIdentificationCN).

Finally, fixed some lossy conversions that were added after #13582 was submitted.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-06-30 01:12:00 -07:00
Divij Vaidya 88e784f7c6
KAFKA-15084: Remove lock contention from RemoteIndexCache (#13850)
Use thread safe Caffeine to cache indexes fetched from RemoteTier locally. This PR removes a lock contention that led to higher fetch latencies as the IO threads spent time unnecessarily waiting on global cache lock while a single thread fetches the index from remote tier. See PR #13850 for details and rejected alternatives.

Reviewers: Luke Chen <showuon@gmail.com>, Satish Duggana <satishd@apache.org>
2023-06-21 18:22:49 +02:00
David Jacot 2aa1555423
MINOR: rat should depend on processMessages task (#13854)
This fix the following issue that we occasionally see in [builds](https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka-pr/detail/PR-13848/4/pipeline/13/).

```
[2023-06-14T11:41:50.769Z] * What went wrong:
[2023-06-14T11:41:50.769Z] A problem was found with the configuration of task ':rat' (type 'RatTask').
[2023-06-14T11:41:50.769Z]   - Gradle detected a problem with the following location: '/home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-13848'.
[2023-06-14T11:41:50.769Z]     
[2023-06-14T11:41:50.769Z]     Reason: Task ':rat' uses this output of task ':clients:processTestMessages' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
[2023-06-14T11:41:50.769Z]     
[2023-06-14T11:41:50.769Z]     Possible solutions:
[2023-06-14T11:41:50.769Z]       1. Declare task ':clients:processTestMessages' as an input of ':rat'.
[2023-06-14T11:41:50.769Z]       2. Declare an explicit dependency on ':clients:processTestMessages' from ':rat' using Task#dependsOn.
[2023-06-14T11:41:50.769Z]       3. Declare an explicit dependency on ':clients:processTestMessages' from ':rat' using Task#mustRunAfter.
[2023-06-14T11:41:50.769Z]     
[2023-06-14T11:41:50.769Z]     Please refer to https://docs.gradle.org/8.1.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
```

Validated manually as well:

```
% ./gradlew rat

> Configure project :
Starting build with version 3.6.0-SNAPSHOT (commit id 874081ca) using Gradle 8.1.1, Java 17 and Scala 2.13.10
Build properties: maxParallelForks=10, maxScalacThreads=8, maxTestRetries=0

> Task :storage:processMessages
MessageGenerator: processed 4 Kafka message JSON files(s).

> Task :raft:processMessages
MessageGenerator: processed 1 Kafka message JSON files(s).

> Task :core:processMessages
MessageGenerator: processed 2 Kafka message JSON files(s).

> Task :group-coordinator:processMessages
MessageGenerator: processed 16 Kafka message JSON files(s).

> Task :streams:processMessages
MessageGenerator: processed 1 Kafka message JSON files(s).

> Task :metadata:processMessages
MessageGenerator: processed 20 Kafka message JSON files(s).

> Task :clients:processMessages
MessageGenerator: processed 146 Kafka message JSON files(s).

> Task :clients:processTestMessages
MessageGenerator: processed 4 Kafka message JSON files(s).

BUILD SUCCESSFUL in 8s
```

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-16 18:38:43 +02:00
David Jacot 7eea2a3908
MINOR: Move MockTime to server-common (#13823)
This patch rewrite `MockTime` in Java and moves it to `server-common` module. This is a prerequisite to move `MockTimer` later on to `server-common` as well. 

Reviewers: David Arthur <mumrah@gmail.com>
2023-06-09 08:54:25 +02: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
atu-sharm 87c9fd9834
KAFKA-15015: Explicit on reload4j version (#13745)
Defining a specific version for reload4j

Reviewers: Luke Chen <showuon@gmail.com>
2023-05-24 09:32:59 +08:00
atu-sharm 3598f12242
KAFKA-14839: Exclude protected variable from JavaDocs (#13633)
Reviewers: Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, John Roesler <john@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2023-05-12 18:32:11 -07:00
Federico Valeri c757af5f7c
KAFKA-14752: Kafka examples improvements - demo changes (#13517)
KAFKA-14752: Kafka examples improvements - demo changes

Reviewers: Luke Chen <showuon@gmail.com>
2023-05-12 10:39:12 +08:00
Said Boudjelda a7d0b3f753
MINOR: Upgrade gradle to 8.1.1 (#13625)
Also upgrade gradle plugins:
 - `org.owasp.dependencycheck` gradle plugin to version `8.2.1`
 - `com.github.johnrengelman.shadow gradle` plugin to version `8.1.1`

Gradle release notes:
* https://docs.gradle.org/8.1.1/release-notes.html

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-04-25 14:31:04 -07:00
Matthew de Detrich 809966a9a0
KAFKA-13299: Accept duplicate listener on port for IPv4/IPv6 (#11478)
Loosens the validation so that Kafka can accept duplicate listeners on the same port but if and only if the listeners are valid IP addresses with one address being an IPv4 address and the other being an IPv6 address.

Reviewers: Josep Prat <jlprat@apache.org>, Luke Chen <showuon@apache.org>
2023-04-19 20:54:07 +02:00
hudeqi b10716e723
KAFKA-14868: Remove all ReplicaManager metrics when it is closed (#13471)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-04-19 18:49:08 +02:00
Ron Dagostino e27926f92b
KAFKA-14735: Improve KRaft metadata image change performance at high … (#13280)
topic counts.

Introduces the use of persistent data structures in the KRaft metadata image to avoid copying the entire TopicsImage upon every change.  Performance that was O(<number of topics in the cluster>) is now O(<number of topics changing>), which has dramatic time and GC improvements for the most common topic-related metadata events.  We abstract away the chosen underlying persistent collection library via ImmutableMap<> and ImmutableSet<> interfaces and static factory methods.

Reviewers: Luke Chen <showuon@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, Ismael Juma <ismael@juma.me.uk>, Purshotam Chauhan <pchauhan@confluent.io>
2023-04-17 17:52:28 -04:00
Chia-Ping Tsai 637bc92ba1
MINOR: move RecordReader from org.apache.kafka.tools (client module) to org.apache.kafka.tools.api (tools-api module) (#13454)
Reviewers: Jun Rao <junrao@gmail.com>
2023-04-07 00:20:56 +08:00
vamossagar12 c14f56b484
KAFKA-14586: Moving StreamResetter to tools (#13127)
Moves StreamResetter to tools project.

Reviewers: Federico Valeri <fedevaleri@gmail.com>, Christo Lolov <lolovc@amazon.com>, Bruno Cadonna <cadonna@apache.org>
2023-03-28 14:43:22 +02:00
Lucas Brutschy 6fae237638
MINOR: Use JUnit-5 extension to enforce strict stubbing (#13347)
A privious change disabled strict stubbing for the `RocksDBMetricsRecorderTest`. To re-enable the behavior in JUnit-5, we need to pull in a new dependency in the `streams` gradle project.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2023-03-20 13:49:35 -07:00
Mickael Maison ccfc389a63
KAFKA-14804: Update swagger plugin/dependencies to 2.2.8 (#13388)
Reviewers: David Arthur <mumrah@gmail.com>
2023-03-14 12:06:12 +01:00
David Arthur 4f990dcd40
Revert swagger plugin to 2.2.0 (#13387)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-03-13 13:44:40 -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
David Jacot 788cc11f45
KAFKA-14462; [3/N] Add `onNewMetadataImage` to `GroupCoordinator` interface (#13357)
The new group coordinator needs to access cluster metadata (e.g. topics, partitions, etc.) and it needs a mechanism to be notified when the metadata changes (e.g. to trigger a rebalance). In KRaft clusters, the easiest is to subscribe to metadata changes via the MetadataPublisher.

Reviewers: Justine Olshan <jolshan@confluent.io>
2023-03-08 08:52:01 +01:00
Chia-Ping Tsai 3b5bb2f6a2
MINOR: use built-in "--rerun" to replace "-Prerun-tests" (#13343)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-03-06 10:53:49 +08:00
Dejan Stojadinović e348da4095
MINOR: Update gradle to 8.0.2 and update several gradle plugins (#13339)
Also removed workaround from `build.gradle` that is no longer required after
the update to Gradle 8.0.2.

Related links:
 - zinc release notes:   https://github.com/sbt/zinc/releases/tag/v1.8.0
 - gradle release notes: https://github.com/gradle/gradle/releases/tag/v8.0.2
 - gradle diff:          https://github.com/gradle/gradle/compare/v8.0.1...v8.0.2

plugins version upgrade details:
 - 'com.github.ben-manes.versions'              0.44.0 -> 0.46.0
 - 'org.owasp.dependencycheck'                     8.0.2 -> 8.1.2
 - 'io.swagger.core.v3.swagger-gradle-plugin' 2.2.0 -> 2.2.8
 - 'org.gradle.test-retry'                                    1.5.1 -> 1.5.2
 - 'com.github.johnrengelman.shadow'           7.1.2 -> 8.1.0

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-03-04 22:25:00 -08:00
Chia-Ping Tsai 3d9a03cfe8
MINOR: fix rerun-tests for unit test (#13288)
Related to #11926. Let `unitTest` also process rerun-tests.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2023-03-01 16:38:12 -08:00
Ismael Juma dcc1799951
MINOR: srcJar should depend on processMessages task (#13316)
This fixes the following `./gradlew install` issue:

```text
* What went wrong:
A problem was found with the configuration of task ':storage:srcJar' (type 'Jar').
  - Gradle detected a problem with the following location: '/Users/ijuma/src/kafka/storage/src/generated/java'.

    Reason: Task ':storage:srcJar' uses this output of task ':storage:processMessages' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':storage:processMessages' as an input of ':storage:srcJar'.
      2. Declare an explicit dependency on ':storage:processMessages' from ':storage:srcJar' using Task#dependsOn.
      3. Declare an explicit dependency on ':storage:processMessages' from ':storage:srcJar' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
```

Reviewers: David Jacot <david.jacot@gmail.com>
2023-02-28 07:16:09 -08: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
Ismael Juma 4441a01bb0
MINOR: Enable spotless for streams-scala when Java 11+ is used (#13311)
Also re-enable it in CI. We do this by adjusting the `Jenkinsfile`
to use a more general task (`./gradlew check -x test`).

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Dejan Stojadinović <dejan2609@users.noreply.github.com>
2023-02-27 00:28:19 -08:00
Dejan Stojadinović 72dd401e51
KAFKA-14680: Upgrade gradle version from 7.6 to 8.0.1 (#13205)
Details:
 * gradle upgrade: 7.6 -> 8.0.1
 * spotbugs plugin upgrade: 5.0.9 -> 5.0.13
 * tweaked the mechanics for `-release`/`-source`/`-target` to workaround idiosyncrasies in Gradle 8.0.1 and newer Scala 2.13 versions.
 * streams-scala `test` task no longer triggers the `spotless` task since a newer version is required for Gradle 8 support, but the newer version requires Java 11.
Note: relates to #5479

Gradle upgrade highlights:
* "Scala Incremental Compilation for Multi-Module projects broken in 7.x": https://github.com/gradle/gradle/issues/20101
* "Incremental compilation of java modules is broken with Gradle 7.6": https://github.com/gradle/gradle/issues/23067

Full release notes: https://docs.gradle.org/8.0/release-notes.html

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-02-23 19:13:43 -08:00
Satish Duggana 322ac86ba2
KAFKA-14706: Move/rewrite ShutdownableThread to server-common module. (#13234)
Move/rewrite ShutdownableThread to server-common module.

Reviewers: Luke Chen <showuon@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2023-02-17 11:51:17 +08: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
Ismael Juma 031d0ff1ba
MINOR: Update build and test dependencies for 3.5 (#13199)
The most recent version that didn't cause compiler or test errors was chosen.

Gradle plugin updates follow, they include minor fixes and support
for newer Java and Gradle versions:

- spotless: 6.10.0 -> 6.13.0
- versions: 0.42.0 -> 0.44.0
- dependencycheck: 7.1.1 -> 8.0.2
- rat: 0.7.1 -> 0.8.0
- spotbugs: 5.0.9 -> 5.0.13
- test-retry: 1.4.0 -> 1.5.1
- scoverage: 7.0.0 -> 7.0.1

Test/benchmark updates:

- jmh: 1.35 -> 1.36
GC profiler and perfasm improvements
https://mail.openjdk.org/pipermail/jmh-dev/2022-November/003553.html

- junit: 5.9.0 -> 5.9.2
Minor fixes
https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.9.2

- jqwik: 1.6.5 -> 1.7.2
A number of usability improvements, bug fixes and minor breaking changes
https://jqwik.net/release-notes.html#172

- mockito: 4.6.1 -> 4.9.0
Usability improvements, perf fixes and bug fixes
https://github.com/mockito/mockito/releases/tag/v4.7.0
https://github.com/mockito/mockito/releases/tag/v4.8.0
https://github.com/mockito/mockito/releases/tag/v4.8.1
https://github.com/mockito/mockito/releases/tag/v4.9.0

Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Luke Chen <showuon@gmail.com>
2023-02-09 15:16:39 +01:00
Satish Duggana 1d3fb76092
KAFKA-14688 Move package org.apache.kafka.server.log.internals to org.apache.kafka.storage.internals.log (#13213)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-02-08 09:22:42 +05:30
David Jacot 094e343f18
KAFKA-14678; Move `__consumer_offsets` records from `core` to `group-coordinator` (#13200)
This patch moves the current `__consumer_offsets` records from the `core` module to the new `group-coordinator` module.

Reviewers: Christo Lolov <lolovc@amazon.com>, Mickael Maison <mickael.maison@gmail.com>
2023-02-07 09:06:56 +01:00
Eric Haag b20e2539b4
MINOR: Remove unnecessary call to asCollection causing eager dependency resolution (#13149)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Nelson Osacky
2023-02-06 11:28:02 +01:00
Federico Valeri 50e0e3c257
KAFKA-14582: Move JmxTool to tools (#13136)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-02 11:23:26 +01:00
Lucas Brutschy eb7f490159
chore: Fix scaladoc warnings (#13164)
Make sure no scaladoc warnings are emitted from the streams-scala project build.
We cannot fully fix all scaladoc warnings due to limitations of the scaladoc tool,
so this is a best-effort attempt at fixing as many warnings as possible. We also
disable one problematic class of scaladoc wornings (link errors) in the gradle build.

The causes of existing warnings are that we link to java members from scaladoc, which
is not possible, or we fail to disambiguate some members.

The broad rule applied in the changes is
 - For links to Java members such as [[StateStore]], we use the fully qualified name in a code tag
   to make manual link resolution via a search engine easy.
 - For some common terms that are also linked to Java members, like [[Serde]], we omit the link.
 - We disambiguate where possible.
 - In the special case of @throws declarations with Java Exceptions, we do not seem to be able
   to avoid the warning altogther.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Guozhang Wang <wangguoz@gmail.com>
2023-01-31 09:00:48 -08:00
Federico Valeri 72cfc994f5
KAFKA-14628: Move CommandLineUtils and CommandDefaultOptions to tools (#13131)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Christo Lolov <christololov@gmail.com>, Sagar Rao <sagarmeansocean@gmail.com>
2023-01-26 20:06:09 +01:00
Ismael Juma 01aee55fc4
MINOR: Remove some connect tests from Java 17 block list (#13121)
Most were converted not to use PowerMock, but some no
longer exist.

Reviewers: Chris Egerton <chrise@aiven.io>, Christo Lolov  <christo_lolov@yahoo.com>
2023-01-21 07:42:50 -08:00
David Jacot 2e0a005dd4
KAFKA-14367; Add internal APIs to the new `GroupCoordinator` interface (#13112)
This patch migrates all the internal APIs of the current group coordinator to the new `GroupCoordinator` interface. It also makes the current implementation package private to ensure that it is not used anymore.

Reviewers: Justine Olshan <jolshan@confluent.io>
2023-01-20 08:38:21 +01:00
Ismael Juma 8ac644d2b1
KAFKA-14607: Move Scheduler/KafkaScheduler to server-common (#13092)
There were some concurrency inconsistencies in `KafkaScheduler` flagged by spotBugs
that had to be fixed, summary of changes below:
* Executor is `volatile`
* We always synchronize and check `isStarted` as the first thing within the critical
   section when a mutating operation is performed.
* We don't synchronize (but ensure the executor is not null in a safe way) in read-only
   operations that operate on the executor.

With regards to `MockScheduler/MockTask`:
* Set the type of `nextExecution` to `AtomicLong` and replaced inconsistent synchronization
* Extracted logic into `MockTask.rescheduleIfPeriodic`

Tweaked the `Scheduler` interface a bit:
* Removed `unit` parameter since we always used `ms` except one invocation
* Introduced a couple of `scheduleOnce` overloads to replace the usage of default
   arguments in Scala
* Pulled up `resizeThreadPool` to the interface and removed `isStarted` from the
  interface.

Other cleanups:
* Removed spotBugs exclusion affecting `kafka.log.LogConfig`, which no longer exists.

For broader context, see:
* KAFKA-14470: Move log layer to storage module

Reviewers: Jun Rao <junrao@gmail.com>
2023-01-10 23:51:58 -08:00
José Armando García Sancio 896573f9bc
KAFKA-14279: Add 3.3.x streams system tests (#13077)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-01-09 23:37:05 -08:00
Satish Duggana 47288806b3
MINOR Fixed doc generation for LogConfig class in genTopicConfigDocs. (#13079)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-01-05 13:21:20 +05:30
Ismael Juma e8232edd24
KAFKA-14477: Move LogValidator and related to storage module (#13012)
Also improved `LogValidatorTest` to cover a bug that was originally
only caught by `LogAppendTimeTest`.

For broader context on this change, please check:

* KAFKA-14470: Move log layer to storage module

Reviewers: Jun Rao <junrao@gmail.com>
2022-12-21 16:57:02 -08: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
Satish Duggana 7146ac57ba
[KAFKA-13369] Follower fetch protocol changes for tiered storage. (#11390)
This PR implements the follower fetch protocol as mentioned in KIP-405.

Added a new version for ListOffsets protocol to receive local log start offset on the leader replica. This is used by follower replicas to find the local log star offset on the leader.

Added a new version for FetchRequest protocol to receive OffsetMovedToTieredStorageException error. This is part of the enhanced fetch protocol as described in KIP-405.

We introduced a new field locaLogStartOffset to maintain the log start offset in the local logs. Existing logStartOffset will continue to be the log start offset of the effective log that includes the segments in remote storage.

When a follower receives OffsetMovedToTieredStorage, then it tries to build the required state from the leader and remote storage so that it can be ready to move to fetch state.

Introduced RemoteLogManager which is responsible for

initializing RemoteStorageManager and RemoteLogMetadataManager instances.
receives any leader and follower replica events and partition stop events and act on them
also provides APIs to fetch indexes, metadata about remote log segments.
Followup PRs will add more functionality like copying segments to tiered storage, retention checks to clean local and remote log segments. This will change the local log start offset and make sure the follower fetch protocol works fine for several cases.

You can look at the detailed protocol changes in KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-405%3A+Kafka+Tiered+Storage#KIP405:KafkaTieredStorage-FollowerReplication

Co-authors: satishd@apache.org, kamal.chandraprakash@gmail.com, yingz@uber.com

Reviewers: Kowshik Prakasam <kprakasam@confluent.io>, Cong Ding <cong@ccding.com>, Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com>, Yaodong Yang <yangyaodong88@gmail.com>, Divij Vaidya <diviv@amazon.com>, Luke Chen <showuon@gmail.com>, Jun Rao <junrao@gmail.com>
2022-12-17 09:36:44 -08:00
Ismael Juma 88725669e7
MINOR: Move MetadataQuorumCommand from `core` to `tools` (#12951)
`core` should only be  used for legacy cli tools and tools that require
access to `core` classes instead of communicating via the kafka protocol
(typically by using the client classes).

Summary of changes:
1. Convert the command implementation and tests to Java and move it to
    the `tools` module.
2. Introduce mechanism to capture stdout and stderr from tests.
3. Change `kafka-metadata-quorum.sh` to point to the new command class.
4. Adjusted the test classpath of the `tools` module so that it supports tests
    that rely on the `@ClusterTests` annotation.
5. Improved error handling when an exception different from `TerseFailure` is
    thrown.
6. Changed `ToolsUtils` to avoid usage of arrays in favor of `List`.

Reviewers: dengziming <dengziming1993@gmail.com>
2022-12-09 09:22:58 -08: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
Ismael Juma 13c9c78a1f
MINOR: Remove unnecessary scalac warnings suppression (#12953)
Fix the underlying warnings instead.

Reviewers: Luke Chen <showuon@gmail.com>
2022-12-05 06:20:23 -08:00
Matthew de Detrich 6ae08c4ee8
KAFKA-14256: Upgrade from Scala 2.13.8 to 2.13.10 (#12675)
In addition to the version bump, we also had to:
* Update the zinc version
* Workaround compiler warnings via suppression (proper fix in a follow up)
* Adjust `testDeleteTopicDoesNotRetryThrottlingQuotaExceededException` to fix a test failure

Release notes:
* https://github.com/scala/scala/releases/tag/v2.13.9
* https://github.com/scala/scala/releases/tag/v2.13.10

Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-12-04 21:02:43 -08:00
Ismael Juma 52bb677bbe
MINOR: Reuse gradle daemon for scala compilation by default (#12280)
The time time to compile was reduced from 5.3 seconds to 0.9 seconds by
changing the keep alive mode from `SESSION` to `DAEMON`. We change the
default to the latter and allow the former to be set via a `keepAliveMode`
property.

Also update the Jenkins build to use `keepAliveMode="session"` instead of
`--no-daemon`.

./gradlew compileTestScala -PkeepAliveMode="daemon" --info:

> Task :streams:streams-scala:compileTestScala
> Watching 928 directories to track changes
> Caching disabled for task ':streams:streams-scala:compileTestScala' because:
>   Build cache is disabled
> Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
>   Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
> Watching 920 directories to track changes
> Watching 919 directories to track changes
> Compiling with Zinc Scala compiler.
> Prepared Zinc Scala inputs: 0.004 secs
> compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
> done compiling
> Completed Scala compilation: 0.925 secs

./gradlew compileTestScala -PkeepAliveMode="session" --info

> Task :streams:streams-scala:compileTestScala
> Watching 928 directories to track changes
> Caching disabled for task ':streams:streams-scala:compileTestScala' because:
>   Build cache is disabled
> Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
>   Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
> Watching 920 directories to track changes
> Watching 919 directories to track changes
> Starting process 'Gradle Worker Daemon 3'. Working directory: /home/ijuma/.gradle/workers Command: /usr/java/jdk-17.0.4.1+1/bin/java -Xss4m -XX:+UseParallelGC --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.file=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED @/home/ijuma/.gradle/.tmp/gradle-worker-classpath3305983246500958050txt -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 3'
> Successfully started process 'Gradle Worker Daemon 3'
> Started Gradle worker daemon (0.244 secs) with fork options DaemonForkOptions{executable=/usr/java/jdk-17.0.4.1+1/bin/java, minHeapSize=null, maxHeapSize=2048m, jvmArgs=[-Xss4m, -XX:+UseParallelGC, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.nio.file=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent=ALL-UNNAMED, --add-opens=java.base/java.util.regex=ALL-UNNAMED, --add-opens=java.base/java.util.stream=ALL-UNNAMED, --add-opens=java.base/java.text=ALL-UNNAMED, --add-opens=java.base/java.time=ALL-UNNAMED, --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED], keepAliveMode=SESSION}.
> Compiling with Zinc Scala compiler.
> Prepared Zinc Scala inputs: 0.187 secs
> compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
> done compiling
> Completed Scala compilation: 5.307 secs

See https://github.com/gradle/gradle/issues/20579 for more details.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-12-01 05:33:43 -08: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
Ismael Juma 528a4ba1a7
MINOR: Remove config/kraft/README.md from rat exclusion list (#12923)
This file was deleted a while back.

Reviewers: Luke Chen <showuon@gmail.com>
2022-11-30 05:28:05 -08: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
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
David Jacot 7387a11625
KAFKA-14363; Add new `group-coordinator` module (KIP-848) (#12827)
Introduce new group-coordinator module that will host the future new group coordinator as part of KIP-848.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-11-09 08:49:57 +01:00
David Jacot bc780c7c32
MINOR: Move timeline data structures from metadata to server-common (#12811)
This path moves the timeline data structures from metadata module to server-common module as those will be used in the new group coordinator.

Reviewers: José Armando García Sancio <jsancio@users.noreply.github.com>, Colin Patrick McCabe <cmccabe@apache.org>
2022-11-04 08:52:32 +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
Divij Vaidya 5e399fe6f3
Move to mockito (#12465)
This PR build on top of #11017. I have added the previous author's comment in this PR for attribution. I have also addressed the pending comments from @chia7712 in this PR.

Notes to help the reviewer:

Mockito has mockStatic method which is equivalent to PowerMock's method.
When we run the tests using @RunWith(MockitoJUnitRunner.StrictStubs.class) Mockito performs a verify() for all stubs that are mentioned, hence, there is no need to explicitly verify the stubs (unless you want to verify the number of times etc.). Note that this does not work for static mocks.

Reviewers: Bruno Cadonna <cadonna@apache.org>, Walker Carlson <wcarlson@confluent.io>, Bill Bejeck <bbejeck@apache.org>
2022-10-27 14:08:44 -04:00
Manikumar Reddy 06dc67a480
MINOR: Fix allDepInsight gradle task with gradle 7.5 (#12779)
Reviewers: David Jacot <djacot@confluent.io>
2022-10-25 18:39:53 +05:30
Manikumar Reddy 0a111a0812
MINOR: Fix rat task verbose output config (#12786)
Reviewers: David Jacot <djacot@confluent.io>
2022-10-25 16:20:59 +05:30
Chris Egerton 215d4f93bd
MINOR: Remove duplicate test dependency declarations for clients module (#12764)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2022-10-21 12:18:00 -04: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
Jason Gustafson c5745d2845
MINOR: Add initial property tests for StandardAuthorizer (#12703)
In https://github.com/apache/kafka/pull/12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from https://github.com/apache/kafka/pull/12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>
2022-10-04 16:31:43 -07:00
Oliver Eikemeier fb0ae71f33
KAFKA-14270: Fix generated Kafka Streams version file name (#12700)
Kafka Streams expects a version resource at /kafka/kafka-streams-version.properties which is read by ClientMetrics. Unfortunately, the name of the generated file was wrong and thus was not copied as a resource.

Reviewer: Bruno Cadonna <cadonna@apache.org>
2022-10-04 11:58:07 +02:00
Jason Gustafson a8fcbcc08f
MINOR: Set display granularity in gradle test logging (#12657)
We sometimes see build failures where the code encounters an exit condition and fails abruptly. For example:
```
[2022-09-18T10:01:25.947Z] * What went wrong:
[2022-09-18T10:01:25.947Z] Execution failed for task ':core:unitTest'.
[2022-09-18T10:01:25.947Z] > Process 'Gradle Test Executor 116' finished with non-zero exit value 1
```
When this happens, it can be difficult to track the failure back to a specific test from the build output because we don't know which test was executing on 'Gradle Test Executor 116.' 

There is a test logging property in gradle called `displayGranularity`, which lets us see the executor for each test run: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.logging.TestLogging.html#org.gradle.api.tasks.testing.logging.TestLogging:displayGranularity.  When `displayGranularity` is set to 2 (the default), we get the following:
```
AdminZkClientTest > testGetBrokerMetadatas() PASSED
```
When set to 0, it looks like this instead:
```
Gradle Test Run :core:test > Gradle Test Executor 76 > AdminZkClientTest > testGetBrokerMetadatas() PASSED
```
Having this extra information should make it easier to debug failures.

Reviewers: Luke Chen <showuon@gmail.com>, David Jacot <djacot@confluent.io>
2022-09-18 18:24:27 -07:00
Chris Egerton e43e59fce1
KAFKA-14198: Define separate configuration for Swagger (#12616)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-09-12 12:33:13 -04:00
Matthew de Detrich e138772ba5
MINOR: Update Scalafmt to latest version (#12475)
Reviewers: Divij Vaidya <diviv@amazon.com>, Chris Egerton <fearthecellos@gmail.com>
2022-09-12 10:05:15 -04:00
Ismael Juma b449b8032e
KAFKA-14198; swagger-jaxrs2 dependency should be compileOnly (#12609)
Verified that the artifact generated by `releaseTarGz` no longer includes
swagger-jaxrs2 or its dependencies (like snakeyaml).

Reviewers: José Armando García Sancio <jsancio@users.noreply.github.com>, Chris Egerton <fearthecellos@gmail.com>
2022-09-09 07:49:29 -07:00
Liam Clarke-Hutchinson b988528b91
MINOR: re-enable WorkerTest for java 16+ (#12557)
Re-enable WorkerTest for java 16+ since we've removed powerMock in the test

Reviewers: Luke Chen <showuon@gmail.com>
2022-08-25 13:54:55 +08: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
dengziming 150fd5b0b1
KAFKA-13914: Add command line tool kafka-metadata-quorum.sh (#12469)
Add `MetadataQuorumCommand` to describe quorum status, I'm trying to use arg4j style command format, currently, we only support one sub-command which is "describe" and we can specify 2 arguments which are --status and --replication.

```
# describe quorum status
kafka-metadata-quorum.sh --bootstrap-server localhost:9092 describe --replication

ReplicaId	LogEndOffset	Lag	LastFetchTimeMs	LastCaughtUpTimeMs	Status  	
0        	10          	        0  	-1             	        -1                	                 Leader  	
1        	10          	        0  	-1             	        -1                	                 Follower	
2        	10          	        0  	-1             	        -1                	                 Follower	

kafka-metadata-quorum.sh --bootstrap-server localhost:9092 describe --status
ClusterId:                             fMCL8kv1SWm87L_Md-I2hg
LeaderId:                             3002
LeaderEpoch:                      2
HighWatermark:                  10
MaxFollowerLag:                 0
MaxFollowerLagTimeMs:   -1
CurrentVoters:                    [3000,3001,3002]
CurrentObservers:              [0,1,2]

# specify AdminClient properties
kafka-metadata-quorum.sh --bootstrap-server localhost:9092 --command-config config.properties describe --status
```

Reviewers: Jason Gustafson <jason@confluent.io>
2022-08-20 08:37:26 -07:00
Peter Nied 22007fba7c
Remove duplicate common.message.* from clients:test jar file (#12407)
When consuming both `kafka-client:3.0.1` and `kafka-client:3.0.1:test`
through maven a hygene tool was detecting multiple instances of the same
class loaded into the classpath.

Verified this change by building locally with a before and after build with
`./gradlew clients:publishToMavenLocal`, then used beyond compare to
verify the contents.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-08-10 06:54:31 -07: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
Ismael Juma 3494d6eea3
MINOR: Upgrade gradle to 7.5.1 and bump other build/test dependencies (#12495)
Gradle 7.5.1:
* Important bug fixes including https://github.com/gradle/gradle/issues/21400
* Release notes: https://docs.gradle.org/7.5.1/release-notes.html

JUnit 5.9.0
* Support for open test reporting and configurable thread mode for @Timeout
* Release notes: https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.9.0

test-retry-gradle-plugin 1.4.0
* Support for Gradle 7.6 and minor fixes
* Release notes:
  * https://github.com/gradle/test-retry-gradle-plugin/releases/tag/v1.3.2
  * https://github.com/gradle/test-retry-gradle-plugin/releases/tag/v1.4.0

spotbugs-gradle-plugin
* Minor fixes
* Release notes:
  * https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.0.7
  * https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.0.8
  * https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.0.9
 
dependency-check-gradle-plugin
* Minor improvements and false positive fixes
* Release notes:
  * https://github.com/jeremylong/DependencyCheck/releases/tag/v7.0.4
  * https://github.com/jeremylong/DependencyCheck/releases/tag/v7.1.0

rat-gradle-plugin
* Minor fixes
* Diff: https://github.com/eskatos/creadur-rat-gradle/compare/v0.7.0...v0.7.1

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-08-10 06:07:54 -07:00
Colin Patrick McCabe 8a1a8a9168
MINOR: add :server-common test dependency to :storage (#12488)
Fix a bug in the KAFKA-14124 PR where a gradle test dependency was missing.
This causes missing test class exceptions.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-08-05 19:17:50 -07:00
Colin Patrick McCabe 555744da70
KAFKA-14124: improve quorum controller fault handling (#12447)
Before trying to commit a batch of records to the __cluster_metadata log, the active controller
should try to apply them to its current in-memory state. If this application process fails, the
active controller process should exit, allowing another node to take leadership. This will prevent
most bad metadata records from ending up in the log and help to surface errors during testing.

Similarly, if the active controller attempts to renounce leadership, and the renunciation process
itself fails, the process should exit. This will help avoid bugs where the active controller
continues in an undefined state.

In contrast, standby controllers that experience metadata application errors should continue on, in
order to avoid a scenario where a bad record brings down the whole controller cluster.  The
intended effect of these changes is to make it harder to commit a bad record to the metadata log,
but to continue to ride out the bad record as well as possible if such a record does get committed.

This PR introduces the FaultHandler interface to implement these concepts. In junit tests, we use a
FaultHandler implementation which does not exit the process. This allows us to avoid terminating
the gradle test runner, which would be very disruptive. It also allows us to ensure that the test
surfaces these exceptions, which we previously were not doing (the mock fault handler stores the
exception).

In addition to the above, this PR fixes a bug where RaftClient#resign was not being called from the
renounce() function. This bug could have resulted in the raft layer not being informed of an active
controller resigning.

Reviewers: David Arthur <mumrah@gmail.com>
2022-08-04 22:49:45 -07:00
Christo Lolov 54af64c33a
KAFKA-14108: Ensure both JUnit 4 and JUnit 5 tests run (#12441)
When the migration of the Streams project to JUnit 5 started with PR #12285, we discovered that the migrated tests were not run by the PR builds. This PR ensures that Streams' tests that are written in JUnit 4 and JUnit 5 are run in the PR builds.

Co-authored-by: Divij Vaidya <diviv@amazon.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Bruno Cadonna <cadonna@apache.org>
2022-07-29 17:21:25 +02:00
Christo Lolov 25b914750d
KAFKA-13982: Move WorkerConfigTransformerTest to use Mockito (#12422) 2022-07-26 09:39:27 -04:00
Ismael Juma 348474e2ae
MINOR: Upgrade to Gradle 7.5 (#12413)
Highlights:
* The default Scala Zinc version was updated from 1.3.5 to 1.6.1
* Multiple Checkstyle tasks may now run in parallel within a project
* Support for Java 18
* Much more responsive continuous builds on Windows and macOS
* Improved diagnostics for dependency resolution

Some of our tests require java.util and java.lang modules to be open,
so do it explicitly given the following Gradle bug fix:

> When running on Java 9+, Gradle no longer opens the java.base/java.util
> and java.base/java.lang JDK modules for all Test tasks. In some cases,
> this would cause code to pass during testing but fail at runtime.

Release notes: https://docs.gradle.org/7.5/release-notes.html

Reviewers:  Manikumar Reddy <manikumar.reddy@gmail.com>, Luke Chen <showuon@gmail.com>
2022-07-26 05:58:50 -07: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
Bruno Cadonna 4d53dd9972
KAFKA-13930: Add 3.2.0 Streams upgrade system tests (#12209)
* KAFKA-13930: Add 3.2.0 Streams upgrade system tests

Apache Kafka 3.2.0 was recently released. Now we need
to test upgrades from 3.2 to trunk in our system tests.

Reviewer: Bill Bejeck <bbejeck@apache.org>
2022-06-21 16:33:40 +02: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
András Csáki 3d5b41e05f
[KAFKA-13848] Clients remain connected after SASL re-authentication f… (#12179)
Clients remain connected and able to produce or consume despite an expired OAUTHBEARER token.

Root cause seems to be SaslServerAuthenticator#calcCompletionTimesAndReturnSessionLifetimeMs failing to set ReauthInfo#sessionExpirationTimeNanos when tokens have already expired (when session life time goes negative), in turn causing KafkaChannel#serverAuthenticationSessionExpired returning false and finally SocketServer not closing the channel.

The issue is observed with OAUTHBEARER but seems to have a wider impact on SASL re-authentication.

Reviewers: Luke Chen <showuon@gmail.com>, Tom Bentley <tbentley@redhat.com>, Sam Barker <sbarker@redhat.com>
2022-06-10 21:33:33 +08: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
David Arthur 1135f22eaf
KAFKA-13830 MetadataVersion integration for KRaft controller (#12050)
This patch builds on #12072 and adds controller support for metadata.version. The kafka-storage tool now allows a
user to specify a specific metadata.version to bootstrap into the cluster, otherwise the latest version is used.

Upon the first leader election of the KRaft quroum, this initial metadata.version is written into the metadata log. When
writing snapshots, a FeatureLevelRecord for metadata.version will be written out ahead of other records so we can
decode things at the correct version level.

This also includes additional validation in the controller when setting feature levels. It will now check that a given
metadata.version is supportable by the quroum, not just the brokers.

Reviewers: José Armando García Sancio <jsancio@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, dengziming <dengziming1993@gmail.com>, Alyssa Huang <ahuang@confluent.io>
2022-05-18 12:08:36 -07:00
jparag 0007369581
MINOR: parameter name fix for maxScalacThreads (#12151)
There's a typo in build.gradle, and cause the `maxScalacThreads` parameter doesn't work as expected
2022-05-12 14:51:27 +08:00
Ismael Juma 2b14a0bb6d
MINOR: reload4j build dependency fixes (#12144)
* Replace `log4j` with `reload4j` in `copyDependantLibs`. Since we have
  some projects that have an explicit `reload4j` dependency, it
  was included in the final release release tar - i.e. it was effectively
  a workaround for this bug.
* Exclude `log4j` and `slf4j-log4j12` transitive dependencies for
  `streams:upgrade-system-tests`. Versions 0100 and 0101
  had a transitive dependency to `log4j` and `slf4j-log4j12` via
  `zkclient` and `zookeeper`. This avoids classpath conflicts that lead
  to [NoSuchFieldError](https://github.com/qos-ch/reload4j/issues/41) in
  system tests.

Reviewers: Jason Gustafson <jason@confluent.io>
2022-05-10 20:14:21 -07:00
Alyssa Huang 8245c9a3d5
KAFKA-13854 Refactor ApiVersion to MetadataVersion (#12072)
Refactoring ApiVersion to MetadataVersion to support both old IBP versioning and new KRaft versioning (feature flags)
for KIP-778.

IBP versions are now encoded as enum constants and explicitly prefixed w/ IBP_ instead of KAFKA_, and having a
LegacyApiVersion vs DefaultApiVersion was not necessary and replaced with appropriate parsing rules for extracting
the correct shortVersions/versions.

Co-authored-by: David Arthur <mumrah@gmail.com>
Reviewers: Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
2022-05-02 16:27:52 -07:00
Clay Johnson 32311bf369
MINOR: Improve Gradle Caching and Fix Deprecations (#12003)
* Fix UP-TO-DATE check in `create*VersionFile` tasks

`create*VersionFile` tasks explicitly declared output UP-TO-DATE status
 as being false. This change properly sets the inputs to
`create*VersionFile` tasks to the `commitId` and `version` values and
sets `receiptFile` locally rather than in an extra property.

* Enable output caching for `process*Messages` tasks

`process*Messages` tasks did not have output caching enabled. This
change enables that caching, as well as setting a property name and
RELATIVE path sensitivity.

* Fix existing Gradle deprecations

Replaces `JavaExec#main` with `JavaExec#mainClass`

Replaces `Report#destination` with `Report#outputLocation`

Adds a `generator` configuration to projects that need to resolve
the `generator` project (rather than referencing the runtimeClasspath
of the `generator` project from other project contexts.

Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-04-21 17:25:20 +02:00
Jason Gustafson f97646488c
KAFKA-13651; Add audit logging to `StandardAuthorizer` (#12031)
This patch adds audit support through the kafka.authorizer.logger logger to StandardAuthorizer. It
follows the same conventions as AclAuthorizer with a similarly formatted log message. When
logIfAllowed is set in the Action, then the log message is at DEBUG level; otherwise, we log at
trace. When logIfDenied is set, then the log message is at INFO level; otherwise, we again log at
TRACE.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2022-04-13 10:33:15 -07:00
Ismael Juma ce4f2ad606
MINOR: Fix support for custom commit ids in the build (#12014)
This regressed in ca375d8004 due to a typo. We need tests
for our builds. :)

I verified that passing the commitId via `-PcommitId=123`
works correctly.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2022-04-08 08:55:52 -07:00
Ismael Juma b964c07a68
MINOR: Upgrade build and test dependencies (#11984)
* gradle: 7.3.3 -> 7.4.2
  Configuration cache improvements and several other improvements.
  https://docs.gradle.org/7.4.2/release-notes.html
* dependencycheck gradle plugin: 6.5.3 -> 7.0.3
  Minor fixes.
* spotbugs gradle plugin: 5.0.5 -> 5.0.6
  Minor fixes.
  https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.0.6
* jmh: 1.34 -> 1.35
  Fixes and profiler improvements.
  https://mail.openjdk.java.net/pipermail/jmh-dev/2022-March/003422.html
* jqwik: 1.6.3 -> 1.6.5
  Various tweaks and some breaking changes that don't seem to affect us.
  https://github.com/jlink/jqwik/releases/tag/1.6.4
  https://github.com/jlink/jqwik/releases/tag/1.6.5
* mockito: 4.3.1 -> 4.4.0
  Add feature to verify static methods calls in order and minor fixes/improvements.
  https://github.com/mockito/mockito/releases/tag/v4.4.0

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-04-06 07:27:03 -07:00
Jason Gustafson b2cb6caa1e
MINOR: Move `KafkaYammerMetrics` to server-common (#11970)
With major server components like the new quorum controller being moved outside of the `core` module, it is useful to have shared dependencies moved into `server-common`. An example of this is Yammer metrics which server components still rely heavily upon. All server components should have access to the default registry used by the broker so that new metrics can be registered and metric naming conventions should be standardized. This is particularly important in KRaft where we are attempting to recreate identically named metrics in the controller context. This patch takes a step in this direction. It moves `KafkaYammerMetrics` into `server-common` and it implements
standard metric naming utilities there. 

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-03-30 13:59:22 -07:00
Mike Lothian ecb0e8eece
KAFKA-13660: Switch log4j12 to reload4j (#11743)
This bumps the slf4j version to 1.7.36 and swaps out log4j 1.2.17 with
reload4j 1.2.19

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>

Reviewers: Luke Chen <showuon@gmail.com>, Ismael Juma <ismael@juma.me.uk>, Bruno Cadonna <cadonna@apache.org>
2022-03-30 20:54:01 +02:00
John Roesler 322a065b90
KAFKA-13714: Fix cache flush position (#11926)
The caching store layers were passing down writes into lower store layers upon eviction, but not setting the context to the evicted records' context. Instead, the context was from whatever unrelated record was being processed at the time.

Reviewers: Matthias J. Sax <mjsax@apache.org>
2022-03-23 22:09:05 -05: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
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
Justin Lee f5d8fb2b0b
(docs) Add JavaDocs for org.apache.kafka.common.security.oauthbearer.secured (#11811)
Reviewers:  Luke Chen <showuon@confluent.io>, Jun Rao <junrao@gmail.com>
2022-03-03 10:13:01 -08:00
Mickael Maison 0269edfc80
KAFKA-13577: Replace easymock with mockito in kafka:core - part 3 (#11674)
Reviewers: Tom Bentley <tbentley@redhat.com>
2022-02-11 16:16:25 +01:00
Ismael Juma 61b0014ec9
MINOR: Move `ext` block above `allprojects` block in `build.gradle` (#11741)
`ext` contains definitions that should be accessible in `allprojects`
(even though we don't use any right now).

Reviewers: Jason Gustafson <jason@confluent.io>
2022-02-08 12:43:45 -08:00
Ismael Juma ca375d8004
MINOR: Reduce scala compilation time by 15% via scalac backend parallelism (#11739)
Introduce `maxScalacThreads` and set the default to the lowest of `8`
and the number of processors available to the JVM. The number `8` was
picked empirically, the sweet spot is between 6 and 10.

On my desktop, `./gradlew clean core:compileScala core:compileTestScala`
improved from around 60s to 51s ( with this change.

While at it, we improve the build output to include more useful
information at the start: build id, max parallel forks, max scala
threads and max test retries.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Sean Li
2022-02-08 11:03:19 -08:00
Ismael Juma 7c2d672413
MINOR: Update library dependencies (Q1 2022) (#11306)
- scala 2.13: 2.13.6 -> 2.13.8
  * Support Java 18 and improve Android compatibility
  * https://www.scala-lang.org/news/2.13.7
  * https://www.scala-lang.org/news/2.13.8
- scala 2.12: 2.12.14 -> 2.12.15. 
  * The `-release` flag now works with Scala 2.12, backend parallelism
    can be enabled via `-Ybackend-parallelism N` and string interpolation
    is more efficient.
  * https://www.scala-lang.org/news/2.12.5
- gradle versions plugin: 0.38.0 -> 0.42.0
  * Minor fixes
  * https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.40.0
  * https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.41.0
  * https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.42.0
- gradle dependency check plugin: 6.1.6 -> 6.5.3
  * Minor fixes
- gradle spotbugs plugin: 4.7.1 -> 5.0.5
  * Fixes and minor improvements
  * There were too many releases to include all the links, include the major version bump
  * https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.0.0
- gradle scoverage plugin: 5.0.0 -> 7.0.0
  * Support newer Gradle versions and other improvements
  * https://github.com/scoverage/gradle-scoverage/releases/tag/6.0.0
  * https://github.com/scoverage/gradle-scoverage/releases/tag/6.1.0
  * https://github.com/scoverage/gradle-scoverage/releases/tag/7.0.0
- gradle shadow plugin: 7.0.0 -> 7.1.2
  * Support gradle toolchains and security fixes
  * https://github.com/johnrengelman/shadow/releases/tag/7.1.0
  * https://github.com/johnrengelman/shadow/releases/tag/7.1.1
  * https://github.com/johnrengelman/shadow/releases/tag/7.1.2
- bcpkix: 1.66 -> 1.70
  * Several improvements and fixes
  * https://www.bouncycastle.org/releasenotes.html
- jline: 3.12.1 -> 3.21.0
  * Various fixes and improvements
- jmh: 1.32 -> 1.34
  * Compiler blackhole enabled by default when using Java 17 and improved
    gradle incremental compilation
  * https://mail.openjdk.java.net/pipermail/jmh-dev/2021-August/003355.html
  * https://mail.openjdk.java.net/pipermail/jmh-dev/2021-December/003406.html
- scalaLogging: 3.9.3 -> 3.9.4
  * Support for Scala 3.0
- jose4j: 0.7.8 -> 0.7.9
  * Minor fixes
- junit: 5.7.1 -> 5.8.2
  * Minor improvements and fixes
  * https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.8.0
  * https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.8.1
  * https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.8.2
- jqwik: 1.5.0 -> 1.6.3
  * Numerous improvements
  * https://github.com/jlink/jqwik/releases/tag/1.6.0
- mavenArtifact: 3.8.1 -> 3.8.4
- mockito: 3.12.4 -> 4.3.1
  * Removed deprecated methods, `DoNotMock` annotation and
    minor fixes/improvements
  * https://github.com/mockito/mockito/releases/tag/v4.0.0
  * https://github.com/mockito/mockito/releases/tag/v4.1.0
  * https://github.com/mockito/mockito/releases/tag/v4.2.0
  * https://github.com/mockito/mockito/releases/tag/v4.3.0
- scalaCollectionCompat: 2.4.4 -> 2.6.0
  * Minor fixes
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.5.0
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.6.0
- scalaJava8Compat: 1.0.0 -> 1.0.2
  * Minor changes
- scoverage: 1.4.1 -> 1.4.11
  * Support for newer Scala versions
- slf4j: 1.7.30 -> 1.7.32
  * Minor fixes, 1.7.35 automatically uses reload4j and 1.7.33/1.7.34
    cause build failures, so we stick with 1.7.32 for now.
- zstd: 1.5.0-4 -> 1.5.2-1
  * zstd 1.5.2
  * Small refinements and performance improvements
  * https://github.com/facebook/zstd/releases/tag/v1.5.1
  * https://github.com/facebook/zstd/releases/tag/v1.5.2

Checkstyle, spotBugs and spotless will be upgraded separately as they
either require non trivial code changes or they have regressions
that affect us.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-02-07 15:24:50 -08:00
David Jacot 7215c90c5e
MINOR: Add 3.0 and 3.1 to streams system tests (#11716)
Reviewers: Bill Bejeck <bill@confluent.io>
2022-01-28 10:06:31 +01:00
Bruno Cadonna 9e579587ac
MINOR: Bump version of grgit to 4.1.1 (#11561)
grgit 4.1.0 caused unsupported version error during gradle builds.
The reason was that grgit 4.1.0 uses always the latest JGit version
internally. Unfortunately, the latest JGit version was compiled with
a Java version later than Java 8 which caused the unsupported version
error during gradle builds for Java 8.

grgit 4.1.1 fixed this issue by upper bounding the version of JGrit
to a version that is still compiled with Java 8. Consequently, we can
remove the hotfix we merged in commit d1e0d2b474
and instead bump the grgit version from 4.1.0 to 4.1.1.

Reviewer: John Roesler <vvcephei@apache.org>
2021-12-07 18:24:43 +01:00
Bruno Cadonna d1e0d2b474
HOTFIX: Set version of jgit to avoid unsupported version error (#11554)
A new version of JGit that is used by grgit that is used by gradle
causes the following error:

org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled
by a more recent version of the Java Runtime (class file version 55.0),
this version of the Java Runtime only recognizes class file versions
up to 52.0

The reason is that version 6.0.0.202111291000-r of JGrit was compiled
with a newer Java version than Java 8, probably Java 11.

Explicitly setting the version of JGrit in gradle to 5.12.0.202106070339-r fixes
the issue.

Reviewers: David Jacot <djacot@confluent.io>, Ismael Juma <ismael@juma.me.uk>, Alexander Stohr, David Arthur <mumrah@gmail.com>
2021-11-30 18:42:41 +01:00
Kirk True 7b379539a5
KAFKA-13202: KIP-768: Extend SASL/OAUTHBEARER with Support for OIDC (#11284)
This task is to provide a concrete implementation of the interfaces defined in KIP-255 to allow Kafka to connect to an OAuth/OIDC identity provider for authentication and token retrieval. While KIP-255 provides an unsecured JWT example for development, this will fill in the gap and provide a production-grade implementation.

The OAuth/OIDC work will allow out-of-the-box configuration by any Apache Kafka users to connect to an external identity provider service (e.g. Okta, Auth0, Azure, etc.). The code will implement the standard OAuth client credentials grant type.

The proposed change is largely composed of a pair of AuthenticateCallbackHandler implementations: one to login on the client and one to validate on the broker.

See the following for more detail:

KIP-768
KAFKA-13202

Reviewers: Yi Ding <dingyi.zj@gmail.com>, Ismael Juma <ismael@juma.me.uk>, Jun Rao <junrao@gmail.com>
2021-10-28 11:36:53 -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
Ismael Juma 0118330103
KAFKA-13273: Add support for Java 17 (#11296)
Java 17 is at release candidate stage and it will be a LTS release once
it's out (previous LTS release was Java 11).

Details:
* Replace Java 16 with Java 17 in Jenkins and Readme.
* Replace `--illegal-access=permit` (which was removed from Java 17)
   with  `--add-opens` for the packages we require internal access to.
   Filed KAFKA-13275 for updating the tests not to require `--add-opens`
   (where possible).
* Update `release.py` to use JDK8. and JDK 17 (instead of JDK 8 and JDK 15).
* Removed all but one Streams test from `testsToExclude`. The
   Connect test exclusion list remains the same.
* Add notable change to upgrade.html
* Upgrade to Gradle 7.2 as it's required for proper Java 17 support.
* Upgrade mockito to 3.12.4 for better Java 17 support.
* Adjusted `KafkaRaftClientTest` and `QuorumStateTest` not to require
   private access to `jdk.internal.util.random`.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2021-09-06 08:55:52 -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
Kamal Chandraprakash a103c95a31
KAFKA-12724: Add 2.8.0 to system tests and streams upgrade tests. (#10602)
Also adjusted the acceptable recovery lag to stabilize Streams tests.

Reviewers: Justine Olshan <jolshan@confluent.io>, Matthias J. Sax <mjsax@apache.org>, John Roesler <vvcephei@apache.org>
2021-08-04 17:31:10 -05:00
dengziming 4eb72add11
MINOR: Replace EasyMock with Mockito in test-utils module (#11157)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2021-08-03 17:26:46 -07:00
Josep Prat 52f87e2c65
KAFKA-12625: Fix the NOTICE file (#10693)
Adds new NOTICE-binary file and packages it in the binary release
2021-07-29 13:53:29 -05:00
Satish Duggana e8ce93bd53
KAFKA-9555 Added default RLMM implementation based on internal topic storage. (#10579)
KAFKA-9555 Added default RLMM implementation based on internal topic storage.

This is the initial version of the default RLMM implementation.
This includes changes containing default RLMM configs, RLMM implementation, producer/consumer managers.
Introduced TopicBasedRemoteLogMetadataManagerHarness which takes care of bringing up a Kafka cluster and create remote log metadata topic and initializes TopicBasedRemoteLogMetadataManager.
Refactored existing RemoteLogMetadataCacheTest to RemoteLogSegmentLifecycleTest to have parameterized tests to run both RemoteLogMetadataCache and also TopicBasedRemoteLogMetadataManager.
Refactored existing InmemoryRemoteLogMetadataManagerTest, RemoteLogMetadataManagerTest to have parameterized tests to run both InmemoryRemoteLogMetadataManager and also TopicBasedRemoteLogMetadataManager.

This is part of tiered storage KIP-405 efforts.

Reviewers: Kowshik Prakasam <kprakasam@confluent.io>, Cong Ding <cong@ccding.com>, Jun Rao <junrao@gmail.com>
2021-07-19 09:05:46 -07:00
Colin Patrick McCabe 526fdfb97b
MINOR: the broker should use metadata.log.max.record.bytes.between.snapshots (#10990)
The broker should trigger a snapshot once
metadata.log.max.record.bytes.between.snapshots has been exceeded.

Reviewers: Jason Gustafson <jason@confluent.io>
2021-07-09 12:00:26 -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
Colin Patrick McCabe 7bd55f5156
KAFKA-12998: Implement broker-side KRaft snapshots (#10931)
This PR implements broker-side KRaft snapshots, including both saving and
loading. The code for triggering a periodic broker-side snapshot will come in a
follow-on PR. Loading should work with just this PR. It also implements
reloading broker snapshots after initialization.

In order to facilitate snapshots, this PR introduces the concept of
MetadataImage and MetadataDelta. MetadataImage represents the metadata state
retained in memory. It is basically a generalization of MetadataCache that
includes a few things that MetadataCache does not (such as features and client
quotas.) KRaftMetadataCache is now an accessor for the data stored in this object.
Similarly, MetadataImage replaces CacheConfigRespository and ClientQuotaCache.
It also subsumes kafka.server.metadata.MetadataImage and related classes.

MetadataDelta represents a change to a MetadataImage. When a KRaft snapshot is
loaded, we will accumulate all the changes into a MetadataDelta first, prior to
applying it. If we must reload a snapshot because we fell too far behind while
consuming metadata, the resulting MetadataDelta will contain all the changes
needed to catch us up. During normal operation, MetadataDelta is also used to
accumulate the changes of each incoming batch of metadata records. These
incremental deltas should be relatively small.

I have removed the logic for updating the various manager objects from
BrokerMetadataListener and placed it into BrokerMetadataPublisher. This makes
it easier to unit test BrokerMetadataListener.

Reviewers: David Arthur <mumrah@gmail.com>, Jason Gustafson <jason@confluent.io>
2021-07-06 16:36:01 -07:00
Ismael Juma 855011f92a
MINOR: Upgrade Gradle to 7.1.1 and remove JDK 15 build (#10968)
Gradle 7.1 improves Java incremental compilation:
https://docs.gradle.org/7.1.1/release-notes.html

We previously kept the JDK 15 build because some
tests didn't work with JDK 16. Since then, a number
of PRs were submitted to fix this so it's best
to remove the JDK 15 build before we create the
3.0 release branch.

Finally bump `test-retry` gradle plugin version too.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Luke Chen <showuon@gmail.com>
2021-07-04 10:55:16 -07:00
Ron Dagostino 4f5b4c868e
KAFKA-12756: Update ZooKeeper to v3.6.3 (#10918)
Update the ZooKeeper version to v3.6.3. This requires adding dropwizard
as a new dependency.

Also, add Kafka v2.8.0 to the ducktape system test image.

Reviewers: Luke Chen <showuon@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, Ismael Juma <ismael@juma.me.uk>
2021-06-30 11:21:33 -07:00
dengziming b1562a90e0
MINOR: Replace easymock with mockito in log4j-appender (#10852)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-06-30 01:25:08 -07:00
CHUN-HAO TANG 580c111258
KAFKA-12662: add unit test for ProducerPerformance (#10588)
Reviewers: Luke Chen <showuon@gmail.com>, wenbingshen <oliver.shen999@gmail.com>, dengziming <dengziming1993@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2021-06-17 20:07:12 +08:00
Ismael Juma 530224e4fe
KAFKA-12940: Enable JDK 16 builds in Jenkins (#10702)
JDK 15 no longer receives updates, so we want to switch from JDK 15 to JDK 16.
However, we have a number of tests that don't yet pass with JDK 16.

Instead of replacing JDK 15 with JDK 16, we have both for now and we either
disable (via annotations) or exclude (via gradle) the tests that don't pass with
JDK 16 yet. The annotations approach is better, but it doesn't work for tests
that rely on the PowerMock JUnit 4 runner.

Also add `--illegal-access=permit` when building with JDK 16 to make MiniKdc
work for now. This has been removed in JDK 17, so we'll have to figure out
another solution when we migrate to that.

Relevant JIRAs for the disabled tests: KAFKA-12790, KAFKA-12941, KAFKA-12942.

Moved some assertions from `testTlsDefaults` to `testUnsupportedTlsVersion`
since the former claims to test the success case while the former tests the failure case.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-06-13 08:14:37 -07:00
wycccccc 8b6752d183
KAFKA-12905: Replace EasyMock and PowerMock with Mockito for NamedCacheMetricsTest (#10835)
* Development of EasyMock and PowerMock has stagnated while Mockito continues to be actively developed. With the new Java cadence, it's a problem to depend on libraries that do bytecode generation and are not actively maintained. In addition, Mockito is also easier to use.KAFKA-7438

Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>, Bruno Cadonna <cadonna@apache.org>
2021-06-10 12:18:19 +02:00
Chia-Ping Tsai dc5456c0d2
MINOR: cleanTest ought to remove output of unitTest task and integrat… (#10585)
The command used by our private CI is ./gradlew cleanTest xxx:test. It does not re-run test when we use unitTest and integrationTest to replace test. The root cause is that we don't offer test output (unitTest and integrationTest) to cleanTest task and so it does not delete related test output.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-06-01 12:31:09 +08:00
Josep Prat 274eccf922
MINOR: Dependency updates for Scala libraries for improved Scala 3.0 support (#10783)
Release notes:
* Scala 2.12.14: https://github.com/scala/scala/releases/tag/v2.12.14
* Scala Logging: https://github.com/lightbend/scala-logging/releases/tag/v3.9.3
* Scala Collection Compat:
  *  https://github.com/scala/scala-collection-compat/releases/tag/v2.3.1
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.3.2
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.4.0
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.4.1
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.4.2
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.4.3
  * https://github.com/scala/scala-collection-compat/releases/tag/v2.4.4
* Scala Java8 Compat:
  * https://github.com/scala/scala-java8-compat/releases/tag/v1.0.0-RC1
  * https://github.com/scala/scala-java8-compat/releases/tag/v1.0.0

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-05-31 12:06:37 -07:00
José Armando García Sancio f50f13d781
KAFKA-12342: Remove MetaLogShim and use RaftClient directly (#10705)
This patch removes the temporary shim layer we added to bridge the interface
differences between MetaLogManager and RaftClient. Instead, we now use the
RaftClient directly from the metadata module.  This also means that the
metadata gradle module now depends on raft, rather than the other way around.
Finally, this PR also consolidates the handleResign and handleNewLeader APIs
into a single handleLeaderChange API.

Co-authored-by: Jason Gustafson <jason@confluent.io>
2021-05-20 15:39:46 -07:00
Dejan Stojadinović ad91c5edf0
KAFKA-12728: Upgrade gradle to 7.0.2 and shadow to 7.0.0 (#10606)
Details:
* gradle upgrade: 6.8.3 -> 7.0.2
  https://github.com/gradle/gradle/releases/tag/v7.0.0
  https://github.com/gradle/gradle/releases/tag/v7.0.1
  https://github.com/gradle/gradle/releases/tag/v7.0.2
* 'distributionSha256Sum' gradle property is included into 'gradle-wrapper.properties' file
* gradle shadow plugin upgrade: 6.1.0 -> 7.0.0
  https://github.com/johnrengelman/shadow/releases/tag/7.0.0
* Remaining configurations obsoleted in Gradle 6 (and removed in Gradle 7) are replaced:
  `compile` -> `implementation`
  `testCompile` -> `testImplementation`

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-05-15 06:10:04 -07:00
Satish Duggana 7ef3879429
KAFKA-12758 Added `server-common` module to have server side common classes. (#10638)
Added server-common module to have server side common classes. Moved ApiMessageAndVersion, RecordSerde, AbstractApiMessageSerde, and BytesApiMessageSerde to server-common module.

Reivewers:  Kowshik Prakasam <kprakasam@confluent.io>, Jun Rao <junrao@gmail.com>
2021-05-11 09:58:28 -07:00
Satish Duggana 80a468e2b3
MINOR Removed copying storage libraries specifically as they are already copied. (#10647)
Reviewers: Ismael Juma <ismael@juma.me.uk>, Jun Rao <junrao@gmail.com>
2021-05-11 09:04:40 -07:00
Satish Duggana a1367f57f5
KAFKA-12429: Added serdes for the default implementation of RLMM based on an internal topic as storage. (#10271)
KAFKA-12429: Added serdes for the default implementation of RLMM based on an internal topic as storage. This topic will receive events of RemoteLogSegmentMetadata, RemoteLogSegmentUpdate, and RemotePartitionDeleteMetadata. These events are serialized into Kafka protocol message format.
Added tests for all the event types for that topic.

This is part of the tiered storaqe implementation KIP-405.

Reivewers:  Kowshik Prakasam <kprakasam@confluent.io>, Jun Rao <junrao@gmail.com>
2021-05-05 07:48:52 -07:00
Ismael Juma 711608b3b1
MINOR: Update test libraries and gradle plugins for better JDK 16/17 support (#10619)
Details:
* spotbugs gradle plugin from 4.6.0 to 4.7.1:
  https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.6.1
  https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.6.2
  https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.7.0
  https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.7.1
* spotless gradle plugin from 5.10.2 to 5.12.4:
  https://github.com/diffplug/spotless/blob/gradle/5.12.4/CHANGES.md
* test-retry gradle plugin from 1.2.0 to 1.2.1:
  https://github.com/gradle/test-retry-gradle-plugin/releases/tag/v1.2.1
* dependency check gradle plugin from 6.1.1 to 6.1.6:
  https://github.com/jeremylong/DependencyCheck/releases/tag/v6.1.2
  https://github.com/jeremylong/DependencyCheck/releases/tag/v6.1.3
  https://github.com/jeremylong/DependencyCheck/releases/tag/v6.1.4
  https://github.com/jeremylong/DependencyCheck/releases/tag/v6.1.5
  https://github.com/jeremylong/DependencyCheck/releases/tag/v6.1.6
* versions gradle plugin from 0.36.0 to 0.38.0:
https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.37.0
https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.38.0
* easymock from 4.2 to 4.3:
  https://github.com/easymock/easymock/releases/tag/easymock-4.3
* mockito from 3.6.0 to 3.9.0:
https://github.com/mockito/mockito/releases (too many releases to list
  them all individually)
* spotbugs from 4.1.4 to 4.2.2:
  https://github.com/spotbugs/spotbugs/blob/4.2.2/CHANGELOG.md
  4.2.3 has a regression that causes spurious errors related to `Random`
  usage.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-05-02 12:15:54 -07:00
Dejan Stojadinović e57973bbf2
KAFKA-12417: streams copyDependentLibs should not copy testRuntime configuration jars (#10466)
This also fixes a Gradle deprecation that unblocks the upgrade to Gradle 7.0.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-04-28 11:31:37 -07:00
Shay Elkin fc405d792d
Minor: Move trogdor out of tools and into its own gradle module (#10539)
Move Trogdor out of tools and into its own gradle module.  This allows us to minimize
the dependencies of the tools module.  We still keep Trogdor in the CLASSPATH
created by kafka-run-class.sh.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2021-04-15 11:37:15 -07:00
Ismael Juma a776020688
KAFKA-12658: Include kafka-shell jar and dependencies in release tar (#10531)
Verified that `./bin/kafka-metadata-shell.sh --help` on the release tarball
works as expected. It failed with a `ClassNotFoundException` before this
change.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Gwen (Chen) Shapira <cshapi@gmail.com>
2021-04-12 22:26:54 -07:00
Jim Hurne 1e8a7c45ef
MINOR: Switch to using the Gradle RAT plugin (#10491)
The Gradle RAT plugin properly declares inputs and outputs and is also
cachable. This also relieves the Kafka developers from maintaining the build
integration with RAT.

The generated RAT report is identical to the one generated previously. The only
difference is the RAT report name: the RAT plugin sets the HTML report name to
`index.html` (still under `build/rat`).

Verified that the rat task fails if unlicensed files are present (and not excluded). Also
`./gradlew rat` succeeds when there is no .git folder.
2021-04-12 21:05:49 -07:00
Ismael Juma 2004f5b2ca
MINOR: Use `testRuntimeOnly` instead of `testRuntime` in storage modules (#10524)
`testRuntime` is deprecated in Gradle 6.x and has been removed in Gradle 7.0.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Satish Duggana <satishd@apache.org>
2021-04-11 22:48:42 -07:00
Satish Duggana 6e1723b483
MINOR Moved tiered storage API classes from clients module to a new storage-api wmodule. (#10489)
Moved tiered storage API classes from clients module to a new storage-api module.
Created storage and storage-api modules. All the remote storage API classes are moved to storage-api module. All the remote storage implementation classes will be added to storage module.

Reviewers: Jun Rao <junrao@gmail.com>
2021-04-07 13:52:50 -07:00
Marco Aurelio Lotz 33d0445b84
KAFKA-5146: remove Connect dependency from Streams module (#10131)
Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Ismael Juma <ismael@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2021-04-06 17:47:52 -07:00
John Roesler ff77864a69
KAFKA-12602: Fix LICENSE file (#10474)
Fixes the LICENSE files that we ship with our releases:
* the source-distribution license included wrong and unnecessary dependencies
* the binary-distribution license was missing most of our actual dependencies

Reviewers: A. Sophie Blee-Goldman <ableegoldman@apache.org>, Ewen Cheslack-Postava <ewencp@apache.org>, Justin Mclean <jmclean@apache.org>
2021-04-06 15:08:24 -05:00
Ismael Juma 12e655f45c
MINOR: Enable scala/java joint compilation consistently for `core` module (#10485)
We were doing it only for test files previously.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Jose Sancio <jsancio@gmail.com>
2021-04-06 12:10:55 -07:00
John Roesler 4ed7f2cd01
KAFKA-12593: Fix Apache License headers (#10452)
* Standardize license headers in scala, python, and gradle files.
* Relocate copyright attribution to the NOTICE.
* Add a license header check to `spotless` for scala files.

Reviewers: Ewen Cheslack-Postava <ewencp@apache.org>, Matthias J. Sax <mjsax@apache.org>, A. Sophie Blee-Goldman <ableegoldman@apache.org
2021-04-01 10:38:37 -05:00
Ismael Juma 16b2d4f3a7
MINOR: Self-managed -> KRaft (Kafka Raft) (#10414)
`Self-managed` is also used in the context of Cloud vs on-prem and it can
be confusing.

`KRaft` is a cute combination of `Kafka Raft` and it's pronounced like `craft`
(as in `craftsmanship`).

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Jose Sancio <jsancio@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>, Ron Dagostino <rdagostino@confluent.io>
2021-03-29 15:39:10 -07:00
Ismael Juma e840b03a02
MINOR: Always apply the java-library gradle plugin (#10394)
As @chia7712 found, we currently apply the `java` plugin indirectly via `rat.gradle`
if the `.git` folder exists (7071ded2a6/gradle/rat.gradle (L101)).

This led to inconsistent behavior if the `.git` directory was not present. With
this change, the `java-library` plugin (which has slightly more features than
the `java` plugin) is always applied.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, John Roesler <vvcephei@apache.org>
2021-03-24 20:19:28 -07:00
John Roesler 9bf5c57997
KAFKA-12435: Fix javadoc errors (#10392)
There were errors while generating javadoc for the streams:test-utils module
because the included TopologyTestDriver imported some excluded classes.

This fixes the errors by inlining the previously excluded packages.

Reviewers: Chia-Ping Tsai <chia7712@apache.org>, Ismael Juma <ijuma@apache.org>
2021-03-24 13:55:27 -05:00
Chia-Ping Tsai 9af81955c4
KAFKA-12173 Migrate streams:streams-scala module to JUnit 5 (#9858)
1. replace org.junit.Assert by org.junit.jupiter.api.Assertions
2. replace org.junit by org.junit.jupiter.api
3. replace Before by BeforeEach
4. replace After by AfterEach
5. remove ExternalResource from all scala modules
6. add explicit AfterClass/BeforeClass to stop/start EmbeddedKafkaCluster

Noted that this PR does not migrate stream module to junit 5 so it does not introduce callback of junit 5 to deal with beforeAll/afterAll. The next PR of migrating stream module can replace explicit beforeAll/afterAll by junit 5 extension. Or we can keep the beforeAll/afterAll if it make code more readable.

Reviewers: John Roesler <vvcephei@apache.org>
2021-03-25 01:04:39 +08:00
Ismael Juma 7c7e8078e4
MINOR: Use self-managed mode instead of KIP-500 and nozk (#10362)
KIP-500 is not particularly descriptive. I also tweaked the readme text a bit.

Tested that the readme for self-managed still works after these changes.

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Ron Dagostino <rdagostino@confluent.io>, Jason Gustafson <jason@confluent.io>
2021-03-19 16:42:37 -07:00
Justine Olshan a065fa5d1a
MINOR: Exclude KIP-500.md from rat check (#10354)
Builds are failing since this file does not have a license. Similar .md files do not seem to have licenses,
so I've added this file to the exclude list.
2021-03-18 13:17:44 -07:00
Ismael Juma b98e5f457c
MINOR: Move `configurations.all` to be a child of `allprojects` (#10349)
It was incorrectly set within `dependencyUpdates` and it still worked.
That is, this is a no-op in terms of behavior, but makes it easier to
read and understand.

I tested that `releaseTarGz` produced a tar with two versions of
`javassist` _without this block_ and a single version with it (in either
position).

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-03-18 11:50:13 -07:00
Dejan Stojadinović 9ffa6d6d74
KAFKA-12293: Remove JCenter from buildscript and delete buildscript.gradle
They're no longer used and JFrog is sunsetting JCenter.

https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-03-18 07:27:14 -07:00
Ismael Juma f6ef714add
KAFKA-12491: Make rocksdb an `api` dependency for `streams` (#10341)
`org.rocksdb.Options` is part of Kafka Streams public api via `RocksDBConfigSetter`.

Reviewers: Anna Sophie Blee-Goldman <sophie@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2021-03-18 07:00:22 -07:00
Jason Gustafson 8ef1619f3e
KAFKA-12459; Use property testing library for raft event simulation tests (#10323)
This patch changes the raft simulation tests to use jqwik, which is a property testing library. This provides two main benefits:

- It simplifies the randomization of test parameters. Currently the tests use a fixed set of `Random` seeds, which means that most builds are doing redundant work. We get a bigger benefit from allowing each build to test different parameterizations.
- It makes it easier to reproduce failures. Whenever a test fails, jqwik will report the random seed that failed. A developer can then modify the `@Property` annotation to use that specific seed in order to reproduce the failure.

This patch also includes an optimization for `MockLog.earliestSnapshotId` which reduces the time to run the simulation tests dramatically.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>, José Armando García Sancio <jsancio@gmail.com>, David Jacot <djacot@confluent.io>
2021-03-17 19:20:07 -07:00
Ismael Juma 19e5918b23
MINOR: Log project, gradle, java and scala versions at the start of the build (#10307)
This is useful when debugging build issues. I also removed two printlns that are now redundant, so
this makes the build more informative and less noisy at the same time. Example output:

> Starting build with version 3.0.0-SNAPSHOT using Gradle 6.8.3, Java 15 and Scala 2.13.5

Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>
2021-03-12 13:03:25 -08:00
Ismael Juma 0e8a84e5d7
MINOR: Various javadoc fixes (#10272)
- Use consistent options for `javadoc` and `aggregatedJavadoc`
- `aggregatedJavadoc` depends on `compileJava`
- `connect-api` inherits `options.links`
- `streams` and `streams-test-utils` javadoc exclusions should be more
specific to avoid unexpected behavior in `aggregatedJavadoc` when the
javadoc for multiple modules is generated together

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-03-09 06:00:16 -08:00
Ismael Juma 7a3ebbebbc
KAFKA-12415 Prepare for Gradle 7.0 and restrict transitive scope for non api dependencies (#10203)
Gradle 7.0 is required for Java 16 compatibility and it removes a number of
deprecated APIs. Fix most issues preventing the upgrade to Gradle 7.0.
The remaining ones are more complicated and should be handled
in a separate PR. Details of the changes:

* Release tarball no longer includes includes test, sources, javadoc and test sources jars (these
are still published to the Maven Central repository).
* Replace `compile` with `api` or `implementation` - note that `implementation`
dependencies appear with `runtime` scope in the pom file so this is a (positive)
change in behavior
* Add missing dependencies that were uncovered by the usage of `implementation`
* Replace `testCompile` with `testImplementation`
* Replace `runtime` with `runtimeOnly` and `testRuntime` with `testRuntimeOnly`
* Replace `configurations.runtime` with `configurations.runtimeClasspath`
* Replace `configurations.testRuntime` with `configurations.testRuntimeClasspath` (except for
the usage in the `streams` project as that causes a cyclic dependency error)
* Use `java-library` plugin instead of `java`
* Use `maven-publish` plugin instead of deprecated `maven` plugin - this changes the
commands used to publish and to install locally, but task aliases for `install` and
`uploadArchives` were added for backwards compatibility
* Removed `-x signArchives` line from the readme since it was wrong (it was a
no-op before and it fails now, however)
* Replaces `artifacts` block with an approach that works with the `maven-publish` plugin
* Don't publish `jmh-benchmark` module - the shadow jar is pretty large and not
particularly useful (before this PR, we would publish the non shadow jars)
* Replace `version` with `archiveVersion`, `baseName` with `archiveBaseName` and
`classifier` with `archiveClassifier`
* Update Gradle and plugins to the latest stable version (7.0 is not stable yet)
* Use `plugin` DSL to configure plugins
* Updated notable changes for 3.0

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Randall Hauch <rhauch@gmail.com>
2021-03-04 11:22:22 -08:00
Satish Duggana 0d9a95a7d0
KAFKA-9548 Added SPIs and public classes/interfaces introduced in KIP-405 for tiered storage feature in Kafka. (#10173)
KIP-405 introduces tiered storage feature in Kafka. With this feature, Kafka cluster is configured with two tiers of storage - local and remote. The local tier is the same as the current Kafka that uses the local disks on the Kafka brokers to store the log segments. The new remote tier uses systems, such as HDFS or S3 or other cloud storages to store the completed log segments. Consumers fetch the records stored in remote storage through the brokers with the existing protocol.

We introduced a few SPIs for plugging in log/index store and remote log metadata store.

This involves two parts
1. Storing the actual data in remote storage like HDFS, S3, or other cloud storages.
2. Storing the metadata about where the remote segments are stored. The default implementation uses an internal Kafka topic.

You can read KIP for more details at https://cwiki.apache.org/confluence/display/KAFKA/KIP-405%3A+Kafka+Tiered+Storage

Reviewers: Jun Rao <junrao@gmail.com>
2021-03-03 08:55:13 -08:00
John Roesler a92b986c85
KAFKA-12268: Implement task idling semantics via currentLag API (#10137)
Implements KIP-695

Reverts a previous behavior change to Consumer.poll and replaces
it with a new Consumer.currentLag API, which returns the client's
currently cached lag.

Uses this new API to implement the desired task idling semantics
improvement from KIP-695.

Reverts fdcf8fbf72 / KAFKA-10866: Add metadata to ConsumerRecords (#9836)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Guozhang Wang <guozhang@apache.org>
2021-03-02 08:20:47 -06:00
Ismael Juma 6f2cb60ef6
KAFKA-12341: Ensure consistent versions for javassist (#10191)
And update to 3.27.0-GA.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-02-23 10:47:53 -08:00
Ismael Juma b5265e98eb
KAFKA-12357: Do not inline methods from the scala package by default (#10174)
As mentioned in #9548, users currently use the kafka jar (`core` module)
for integration testing and the current inlining behavior causes
problems when the user's classpath contains a different Scala version
than the one that was used for compilation (e.g. 2.13.4 versus 2.13.3).

An example error:

`java.lang.NoClassDefFoundError: scala/math/Ordering$$anon$7`

We now disable inlining of the `scala` package by default, but make it
easy to enable it for those who so desire (a good option if you can
ensure the scala library version matches the one used for compilation).
While at it, we make it possible to disable scala compiler optimizations
(`none`) or to use only method local optimizations (`method`). This can
be useful if optimizing for compilation time during development.

Verified behavior by running gradlew with `--debug` and checking the
output after `[zinc] The Scala compiler is invoked with:`

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-02-22 21:11:17 -08:00
Colin Patrick McCabe 5eac5a822f
KAFKA-12276: Add the quorum controller code (#10070)
The quorum controller stores metadata in the KIP-500 metadata log, not in Apache
ZooKeeper. Each controller node is a voter in the metadata quorum. The leader of the
quorum is the active controller, which processes write requests. The followers are standby
controllers, which replay the operations written to the log. If the active controller goes away,
a standby controller can take its place.

Like the ZooKeeper-based controller, the quorum controller is based on an event queue
backed by a single-threaded executor. However, unlike the ZK-based controller, the quorum
controller can have multiple operations in flight-- it does not need to wait for one operation
to be finished before starting another. Therefore, calls into the QuorumController return
CompleteableFuture objects which are completed with either a result or an error when the
operation is done. The QuorumController will also time out operations that have been
sitting on the queue too long without being processed. In this case, the future is completed
with a TimeoutException.

The controller uses timeline data structures to store multiple "versions" of its in-memory 
state simultaneously. "Read operations" read only committed state, which is slightly older
than the most up-to-date in-memory state. "Write operations" read and write the latest
in-memory state. However, we can not return a successful result for a write operation until
its state has been committed to the log. Therefore, if a client receives an RPC response, it
knows that the requested operation has been performed, and can not be undone by a
controller failover.

Reviewers: Jun Rao <junrao@gmail.com>, Ron Dagostino <rdagostino@confluent.io>
2021-02-19 18:03:23 -08:00
Colin P. Mccabe 690f72dd69 KAFKA-12334: Add the KIP-500 metadata shell
The Kafka Metadata shell is a new command which allows users to
interactively examine the metadata stored in a KIP-500 cluster.
It can examine snapshot files that are specified via --snapshot.

The metadata tool works by replaying the log and storing the state into
in-memory nodes.  These nodes are presented in a fashion similar to
filesystem directories.

Reviewers: Jason Gustafson <jason@confluent.io>, David Arthur <mumrah@gmail.com>, Igor Soarez <soarez@apple.com>
2021-02-19 15:46:34 -08:00
David Arthur e7e4252b0f
JUnit extensions for integration tests (#9986)
Adds JUnit 5 extension for running the same test with different types of clusters. 
See core/src/test/java/kafka/test/junit/README.md for details
2021-02-09 11:49:33 -05:00
Colin Patrick McCabe 1d3e293c08
MINOR: Add ClusterTool as specified in KIP-631 (#10047)
Add ClusterTool as specified in KIP-631. It can report the current cluster ID, and also send the new RPC for removing broker registrations.

Reviewers: David Arthur <mumrah@gmail.com>
2021-02-08 12:07:39 -08:00
Jason Gustafson f58c2acf26
KAFKA-12250; Add metadata record serde for KIP-631 (#9998)
This patch adds a `RecordSerde` implementation for the metadata record format expected by KIP-631. 

Reviewers: Colin McCabe <cmccabe@apache.org>, Ismael Juma <mlists@juma.me.uk>
2021-02-03 16:16:35 -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
Colin Patrick McCabe 1711cfa4eb
KAFKA-12209: Add the timeline data structures for the KIP-631 controller (#9901)
Reviewers: Jun Rao <junrao@gmail.com>
2021-02-02 11:33:55 -08:00
John Roesler fdcf8fbf72
KAFKA-10866: Add metadata to ConsumerRecords (#9836)
Expose fetched metadata via the ConsumerRecords
object as described in KIP-695.

Reviewers: Guozhang Wang <guozhang@apache.org>
2021-01-27 18:18:38 -06:00
bertber 484c99e200
KAFKA-12175 Migrate generator module to junit5 (#9926)
Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
2021-01-21 11:42:47 +08:00
Ismael Juma ef5b7b701f
MINOR: Exclude junit 3 transitive dependency from jfreechart (#9928)
This was causing IntelliJ to choose the Vintage runner when running `core` tests
which would then fail during the discovery phase.

Verified that `core` tests work in IntelliJ again after this change.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-19 08:15:57 -08:00
Ismael Juma 418aaa0d3d
MINOR: Ensure compile and runtime classpaths have consistent versions (#9921)
Ensure that runtime-only dependencies don't cause a different version to be used.
More specifically:

> The relationship is directed, which means that if the runtimeClasspath configuration
has to be resolved, Gradle will first resolve the compileClasspath and then "inject" the
result of resolution as strict constraints into the runtimeClasspath.

For more details, see:
https://docs.gradle.org/6.8/userguide/resolution_strategy_tuning.html#sec:configuration_consistency

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-19 08:12:26 -08:00
Ismael Juma 8648643abb
MINOR: Use Gradle's JUnitPlatform for upgrade-system-tests modules (#9922)
Add a runtime dependency on the jupiter engine to avoid failures
during `./gradlew unitTest/integrationTest/test` for `upgrade-system-tests-*`.

Also remove `connect` and `examples` from the JUnit 5 blocklist since they
contains no tests.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-18 08:59:09 -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
Chia-Ping Tsai 5a4bbb9f91
KAFKA-7341 Migrate core module to JUnit 5 (#9855)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-19 00:00:32 +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
Ismael Juma 144b1230e3
MINOR: Remove incorrect code in metadata module build (#9897)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-15 05:40:48 -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
Colin Patrick McCabe 217334b0f4
KAFKA-12183: Add the KIP-631 metadata record definitions (#9876)
Add the metadata gradle module, which will contain the metadata record
definitions, and other metadata-related broker-side code.

Add MetadataParser, MetadataParseException, etc.

Reviewers: José Armando García Sancio <jsancio@gmail.com>, Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>
2021-01-14 09:58:52 -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
dengziming 06aa9c5aa3
MINOR: Fix typo in `shouldUseJUnit5` in build.gradle (#9893)
"mirorr-client" => "mirror-client"

Reviewers: Ismael Juma <ismael@juma.me.uk
2021-01-14 05:47:48 -08:00
Ismael Juma fa66ecef28
MINOR: Make JUnit 5 the default for new projects (#9882)
Instead of listing the projects that should use JUnit 5, list the
projects that are still using JUnit 4.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-01-14 05:16:43 -08:00
Chia-Ping Tsai 04827dad51
KAFKA-12171: Migrate streams:test-utils module to JUnit 5 (#9856)
* replace `org.junit.Assert` by `org.junit.jupiter.api.Assertions`
* replace `org.junit` by `org.junit.jupiter.api`
* replace `org.junit.runners.Parameterized` by `org.junit.jupiter.params.ParameterizedTest`
* replace `org.junit.runners.Parameterized.Parameters` by `org.junit.jupiter.params.provider.{Arguments, MethodSource}`
* replace `Before` by `BeforeEach`
* replace `After` by `AfterEach`

Reviewers: Ismael Juma <ismael@juma.me.uk>
2021-01-13 21:23:48 -08:00