Commit Graph

2933 Commits

Author SHA1 Message Date
gongxuanzhang 5a331acad0
KAFKA-10787 apply spotless to `streams:examples` and `streams-scala` (#16378)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-18 18:56:46 +08:00
dujian0068 823d6f7555
KAFKA-16958 add STRICT_STUBS to EndToEndLatencyTest, OffsetCommitCallbackInvokerTest, ProducerPerformanceTest, and TopologyTest (#16348)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-18 18:51:43 +08:00
TingIāu "Ting" Kì 92d8d4bd1f
KAFKA-16970 Fix hash implementation of `ScramCredentialValue`, `ScramCredentialData`, and `ContextualRecord` (#16359)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-17 22:29:22 +08:00
gongxuanzhang 09b4ef416a
KAFKA-10787 Apply spotless to `stream:test-utils` and `:streams:upgrade-system-tests-xxxx` (#16357)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-17 19:48:44 +08:00
Rohan 9a239c6142
KAFKA-16955: fix synchronization of streams threadState (#16337)
Each KafkaStreams instance maintains a map from threadId to state
to use to aggregate to a KafkaStreams app state. The map is updated
on every state change, and when a new thread is created. State change
updates are done in a synchronized blocks, however the update that
happens on thread creation is not, which can raise
ConcurrentModificationException. This patch moves this update
into the listener object and protects it using the object's lock.
It also moves ownership of the state map into the listener so that
its less likely that future changes access it without locking

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-06-14 10:44:36 -07:00
Antoine Pourchet 8afa5e74ac
KAFKA-15045: (KIP-924 pt. 26) default standby task assignment nit (#16331)
The new default standby task assignment in TaskAssignment should only assign standby tasks for changelogged tasks, not all stateful tasks.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-14 00:08:31 -07:00
PoAn Yang c32693d556
KAFKA-15623 (1/N) Migrate streams tests module to JUnit 5 (#16254)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-14 12:54:11 +08:00
Greg Harris dfe0fcfe28
MINOR: Change KStreamKstreamOuterJoinTest to use distinct left and right types (#15513)
KStreamKStreamJoin was recently refactored to be type safe with regard to left and right value-types. This PR updates the corresponding test to use different value types instead of the same one to improve test coverage.

Reviewers: Bruno Cadonna <bruno@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2024-06-13 18:32:25 -07:00
dujian0068 133f2b0f31
KAFKA-16879 SystemTime should use singleton mode (#16266)
Reviewers: Greg Harris <gharris1727@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-06-14 08:49:19 +08:00
A. Sophie Blee-Goldman 4333af5c9f
KAFKA-15045: (KIP-924 pt. 25) Rename old internal StickyTaskAssignor to LegacyStickyTaskAssignor (#16322)
To avoid confusion in 3.8/until we fully remove all the old task assignors and internal config, we should rename the old internal assignor classes like the StickyTaskAssignor so that they won't be mixed up with the new version of the assignor (which is also named StickyTaskAssignor)

Reviewers: Bruno Cadonna <cadonna@apache.org>, Josep Prat <josep.prat@aiven.io>
2024-06-13 11:27:50 -07:00
gongxuanzhang 596b945072
KAFKA-16643 Add ModifierOrder checkstyle rule (#15890)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-06-13 15:39:32 +08:00
Antoine Pourchet 103ff5c0f0
KAFKA-15045: (KIP-924 pt. 24) internal TaskAssignor rename to LegacyTaskAssignor (#16318)
Since the new public API for TaskAssignor shared a name, this rename will prevent users from confusing the internal definition with the public one.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-13 00:32:39 -07:00
Antoine Pourchet 16e2b68b73
KAFKA-15045: (KIP-924 pt. 23) More TaskAssignmentUtils tests (#16292)
Also moved the assignment validation test from StreamsPartitionAssignorTest to TaskAssignmentUtilsTest.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-12 14:25:47 -07:00
Bruno Cadonna 39ffdea6d3
KAFKA-10199: Enable state updater by default (#16107)
We have already enabled the state updater by default once.
However, we ran into issues that forced us to disable it again.
We think that we fixed those issues. So we want to enable the
state updater again by default.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2024-06-12 07:51:38 +02:00
Antoine Pourchet 0782232fbe
KAFKA-15045: (KIP-924 pt. 22) Add RackAwareOptimizationParams and other minor TaskAssignmentUtils changes (#16294)
We now provide a way to more easily customize the rack aware
optimizations that we provide by way of a configuration class called
RackAwareOptimizationParams.

We also simplified the APIs for the optimizeXYZ utility functions since
they were mutating the inputs anyway.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-11 21:31:43 -07:00
Antoine Pourchet 8b6013f851
KAFKA-15045: (KIP-924 pt. 21) UUID to ProcessId migration (#16269)
This PR changes the assignment process to use ProcessId instead of UUID.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-11 12:24:44 -07:00
Loïc GREFFIER 2533a07ad0
KAFKA-16448: Add ProcessingExceptionHandler in Streams configuration (#16188)
This PR is part of KAFKA-16448 which aims to bring a ProcessingExceptionHandler to Kafka Streams in order to deal with exceptions that occur during processing.

This PR brings ProcessingExceptionHandler in Streams configuration.

Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: sebastienviale <sebastien.viale@michelin.com>

Reviewer: Bruno Cadonna <cadonna@apache.org>
2024-06-10 13:23:10 +02:00
Antoine Pourchet 34afdb9627
KAFKA-15045: (KIP-924 pt. 20) Custom task assignment configuration fix (#16245)
The StreamsConfig class was not parsing the new task assignment
configuration flag properly, which made it impossible to properly
configure a custom task assignor.

This PR fixes this and adds a bit of INFO logging to help users diagnose
assignor misconfiguration issues.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-08 19:55:13 -07:00
Antoine Pourchet 824900b97a
KAFKA-15045: (KIP-924 pt. 18) Better assignment testing (#16201)
Added more testing for the StickyTaskAssignor, which includes a large-scale test with rack aware enabled.

Also added a no-op change to StreamsAssignmentScaleTest.java to allow for rack aware optimization testing.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-08 19:48:43 -07:00
Antoine Pourchet ee834d9214
KAFKA-15045: (KIP-924 pt. 19) Update to new AssignmentConfigs (#16219)
This PR updates all of the streams task assignment code to use the new AssignmentConfigs public class.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-06 14:20:48 -07:00
Bruno Cadonna 8a2bc3a221
KAFKA-16903: Consider produce error of different task (#16222)
A task does not know anything about a produce error thrown
by a different task. That might lead to a InvalidTxnStateException
when a task attempts to do a transactional operation on a producer
that failed due to a different task.

This commit stores the produce exception in the streams producer
on completion of a send instead of the record collector since the
record collector is on task level whereas the stream producer
is on stream thread level. Since all tasks use the same streams
producer the error should be correctly propagated across tasks
of the same stream thread.

For EOS alpha, this commit does not change anything because
each task uses its own producer. The send error is still
on task level but so is also the transaction.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-06-06 12:19:52 -07:00
Loïc GREFFIER ebe1e964ff
KAFKA-16448: Add ProcessingExceptionHandler interface and implementations (#16187)
This PR is part of KAFKA-16448 which aims to bring a ProcessingExceptionHandler to Kafka Streams in order to deal with exceptions that occur during processing.

This PR brings ProcessingExceptionHandler interface and default implementations.

Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: sebastienviale <sebastien.viale@michelin.com>

Reviewer: Bruno Cadonna <cadonna@apache.org>
2024-06-06 13:40:31 +02:00
Ayoub Omari 1134520dec
KAFKA-16573: Specify node and store where serdes are needed (#15790)
Reviewers: Matthias J. Sax <matthias@confluent.io>, Bruno Cadonna <bruno@confluent.io>, Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-05 15:05:04 -07:00
Antoine Pourchet 0109a3f718
KAFKA-15045: (KIP-924 pt. 17) State store computation fixed (#16194)
Fixed the calculation of the store name list based on the subtopology being accessed.

Also added a new test to make sure this new functionality works as intended.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-05 13:09:37 -07:00
Antoine Pourchet 5ce4b91dfa
KAFKA-15045: (KIP-924 pt. 16) TaskAssignor.onAssignmentComputed handling (#16147)
This PR takes care of making the call back toTaskAssignor.onAssignmentComputed.

It also contains a change to the public AssignmentConfigs API, as well as some simplifications of the StickyTaskAssignor.

This PR also changes the rack information fetching to happen lazily in the case where the TaskAssignor makes its decisions without said rack information.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-06-04 11:33:48 -07:00
Josep Prat 7e81cc5e68
MINOR: Bump trunk to 3.9.0-SNAPSHOT (#16150)
Signed-off-by: Josep Prat <josep.prat@aiven.io>

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-05-31 16:41:44 +02:00
Bruno Cadonna 76d1f18e42
Revert "KAFKA-16448: Add ProcessingExceptionHandler interface and implementations (#16090)" (#16142)
This reverts commit 8d11d95795.

We decided to not release KIP-1033 with AK 3.8

Reviewer: Lucas Brutschy <lbrutschy@confluent.io>
2024-05-31 09:56:36 +02:00
Antoine Pourchet 370e5ea1f8
KAFKA-15045: (KIP-924 pt. 15) Implement #defaultStandbyTaskAssignment and finish rack-aware standby optimization (#16129)
This fills in the implementation details of the standby task assignment utility functions within TaskAssignmentUtils.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-30 15:11:33 -07:00
Bruno Cadonna fea3eeb7f7
Revert "KAFKA-16448: Add ProcessingExceptionHandler in Streams configuration (#16092)" (#16141)
This reverts commit 3f70c46874.

Reviewer: Lucas Brutschy <lbrutschy@confluent.io>
2024-05-30 17:52:07 +02:00
Loïc GREFFIER 3f70c46874
KAFKA-16448: Add ProcessingExceptionHandler in Streams configuration (#16092)
This PR is part of KAFKA-16448 which aims to bring a ProcessingExceptionHandler to Kafka Streams in order to deal with exceptions that occur during processing.

This PR brings ProcessingExceptionHandler in Streams configuration.

Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: sebastienviale <sebastien.viale@michelin.com>

Reviewer: Bruno Cadonna <cadonna@apache.org>
2024-05-30 10:39:38 +02:00
Antoine Pourchet 5c08ee0062
KAFKA-15045: (KIP-924 pt. 9) TaskAssignmentUtils implementation of optimizeRackAwareActiveTasks (#16033)
This PR implements the rack aware optimization of active tasks that can be used by the assignors themselves. It takes in the full output of the assignment and tries to reorganize it so as to minimize cross-rack traffic.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-29 16:11:37 -07:00
Antoine Pourchet cc269b0d43
KAFKA-15045: (KIP-924 pt. 14) Callback to TaskAssignor::onAssignmentComputed (#16123)
This PR adds the logic and wiring necessary to make the callback to
TaskAssignor::onAssignmentComputed with the necessary parameters.

We also fixed some log statements in the actual assignment error
computation, as well as modified the ApplicationState::allTasks method
to return a Map instead of a Set of TaskInfos.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-29 13:15:02 -07:00
Loïc GREFFIER 8d11d95795
KAFKA-16448: Add ProcessingExceptionHandler interface and implementations (#16090)
This PR is part of KAFKA-16448 which aims to bring a ProcessingExceptionHandler to Kafka Streams in order to deal with exceptions that occur during processing.

This PR brings ProcessingExceptionHandler interface and default implementations.

Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: sebastienviale <sebastien.viale@michelin.com>

Reviewer: Bruno Cadonna <cadonna@apache.org>
2024-05-29 14:09:22 +02:00
Ramin Gharib b73f4798a4
KAFKA-16362: Fix type-unsafety in KStreamKStreamJoin caused by isLeftSide (#15601)
The introduced changes provide a cleaner definition of the join side in KStreamKStreamJoin. Before, this was done by using a Boolean flag, which led to returning a raw LeftOrRightValue without generic arguments because the generic type arguments depended on the boolean input.

Reviewers: Greg Harris <greg.harris@aiven.io>, Bruno Cadonna <cadonna@apache.org>
2024-05-29 13:12:54 +02:00
A. Sophie Blee-Goldman 9562143f08
HOTFIX: remove unnecessary list creation (#16117)
Removing a redundant list declaration in the new StickyTaskAssignor implementation

Reviewers: Antoine Pourchet <antoine@responsive.dev>
2024-05-28 21:35:02 -07:00
Antoine Pourchet d64e3fbb2b
KAFKA-15045: (KIP-924 pt. 13) AssignmentError calculation added (#16114)
This PR adds the post-processing of the TaskAssignment to figure out if the new assignment is valid, and return an AssignmentError otherwise.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-28 19:43:30 -07:00
Antoine Pourchet 8d243dfbd4
KAFKA-15045: (KIP-924 pt. 12) Wiring in new assignment configs and logic (#16074)
This PR creates the new public config of KIP-924 in StreamsConfig and uses it to instantiate user-created TaskAssignors. If such a TaskAssignor is found and successfully created we then use that assignor to perform the task assignment, otherwise we revert back to the pre KIP-924 world with the internal task assignors.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Almog Gavra <almog@responsive.dev>
2024-05-28 18:01:18 -07:00
Antoine Pourchet 56ee1392e8
KAFKA-15045: (KIP-924 pt. 11) Implemented StickyTaskAssignor (#16052)
This PR implements the StickyTaskAssignor with the new KIP 924 API.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-28 17:05:51 -07:00
Nick Telford 59ba555142
KAFKA-15541: Add oldest-iterator-open-since-ms metric (#16041)
Part of [KIP-989](https://cwiki.apache.org/confluence/x/9KCzDw).

This new `StateStore` metric tracks the timestamp that the oldest
surviving Iterator was created.

This timestamp should continue to climb, and closely track the current
time, as old iterators are closed and new ones created. If the timestamp
remains very low (i.e. old), that suggests an Iterator has leaked, which
should enable users to isolate the affected store.

It will report no data when there are no currently open Iterators.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-05-28 16:23:23 -07:00
Omnia Ibrahim 64f699aeea
KAFKA-15853: Move general configs out of KafkaConfig (#16040)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-05-28 16:22:54 +02:00
Nick Telford d9ee9c96dd
KAFKA-15541: Use LongAdder instead of AtomicInteger (#16076)
`LongAdder` performs better than `AtomicInteger` when under contention
from many threads. Since it's possible that many Interactive Query
threads could create a large number of `KeyValueIterator`s, we don't
want contention on a metric to be a performance bottleneck.

The trade-off is memory, as `LongAdder` uses more memory to space out
independent counters across different cache lines. In practice, I don't
expect this to cause too many problems, as we're only constructing 1
per-store.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-05-25 12:22:56 -07:00
Kuan-Po (Cooper) Tseng de3202832d
KAFKA-16828 RackAwareTaskAssignorTest failed (#16044)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-05-24 05:25:53 +08:00
Antoine Pourchet 93238ae312
KAFKA-15045: (KIP-924 pt. 10) Topic partition rack annotation simplified (#16034)
This PR uses the new TaskTopicPartition structure to simplify the build
process for the ApplicationState, which is the input to the new
TaskAssignor#assign call.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-23 12:45:29 -07:00
Nick Telford bef83ce89b
KAFKA-15541: Add iterator-duration metrics (#16028)
Part of [KIP-989](https://cwiki.apache.org/confluence/x/9KCzDw).

This new `StateStore` metric tracks the average and maximum amount of
time between creating and closing Iterators.

Iterators with very high durations can indicate to users performance
problems that should be addressed.

If a store reports no data for these metrics, despite the user opening
Iterators on the store, it suggests those iterators are not being
closed, and have therefore leaked.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-05-22 21:34:31 -07:00
Antoine Pourchet 06739d5aa0
KAFKA-15045: (KIP-924 pt. 8) Added TopicPartitionAssignmentInfo (#16024)
For task assignment purposes, the user needs to have a set of information available for each topic partition affecting the desired tasks.

This PR introduces a new interface for a read-only container class that allows all the important and relevant information to be found in one place.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-22 15:52:53 -07:00
Antoine Pourchet 27a6c156c4
KAFKA-15045: (KIP-924 pt. 7) Simplify requirements for rack aware graphs (#16004)
Rack aware graphs don't actually need any topology information about the system, but rather require a simple ordered (not sorted) grouping of tasks.

This PR changes the internal constructors and some interface signatures of RackAwareGraphConstructor and its implementations to allow reuse by future components that may not have access to the actual subtopology information.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-22 13:25:18 -07:00
Antoine Pourchet ef2c5e41a5
KAFKA-15045: (KIP-924 pt. 5) Add rack information to ApplicationState (#15972)
This rack information is required to compute rack-aware assignments, which many of the current assigners do.

The internal ClientMetadata class was also edited to pass around this rack information.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-22 13:24:26 -07:00
Nick Telford 5552f5c26d
KAFKA-15541: Add num-open-iterators metric (#15975)
Part of [KIP-989](https://cwiki.apache.org/confluence/x/9KCzDw).

This new `StateStore` metric tracks the number of `Iterator` instances
that have been created, but not yet closed (via `AutoCloseable#close()`).

This will aid users in detecting leaked iterators, which can cause major
performance problems.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2024-05-21 23:29:50 -07:00
Antoine Pourchet 6339e3a6bf
KAFKA-15045: (KIP-924 pt. 6) Post process new assignment structure (#16002)
This PR creates the required methods to post-process the result of TaskAssignor.assign into the required ClientMetadata map. This allows most of the internal logic to remain intact after the user's assignment code runs.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
2024-05-21 13:14:39 -07:00
Ayoub Omari 4cc99cbf3f
KAFKA-16343: Add unit tests of foreignKeyJoin classes (#15564)
Added unit tests of two processors included in foreignKey join : SubscriptionSendProcessorSupplier and ForeignTableJoinProcessorSupplier.
Renamed ForeignTableJoinProcessorSupplierTest to SubscriptionJoinProcessorSupplierTest as that's the processor which the test class is testing.

Reviewers: Walker Carlson <wcarlson@apache.org>
2024-05-21 14:23:04 -05:00