Commit Graph

11072 Commits

Author SHA1 Message Date
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
Alyssa Huang 7159f6c1a8
MINOR: KRaftMetadataCache.getPartitionInfo must set all relevant fields
Fix a case where KRaftMetadataCache.getPartitionInfo was not setting all the PartitionInfo fields it
should have been. Add a regression test.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-04-17 11:03:45 -07:00
Federico Valeri 2c1cf03a89
MINOR: Add ClusterTool wrapper scripts and redirection (KIP-906) (#13560)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-04-17 16:09:56 +02:00
Federico Valeri 6ad236a8bd
MINOR: Add ConsumerPerformance tool migration note (#13559)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-04-17 15:55:21 +02:00
Federico Valeri 3d4a4d28e1
MINOR: Add StreamsResetter tool migration note (#13586)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-04-17 15:49:36 +02:00
Federico Valeri ac38fd9db9
MINOR: Add EndToEndLatency wrapper scripts and redirection (KIP-906) (#13556)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-04-17 15:31:50 +02:00
Federico Valeri 57d6a881ca
MINOR: Add JmxTool wrapper scripts and redirection (KIP-906) (#13195)
Reviewers: Mickael Maison <mickael.maison@gmail.com>

, 
David Jacot <djacot@confluent.io>, Christo Lolov <christololov@gmail.com>, Alexandre Dupriez <alexandre.dupriez@gmail.com>
2023-04-17 14:59:35 +02:00
Anton Agestam 6ca8f0d5f0
MINOR: Correct type of record batch CRC field (#13583)
The CRC field of Record Batch was incorrectly documented as int32 while in reality it's an unsigned uint32 field.

Reviewers: Luke Chen <showuon@gmail.com>
2023-04-17 20:22:36 +08:00
Gantigmaa Selenge 639bd65449
MINOR: Add note for KIP-894 (#13547)
Add release note for KIP-894

Reviewers: Luke Chen <showuon@gmail.com>
2023-04-17 15:27:16 +08:00
Ismael Juma 9c12e46210
Update zstd to 1.5.5 (#13567)
1.5.4 is a large release that offers significant performance improvements across
multiple scenarios, as well as new features.

1.5.5 is a smaller release that corrects a rare corruption bug and improves performance
in some scenarios.

It looks like 1.5.3 was retracted or never released.

Zstandard release notes:
* 1.5.4: https://github.com/facebook/zstd/releases/tag/v1.5.4
* 1.5.5: https://github.com/facebook/zstd/releases/tag/v1.5.5

zstd-jni diff: https://github.com/luben/zstd-jni/compare/v1.5.2-1...v1.5.5-1

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Divij Vaidya <diviv@amazon.com>
2023-04-15 12:30:22 -07:00
Greg Harris fe375dce54
KAFKA-8115: Reduce flakiness in Trogdor JsonRestServer shutdown (#12830)
The GRACEFUL_SHUTDOWN_TIMEOUT_MS for the Trogdor JsonRestServer is 100ms.
In heavily loaded CI environments, this timeout can be exceeded. When this happens,
it causes the jettyServer.stop() and jettyServer.destroy() calls to throw exceptions, which
prevents shutdownExecutor.shutdown() from running. This has the effect of causing the JsonRestServer::waitForShutdown method to block for 1 day, which exceeds the 120s
timeout on the CoordinatorTest (and any other test relying on MiniTrogdorCluster).

This change makes it such that the graceful shutdown timeout is less likely to be exceeded,
and when it is, the timeout does not cause the waitForShutdown method to block for much
longer than the graceful shutdown timeout.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-04-15 12:21:56 -07:00
Matthias J. Sax bf3a5a3e04
MINOR: remove unnecessary `KeyValueMapper` (#13545)
Reviewers: Christo Lolov (@clolov), Bill Bejeck <bill@confluent.io>
2023-04-14 14:37:40 -07:00
Philip Nee fc9df51be5
MINOR: improve ProductionExceptionHandler test (#13576)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-14 13:03:45 -07:00
Matthias J. Sax c958d8719d
Revert "KAFKA-14318: KIP-878, Introduce partition autoscaling configs (#12962)" (#13527)
This reverts commit d9b139220e.

KIP-878 implementation did not make any progress, so we need to revert
the public API changes which are not functional right now.

Reviewers: Bill Bejeck <bill@confluent.io>
2023-04-14 12:08:49 -07:00
Colin Patrick McCabe cfd0503006
MINOR: fix some flaky KRaft-related tests (#13543) (#13543)
In SharedServer, fix some cases where a volatile variable could change to null while we were using
it, during shutdown. This is mainly a junit test issue, although it could also cause ugly error
messages during shutdown when running the server in a production context.

Fix a race in KafkaEventQueueTest.testSize.

Reviewers: David Arthur <mumrah@gmail.com>
2023-04-14 13:39:08 -04:00
José Armando García Sancio 1f1900b380
MINOR: Improve raft log4j messages a bit (#13553)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-04-14 10:05:22 -07:00
Matthias J. Sax 20028e24cc
KAFKA-14054: Handle TimeoutException gracefully (#13534)
We incorrectly assumed, that `consumer.position()` should always be
served by the consumer locally set position.

However, within `commitNeeded()` we check if first `if(commitNeeded)`
and thus go into the else only if we have not processed data (otherwise,
`commitNeeded` would be true). For this reason, we actually don't know
if the consumer has a valid position or not.

We should just swallow a timeout if the consumer cannot get the position
from the broker, and try the next partition. If any position advances, we
can return true, and if we timeout for all partitions we can return
false.

Reviewers: Michal Cabak (@miccab), John Roesler <john@confluent.io>, Guozhang Wang <guozhand@confluent.io>
2023-04-14 09:43:53 -07:00
Justine Olshan cbf360b37d
KAFKA-14790: Add more AddPartitionsToTxn tests in KafkaApis and Authorizer tests (#13502)
Added AddPartitionsToTxn tests to KafkaApis.

Reviewers: David Jacot <djacot@confluent.io>
2023-04-14 09:35:45 -07:00
Matthias J. Sax 5767d12963
MINOR: Refactor changelogger to accept timestamp (#13563)
Reviewers: Bill Bejeck <bill@confluent.io>
2023-04-14 07:14:10 -07:00
David Arthur 6d5df1ce76
MINOR: Disable the dual write integration test until KAFKA-14840 (#13573)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-04-14 10:02:46 -04:00
David Jacot 741a27351e
KAFKA-14462; [6/N] Update Records (#13536)
This patch updates the KIP-848's records.

Reviewers: Christo Lolov <lolovc@amazon.com>, Jason Gustafson <jason@confluent.io>
2023-04-14 14:25:33 +02:00
Ritika Reddy f1e7a64bf6
MINOR: Refine `PartitionAssignor` server-side interface (#13524)
This patch updates the `PartitionAssignor` server-side interface used in the new group coordinator for the new consumer group protocol as follow:
- It switches subscription from topic names to topic ids in order to be closer to the server side implementation.
- It switches assignment from Set to Map<Integer, Set> to be closer to the server side implementation.
- It adds getters for all attributes.
- It makes all attributes final private.

Reviewers: Jeff Kim <jeff.kim@confluent.io>, Alexandre Dupriez <alexandre.dupriez@gmail.com>, David Jacot <djacot@confluent.io>
2023-04-14 14:22:51 +02:00
Mickael Maison dc1ede8d89
MINOR: Bump trunk to 3.6.0-SNAPSHOT (#13570)
Reviewers: David Jacot <djacot@confluent.io>
2023-04-14 14:17:07 +02:00
Matthias J. Sax b1830e4aa2
KAFKA-14834: [9/N] Disable versioned-stores for unsupported operations (#13565)
Using versioned-stores for global-KTables is not allowed, because a
global-table is bootstrapped on startup, and a stream-globalTable join
does not support temporal semantics.

Furthermore, `suppress()` does not support temporal semantics and thus
cannot be applied to an versioned-KTable.

This PR disallows both use-cases explicitely.

Part of KIP-914.

Reviewers: Bill Bejeck <bbejeck@gmail.com>, Victoria Xia <victoria.xia@confluent.io>
2023-04-14 11:43:54 +02:00
Philip Nee b8d8fcdd62
KAFKA-7499: Handle serialization error in ProductionExceptionHandler (#13477)
Implements KIP-399.

Extends ProductionExceptionHandler to handle serialization errors, and to allow users to continue processing and dropping the corresponding record on the floor.

Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2023-04-13 23:36:26 -07:00
Victoria Xia f1eb260fea
KAFKA-14834: [10/N] Reserve repartition topic formats to include isLatest (#13566)
KIP-914 introduced a new boolean isLatest into Change to indicate whether a change update represents the latest for the key. Even though Change is serialized into the table repartition topic, the new boolean does not need to be serialized in, because the table repartition map processor performs an optimization to drop records for which isLatest = false. If not for this optimization, the downstream table aggregate would have to drop such records instead, and isLatest would need to be serialized into the repartition topic.

In light of the possibility that isLatest may need to be serialized into the repartition topic in the future, e.g., if other downstream processors are added which need to distinguish between records for which isLatest = true vs isLatest = false, this PR reserves repartition topic formats which include isLatest. Reserving these formats now comes at no additional cost to users since a rolling bounce is already required for the upcoming release due to KIP-904. If we don't reserve them now and instead have to add them later, then another bounce would be required at that time. Reserving formats is cheap, so we choose to do it now.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-13 21:56:36 -07:00
Victoria Xia a87edf13d5
KAFKA-14834: [8/N] Propagate `isLatest` as part of `Change` (#13564)
Part of KIP-914.

This PR adds an additional boolean isLatest into Change which specifies whether the new value is the latest for its key. For un-versioned stores, isLatest is always true. For versioned stores, isLatest is true if the value has the latest timestamp seen for the key, else false. This boolean will be used by processors such as the table repartition map processor to determine when a record is out-of-order and should be dropped (when processing a versioned table).  This PR updates the table repartition map processor accordingly, and also adds test coverage for table filter.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-13 21:20:05 -07:00
Victoria Xia 9217c7e151
KAFKA-14834: [7/N] Update VersionedKeyValueStore#put() to return validTo (#13554)
Part of KIP-914.

This PR updates the return type of VersionedKeyValueStore#put(...) from void to long, where the long is the validTo timestamp of the newly put record, with two special values to indicate either that no such timestamp exists (because the record is the latest for its key) or that the put did not take place (because grace period has elapsed). 

As part of making this change, VersionedBytesStore introduces its own put(key, value, timestamp) method to avoid method signature conflicts with the existing put(key, value) method from KeyValueStore<Bytes, byte[]> which has void return type. As a result, the previously added NullableValueAndTimestampSerde class is no longer needed so it's also been removed in this PR as cleanup.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-13 20:19:42 -07:00
Victoria Xia 7d580dc7a2
KAFKA-14834: [6/N] Add tracking of versioned tables into graph nodes (#13552)
This PR adds a method into GraphNode to assist in tracking whether tables are materialized as versioned or unversioned stores. This is needed in order to allow processors which have different behavior on versioned vs unversioned tables to use the correct semantics. Part of KIP-914.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-13 14:21:28 -07:00
Spacrocket 1f19696309
KAFKA-14722: Make BooleanSerde public (an addition of upgrade.html changes) (#13491)
Moved the information about the BooleanSerde addition from general upgrade notes to notes in Streams.

 Reviewers: Walker Carlson <wcarlson@confluent.io>, Divij Vaidya <diviv@amazon.com>
2023-04-13 15:37:42 -05:00
Greg Harris f252c75bf3
MINOR: Fix regression in MM2 task forwarding introduced by KAFKA-14783 (#13548)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-04-13 09:50:02 -04:00
David Jacot 440a53099d
KAFKA-14462; [5/N] Add EventAccumulator (#13505)
This patch adds the `EventAccumulator` which will be used in the runtime of the new group coordinator. The aim of this accumulator is to basically have a queue per __consumer_group partitions and to ensure that events addressed to the same partitions are not processed concurrently. The accumulator is generic so we could reuse it in different context.

Reviewers: Alexandre Dupriez <alexandre.dupriez@gmail.com>, Justine Olshan <jolshan@confluent.io>
2023-04-13 08:33:40 +02:00
Paolo Patierno 571841fed3
KAFKA-14883: Expose `observer` state in KRaft metrics (#13525)
Currently, the current-state KRaft related metric reports follower state for a broker while technically it should be reported as an observer as the kafka-metadata-quorum tool does.

Reviewers: Luke Chen <showuon@gmail.com>, dengziming <dengziming1993@gmail.com>
2023-04-13 12:55:57 +08:00
Victoria Xia 1d5d003ff4
KAFKA-14834: [5/N] Drop out-of-order records from FK join with versioned tables (#13522)
This PR updates foreign-key table-table join processors to ignore out-of-order records from versioned tables, as specified in KIP-914.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-12 19:05:10 -07:00
Gantigmaa Selenge 951894d2ff
MINOR: Install missing iputils-ping for system tests (#13500)
Some system tests from kafkatest.tests.core.network_degrade_test are failing due to missing utility iputils-ping.

[DEBUG - 2023-02-04 01:34:56,322 - network_degrade_test - test_latency -
 lineno:67]: Ping output: bash: line 1: ping: command not found

Reviewers: Luke Chen <showuon@gmail.com>
2023-04-13 09:30:56 +08:00
Victoria Xia 1395ad6497
KAFKA-14834: [4/N] Drop out-of-order records from table-table join with versioned tables (#13510)
This PR updates primary-key table-table join processors to ignore out-of-order records from versioned tables, as specified in KIP-914.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-12 17:06:28 -07:00
Justine Olshan 56dcb837a2
KAFKA-14561: Improve transactions experience for older clients by ensuring ongoing transaction (#13391)
Added check for ongoing transaction
Thread to send and receive verify only add partition to txn requests
Code to send on request thread courtesy of @artemlivshits

Reviewers: Artem Livshits <alivshits@confluent.io>, Jun Rao <junrao@gmail.com>
2023-04-12 17:04:51 -07:00
Victoria Xia 88e2d6b8c2
KAFKA-14834: [3/N] Timestamped lookups for stream-table joins (#13509)
This PR updates the stream-table join processors, including both KStream-KTable and KStream-GlobalKTable joins, to perform timestamped lookups when the (global) table is versioned, as specified in KIP-914.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-12 16:54:15 -07:00
Guozhang Wang 750a389308
MINOR: Follow-up on failing streams test, and fix StoreChangelogReader (#13523)
1. I've verified and made sure the only case that task would be null and not stream task would be in testing code only, with pausing / resuming topologies; I've revamped the restoration recording func, mainly to make just one method on the Task interface, to make sure we would never get task == null and do not need to cast to StreamTask.
2. Use numRecords directly to avoid calling records.size() that triggers concurrent modifications.
3. Rewrite the TaskMetricsTest to not use the removed impl functions.
4. Found an issue while fixing 1) above, turns out it's related to pausing tasks: if the tasks are paused due to instance / named-topologies are paused while they need restoration, the restoration would never finish, and hence the instance's state would not transit to RUNNING. Similarly, if user paused just one of the named-topology right at the beginning, since the state would not transit to RUNNING, every tasks across all named-topologies would not make progress. We keep the behavior as is to be consistent with and without state-updater.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Lucas Brutschy <lbrutschy@confluent.io>
2023-04-12 14:57:02 -07:00
andymg3 c4ad09e47d
MINOR: Add more KRaft reassignment tests (#13521)
Although KAFKA-14808 did not affect KRaft mode, it is important to ensure that we have regression
tests in KRaft mode to prevent a similar bug from appearing there in the future. This PR adds two
tests. First, it adds a test that makes sure we handle what happens when a reassignment completes
and none of the new replicas can be made leader. It's important that we dont keep an old replica as
leader. Second, it adds a test that makes sure we handle new reassignments that don't include a
previous assignment replica that was leader.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-04-12 12:00:35 -07:00
Victoria Xia 7c74f3983b
KAFKA-14491: [21/N] Docs updates for versioned state stores (#13444)
Add docs for KIP-889.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-12 11:31:27 -07:00
dorwi 9c0caca660
MINOR: update the connect task metrics documentation (#13494)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-04-12 12:08:07 -04:00
David Jacot e1e3900ba1
KAFKA-14462; [4/N] Add Group, Record and Result (#13520)
This patch adds Group, Record and Result.

Reviewers: Jason Gustafson <jason@confluent.io>, Jeff Kim <jeff.kim@confluent.io>, Justine Olshan <jolshan@confluent.io>
2023-04-12 13:16:49 +02:00
Rajini Sivaram b64ac94a8c
KAFKA-14891: Fix rack-aware range assignor to assign co-partitioned subsets (#13539)
Reviewers: David Jacot <djacot@confluent.io>
2023-04-12 08:35:03 +01:00
Satish Duggana e99984248d
KAFKA-9550 Copying log segments to tiered storage in RemoteLogManager (#13487)
Added functionality to copy log segments, indexes to the target remote storage for each topic partition enabled with tiered storage. This involves creating scheduled tasks for all leader partition replicas to copy their log segments in sequence to tiered storage.

Reviewers: Jun Rao <junrao@gmail.com>, Luke Chen <showuon@gmail.com>
2023-04-12 13:55:36 +08:00
Victoria Xia 17b4569d70
KAFKA-14834: [2/N] Test coverage for out-of-order data in joins (#13497)
In preparation for updating DSL join processors to have updated semantics when versioned stores are used (cf KIP-914), this PR adds test coverage for out-of-order data in joins to the existing integration tests for stream-table joins and primary-key table-table joins. Follow-up PRs will build on top of this change by adding new tests for versioned stores, and the out-of-order data will produce different results in those settings.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-11 20:42:55 -07:00
Victoria Xia cb7d0833ee
KAFKA-14834: [1/N] Add timestamped get to KTableValueGetter (#13496)
In preparation for updating DSL processors to use versioned stores (cf KIP-914), this PR adds two new methods to KTableValueGetter: isVersioned() and get(key, asOfTimestamp) and updates all existing implementations accordingly.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-11 20:40:11 -07:00
Colin Patrick McCabe f1f35ef1a8
KAFKA-14894: MetadataLoader must call finishSnapshot after loading a snapshot (#13541)
The MetadataLoader must call finishSnapshot after loading a snapshot. This function removes
whatever was in the old snapshot that is not in the new snapshot that was just loaded. While this
is not significant when the old snapshot was the empty snapshot, it is important to do when we are
loading a snapshot on top of an existing non-empty image.

In initializeNewPublishers, the newly installed publishers should be given a MetadataDelta based on
MetadataImage.EMPTY, reflecting the fact that they are seeing everything for the first time.

Reviewers: David Arthur <mumrah@gmail.com>
2023-04-11 15:02:33 -07:00
Chris Egerton e49a5a265f
KAFKA-14783 (KIP-875): New STOPPED state for connectors (#13424)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Yash Mayya <yash.mayya@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-04-11 09:37:26 -04:00
Farooq Qaiser 396536bb5a
KAFKA-12446: Call subtractor before adder if key is the same (#10747)
Implements KIP-904.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-04-10 13:27:04 -07:00