Skip to content

Commit c96ca37

Browse files
author
Andrey
committed
Merge remote-tracking branch 'upstream/master'
2 parents 5868d31 + 08c7749 commit c96ca37

Some content is hidden

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

93 files changed

+2526
-842
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ docs/_build
1313
.cache*
1414
.idea/
1515
integration-test/
16-
tests-env/
16+
tests-env/
17+
.pytest_cache/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
- KAFKA_VERSION=0.9.0.1
1313
- KAFKA_VERSION=0.10.2.1
1414
- KAFKA_VERSION=0.11.0.2
15+
- KAFKA_VERSION=1.0.1
1516

1617
sudo: false
1718

CHANGES.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,182 @@
1+
# 1.4.3 (May 26, 2018)
2+
3+
Compatibility
4+
* Fix for python 3.7 support: remove 'async' keyword from SimpleProducer (dpkp #1454)
5+
6+
Client
7+
* Improve BrokerConnection initialization time (romulorosa #1475)
8+
* Ignore MetadataResponses with empty broker list (dpkp #1506)
9+
* Improve connection handling when bootstrap list is invalid (dpkp #1507)
10+
11+
Consumer
12+
* Check for immediate failure when looking up coordinator in heartbeat thread (dpkp #1457)
13+
14+
Core / Protocol
15+
* Always acquire client lock before coordinator lock to avoid deadlocks (dpkp #1464)
16+
* Added AlterConfigs and DescribeConfigs apis (StephenSorriaux #1472)
17+
* Fix CreatePartitionsRequest_v0 (StephenSorriaux #1469)
18+
* Add codec validators to record parser and builder for all formats (tvoinarovskyi #1447)
19+
* Fix MemoryRecord bugs re error handling and add test coverage (tvoinarovskyi #1448)
20+
* Force lz4 to disable Kafka-unsupported block linking when encoding (mnito #1476)
21+
* Stop shadowing `ConnectionError` (jeffwidman #1492)
22+
23+
Documentation
24+
* Document methods that return None (jeffwidman #1504)
25+
* Minor doc capitalization cleanup (jeffwidman)
26+
* Adds add_callback/add_errback example to docs (Berkodev #1441)
27+
* Fix KafkaConsumer docstring for request_timeout_ms default (dpkp #1459)
28+
29+
Test Infrastructure
30+
* Skip flakey SimpleProducer test (dpkp)
31+
* Fix skipped integration tests if KAFKA_VERSION unset (dpkp #1453)
32+
33+
Logging / Error Messages
34+
* Stop using deprecated log.warn() (jeffwidman)
35+
* Change levels for some heartbeat thread logging (dpkp #1456)
36+
* Log Heartbeat thread start / close for debugging (dpkp)
37+
38+
39+
# 1.4.2 (Mar 10, 2018)
40+
41+
Bugfixes
42+
* Close leaked selector in version check (dpkp #1425)
43+
* Fix `BrokerConnection.connection_delay()` to return milliseconds (dpkp #1414)
44+
* Use local copies in `Fetcher._fetchable_partitions` to avoid mutation errors (dpkp #1400)
45+
* Fix error var name in `_unpack` (j2gg0s #1403)
46+
* Fix KafkaConsumer compacted offset handling (dpkp #1397)
47+
* Fix byte size estimation with kafka producer (blakeembrey #1393)
48+
* Fix coordinator timeout in consumer poll interface (braedon #1384)
49+
50+
Client
51+
* Add `BrokerConnection.connect_blocking()` to improve bootstrap to multi-address hostnames (dpkp #1411)
52+
* Short-circuit `BrokerConnection.close()` if already disconnected (dpkp #1424)
53+
* Only increase reconnect backoff if all addrinfos have been tried (dpkp #1423)
54+
* Make BrokerConnection .host / .port / .afi immutable to avoid incorrect 'metadata changed' checks (dpkp #1422)
55+
* Connect with sockaddrs to support non-zero ipv6 scope ids (dpkp #1433)
56+
* Check timeout type in KafkaClient constructor (asdaraujo #1293)
57+
* Update string representation of SimpleClient (asdaraujo #1293)
58+
* Do not validate `api_version` against known versions (dpkp #1434)
59+
60+
Consumer
61+
* Avoid tight poll loop in consumer when brokers are down (dpkp #1415)
62+
* Validate `max_records` in KafkaConsumer.poll (dpkp #1398)
63+
* KAFKA-5512: Awake heartbeat thread when it is time to poll (dpkp #1439)
64+
65+
Producer
66+
* Validate that serializers generate bytes-like (or None) data (dpkp #1420)
67+
68+
Core / Protocol
69+
* Support alternative lz4 package: lz4framed (everpcpc #1395)
70+
* Use hardware accelerated CRC32C function if available (tvoinarovskyi #1389)
71+
* Add Admin CreatePartitions API call (alexef #1386)
72+
73+
Test Infrastructure
74+
* Close KafkaConsumer instances during tests (dpkp #1410)
75+
* Introduce new fixtures to prepare for migration to pytest (asdaraujo #1293)
76+
* Removed pytest-catchlog dependency (asdaraujo #1380)
77+
* Fixes racing condition when message is sent to broker before topic logs are created (asdaraujo #1293)
78+
* Add kafka 1.0.1 release to test fixtures (dpkp #1437)
79+
80+
Logging / Error Messages
81+
* Re-enable logging during broker version check (dpkp #1430)
82+
* Connection logging cleanups (dpkp #1432)
83+
* Remove old CommitFailed error message from coordinator (dpkp #1436)
84+
85+
86+
# 1.4.1 (Feb 9, 2018)
87+
88+
Bugfixes
89+
* Fix consumer poll stuck error when no available partition (ckyoog #1375)
90+
* Increase some integration test timeouts (dpkp #1374)
91+
* Use raw in case string overriden (jeffwidman #1373)
92+
* Fix pending completion IndexError bug caused by multiple threads (dpkp #1372)
93+
94+
95+
# 1.4.0 (Feb 6, 2018)
96+
97+
This is a substantial release. Although there are no known 'showstopper' bugs as of release,
98+
we do recommend you test any planned upgrade to your application prior to running in production.
99+
100+
Some of the major changes include:
101+
* We have officially dropped python 2.6 support
102+
* The KafkaConsumer now includes a background thread to handle coordinator heartbeats
103+
* API protocol handling has been separated from networking code into a new class, KafkaProtocol
104+
* Added support for kafka message format v2
105+
* Refactored DNS lookups during kafka broker connections
106+
* SASL authentication is working (we think)
107+
* Removed several circular references to improve gc on close()
108+
109+
Thanks to all contributors -- the state of the kafka-python community is strong!
110+
111+
Detailed changelog are listed below:
112+
113+
Client
114+
* Fixes for SASL support
115+
* Refactor SASL/gssapi support (dpkp #1248 #1249 #1257 #1262 #1280)
116+
* Add security layer negotiation to the GSSAPI authentication (asdaraujo #1283)
117+
* Fix overriding sasl_kerberos_service_name in KafkaConsumer / KafkaProducer (natedogs911 #1264)
118+
* Fix typo in _try_authenticate_plain (everpcpc #1333)
119+
* Fix for Python 3 byte string handling in SASL auth (christophelec #1353)
120+
* Move callback processing from BrokerConnection to KafkaClient (dpkp #1258)
121+
* Use socket timeout of request_timeout_ms to prevent blocking forever on send (dpkp #1281)
122+
* Refactor dns lookup in BrokerConnection (dpkp #1312)
123+
* Read all available socket bytes (dpkp #1332)
124+
* Honor reconnect_backoff in conn.connect() (dpkp #1342)
125+
126+
Consumer
127+
* KAFKA-3977: Defer fetch parsing for space efficiency, and to raise exceptions to user (dpkp #1245)
128+
* KAFKA-4034: Avoid unnecessary consumer coordinator lookup (dpkp #1254)
129+
* Handle lookup_coordinator send failures (dpkp #1279)
130+
* KAFKA-3888 Use background thread to process consumer heartbeats (dpkp #1266)
131+
* Improve KafkaConsumer cleanup (dpkp #1339)
132+
* Fix coordinator join_future race condition (dpkp #1338)
133+
* Avoid KeyError when filtering fetchable partitions (dpkp #1344)
134+
* Name heartbeat thread with group_id; use backoff when polling (dpkp #1345)
135+
* KAFKA-3949: Avoid race condition when subscription changes during rebalance (dpkp #1364)
136+
* Fix #1239 regression to avoid consuming duplicate compressed messages from mid-batch (dpkp #1367)
137+
138+
Producer
139+
* Fix timestamp not passed to RecordMetadata (tvoinarovskyi #1273)
140+
* Raise non-API exceptions (jeffwidman #1316)
141+
* Fix reconnect_backoff_max_ms default config bug in KafkaProducer (YaoC #1352)
142+
143+
Core / Protocol
144+
* Add kafka.protocol.parser.KafkaProtocol w/ receive and send (dpkp #1230)
145+
* Refactor MessageSet and Message into LegacyRecordBatch to later support v2 message format (tvoinarovskyi #1252)
146+
* Add DefaultRecordBatch implementation aka V2 message format parser/builder. (tvoinarovskyi #1185)
147+
* optimize util.crc32 (ofek #1304)
148+
* Raise better struct pack/unpack errors (jeffwidman #1320)
149+
* Add Request/Response structs for kafka broker 1.0.0 (dpkp #1368)
150+
151+
Bugfixes
152+
* use python standard max value (lukekingbru #1303)
153+
* changed for to use enumerate() (TheAtomicOption #1301)
154+
* Explicitly check for None rather than falsey (jeffwidman #1269)
155+
* Minor Exception cleanup (jeffwidman #1317)
156+
* Use non-deprecated exception handling (jeffwidman a699f6a)
157+
* Remove assertion with side effect in client.wakeup() (bgedik #1348)
158+
* use absolute imports everywhere (kevinkjt2000 #1362)
159+
160+
Test Infrastructure
161+
* Use 0.11.0.2 kafka broker for integration testing (dpkp #1357 #1244)
162+
* Add a Makefile to help build the project, generate docs, and run tests (tvoinarovskyi #1247)
163+
* Add fixture support for 1.0.0 broker (dpkp #1275)
164+
* Add kafka 1.0.0 to travis integration tests (dpkp #1365)
165+
* Change fixture default host to localhost (asdaraujo #1305)
166+
* Minor test cleanups (dpkp #1343)
167+
* Use latest pytest 3.4.0, but drop pytest-sugar due to incompatibility (dpkp #1361)
168+
169+
Documentation
170+
* Expand metrics docs (jeffwidman #1243)
171+
* Fix docstring (jeffwidman #1261)
172+
* Added controlled thread shutdown to example.py (TheAtomicOption #1268)
173+
* Add license to wheel (jeffwidman #1286)
174+
* Use correct casing for MB (jeffwidman #1298)
175+
176+
Logging / Error Messages
177+
* Fix two bugs in printing bytes instance (jeffwidman #1296)
178+
179+
1180
# 1.3.5 (Oct 7, 2017)
2181

3182
Bugfixes

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ test27: build-integration
2323
# Test using py.test directly if you want to use local python. Useful for other
2424
# platforms that require manual installation for C libraries, ie. Windows.
2525
test-local: build-integration
26-
py.test --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF kafka test
26+
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) py.test \
27+
--pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF $(FLAGS) kafka test
2728

2829
cov-local: build-integration
29-
py.test --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF --cov=kafka \
30-
--cov-config=.covrc --cov-report html kafka test
30+
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) py.test \
31+
--pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF --cov=kafka \
32+
--cov-config=.covrc --cov-report html $(FLAGS) kafka test
3133
@echo "open file://`pwd`/htmlcov/index.html"
3234

3335
# Check the readme for syntax errors, which can lead to invalid formatting on

README.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Kafka Python client
22
------------------------
33

4-
.. image:: https://img.shields.io/badge/kafka-0.11%2C%200.10%2C%200.9%2C%200.8-brightgreen.svg
4+
.. image:: https://img.shields.io/badge/kafka-1.0%2C%200.11%2C%200.10%2C%200.9%2C%200.8-brightgreen.svg
55
:target: https://kafka-python.readthedocs.io/compatibility.html
66
.. image:: https://img.shields.io/pypi/pyversions/kafka-python.svg
77
:target: https://pypi.python.org/pypi/kafka-python
@@ -70,6 +70,11 @@ that expose basic message attributes: topic, partition, offset, key, and value:
7070
>>> for msg in consumer:
7171
... assert isinstance(msg.value, dict)
7272

73+
>>> # Access record headers. The returned value is a list of tuples
74+
>>> # with str, bytes for key and value
75+
>>> for msg in consumer:
76+
... print (msg.headers)
77+
7378
>>> # Get consumer metrics
7479
>>> metrics = consumer.metrics()
7580

@@ -112,6 +117,10 @@ for more details.
112117
>>> for i in range(1000):
113118
... producer.send('foobar', b'msg %d' % i)
114119

120+
>>> # Include record headers. The format is list of tuples with string key
121+
>>> # and bytes value.
122+
>>> producer.send('foobar', value=b'c29tZSB2YWx1ZQ==', headers=[('content-encoding', b'base64')])
123+
115124
>>> # Get producer performance metrics
116125
>>> metrics = producer.metrics()
117126

@@ -141,7 +150,7 @@ for interacting with kafka brokers via the python repl. This is useful for
141150
testing, probing, and general experimentation. The protocol support is
142151
leveraged to enable a KafkaClient.check_version() method that
143152
probes a kafka broker and attempts to identify which version it is running
144-
(0.8.0 to 0.11).
153+
(0.8.0 to 1.0).
145154

146155
Low-level
147156
*********

build_integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
: ${ALL_RELEASES:="0.8.2.2 0.9.0.1 0.10.1.1 0.10.2.1 0.11.0.2"}
3+
: ${ALL_RELEASES:="0.8.2.2 0.9.0.1 0.10.1.1 0.10.2.1 0.11.0.2 1.0.1"}
44
: ${SCALA_VERSION:=2.11}
55
: ${DIST_BASE_URL:=https://archive.apache.org/dist/kafka/}
66
: ${KAFKA_SRC_GIT:=https://github.com/apache/kafka.git}

0 commit comments

Comments
 (0)