Skip to content

Commit a17217c

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into KAFKA-19082-Client-Side-2PC-Changes-pt1
2 parents b1b0072 + fb2ce76 commit a17217c

File tree

496 files changed

+19366
-9662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

496 files changed

+19366
-9662
lines changed

.asf.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ notifications:
2929
# Read more here: https://github.com/apache/infrastructure-asfyaml
3030
github:
3131
collaborators:
32-
- apoorvmittal10
3332
- brandboat
34-
- frankvicky
3533
- FrankYang0529
3634
- gongxuanzhang
3735
- m1a2st
3836
- mingyen066
37+
- ShivsundarR
3938
- smjn
4039
- TaiJuWu
4140
- xijiu
41+
- Yunyung
4242
enabled_merge_buttons:
4343
squash: true
4444
squash_commit_message: PR_TITLE_AND_DESC

.github/scripts/pr-format.py

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import shlex
2323
import sys
2424
import tempfile
25+
import textwrap
2526
from typing import Dict, Optional, TextIO
2627

27-
2828
logger = logging.getLogger()
2929
logger.setLevel(logging.DEBUG)
3030
handler = logging.StreamHandler(sys.stderr)
@@ -61,6 +61,7 @@ def write_commit(io: TextIO, title: str, body: str):
6161
io.write(body.encode())
6262
io.flush()
6363

64+
6465
def parse_trailers(title, body) -> Dict:
6566
trailers = defaultdict(list)
6667

@@ -77,6 +78,29 @@ def parse_trailers(title, body) -> Dict:
7778
return trailers
7879

7980

81+
def split_paragraphs(text: str):
82+
"""
83+
Split the given text into a generator of paragraph lines and a boolean "markdown" flag.
84+
85+
If any line of a paragraph starts with a markdown character, we will assume the whole paragraph
86+
contains markdown.
87+
"""
88+
lines = text.splitlines(keepends=True)
89+
paragraph = []
90+
markdown = False
91+
for line in lines:
92+
if line.strip() == "":
93+
if len(paragraph) > 0:
94+
yield paragraph, markdown
95+
paragraph.clear()
96+
markdown = False
97+
else:
98+
if line[0] in ("#", "*", "-", "=") or line[0].isdigit():
99+
markdown = True
100+
paragraph.append(line)
101+
yield paragraph, markdown
102+
103+
80104
if __name__ == "__main__":
81105
"""
82106
This script performs some basic linting of our PR titles and body. The PR number is read from the PR_NUMBER
@@ -96,10 +120,6 @@ def parse_trailers(title, body) -> Dict:
96120
* Has "Reviewers:" trailer if the PR is approved
97121
"""
98122

99-
if not get_env("GITHUB_ACTIONS"):
100-
print("This script is intended to by run by GitHub Actions.")
101-
exit(1)
102-
103123
pr_number = get_env("PR_NUMBER")
104124
cmd = f"gh pr view {pr_number} --json 'title,body,reviews'"
105125
p = subprocess.run(shlex.split(cmd), capture_output=True)
@@ -132,6 +152,35 @@ def check(positive_assertion, ok_msg, err_msg):
132152
check("Delete this text and replace" not in body, "PR template text not present", "PR template text should be removed")
133153
check("Committer Checklist" not in body, "PR template text not present", "Old PR template text should be removed")
134154

155+
paragraph_iter = split_paragraphs(body)
156+
new_paragraphs = []
157+
for p, markdown in paragraph_iter:
158+
if markdown:
159+
# If a paragraph looks like it has markdown in it, wrap each line separately.
160+
new_lines = []
161+
for line in p:
162+
new_lines.append(textwrap.fill(line, width=72, break_long_words=False, break_on_hyphens=False, replace_whitespace=False))
163+
rewrapped_p = "\n".join(new_lines)
164+
else:
165+
indent = ""
166+
if len(p) > 0 and p[0].startswith("Reviewers:"):
167+
indent = " "
168+
rewrapped_p = textwrap.fill("".join(p), subsequent_indent=indent, width=72, break_long_words=False, break_on_hyphens=False, replace_whitespace=True)
169+
new_paragraphs.append(rewrapped_p + "\n")
170+
body = "\n".join(new_paragraphs)
171+
172+
if get_env("GITHUB_ACTIONS"):
173+
with tempfile.NamedTemporaryFile() as fp:
174+
fp.write(body.encode())
175+
fp.flush()
176+
cmd = f"gh pr edit {pr_number} --body-file {fp.name}"
177+
p = subprocess.run(shlex.split(cmd), capture_output=True)
178+
fp.close()
179+
if p.returncode != 0:
180+
logger.error(f"Could not update PR {pr_number}. STDOUT: {p.stdout.decode()}")
181+
else:
182+
logger.info(f"Not reformatting {pr_number} since this is not running on GitHub Actions.")
183+
135184
# Check for Reviewers
136185
approved = has_approval(reviews)
137186
if approved:
@@ -143,12 +192,13 @@ def check(positive_assertion, ok_msg, err_msg):
143192
logger.debug(reviewer_in_body)
144193

145194
logger.debug("Commit will look like:\n")
146-
logger.debug("```")
195+
logger.debug("<pre>")
147196
io = BytesIO()
197+
title += f" (#{pr_number})"
148198
write_commit(io, title, body)
149199
io.seek(0)
150200
logger.debug(io.read().decode())
151-
logger.debug("```\n")
201+
logger.debug("</pre>\n")
152202

153203
exit_code = 0
154204
logger.debug("Validation results:")

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ fail due to code changes. You can just run:
9999

100100
./gradlew processMessages processTestMessages
101101

102+
See [Apache Kafka Message Definitions](clients/src/main/resources/common/message/README.md) for details on Apache Kafka message protocol.
103+
102104
### Running a Kafka broker
103105

104106
Using compiled files:
@@ -109,7 +111,9 @@ Using compiled files:
109111

110112
Using docker image:
111113

112-
docker run -p 9092:9092 apache/kafka:3.7.0
114+
docker run -p 9092:9092 apache/kafka:latest
115+
116+
See [docker/README.md](docker/README.md) for detailed information.
113117

114118
### Cleaning the build ###
115119
./gradlew clean
@@ -263,10 +267,28 @@ default. See https://www.lightbend.com/blog/scala-inliner-optimizer for more det
263267

264268
See [tests/README.md](tests/README.md).
265269

270+
### Using Trogdor for testing ###
271+
272+
We use Trogdor as a test framework for Apache Kafka. You can use it to run benchmarks and other workloads.
273+
274+
See [trogdor/README.md](trogdor/README.md).
275+
266276
### Running in Vagrant ###
267277

268278
See [vagrant/README.md](vagrant/README.md).
269279

280+
### Release Kafka ###
281+
282+
See [release/README.md](release/README.md).
283+
284+
### Official Documentation ###
285+
286+
See [docs/README.md](docs/README.md).
287+
288+
### Kafka client examples ###
289+
290+
See [examples/README.md](examples/README.md).
291+
270292
### Contribution ###
271293

272294
Apache Kafka is interested in building the community; we would welcome any thoughts or [patches](https://issues.apache.org/jira/browse/KAFKA). You can reach us [on the Apache mailing lists](http://kafka.apache.org/contact.html).

bin/kafka-streams-groups.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
exec $(dirname $0)/kafka-run-class.sh org.apache.kafka.tools.streams.StreamsGroupCommand "$@"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3737,7 +3737,7 @@ project(':connect:mirror') {
37373737
testImplementation project(':core')
37383738
testImplementation project(':test-common:test-common-runtime')
37393739
testImplementation project(':server')
3740-
testImplementation project(':server-common').sourceSets.test.output
3740+
testImplementation project(':server-common')
37413741

37423742

37433743
testRuntimeOnly project(':connect:runtime')

checkstyle/import-control-clients-integration-tests.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
-->
2020

2121
<import-control pkg="org.apache.kafka">
22-
<allow pkg="java" />
23-
<allow pkg="org.junit" />
22+
<allow pkg="java"/>
23+
<allow pkg="org.junit"/>
2424

25-
<!-- These are tests, allow whatever -->
26-
<allow pkg="org.apache.kafka"/>
27-
<allow pkg="org.junit" />
28-
<allow pkg="kafka"/>
25+
<!-- These are tests, allow whatever -->
26+
<allow pkg="org.apache.kafka"/>
27+
<allow pkg="org.junit"/>
28+
<allow pkg="kafka"/>
29+
30+
<subpackage name="clients.producer">
31+
<allow pkg="org.opentest4j"/>
32+
</subpackage>
2933

3034
</import-control>

checkstyle/import-control-metadata.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@
176176
<allow pkg="org.apache.kafka.controller" />
177177
<allow pkg="org.apache.kafka.metadata" />
178178
<allow pkg="org.apache.kafka.common.internals" />
179+
<allow pkg="org.apache.kafka.common.metrics" />
180+
<allow pkg="org.apache.kafka.common.metrics.internals" />
181+
<allow pkg="org.apache.kafka.common.metrics.stats" />
179182
</subpackage>
180183
<subpackage name="bootstrap">
181184
<allow pkg="org.apache.kafka.snapshot" />

checkstyle/import-control-server-common.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<disallow pkg="kafka" />
3939

4040
<!-- anyone can use public classes -->
41-
<allow pkg="org.apache.kafka.common" exact-match="true" />
41+
<allow pkg="org.apache.kafka.common" />
4242
<allow pkg="org.apache.kafka.common.security" />
4343
<allow pkg="org.apache.kafka.common.serialization" />
4444
<allow pkg="org.apache.kafka.common.utils" />
@@ -130,6 +130,7 @@
130130
</subpackage>
131131
<subpackage name="config">
132132
<allow pkg="org.apache.kafka.server"/>
133+
<allow pkg="org.apache.kafka.clients"/>
133134
</subpackage>
134135
</subpackage>
135136

checkstyle/import-control-server.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<allow pkg="org.apache.kafka.metadata" />
6060

6161
<!-- utilities and reusable classes from server-common -->
62+
<allow pkg="org.apache.kafka.config"/>
6263
<allow pkg="org.apache.kafka.queue" />
6364
<allow pkg="org.apache.kafka.security" />
6465
<allow pkg="org.apache.kafka.server.common" />
@@ -81,8 +82,10 @@
8182
<allow pkg="org.apache.kafka.raft" />
8283

8384
<subpackage name="server">
85+
<allow pkg="javax.crypto" />
8486
<allow pkg="org.apache.kafka.server" />
8587
<allow pkg="org.apache.kafka.image" />
88+
<allow pkg="org.apache.kafka.network.metrics" />
8689
<allow pkg="org.apache.kafka.storage.internals.log" />
8790
<allow pkg="org.apache.kafka.storage.internals.checkpoint" />
8891
<subpackage name="metrics">
@@ -102,6 +105,7 @@
102105
<subpackage name="security">
103106
<allow pkg="org.apache.kafka.common.resource" />
104107
<allow pkg="org.apache.kafka.network" />
108+
<allow pkg="org.apache.kafka.server" />
105109
<allow pkg="org.apache.kafka.server.authorizer" />
106110
</subpackage>
107111

checkstyle/import-control-storage.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949

5050

5151
<subpackage name="server">
52+
<allow pkg="com.yammer.metrics.core" />
5253
<allow pkg="org.apache.kafka.common" />
54+
<allow pkg="org.apache.kafka.server.metrics" />
55+
<allow pkg="org.apache.kafka.server.util.timer" />
56+
<allow pkg="org.apache.kafka.storage.internals.log" />
5357

5458
<subpackage name="log">
5559
<allow pkg="com.fasterxml.jackson" />
@@ -84,6 +88,7 @@
8488
<allow pkg="com.fasterxml.jackson" />
8589
<allow pkg="com.yammer.metrics.core" />
8690
<allow pkg="org.apache.kafka.common" />
91+
<allow pkg="org.apache.kafka.config" />
8792
<allow pkg="org.apache.kafka.server"/>
8893
<allow pkg="org.apache.kafka.storage.internals"/>
8994
<allow pkg="org.apache.kafka.storage.log.metrics"/>

0 commit comments

Comments
 (0)