Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7291ef3
Implement TopologyMetadata
ableegoldman Apr 13, 2021
56d9482
KAFKA-12819: Add assert messages to MirrorMaker tests plus other qual…
mdedetrich May 27, 2021
a02b19c
KAFKA-12796: Removal of deprecated classes under streams-scala (#10710)
jlprat May 27, 2021
e4b3a3c
MINOR: Adjust parameter ordering of `waitForCondition` and `retryOnEx…
ijuma May 27, 2021
3fb836f
MINOR: Improve Log layer segment iteration logic and few other areas …
kowshik May 27, 2021
2313026
KAFKA-12856: Upgrade Jackson to 2.12.3 (#10778)
ijuma May 27, 2021
6659777
MINOR: Don't ignore deletion of partition metadata file and log topic…
ijuma May 27, 2021
5cbe6a7
KAFKA-12791: ConcurrentModificationException in AbstractConfig use by…
lbradstreet May 27, 2021
184fe1d
Fix up javadocs, some small stuff
ableegoldman May 27, 2021
c508638
review feedback
ableegoldman May 27, 2021
6250f4e
fixing up tests, switch to StreamsConfig
ableegoldman May 28, 2021
a6f3094
MINOR: make sure all fiedls of o.p.k.s.a.Action are NOT null (#10764)
chia7712 May 28, 2021
588ea44
KAFKA-12782: Fix Javadocs generation by upgrading JDK (#10780)
jlprat May 28, 2021
f207bac
KAFKA-8410: KTableProcessor migration groundwork (#10744)
vvcephei May 28, 2021
0bf4b47
MINOR: upgrade pip from 20.2.2 to 21.1.1 (#10661)
chia7712 May 29, 2021
99a0312
KAFKA-12865 : Fix doc error in Admin.describeAcls API (#10790)
rohit-sachan May 29, 2021
6b005b2
MINOR: Reduce allocations in requests via buffer caching (#9229)
ijuma May 30, 2021
6c9e27c
HOTFIX: fix build error (#10796)
chia7712 May 31, 2021
274eccf
MINOR: Dependency updates for Scala libraries for improved Scala 3.0 …
jlprat May 31, 2021
dc5456c
MINOR: cleanTest ought to remove output of unitTest task and integrat…
chia7712 Jun 1, 2021
f426a72
MINOR: replace by org.junit.jupiter.api.Tag by net.jqwik.api.Tag for …
chia7712 Jun 1, 2021
054d5f9
MINOR: fix code listings security.html (#10770)
jlprat Jun 1, 2021
cfe642e
KAFKA-12519: Remove built-in Streams metrics for versions 0.10.0-2.4 …
cadonna Jun 1, 2021
a842e0e
KAFKA-12866: Avoid root access to Zookeeper (#10795)
soarez Jun 1, 2021
21532a7
KAFKA-12596: remove --zookeeper option from topic command (#10457)
showuon Jun 1, 2021
2d7a4ed
KAFKA-12709; Add Admin API for `ListTransactions` (#10616)
hachikuji Jun 2, 2021
1a7ad70
MINOR: remove unneccessary public keyword from ProducerInterceptor/Co…
KahnCheny Jun 2, 2021
8b71604
MINOR: Update jmh for async profiler 2.0 support (#10800)
ijuma Jun 2, 2021
4c1efd3
MINOR: Update kafka-topics.sh line command tool upgrade notes with re…
wenbingshen Jun 2, 2021
13ba9c9
KAFKA-12867: Fix ConsumeBenchWorker exit behavior for maxMessages con…
kowshik Jun 2, 2021
364bd36
KAFKA-12880: Remove deprecated `Count` and `SampledTotal` in 3.0 (#10…
ijuma Jun 2, 2021
6db51e4
KAFKA-12675: improve the sticky general assignor scalability and perf…
showuon Jun 2, 2021
ccec9b0
KAFKA-12864: Move KafkaEventQueue into server-common. #10787 (#10787)
cmccabe Jun 2, 2021
c2c08b4
MINOR: Apply try-with-resource to KafkaStreamsTest (#10668)
Jun 3, 2021
93dca8e
KAFKA-12749: Changelog topic config on suppressed KTable lost (#10664)
vichu Jun 3, 2021
e97cff2
KAFKA-12620 Allocate Producer IDs in KRaft controller (#10752)
mumrah Jun 3, 2021
0358c21
minor stylish fixes to raft client (#10809)
Jun 4, 2021
ccde334
KAFKA-12597: Remove deprecated --zookeeper option in ReassignPartitio…
showuon Jun 4, 2021
b2d463a
KAFKA-8897 Follow-up: Consolidate the global state stores (#10646)
guozhangwang Jun 4, 2021
5ef9022
MINOR: LogLoader: Add log identifier at few missing areas (#10819)
kowshik Jun 4, 2021
37a8659
KAFKA-12892: Use dedicated root in ZK ACL test (#10821)
soarez Jun 5, 2021
1ba217d
MINOR: Log member id of the leader when assignment are received (#10817)
dajac Jun 7, 2021
c72ce00
KAFKA-10614: Ensure group state (un)load is executed in the right ord…
tombentley Jun 7, 2021
51665b9
KAFKA-12338; Remove unused `MetadataParser` (#10793)
dengziming Jun 7, 2021
43db8ac
KAFKA-12897: KRaft multi-partition placement on single broker (#10823)
rondagostino Jun 7, 2021
48379bd
KAFKA-12648: Pt. 1 - Add NamedTopology to protocol and state director…
ableegoldman Jun 7, 2021
a4d9182
merge with upstream
ableegoldman Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ buildscript {
}

plugins {
id 'com.diffplug.spotless' version '5.12.4'
id 'com.diffplug.spotless' version '5.12.5'
id 'com.github.ben-manes.versions' version '0.38.0'
id 'idea'
id 'java-library'
Expand Down Expand Up @@ -449,6 +449,14 @@ subprojects {
}
}

// remove test output from all test types
tasks.withType(Test).all { t ->
cleanTest {
delete t.reports.junitXml.destination
delete t.reports.html.destination
}
}

jar {
from "$rootDir/LICENSE"
from "$rootDir/NOTICE"
Expand Down
2 changes: 1 addition & 1 deletion checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@

<!-- Streams -->
<suppress checks="ClassFanOutComplexity"
files="(KafkaStreams|KStreamImpl|KTableImpl|StreamsPartitionAssignor).java"/>
files="(KafkaStreams|KStreamImpl|KTableImpl|InternalTopologyBuilder|StreamsPartitionAssignor).java"/>

<suppress checks="MethodLength"
files="KTableImpl.java"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@

@InterfaceStability.Evolving
public class AbortTransactionOptions extends AbstractOptions<AbortTransactionOptions> {

@Override
public String toString() {
return "AbortTransactionOptions(" +
"timeoutMs=" + timeoutMs +
')';
}

}
26 changes: 24 additions & 2 deletions clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ default DescribeClusterResult describeCluster() {
* This operation is supported by brokers with version 0.11.0.0 or higher.
*
* @param filter The filter to use.
* @return The DeleteAclsResult.
* @return The DescribeAclsResult.
*/
default DescribeAclsResult describeAcls(AclBindingFilter filter) {
return describeAcls(filter, new DescribeAclsOptions());
Expand All @@ -354,7 +354,7 @@ default DescribeAclsResult describeAcls(AclBindingFilter filter) {
*
* @param filter The filter to use.
* @param options The options to use when listing the ACLs.
* @return The DeleteAclsResult.
* @return The DescribeAclsResult.
*/
DescribeAclsResult describeAcls(AclBindingFilter filter, DescribeAclsOptions options);

Expand Down Expand Up @@ -1533,6 +1533,28 @@ default AbortTransactionResult abortTransaction(AbortTransactionSpec spec) {
*/
AbortTransactionResult abortTransaction(AbortTransactionSpec spec, AbortTransactionOptions options);

/**
* List active transactions in the cluster. See
* {@link #listTransactions(ListTransactionsOptions)} for more details.
*
* @return The result
*/
default ListTransactionsResult listTransactions() {
return listTransactions(new ListTransactionsOptions());
}

/**
* List active transactions in the cluster. This will query all potential transaction
* coordinators in the cluster and collect the state of all transactions. Users
* should typically attempt to reduce the size of the result set using
* {@link ListTransactionsOptions#filterProducerIds(Collection)} or
* {@link ListTransactionsOptions#filterStates(Collection)}
*
* @param options Options to control the method behavior (including filters)
* @return The result
*/
ListTransactionsResult listTransactions(ListTransactionsOptions options);

/**
* Get the metrics kept by the adminClient
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public PartitionProducerState(List<ProducerState> activeProducers) {
public List<ProducerState> activeProducers() {
return activeProducers;
}

@Override
public String toString() {
return "PartitionProducerState(" +
"activeProducers=" + activeProducers +
')';
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@
@InterfaceStability.Evolving
public class DescribeTransactionsOptions extends AbstractOptions<DescribeTransactionsOptions> {

@Override
public String toString() {
return "DescribeTransactionsOptions(" +
"timeoutMs=" + timeoutMs +
')';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
import org.apache.kafka.clients.admin.internals.AbortTransactionHandler;
import org.apache.kafka.clients.admin.internals.AdminApiDriver;
import org.apache.kafka.clients.admin.internals.AdminApiHandler;
import org.apache.kafka.clients.admin.internals.AdminApiFuture;
import org.apache.kafka.clients.admin.internals.AdminMetadataManager;
import org.apache.kafka.clients.admin.internals.AllBrokersStrategy;
import org.apache.kafka.clients.admin.internals.ConsumerGroupOperationContext;
import org.apache.kafka.clients.admin.internals.CoordinatorKey;
import org.apache.kafka.clients.admin.internals.DescribeProducersHandler;
import org.apache.kafka.clients.admin.internals.DescribeTransactionsHandler;
import org.apache.kafka.clients.admin.internals.ListTransactionsHandler;
import org.apache.kafka.clients.admin.internals.MetadataOperationContext;
import org.apache.kafka.clients.consumer.ConsumerPartitionAssignor.Assignment;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
Expand Down Expand Up @@ -4729,48 +4733,57 @@ void handleFailure(Throwable throwable) {

@Override
public DescribeProducersResult describeProducers(Collection<TopicPartition> topicPartitions, DescribeProducersOptions options) {
DescribeProducersHandler handler = new DescribeProducersHandler(
new HashSet<>(topicPartitions),
options,
logContext
);
return new DescribeProducersResult(invokeDriver(handler, options.timeoutMs));
AdminApiFuture.SimpleAdminApiFuture<TopicPartition, DescribeProducersResult.PartitionProducerState> future =
DescribeProducersHandler.newFuture(topicPartitions);
DescribeProducersHandler handler = new DescribeProducersHandler(options, logContext);
invokeDriver(handler, future, options.timeoutMs);
return new DescribeProducersResult(future.all());
}

@Override
public DescribeTransactionsResult describeTransactions(Collection<String> transactionalIds, DescribeTransactionsOptions options) {
DescribeTransactionsHandler handler = new DescribeTransactionsHandler(
transactionalIds,
logContext
);
return new DescribeTransactionsResult(invokeDriver(handler, options.timeoutMs));
AdminApiFuture.SimpleAdminApiFuture<CoordinatorKey, TransactionDescription> future =
DescribeTransactionsHandler.newFuture(transactionalIds);
DescribeTransactionsHandler handler = new DescribeTransactionsHandler(logContext);
invokeDriver(handler, future, options.timeoutMs);
return new DescribeTransactionsResult(future.all());
}

@Override
public AbortTransactionResult abortTransaction(AbortTransactionSpec spec, AbortTransactionOptions options) {
AbortTransactionHandler handler = new AbortTransactionHandler(
spec,
logContext
);
return new AbortTransactionResult(invokeDriver(handler, options.timeoutMs));
AdminApiFuture.SimpleAdminApiFuture<TopicPartition, Void> future =
AbortTransactionHandler.newFuture(Collections.singleton(spec.topicPartition()));
AbortTransactionHandler handler = new AbortTransactionHandler(spec, logContext);
invokeDriver(handler, future, options.timeoutMs);
return new AbortTransactionResult(future.all());
}

@Override
public ListTransactionsResult listTransactions(ListTransactionsOptions options) {
AllBrokersStrategy.AllBrokersFuture<Collection<TransactionListing>> future =
ListTransactionsHandler.newFuture();
ListTransactionsHandler handler = new ListTransactionsHandler(options, logContext);
invokeDriver(handler, future, options.timeoutMs);
return new ListTransactionsResult(future.all());
}

private <K, V> Map<K, KafkaFutureImpl<V>> invokeDriver(
private <K, V> void invokeDriver(
AdminApiHandler<K, V> handler,
AdminApiFuture<K, V> future,
Integer timeoutMs
) {
long currentTimeMs = time.milliseconds();
long deadlineMs = calcDeadlineMs(currentTimeMs, timeoutMs);

AdminApiDriver<K, V> driver = new AdminApiDriver<>(
handler,
future,
deadlineMs,
retryBackoffMs,
logContext
);

maybeSendRequests(driver, currentTimeMs);
return driver.futures();
}

private <K, V> void maybeSendRequests(AdminApiDriver<K, V> driver, long currentTimeMs) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.kafka.clients.admin;

import org.apache.kafka.common.annotation.InterfaceStability;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
* Options for {@link Admin#listTransactions()}.
*
* The API of this class is evolving, see {@link Admin} for details.
*/
@InterfaceStability.Evolving
public class ListTransactionsOptions extends AbstractOptions<ListTransactionsOptions> {
private Set<TransactionState> filteredStates = Collections.emptySet();
private Set<Long> filteredProducerIds = Collections.emptySet();

/**
* Filter only the transactions that are in a specific set of states. If no filter
* is specified or if the passed set of states is empty, then transactions in all
* states will be returned.
*
* @param states the set of states to filter by
* @return this object
*/
public ListTransactionsOptions filterStates(Collection<TransactionState> states) {
this.filteredStates = new HashSet<>(states);
return this;
}

/**
* Filter only the transactions from producers in a specific set of producerIds.
* If no filter is specified or if the passed collection of producerIds is empty,
* then the transactions of all producerIds will be returned.
*
* @param producerIdFilters the set of producerIds to filter by
* @return this object
*/
public ListTransactionsOptions filterProducerIds(Collection<Long> producerIdFilters) {
this.filteredProducerIds = new HashSet<>(producerIdFilters);
return this;
}

/**
* Returns the set of states to be filtered or empty if no states have been specified.
*
* @return the current set of filtered states (empty means that no states are filtered and all
* all transactions will be returned)
*/
public Set<TransactionState> filteredStates() {
return filteredStates;
}

/**
* Returns the set of producerIds that are being filtered or empty if none have been specified.
*
* @return the current set of filtered states (empty means that no producerIds are filtered and
* all transactions will be returned)
*/
public Set<Long> filteredProducerIds() {
return filteredProducerIds;
}

@Override
public String toString() {
return "ListTransactionsOptions(" +
"filteredStates=" + filteredStates +
", filteredProducerIds=" + filteredProducerIds +
", timeoutMs=" + timeoutMs +
')';
}
}
Loading