Skip to content

Merge latest official repo #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ca1bd08
Use latest pytest 3.4.0, but drop pytest-sugar due to incompatibility…
dpkp Jan 31, 2018
b3202ea
Bump `lz4` in `requirements-dev.txt` (#1359)
jeffwidman Jan 31, 2018
08a7fb7
Add kafka 1.0.0 to travis integration tests
dpkp Feb 1, 2018
618c505
KAFKA-3949: Avoid race condition when subscription changes during reb…
dpkp Feb 3, 2018
441aeb8
Avoid consuming duplicate compressed messages from mid-batch (#1367)
dpkp Feb 6, 2018
c0df771
Add Request/Response structs for kafka broker 1.0.0
dpkp Feb 6, 2018
9ae0e59
use absolute imports everywhere (#1362)
kevinkjt2000 Feb 6, 2018
acc3a0f
pylint 1.8.2 (#1369)
dpkp Feb 6, 2018
0c2523c
Release 1.4.0
dpkp Feb 6, 2018
68068ca
Bump version for development of next release
dpkp Feb 7, 2018
41aa034
Fix pending completion IndexError bug caused by multiple threads (#1372)
dpkp Feb 8, 2018
7d8f9a4
Use raw in case string overriden (#1373)
jeffwidman Feb 8, 2018
8655c75
Increase some integration test timeouts (#1374)
dpkp Feb 9, 2018
990e928
Fix consumer poll stuck error when no available partition (#1375)
ckyoog Feb 9, 2018
00dd2c7
Patch Release 1.4.1 (#1376)
dpkp Feb 9, 2018
3fb0969
Bump version for development
dpkp Feb 11, 2018
60b22b1
Removed pytest-catchlog dependency
asdaraujo Feb 11, 2018
f1f6908
Add Admin CreatePartitions API call
alexef Feb 18, 2018
f5a0e40
Fix response schema
alexef Feb 19, 2018
92635d9
Correctly respect timeouts in consumer poll interface (#1384)
braedon Feb 21, 2018
0c0c7ea
Use hardware accelerated CRC32C function if available (#1389)
tvoinarovskyi Feb 21, 2018
54d6410
Update string representation of SimpleClient
asdaraujo Nov 6, 2017
0f5d35f
Check timeout type in KafkaClient constructor
asdaraujo Nov 7, 2017
a1869c4
Introduce new fixtures to prepare for migration to pytest.
asdaraujo Nov 15, 2017
fb279d7
Fixes racing condition when message is sent to broker before topic lo…
asdaraujo Feb 11, 2018
e66d8c4
Fix byte size estimation with kafka producer (#1393)
blakeembrey Feb 24, 2018
4cadaaf
Fix KafkaConsumer compacted offset handling (#1397)
dpkp Feb 26, 2018
793dc4d
Validate max_records in KafkaConsumer.poll (#1398)
dpkp Feb 27, 2018
ff13f87
Fix error var name in _unpack (#1403)
j2gg0s Mar 5, 2018
a6130d2
Use local copies in Fetcher._fetchable_partitions to avoid mutation e…
dpkp Mar 8, 2018
4c383da
Close KafkaConsumer instances during tests (#1410)
dpkp Mar 8, 2018
b33a651
Fix BrokerConnection.connection_delay() to return milliseconds (#1414)
dpkp Mar 8, 2018
4abdb1b
Avoid tight poll loop in consumer when brokers are down (#1415)
dpkp Mar 8, 2018
ce96752
Make BrokerConnection .host / .port / .afi immutable, use _sock_* att…
dpkp Mar 9, 2018
d90cf22
Close leaked selector in version check (#1425)
dpkp Mar 9, 2018
5446d18
Support alternative lz4framed (#1395)
everpcpc Mar 9, 2018
1974dc1
Only increase reconnect backoff if all addrinfos have been tried (#1423)
dpkp Mar 9, 2018
4cbeb2e
Short-circuit BrokerConnection.close() if already disconnected (#1424)
dpkp Mar 9, 2018
1ffdd5c
Add BrokerConnection.connect_blocking() (#1411)
dpkp Mar 9, 2018
eb941ee
Connection logging cleanups (#1432)
dpkp Mar 9, 2018
3dc536a
Re-enable logging during broker version check (#1430)
dpkp Mar 9, 2018
acbc346
Connect with sockaddrs to support non-zero ipv6 scope ids (#1433)
dpkp Mar 10, 2018
22e3f75
Do not validate api_version against known versions (#1434)
dpkp Mar 10, 2018
b8d40b5
Validate that serializers generate bytes-like (or None) data (#1420)
dpkp Mar 10, 2018
ec9049c
Update changelog with unreleased 1.4.2 notes
Mar 10, 2018
8bdbe92
Remove old CommitFailed error message from coordinator (#1436)
dpkp Mar 10, 2018
c920a2a
Add kafka 1.0.1 release to test fixtures (#1437)
dpkp Mar 10, 2018
9998604
KAFKA-5512; Awake the heartbeat thread when timetoNextHeartbeat is eq…
dpkp Mar 11, 2018
bfc8f6a
Patch Release 1.4.2
Mar 11, 2018
18e48dc
Bump version for development
Mar 11, 2018
e8cb888
Fix skipped integration tests if KAFKA_VERSION unset (#1453)
dpkp Mar 23, 2018
204388b
Check for immediate failure when looking up coordinator in heartbeat …
dpkp Mar 23, 2018
b62006a
Change SimpleProducer to use async_send (async is reserved in py37) (…
dpkp Mar 23, 2018
c0fddbd
Fix KafkaConsumer docstring for request_timeout_ms default (#1459)
dpkp Mar 23, 2018
f18fd75
Change levels for some heartbeat thread logging
dpkp Mar 22, 2018
4c87d11
Heartbeat thread start / close
dpkp Mar 22, 2018
4267ed5
Adds add_callback/add_errback example to docs (#1441)
Berkodev Mar 29, 2018
6163aa3
Fix CreatePartitionsRequest_v0 (#1469)
StephenSorriaux Apr 5, 2018
e23676d
Improve BrokerConnection initialization (#1475)
romulorosa Apr 16, 2018
1c71dfc
Always acquire client lock before coordinator lock to avoid deadlocks…
dpkp Apr 18, 2018
d9e41c8
Fix MemoryRecord bugs re error handling and add test coverage (#1448)
tvoinarovskyi Mar 18, 2018
908ac8f
Add codec validators to record parser and builder for all formats (#1…
tvoinarovskyi Mar 18, 2018
59b0c6f
Added AlterConfigs and DescribeConfigs apis (#1472)
StephenSorriaux Apr 18, 2018
b6ffbaa
Skip flakey SimpleProducer test
dpkp Apr 18, 2018
afc6346
Force lz4 to disable Kafka-unsupported block linking when encoding (#…
mnito Apr 19, 2018
27f939a
Minor doc capitalization cleanup
jeffwidman Apr 24, 2018
9221fcf
Stop using deprecated log.warn()
jeffwidman May 10, 2018
11cf397
Stop shadowing `ConnectionError`
jeffwidman May 10, 2018
c9d783a
Document methods that return None
jeffwidman May 22, 2018
ee26c3f
Ignore MetadataResponses with empty broker list (#1506)
dpkp May 26, 2018
39ebe1d
Improve connection handling when bootstrap list is invalid (#1507)
dpkp May 26, 2018
535d8f6
Retain but deprecate kafka.errors.ConnectionError for compatibility
dpkp May 26, 2018
e81990b
Release 1.4.3
dpkp May 26, 2018
81cda59
Bump version for development
dpkp May 26, 2018
bc4cc43
Don't use `kafka.common` internally
jeffwidman May 28, 2018
9ac3cb1
Document connections_max_idle_ms
jeffwidman Jun 26, 2018
a7d3063
add support for smaller topic metadata fetch during bootstrap (#1541)
andyxning Aug 31, 2018
36b53f4
add kerberos domain name config for gssapi sasl mechanism handshake (…
Aug 31, 2018
5a04bc7
Return future from commit_offsets_async (#1560)
ekimekim Aug 31, 2018
5068229
Clear the metrics dictionary on close. (#1569)
kishorenc Aug 31, 2018
ba7372e
Remove ConsumerTimeout
emord Sep 8, 2018
5825c67
Expose ConsumerRebalanceListener in all
ben-harack Sep 20, 2018
9d30ab8
Add positive tests for headers in record encode/decode
hnousiainen Aug 29, 2018
0ca4313
Expose record headers in ConsumerRecords
hnousiainen Aug 14, 2018
08c7749
Support produce with Kafka record headers
hnousiainen Aug 14, 2018
c96ca37
Merge remote-tracking branch 'upstream/master'
Oct 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ docs/_build
.cache*
.idea/
integration-test/
tests-env/
tests-env/
.pytest_cache/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
- KAFKA_VERSION=0.9.0.1
- KAFKA_VERSION=0.10.2.1
- KAFKA_VERSION=0.11.0.2
- KAFKA_VERSION=1.0.1

sudo: false

Expand Down
179 changes: 179 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,182 @@
# 1.4.3 (May 26, 2018)

Compatibility
* Fix for python 3.7 support: remove 'async' keyword from SimpleProducer (dpkp #1454)

Client
* Improve BrokerConnection initialization time (romulorosa #1475)
* Ignore MetadataResponses with empty broker list (dpkp #1506)
* Improve connection handling when bootstrap list is invalid (dpkp #1507)

Consumer
* Check for immediate failure when looking up coordinator in heartbeat thread (dpkp #1457)

Core / Protocol
* Always acquire client lock before coordinator lock to avoid deadlocks (dpkp #1464)
* Added AlterConfigs and DescribeConfigs apis (StephenSorriaux #1472)
* Fix CreatePartitionsRequest_v0 (StephenSorriaux #1469)
* Add codec validators to record parser and builder for all formats (tvoinarovskyi #1447)
* Fix MemoryRecord bugs re error handling and add test coverage (tvoinarovskyi #1448)
* Force lz4 to disable Kafka-unsupported block linking when encoding (mnito #1476)
* Stop shadowing `ConnectionError` (jeffwidman #1492)

Documentation
* Document methods that return None (jeffwidman #1504)
* Minor doc capitalization cleanup (jeffwidman)
* Adds add_callback/add_errback example to docs (Berkodev #1441)
* Fix KafkaConsumer docstring for request_timeout_ms default (dpkp #1459)

Test Infrastructure
* Skip flakey SimpleProducer test (dpkp)
* Fix skipped integration tests if KAFKA_VERSION unset (dpkp #1453)

Logging / Error Messages
* Stop using deprecated log.warn() (jeffwidman)
* Change levels for some heartbeat thread logging (dpkp #1456)
* Log Heartbeat thread start / close for debugging (dpkp)


# 1.4.2 (Mar 10, 2018)

Bugfixes
* Close leaked selector in version check (dpkp #1425)
* Fix `BrokerConnection.connection_delay()` to return milliseconds (dpkp #1414)
* Use local copies in `Fetcher._fetchable_partitions` to avoid mutation errors (dpkp #1400)
* Fix error var name in `_unpack` (j2gg0s #1403)
* Fix KafkaConsumer compacted offset handling (dpkp #1397)
* Fix byte size estimation with kafka producer (blakeembrey #1393)
* Fix coordinator timeout in consumer poll interface (braedon #1384)

Client
* Add `BrokerConnection.connect_blocking()` to improve bootstrap to multi-address hostnames (dpkp #1411)
* Short-circuit `BrokerConnection.close()` if already disconnected (dpkp #1424)
* Only increase reconnect backoff if all addrinfos have been tried (dpkp #1423)
* Make BrokerConnection .host / .port / .afi immutable to avoid incorrect 'metadata changed' checks (dpkp #1422)
* Connect with sockaddrs to support non-zero ipv6 scope ids (dpkp #1433)
* Check timeout type in KafkaClient constructor (asdaraujo #1293)
* Update string representation of SimpleClient (asdaraujo #1293)
* Do not validate `api_version` against known versions (dpkp #1434)

Consumer
* Avoid tight poll loop in consumer when brokers are down (dpkp #1415)
* Validate `max_records` in KafkaConsumer.poll (dpkp #1398)
* KAFKA-5512: Awake heartbeat thread when it is time to poll (dpkp #1439)

Producer
* Validate that serializers generate bytes-like (or None) data (dpkp #1420)

Core / Protocol
* Support alternative lz4 package: lz4framed (everpcpc #1395)
* Use hardware accelerated CRC32C function if available (tvoinarovskyi #1389)
* Add Admin CreatePartitions API call (alexef #1386)

Test Infrastructure
* Close KafkaConsumer instances during tests (dpkp #1410)
* Introduce new fixtures to prepare for migration to pytest (asdaraujo #1293)
* Removed pytest-catchlog dependency (asdaraujo #1380)
* Fixes racing condition when message is sent to broker before topic logs are created (asdaraujo #1293)
* Add kafka 1.0.1 release to test fixtures (dpkp #1437)

Logging / Error Messages
* Re-enable logging during broker version check (dpkp #1430)
* Connection logging cleanups (dpkp #1432)
* Remove old CommitFailed error message from coordinator (dpkp #1436)


# 1.4.1 (Feb 9, 2018)

Bugfixes
* Fix consumer poll stuck error when no available partition (ckyoog #1375)
* Increase some integration test timeouts (dpkp #1374)
* Use raw in case string overriden (jeffwidman #1373)
* Fix pending completion IndexError bug caused by multiple threads (dpkp #1372)


# 1.4.0 (Feb 6, 2018)

This is a substantial release. Although there are no known 'showstopper' bugs as of release,
we do recommend you test any planned upgrade to your application prior to running in production.

Some of the major changes include:
* We have officially dropped python 2.6 support
* The KafkaConsumer now includes a background thread to handle coordinator heartbeats
* API protocol handling has been separated from networking code into a new class, KafkaProtocol
* Added support for kafka message format v2
* Refactored DNS lookups during kafka broker connections
* SASL authentication is working (we think)
* Removed several circular references to improve gc on close()

Thanks to all contributors -- the state of the kafka-python community is strong!

Detailed changelog are listed below:

Client
* Fixes for SASL support
* Refactor SASL/gssapi support (dpkp #1248 #1249 #1257 #1262 #1280)
* Add security layer negotiation to the GSSAPI authentication (asdaraujo #1283)
* Fix overriding sasl_kerberos_service_name in KafkaConsumer / KafkaProducer (natedogs911 #1264)
* Fix typo in _try_authenticate_plain (everpcpc #1333)
* Fix for Python 3 byte string handling in SASL auth (christophelec #1353)
* Move callback processing from BrokerConnection to KafkaClient (dpkp #1258)
* Use socket timeout of request_timeout_ms to prevent blocking forever on send (dpkp #1281)
* Refactor dns lookup in BrokerConnection (dpkp #1312)
* Read all available socket bytes (dpkp #1332)
* Honor reconnect_backoff in conn.connect() (dpkp #1342)

Consumer
* KAFKA-3977: Defer fetch parsing for space efficiency, and to raise exceptions to user (dpkp #1245)
* KAFKA-4034: Avoid unnecessary consumer coordinator lookup (dpkp #1254)
* Handle lookup_coordinator send failures (dpkp #1279)
* KAFKA-3888 Use background thread to process consumer heartbeats (dpkp #1266)
* Improve KafkaConsumer cleanup (dpkp #1339)
* Fix coordinator join_future race condition (dpkp #1338)
* Avoid KeyError when filtering fetchable partitions (dpkp #1344)
* Name heartbeat thread with group_id; use backoff when polling (dpkp #1345)
* KAFKA-3949: Avoid race condition when subscription changes during rebalance (dpkp #1364)
* Fix #1239 regression to avoid consuming duplicate compressed messages from mid-batch (dpkp #1367)

Producer
* Fix timestamp not passed to RecordMetadata (tvoinarovskyi #1273)
* Raise non-API exceptions (jeffwidman #1316)
* Fix reconnect_backoff_max_ms default config bug in KafkaProducer (YaoC #1352)

Core / Protocol
* Add kafka.protocol.parser.KafkaProtocol w/ receive and send (dpkp #1230)
* Refactor MessageSet and Message into LegacyRecordBatch to later support v2 message format (tvoinarovskyi #1252)
* Add DefaultRecordBatch implementation aka V2 message format parser/builder. (tvoinarovskyi #1185)
* optimize util.crc32 (ofek #1304)
* Raise better struct pack/unpack errors (jeffwidman #1320)
* Add Request/Response structs for kafka broker 1.0.0 (dpkp #1368)

Bugfixes
* use python standard max value (lukekingbru #1303)
* changed for to use enumerate() (TheAtomicOption #1301)
* Explicitly check for None rather than falsey (jeffwidman #1269)
* Minor Exception cleanup (jeffwidman #1317)
* Use non-deprecated exception handling (jeffwidman a699f6a)
* Remove assertion with side effect in client.wakeup() (bgedik #1348)
* use absolute imports everywhere (kevinkjt2000 #1362)

Test Infrastructure
* Use 0.11.0.2 kafka broker for integration testing (dpkp #1357 #1244)
* Add a Makefile to help build the project, generate docs, and run tests (tvoinarovskyi #1247)
* Add fixture support for 1.0.0 broker (dpkp #1275)
* Add kafka 1.0.0 to travis integration tests (dpkp #1365)
* Change fixture default host to localhost (asdaraujo #1305)
* Minor test cleanups (dpkp #1343)
* Use latest pytest 3.4.0, but drop pytest-sugar due to incompatibility (dpkp #1361)

Documentation
* Expand metrics docs (jeffwidman #1243)
* Fix docstring (jeffwidman #1261)
* Added controlled thread shutdown to example.py (TheAtomicOption #1268)
* Add license to wheel (jeffwidman #1286)
* Use correct casing for MB (jeffwidman #1298)

Logging / Error Messages
* Fix two bugs in printing bytes instance (jeffwidman #1296)


# 1.3.5 (Oct 7, 2017)

Bugfixes
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ test27: build-integration
# Test using py.test directly if you want to use local python. Useful for other
# platforms that require manual installation for C libraries, ie. Windows.
test-local: build-integration
py.test --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF kafka test
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) py.test \
--pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF $(FLAGS) kafka test

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

# Check the readme for syntax errors, which can lead to invalid formatting on
Expand Down
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Kafka Python client
------------------------

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

>>> # Access record headers. The returned value is a list of tuples
>>> # with str, bytes for key and value
>>> for msg in consumer:
... print (msg.headers)

>>> # Get consumer metrics
>>> metrics = consumer.metrics()

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

>>> # Include record headers. The format is list of tuples with string key
>>> # and bytes value.
>>> producer.send('foobar', value=b'c29tZSB2YWx1ZQ==', headers=[('content-encoding', b'base64')])

>>> # Get producer performance metrics
>>> metrics = producer.metrics()

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

Low-level
*********
Expand Down
2 changes: 1 addition & 1 deletion build_integration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

: ${ALL_RELEASES:="0.8.2.2 0.9.0.1 0.10.1.1 0.10.2.1 0.11.0.2"}
: ${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"}
: ${SCALA_VERSION:=2.11}
: ${DIST_BASE_URL:=https://archive.apache.org/dist/kafka/}
: ${KAFKA_SRC_GIT:=https://github.com/apache/kafka.git}
Expand Down
Loading