Commit Graph

9849 Commits

Author SHA1 Message Date
Idan Kamara eddb98df67
MINOR: Fix class comparison in `AlterConfigPolicy.RequestMetadata.equals()` (#11900)
This patch fixes a bug in the `AlterConfigPolicy.RequestMetadata.equals` method where we were not comparing the class correctly.

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

Reviewers: David Jacot <djacot@confluent.io>
2022-03-22 09:45:04 +01:00
Xiaobing Fang be4ef3df42
KAFKA-13752: Uuid compare using equals in java (#11912)
This patch fixes a few cases where we use `==` instead of `equals` to compare UUID. The impact of this bug is low because `Uuid.ZERO_UUID` is used by default everywhere.

Reviewers: Justine Olshan <jolshan@confluent.io>, dengziming <dengziming1993@gmail.com>, David Jacot <djacot@confluent.io>
2022-03-22 09:31:46 +01:00
vamossagar12 0924fd3f9f
KAFKA-13152: Replace "buffered.records.per.partition" with "input.buffer.max.bytes" (#11796)
Implements KIP-770

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-03-21 17:16:00 -07:00
dengziming c9c03dd7ef
MINOR: Remove scala KafkaException (#11913)
Use the standard org.apache.kafka.common.KafkaException instead of kafka.common.KafkaException.

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Ismael Juma <ismael@confluent.io>
2022-03-21 14:56:25 -07:00
dengziming d449f850e1
MINOR: show LogRecoveryState in MetadataShell and fix log message
Show the LeaderRecoveryState in MetadataShell.

Fix a case where we were comparing a Byte type with an enum type.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2022-03-21 14:33:51 -07:00
Bruno Cadonna 4c8685e701
MINOR: Bump trunk to 3.3.0-SNAPSHOT (#11925)
Version bumps on trunk following the creation of the 3.2 release branch.

Reviewer: David Jacot <djacot@confluent.io>
2022-03-21 21:37:05 +01:00
David Jacot 72558da976
MINOR: Small cleanups in the AclAuthorizer (#11921)
Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-03-21 11:23:31 +01:00
Márton Sigmond e5eb180a6f
MINOR: Pass materialized to the inner KTable instance (#11888)
Reviewers: Luke Chen <showuon@gmail.com>
2022-03-21 17:03:04 +08:00
Luke Chen 3a8f6b17a6
KAFKA-7540: commit offset sync before close (#11898)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-03-21 16:51:21 +08:00
彭小漪 6145974fef
KAFKA-13728: fix PushHttpMetricsReporter no longer pushes metrics when network failure is recovered. (#11879)
The class PushHttpMetricsReporter no longer pushes metrics when network failure is recovered.

I debugged the code and found the problem here: when we submit a task to the ScheduledThreadPoolExecutor that needs to be executed periodically, if the task throws an exception and is not swallowed, the task will no longer be scheduled to execute.

So when an IO exception occasionally occurs on the network, we should swallow it rather than throw it in task HttpReporter.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-03-19 21:09:28 -07:00
José Armando García Sancio 8d6968e832
KAFKA-13682; KRaft Controller auto preferred leader election (#11893)
Implement auto leader rebalance for KRaft by keeping track of the set of topic partitions which have a leader that is not the preferred replica. If this set is non-empty then schedule a leader balance event for the replica control manager.

When applying PartitionRecords and PartitionChangeRecords to the ReplicationControlManager, if the elected leader is not the preferred replica then remember this topic partition in the set of imbalancedPartitions.

Anytime the quorum controller processes a ControllerWriteEvent it schedules a rebalance operation if the there are no pending rebalance operations, the feature is enabled and there are imbalance partitions.

This KRaft implementation only supports the configurations properties auto.leader.rebalance.enable and leader.imbalance.check.interval.seconds. The configuration property leader.imbalance.per.broker.percentage is not supported and ignored.

Reviewers: Jun Rao <junrao@gmail.com>, David Arthur <mumrah@gmail.com>
2022-03-18 14:30:52 -07:00
José Armando García Sancio 52621613fd
KAFKA-13587; Implement leader recovery for KIP-704 (#11733)
Implementation of the protocol for starting and stopping leader recovery after an unclean leader election. This includes the management of state in the controllers (legacy and KRaft) and propagating this information to the brokers. This change doesn't implement log recovery after an unclean leader election.

Protocol Changes
================

For the topic partition state znode, the new field "leader_recovery_state" was added. If the field is missing the value is assumed to be RECOVERED.

ALTER_PARTITION was renamed from ALTER_ISR. The CurrentIsrVersion field was renamed to PartitionEpoch. The new field LeaderRecoveryState was added.

The new field LeaderRecoverState was added to the LEADER_AND_ISR request. The inter broker protocol version is used to determine which version to send to the brokers.

A new tagged field for LeaderRecoveryState was added to both the PartitionRecord and PartitionChangeRecord.

Controller
==========

For both the KRaft and legacy controller the LeaderRecoveryState is set to RECOVERING, if the leader was elected out of the ISR, also known as unclean leader election. The controller sets the state back to RECOVERED after receiving an ALTER_PARTITION request with version 0, or with version 1 and with the LeaderRecoveryState set to RECOVERED.

Both controllers preserve the leader recovery state even if the unclean leader goes offline and comes back online before an RECOVERED ALTER_PARTITION is sent.

The controllers reply with INVALID_REQUEST if the ALTER_PARTITION either:

    1. Attempts to increase the ISR while the partition is still RECOVERING
    2. Attempts to change the leader recovery state to RECOVERING from a RECOVERED state.

Topic Partition Leader
======================

The topic partition leader doesn't implement any log recovery in this change. The topic partition leader immediately marks the partition as RECOVERED and sends that state in the next ALTER_PARTITION request.

Reviewers: Jason Gustafson <jason@confluent.io>
2022-03-18 09:24:11 -07:00
Chris Egerton 43bf464232
KAFKA-13497: Add trace logging to RegexRouter (#11903)
This patch adds runtime logging to the RegexRouter to show exactly which topics get routed where.

Reviewers: David Jacot <djacot@confluent.io>
2022-03-18 10:27:49 +01:00
Jules Ivanic 03641e6a28
MINOR: Fix `ConsumerConfig.ISOLATION_LEVEL_DOC` (#11915)
Reviewers: David Jacot <djacot@confluent.io>
2022-03-18 09:20:08 +01:00
Ludovic DEHON df963ee0a9
MINOR: Fix incorrect log for out-of-order KTable (#11905)
Reviewers: Luke Chen <showuon@gmail.com>
2022-03-18 10:00:03 +08:00
Justine Olshan 7afdb069bf
KAFKA-13750; Client Compatability KafkaTest uses invalid idempotency configs (#11909)
Reviewers: Luke Chen <showuon@gmail.com>, David Jacot <djacot@confluent.io>
2022-03-17 18:00:27 +01:00
dengziming 5cebe12a66
KAFKA-13509; Support max timestamp in GetOffsetShell (KIP-815) (#11173)
This patch implements KIP-815 as described here: https://cwiki.apache.org/confluence/display/KAFKA/KIP-815%3A++Support+max-timestamp+in+GetOffsetShell.

Reviewers: Luke Chen <showuon@gmail.com>, Justine Olshan <jolshan@confluent.io>, David Jacot <djacot@confluent.io>
2022-03-17 17:53:37 +01:00
dengziming 3dacdc5694
MINOR: Replace EasyMock with Mockito in connect:file (#11471)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2022-03-17 17:30:37 +01:00
Luke Chen fbe7fb9411
KAFKA-9847: add config to set default store type (KIP-591) (#11705)
Reviewers: Hao Li <hli@confluent.io>, A. Sophie Blee-Goldman <sophie@confluent.io>, Guozhang Wang <wangguoz@gmail.com>, Matthias J. Sax <mjsax@apache.org>
2022-03-17 10:19:42 +08:00
Levani Kokhreidze b68463c250
KAFKA-6718 / Add rack awareness configurations to StreamsConfig (#11837)
This PR is part of KIP-708 and adds rack aware standby task assignment logic.

Rack aware standby task assignment won't be functional until all parts of this KIP gets merged.

Splitting PRs into three smaller PRs to make the review process easier to follow. Overall plan is the following:

⏭️ Rack aware standby task assignment logic #10851
⏭️ Protocol change, add clientTags to SubscriptionInfoData #10802
👉 Add required configurations to StreamsConfig (public API change, at this point we should have full functionality)

This PR implements last point of the above mentioned plan.

Reviewers: Luke Chen <showuon@gmail.com>, Bruno Cadonna <cadonna@apache.org>
2022-03-16 18:02:24 +01:00
David Arthur 5c1dd493d6
Don't generate Uuid with a leading "-" (#11901) 2022-03-16 11:54:02 -04:00
Mickael Maison 1783fb14df
MINOR: Bump latest 3.0 version to 3.0.1 (#11885)
Reviewers: Matthias J. Sax <mjsax@apache.org>
2022-03-16 11:43:37 +01:00
liym 620f1d88d8
Polish Javadoc for EpochState (#11897)
Polish Javadoc for EpochState

Reviewers: Bill Bejeck <bbejeck@apache.org>
2022-03-15 19:58:47 -04:00
Nick Telford 9e8ace0809
KAFKA-13549: Add repartition.purge.interval.ms (#11610)
Implements KIP-811.

Add a new config `repartition.purge.interval.ms` that limits how often data is purged from repartition topics.
2022-03-15 15:55:20 -07:00
Walker Carlson f708dc58ed
MINOR: fix shouldWaitForMissingInputTopicsToBeCreated test (#11902)
This test was falling occasionally. It does appear to be a matter of the tests assuming perfecting deduplication/caching when asserting the test output records, ie a bug in the test not in the real code. Since we are not assuming that it is going to be perfect I changed the test to make sure the records we expect arrive, instead of only those arrive.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-03-15 13:54:48 -07:00
Colin Patrick McCabe bda5c34b03
MINOR: refactor how ConfigurationControl checks for resource existence (#11835)
ConfigurationControl methods should take a boolean indicating whether the resource is newly
created, rather than taking an existence checker object. The boolean is easier to understand. Also
add a unit test of existing checking failing (and succeeding).

Reviewers: Kirk True <kirk@mustardgrain.com>, José Armando García Sancio <jsancio@users.noreply.github.com>
2022-03-15 12:50:53 -07:00
Jason Gustafson 76d287c967
KAFKA-13727; Preserve txn markers after partial segment cleaning (#11891)
It is possible to clean a segment partially if the offset map is filled before reaching the end of the segment. The highest offset that is reached becomes the new dirty offset after the cleaning completes. The data above this offset is nevertheless copied over to the new partially cleaned segment. Hence we need to ensure that the transaction index reflects aborted transactions from both the cleaned and uncleaned portion of the segment. Prior to this patch, this was not the case. We only collected the aborted transactions from the cleaned portion, which means that the reconstructed index could be incomplete. This can cause the aborted data to become effectively committed. It can also cause the deletion of the abort marker before the corresponding data has been removed (i.e. the aborted transaction becomes hanging).

Reviewers: Jun Rao <junrao@gmail.com>
2022-03-15 12:26:23 -07:00
Matthias J. Sax 03411ca28b
KAFKA-13721: asymetric join-winodws should not emit spurious left/outer join results (#11875)
Reviewers:  Sergio Peña <sergio@confluent.io>, Guozhang Wang <guozhang@confluent.io>
2022-03-15 09:37:01 -07:00
wangyap e8a762eee4
MINOR: set batch-size option into batch.size config in consoleProducer (#11855)
Reviewers: Luke Chen <showuon@gmail.com>
2022-03-15 19:40:11 +08:00
Paolo Patierno 418b122150
MINOR: Improve producer Javadoc about send with acks = 0 (#11882)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-03-15 12:08:10 +01:00
Guozhang Wang cad4985a0a
MINOR: Disable those flaky tests (#11895)
I collected a list of the most flaky tests observed lately, checked / created their corresponding tickets, and mark them as ignored for now. Many of these failures are:

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

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

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

Reviewers: John Roesler <vvcephei@apache.org>, Matthias J. Sax <mjsax@apache.org>, Luke Chen <showuon@gmail.com>, Randall Hauch <rhauch@gmail.com>
2022-03-14 21:32:28 -07:00
Liam Clarke-Hutchinson 76cf7a5793
KAFKA-7077: Use default producer settings in Connect Worker (#11475)
Reviewers: Luke Chen <showuon@gmail.com>
2022-03-15 11:20:18 +08:00
Guozhang Wang b916cb40bd
KAFKA-13690: Fix flaky test in EosIntegrationTest (#11887)
I found a couple of flakiness with the integration test.

IQv1 on stores failed although getting the store itself is covered with timeouts, since the InvalidStoreException is upon the query (store.all()). I changed to the util function with IQv2 whose timeout/retry covers the whole procedure. Example of such failure is: https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka-pr/detail/PR-11802/11/tests/

With ALOS we should not check that the output, as well as the state store content is exactly as of processed once, since it is possible that during processing we got spurious task-migrate exceptions and re-processed with duplicates. I actually cannot reproduce this error locally, but from the jenkins errors it seems possible indeed. Example of such failure is: https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka-pr/detail/PR-11433/4/tests/

Some minor cleanups.

Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>
2022-03-14 15:42:10 -07:00
Matthias J. Sax b1f36360ed
KAKFA-13699: new ProcessorContext is missing methods (#11877)
We added `currentSystemTimeMs()` and `currentStreamTimeMs()` to the
`ProcessorContext` via KIP-622, but forgot to add both to the new
`api.ProcessorContext`.

Reviewers: Ricardo Brasil <anribrasil@gmail.com>, Guozhang Wang <guozhang@confluent.io>
2022-03-14 09:22:01 -07:00
GauthamM-official eb6c5baf3e
MINOR: Adding kafka-storage.bat file (similar to kafka-storage.sh) for windows. (#11816)
Reviewers: Jun Rao <junrao@gmail.com>
2022-03-14 09:20:28 -07: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
Hao Li 63ea5db9ec
KIP-825: Part 1, add new RocksDBTimeOrderedWindowStore (#11802)
Initial State store implementation for TimedWindow and SlidingWindow.

RocksDBTimeOrderedWindowStore.java contains one RocksDBTimeOrderedSegmentedBytesStore which contains index and base schema.

PrefixedWindowKeySchemas.java implements keyschema for time ordered base store and key ordered index store.

Reviewers: James Hughes, Guozhang Wang <wangguoz@gmail.com>
2022-03-11 17:51:10 -08:00
Hao Li 17988f4710
MINOR: fix flaky EosIntegrationTest.shouldCommitCorrectOffsetIfInputTopicIsTransactional[at_least_once] (#11878)
In this test, we started Kafka Streams app and then write to input topic in transaction. It's possible when streams commit offset, transaction hasn't finished yet. So the streams committed offset could be less than the eventual endOffset.

This PR moves the logic of writing to input topic before starting streams app.

Reviewers: John Roesler <vvcephei@apache.org>
2022-03-11 12:01:46 -06:00
Stanislav Vodetskyi 7e683852b4
MINOR: unpin ducktape dependency to always use the newest version (py3 edition) (#11884)
Ensures we always have the latest published ducktape version.
This way whenever we release a new one, we won't have to cherry pick a bunch of commits across a bunch of branches.
2022-03-11 17:48:19 +05:30
Levani Kokhreidze 87eb0cf03c
KAFKA-6718: Update SubscriptionInfoData with clientTags (#10802)
adds ClientTags to SubscriptionInfoData

Reviewer: Luke Chen <showuon@gmail.com>, Bruno Cadonna <cadonna@apache.org>
2022-03-11 16:29:05 +08:00
xuexiaoyue f025a93c7c
MINOR: Fix comments in TransactionsTest (#11880)
Reviewer: Luke Chen <showuon@gmail.com>
2022-03-11 15:42:44 +08:00
Lucas Bradstreet dc36dedd28
MINOR: jmh.sh swallows compile errors (#11870)
jmh.sh runs tasks in quiet mode which swallows compiler errors. This is a pain and I frequently have to edit the shell script to see the error.

Reviewers:  Ismael Juma <ismael@confluent.io>, Bill Bejeck <bbejeck@apache.org>
2022-03-10 18:18:41 -05:00
Walker Carlson 4d5a28973f
Revert "KAFKA-13542: add rebalance reason in Kafka Streams (#11804)" (#11873)
This reverts commit 2ccc834faa.

This reverts commit 2ccc834. We were seeing serious regressions in our state heavy benchmarks. We saw that our state heavy benchmarks were experiencing a really bad regression. The State heavy benchmarks runs with rolling bounces with 10 nodes.

We regularly saw this exception:  java.lang.OutOfMemoryError: Java heap space                                                                                                                                                                                              

I ran through a git bisect and found this commit. We verified that the commit right before did not have the same issues as this one did. I then reverted the problematic commit and ran the benchmarks again on this commit and did not see any more issues. We are still looking into the root cause, but for now since this isn't a critical improvement so we can remove it temporarily.

Reviewers: Bruno Cadonna <cadonna@confluent.io>, Anna Sophie Blee-Goldman <ableegoldman@apache.org>, David Jacot <djacot@confluent.io>, Ismael Juma <ismael@confluent.io>
2022-03-10 13:52:05 -08:00
A. Sophie Blee-Goldman 113595cf5c
KAFKA-12648: fix flaky #shouldAddToEmptyInitialTopologyRemoveResetOffsetsThenAddSameNamedTopologyWithRepartitioning (#11868)
This test has started to become flaky at a relatively low, but consistently reproducible, rate. Upon inspection, we find this is due to IOExceptions during the #cleanUpNamedTopology call -- specifically, most often a DirectoryNotEmptyException with an ocasional FileNotFoundException

Basically, signs pointed to having returned from/completed the #removeNamedTopology future prematurely, and moving on to try and clear out the topology's state directory while there was a streamthread somewhere that was continuing to process/close its tasks.

I believe this is due to updating the thread's topology version before we perform the actual topology update, in this case specifically the act of eg clearing out a directory. If one thread updates its version and then goes to perform the topology removal/cleanup when the second thread finishes its own topology removal, this other thread will check whether all threads are on the latest version and complete any waiting futures if so -- which means it can complete the future before the first thread has actually completed the corresponding action

Reviewers: Guozhang Wang <guozhang@confluent.io>, Walker Carlson <wcarlson@confluent.io>
2022-03-10 12:02:07 -08:00
aSemy 38e3787d76
Minor typo: "result _is_ a" > "result _in_ a" (#11876)
Reviewers Bill Bejeck <bbejeck@apache.org>
2022-03-10 14:03:12 -05:00
RivenSun 84b41b9d3a
KAFKA-13689: Revert AbstractConfig code changes (#11863)
Reviewer: Luke Chen <showuon@gmail.com>
2022-03-10 10:54:10 +08:00
Vincent Jiang 798275f254
KAFKA-13717: skip coordinator lookup in commitOffsetsAsync if offsets is empty (#11864)
Reviewer: Luke Chen <showuon@gmail.com>, David Jacot <djacot@confluent.io>
2022-03-10 10:52:05 +08:00
A. Sophie Blee-Goldman 9c7d857713
KAFKA-12648: fix #getMinThreadVersion and include IOException + topologyName in StreamsException when topology dir cleanup fails (#11867)
Quick fix to make sure we log the actual source of the failure both in the actual log message as well as the StreamsException that we bubble up to the user's exception handler, and also to report the offending topology by filling in the StreamsException's taskId field.

Also prevents a NoSuchElementException from being thrown when trying to compute the minimum topology version across all threads when the last thread is being unregistered during shutdown.

Reviewers: Guozhang Wang <guozhang@confluent.io>, Walker Carlson <wcarlson@confluent.io>
2022-03-09 16:30:42 -08:00
Randall Hauch d2d49f6421
KAFKA-12879: Remove extra sleep (#11872) 2022-03-09 15:11:46 -06:00
Philip Nee ddcee81043
KAFKA-12879: Addendum to reduce flakiness of tests (#11871)
This is an addendum to the KAFKA-12879 (#11797) to fix some tests that are somewhat flaky when a build machine is heavily loaded (when the timeouts are too small).

- Add an if check to void sleep(0)
- Increase timeout in the tests
2022-03-09 14:37:48 -06:00