Kafka library in Go
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Fixes some flaky tests in the build as well as the case when tests start before kafka is ready. (#1349) | 1 年前 | |
improve issue templates (#883) * improve issue templates * improve feature request template | 4 年前 | |
Fix various typos and disfluencies (#1118) | 3 年前 | |
[DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go (#1255) * [DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go * [DP-1901] - removing duplicate env in config * [DP-1901] - adding KAFKA_VERSION * [DP-1901] - FIXING KAFKA_VERSION * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - minor fixtures in lint * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - fixing zookeeper connect * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - fixing kafka-011 * [DP-1901] - fixing kafka-011 environment * [DP-1901] - fixing zookeeper kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - Adding AUTHORIZER kafka-011 * [DP-1901] - reset kafka-011 * [DP-1901] - bitnami for kafka-011 * [DP-1901] - bitnami for kafka-011 zookeeper fixtures * [DP-1901] - fixtures to circleci and creating docker_compose_versions folder * [DP-1901] - zookeeper fix * [DP-1901] - fixtures to circleci. removed unsupported kafka * [DP-1901] - fixtures to circleci 2.3.1. fixing examples folder * [DP-1901] - examples docker-compose fix to bitnami * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - Grammatical fixtures in README.md * [DP-1901] - Adding support for v281 and v361 in circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - Creating v361docker and modify circleci * [DP-1901] - Creating v361 docker and modify circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - removing v361 from circleci | 2 年前 | |
[DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go (#1255) * [DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go * [DP-1901] - removing duplicate env in config * [DP-1901] - adding KAFKA_VERSION * [DP-1901] - FIXING KAFKA_VERSION * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - minor fixtures in lint * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - fixing zookeeper connect * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - fixing kafka-011 * [DP-1901] - fixing kafka-011 environment * [DP-1901] - fixing zookeeper kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - Adding AUTHORIZER kafka-011 * [DP-1901] - reset kafka-011 * [DP-1901] - bitnami for kafka-011 * [DP-1901] - bitnami for kafka-011 zookeeper fixtures * [DP-1901] - fixtures to circleci and creating docker_compose_versions folder * [DP-1901] - zookeeper fix * [DP-1901] - fixtures to circleci. removed unsupported kafka * [DP-1901] - fixtures to circleci 2.3.1. fixing examples folder * [DP-1901] - examples docker-compose fix to bitnami * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - Grammatical fixtures in README.md * [DP-1901] - Adding support for v281 and v361 in circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - Creating v361docker and modify circleci * [DP-1901] - Creating v361 docker and modify circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - removing v361 from circleci | 2 年前 | |
Add fixture tests. The fixtures come from actual broker responses, and represent various combinations of message formats, batches, and compression. The pcap files are included with the fixtures to allow folks to inspect them in tools like Wireshark. | 4 年前 | |
Use faster gzip package (#982) * Use faster gzip package Before: ``` BenchmarkCompression/gzip/compress-32 81 13573535 ns/op 8.77 MB/s 10115 B/op 1 allocs/op BenchmarkCompression/gzip/decompress-32 580 2023225 ns/op 959.10 MB/s 7563 B/op 53 allocs/op gzip: 93.86% ``` After: ``` BenchmarkCompression/gzip/compress-32 224 5340019 ns/op 24.42 MB/s 4838 B/op 1 allocs/op BenchmarkCompression/gzip/decompress-32 692 1713771 ns/op 1132.28 MB/s 566 B/op 34 allocs/op gzip: 93.28% ```` Pretty typical scenario for default settings, 2-3x faster, sometimes at a slight compression loss. This provides a much better "default" trade-off than the stdlib. For people regretting the 0.6% loss the higher compression levels can be used. Decompression typically has even bigger margin, but it depends on the input. * Use gz as import alias. | 3 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Add RawProduce API (#1233) | 2 年前 | |
Update SCRAM dependency (#1108) xdg/scram was moved to xdg-go/scram, the original no longer gets updated | 3 年前 | |
Fixes some flaky tests in the build as well as the case when tests start before kafka is ready. (#1349) | 1 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Add fixture tests. The fixtures come from actual broker responses, and represent various combinations of message formats, batches, and compression. The pcap files are included with the fixtures to allow folks to inspect them in tools like Wireshark. | 4 年前 | |
Updated Writer and Reader docs to show use of multiple brokers. (#959) Based on the discussion [here](https://github.com/segmentio/kafka-go/issues/894#issuecomment-1199788686) | 4 年前 | |
add consumer group apis to client (#943) * add consumer group apis to client JoinGroup,SyncGroup,LeaveGroup | 4 年前 | |
Add Code of Conduct and Contribution Guidelines (#699) * Add Code of Conduct and Contribution Guidelines Add a full Code of Conduct and Code Contribution Guidelines document. Provide description on how best to retrieve code, fork, checkout, and commit changes. Fixes #688 * Update steps for git push * Update based on PR comments Removed several linkable sections in the Code of Conduct. Update contributing to use kafka-go consistently. Finished explaining how to replace the original version with forked version of the library. * Update based on further feedback * Adjust to follow the twilio-go code of contact | 4 年前 | |
Add Code of Conduct and Contribution Guidelines (#699) * Add Code of Conduct and Contribution Guidelines Add a full Code of Conduct and Code Contribution Guidelines document. Provide description on how best to retrieve code, fork, checkout, and commit changes. Fixes #688 * Update steps for git push * Update based on PR comments Removed several linkable sections in the Code of Conduct. Update contributing to use kafka-go consistently. Finished explaining how to replace the original version with forked version of the library. * Update based on further feedback * Adjust to follow the twilio-go code of contact | 4 年前 | |
update README | 9 年前 | |
Makefile: use docker compose not docker-compose (#1309) As part of the Docker binary this will be updated more often and has better support and newer features than the separate "docker-compose" binary. | 2 年前 | |
[DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go (#1255) * [DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go * [DP-1901] - removing duplicate env in config * [DP-1901] - adding KAFKA_VERSION * [DP-1901] - FIXING KAFKA_VERSION * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - minor fixtures in lint * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - fixing zookeeper connect * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - fixing kafka-011 * [DP-1901] - fixing kafka-011 environment * [DP-1901] - fixing zookeeper kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - Adding AUTHORIZER kafka-011 * [DP-1901] - reset kafka-011 * [DP-1901] - bitnami for kafka-011 * [DP-1901] - bitnami for kafka-011 zookeeper fixtures * [DP-1901] - fixtures to circleci and creating docker_compose_versions folder * [DP-1901] - zookeeper fix * [DP-1901] - fixtures to circleci. removed unsupported kafka * [DP-1901] - fixtures to circleci 2.3.1. fixing examples folder * [DP-1901] - examples docker-compose fix to bitnami * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - Grammatical fixtures in README.md * [DP-1901] - Adding support for v281 and v361 in circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - Creating v361docker and modify circleci * [DP-1901] - Creating v361 docker and modify circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - removing v361 from circleci | 2 年前 | |
Fix spelling errors reported by misspell (#750) * fix formatting + require Go 1.15 * fix spelling errors | 4 年前 | |
Fixes some flaky tests in the build as well as the case when tests start before kafka is ready. (#1349) | 1 年前 | |
Fix spelling errors reported by misspell (#750) * fix formatting + require Go 1.15 * fix spelling errors | 4 年前 | |
Add AddOffsetsToTxn function to Client (#739) Implement the AddOffsetsToTxn protocol and request types. Add Client function AddOffsetsToTxn. | 4 年前 | |
add port to SASL metadata (#780) | 4 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
wrap errors with makeError | 3 年前 | |
wrap errors with makeError | 3 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Changed AlterPartitionReassignments request to support multiple topics (#1204) * changed AlterPartitionReassignments request to support multiple topics * keep compatibility with existing code. | 2 年前 | |
Changed AlterPartitionReassignments request to support multiple topics (#1204) * changed AlterPartitionReassignments request to support multiple topics * keep compatibility with existing code. | 2 年前 | |
support userscramcredentials apis (#1168) * userscramcredentials protocols * alteruserscramcredentials working * describeuserscramcredentials working * gofmt -s -w alteruserscramcredentials_test.go * fix typo * add tests for deletion * gofmt * improve test * separate alteruserscramcredentials_test and describeuserscramcredentials_test * add protocol tests * remove unused v1 constant * change iterations from int32 to int * keep errors with results | 3 年前 | |
support userscramcredentials apis (#1168) * userscramcredentials protocols * alteruserscramcredentials working * describeuserscramcredentials working * gofmt -s -w alteruserscramcredentials_test.go * fix typo * add tests for deletion * gofmt * improve test * separate alteruserscramcredentials_test and describeuserscramcredentials_test * add protocol tests * remove unused v1 constant * change iterations from int32 to int * keep errors with results | 3 年前 | |
Misc. fixes in response to code review feedback | 5 年前 | |
Return error if updating configs for multiple brokers in same request | 5 年前 | |
fix: data race in roundrobin balancer (#1251) | 2 年前 | |
Add Chunk Size to RR Balancer (Increased Batching Ability) (#1232) * Add Chunk Size to RR Balancer | 2 年前 | |
Use buffer pool for decompressed buffer (#1063) * Use buffer pool for decompressed buffer * Address review comments | 3 年前 | |
Improving some internal error-handling (#846) * refactor: use more errors.Is to allow errors to be wrapped more safely * refactor(dialer): wrap returned errors with context * refactor: decorate more errors * revert some error wrap changes to reduce PR noise * revert conn changes | 4 年前 | |
recycle compression buffers (#320) | 6 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Improving some internal error-handling (#846) * refactor: use more errors.Is to allow errors to be wrapped more safely * refactor(dialer): wrap returned errors with context * refactor: decorate more errors * revert some error wrap changes to reduce PR noise * revert conn changes | 4 年前 | |
enable errorlint linter and fix issues (#914) | 4 年前 | |
Internally, kafka-go offset is consistent with itself. Unfortunately, not with the rest of the world. The commit offset should be the offset of the next message to read and NOT the last message read. Verified by running sarama and kafka-go sequentially to verify they picked up each others offsets. (#62) Seeing as you were working in commits, I thought I would hop on your commit. | 8 年前 | |
Internally, kafka-go offset is consistent with itself. Unfortunately, not with the rest of the world. The commit offset should be the offset of the next message to read and NOT the last message read. Verified by running sarama and kafka-go sequentially to verify they picked up each others offsets. (#62) Seeing as you were working in commits, I thought I would hop on your commit. | 8 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
fix; remove runtime.Gosched (#1086) | 3 年前 | |
fix issue 971 (#973) * fix issue 971 * fix int => int32 * fix TestMakeBrokersOneMissing * update documentation | 3 年前 | |
fix typo (#1302) | 2 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
don't use io.StringWriter (#337) | 6 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
add methods for parsing and stringifying acl related resources (#1218) * Add methods for marshalling/unmarshalling ACLOperationType and ACLPermissionType * Fix unknown types * Implement ResourceType * make function ordering more consistent * add patterntype and resourcetype * make capitalization consistent * add comment and test around ResourceTypeBroker and ResourceTypeCluster having same value | 2 年前 | |
add methods for parsing and stringifying acl related resources (#1218) * Add methods for marshalling/unmarshalling ACLOperationType and ACLPermissionType * Fix unknown types * Implement ResourceType * make function ordering more consistent * add patterntype and resourcetype * make capitalization consistent * add comment and test around ResourceTypeBroker and ResourceTypeCluster having same value | 2 年前 | |
Add DescribeConfigs, AlterConfigs & CreatePartition implementation | 5 年前 | |
Makes Assignments nullable in createpartitions RequestTopic (#758) | 4 年前 | |
CreateTopics: only suppress topic already exists errors | 3 年前 | |
check conn Close error | 3 年前 | |
Deleteacls support (#1174) * support deleteacls * add deleteacls_test * add protocol test * test that acl was deleted * trigger build | 2 年前 | |
Deleteacls support (#1174) * support deleteacls * add deleteacls_test * add protocol test * test that acl was deleted * trigger build | 2 年前 | |
Add DeleteGroups function to Client (#1095) * Add DeleteGroups function to Client * goimports * set minimum Kafka version * goimports * improvements | 3 年前 | |
Add DeleteGroups function to Client (#1095) * Add DeleteGroups function to Client * goimports * set minimum Kafka version * goimports * improvements | 3 年前 | |
all: fix spelling errors (#1120) | 3 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Support describeacls (#1166) * Support describeacls * gofmt -s -w createacl_test.go * make test diff smaller and fix protocl api key * fix another protocol api key * improve test name * protocol fixes * add missing patterntype * fix createacls protocol * fix tags and add tagged fields back in * bump createacls version to v3 * wip * just one filter, not a list of filters * add missing patterntype in test * fix patterntype location * add prototests * createacl_test.go -> createacls_test.go * seperate createacls_test and describeacls_test * fix describeaclstest * add comment for ResourcePatternTypeFilter | 3 年前 | |
Support describeacls (#1166) * Support describeacls * gofmt -s -w createacl_test.go * make test diff smaller and fix protocl api key * fix another protocol api key * improve test name * protocol fixes * add missing patterntype * fix createacls protocol * fix tags and add tagged fields back in * bump createacls version to v3 * wip * just one filter, not a list of filters * add missing patterntype in test * fix patterntype location * add prototests * createacl_test.go -> createacls_test.go * seperate createacls_test and describeacls_test * fix describeaclstest * add comment for ResourcePatternTypeFilter | 3 年前 | |
remove unnecessary kafka tags in describeclientquotas.go | 3 年前 | |
Removed the outdated part of the documentation (#1030) * Removed the outdated part of the documentation * Corrected an inaccuracy in the field description | 3 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Remove deprecated groups api | 4 年前 | |
support userscramcredentials apis (#1168) * userscramcredentials protocols * alteruserscramcredentials working * describeuserscramcredentials working * gofmt -s -w alteruserscramcredentials_test.go * fix typo * add tests for deletion * gofmt * improve test * separate alteruserscramcredentials_test and describeuserscramcredentials_test * add protocol tests * remove unused v1 constant * change iterations from int32 to int * keep errors with results | 3 年前 | |
support userscramcredentials apis (#1168) * userscramcredentials protocols * alteruserscramcredentials working * describeuserscramcredentials working * gofmt -s -w alteruserscramcredentials_test.go * fix typo * add tests for deletion * gofmt * improve test * separate alteruserscramcredentials_test and describeuserscramcredentials_test * add protocol tests * remove unused v1 constant * change iterations from int32 to int * keep errors with results | 3 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Support metadata request v6 (#1013) * Support metadata request v6 * Empty commit to trigger circleci * Another empty commit * Fix TestDialer, add OfflineReplicas to expected response. * Fix tests I'm assuming it's ok to send AllowAutoTopicCreation: true in metadata v6 request, since server auto.create.topics.enable controls this anyway. * Set OfflineReplicas to empty array when it doesn't exist in the v1 response. Maybe fixing TestDialer for old kafkas * Fix returning errors from readTopicMetadataV1/6. | 3 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
enable errorlint linter and fix issues (#914) | 4 年前 | |
[DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go (#1255) * [DP-1901] - Convert Wurstmeister Kafka image to Bitnami for Kafka-go * [DP-1901] - removing duplicate env in config * [DP-1901] - adding KAFKA_VERSION * [DP-1901] - FIXING KAFKA_VERSION * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - minor fixtures in lint * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - minor fixtures to KAFKA_VERSION * [DP-1901] - fixing zookeeper connect * [DP-1901] - fixing KAFKA_VERSION to 0.10.2.1 * [DP-1901] - fixing kafka-011 * [DP-1901] - fixing kafka-011 environment * [DP-1901] - fixing zookeeper kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - fixing KAFKA_VERSION kafka-011 * [DP-1901] - Adding AUTHORIZER kafka-011 * [DP-1901] - reset kafka-011 * [DP-1901] - bitnami for kafka-011 * [DP-1901] - bitnami for kafka-011 zookeeper fixtures * [DP-1901] - fixtures to circleci and creating docker_compose_versions folder * [DP-1901] - zookeeper fix * [DP-1901] - fixtures to circleci. removed unsupported kafka * [DP-1901] - fixtures to circleci 2.3.1. fixing examples folder * [DP-1901] - examples docker-compose fix to bitnami * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - minor README.md fixtures * [DP-1901] - Grammatical fixtures in README.md * [DP-1901] - Adding support for v281 and v361 in circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - Creating v361docker and modify circleci * [DP-1901] - Creating v361 docker and modify circleci * [DP-1901] - touch README.md for circleci trigger * [DP-1901] - removing v361 from circleci | 2 年前 | |
Misc. fixes in response to code review feedback | 5 年前 | |
Improve error checking in tests | 5 年前 | |
Fix spelling errors reported by misspell (#750) * fix formatting + require Go 1.15 * fix spelling errors | 4 年前 | |
Add ErrorType method to MessageTooLargeError (#1311) * Add ErrorType method to MessageTooLargeError struct to support functionality with the errors.Is function. See #1293 * implement the unwrap method to satisfy errors.Is * support error interface for unwrap | 1 年前 | |
Add ErrorType method to MessageTooLargeError (#1311) * Add ErrorType method to MessageTooLargeError struct to support functionality with the errors.Is function. See #1293 * implement the unwrap method to satisfy errors.Is * support error interface for unwrap | 1 年前 | |
enable errorlint linter and fix issues (#914) | 4 年前 | |
Fix go vet issues: example tests, returning a mutex copy (#783) Example tests are renamed to fit required naming conventions. This caused them to be relocated in generated docs. Also, a problem with writer.newBatchQueue is fixed; in order to avoid an unnecessary copy of a newly created object holding a mutex, the mutex field within batchQueue is now a pointer, so that copying on return doesn't copy the mutex itself. The same treatment is needed for the cond field; the same no-copy rule applies to it. | 4 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Fix various typos and disfluencies (#1118) | 3 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
add consumer group apis to client (#943) * add consumer group apis to client JoinGroup,SyncGroup,LeaveGroup | 4 年前 | |
Bump golang.org/x/net from 0.7.0 to 0.17.0 (#1209) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.7.0 to 0.17.0. - [Commits](https://github.com/golang/net/compare/v0.7.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2 年前 | |
Bump golang.org/x/net from 0.7.0 to 0.17.0 (#1209) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.7.0 to 0.17.0. - [Commits](https://github.com/golang/net/compare/v0.7.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
Misc. fixes in response to code review feedback | 5 年前 | |
Clean up APIs and add tests | 5 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
run tests against unsafe tag as well (#1159) * run tests against unsafe tag as well * differentiate test step name * use random transactional id | 3 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
Support metadata request v6 (#1013) * Support metadata request v6 * Empty commit to trigger circleci * Another empty commit * Fix TestDialer, add OfflineReplicas to expected response. * Fix tests I'm assuming it's ok to send AllowAutoTopicCreation: true in metadata v6 request, since server auto.create.topics.enable controls this anyway. * Set OfflineReplicas to empty array when it doesn't exist in the v1 response. Maybe fixing TestDialer for old kafkas * Fix returning errors from readTopicMetadataV1/6. | 3 年前 | |
Reader: allow config to return OffsetOutOfRange errors (#917) | 4 年前 | |
add consumer group apis to client (#943) * add consumer group apis to client JoinGroup,SyncGroup,LeaveGroup | 4 年前 | |
fix typos in group structs (#946) | 4 年前 | |
Misc. fixes in response to code review feedback | 5 年前 | |
Make writer tests more reliable | 4 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Implementation of ListPartitionReassignments API (#1203) * implemented ListPartitionReassignments API. * fix nullable * fix lint * fix tag. | 2 年前 | |
Implementation of ListPartitionReassignments API (#1203) * implemented ListPartitionReassignments API. * fix nullable * fix lint * fix tag. | 2 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
ensure message headers are including for batching decision | 3 年前 | |
Don't invoce r.log() if not r.debug (#1110) Profiling shows that up to 40% of our allocations happen in r.markRead(): just to allocate a slice to pass the "remain" arg, which will be discarded because we don't run with r.debug=true. This makes the code slightly verbose, having to check the debug mode before invoking r.log(), but it's a huge difference in high-throughput applications. Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> | 3 年前 | |
enable errorlint linter and fix issues (#914) | 4 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Add Offsetcommit to Client (#735) * add OffsetCommit API Co-authored-by: Achille Roussel <achille@segment.com> | 4 年前 | |
Add Offsetcommit to Client (#735) * add OffsetCommit API Co-authored-by: Achille Roussel <achille@segment.com> | 4 年前 | |
Support for offsetdelete (#1010) * support for offsetdelete * gate test for proper kafka version * add test for offsetdelete response * fixed word in comment | 3 年前 | |
Support for offsetdelete (#1010) * support for offsetdelete * gate test for proper kafka version * add test for offsetdelete response * fixed word in comment | 3 年前 | |
offsetfetch request topics are now nullable (#1162) * offsetfetch request topics are now nullable * new unit tests for offsetfetch was added | 3 年前 | |
offsetfetch request topics are now nullable (#1162) * offsetfetch request topics are now nullable * new unit tests for offsetfetch was added | 3 年前 | |
all: fix spelling errors (#1120) | 3 年前 | |
add encoding.TextMarshaler and encoding.TextUnmarshaler implementations (#754) * add encoding.TextMarshaler and encoding.TextUnmarshaler implementations * support numeric codes as well * PR feedback | 4 年前 | |
Support metadata request v6 (#1013) * Support metadata request v6 * Empty commit to trigger circleci * Another empty commit * Fix TestDialer, add OfflineReplicas to expected response. * Fix tests I'm assuming it's ok to send AllowAutoTopicCreation: true in metadata v6 request, since server auto.create.topics.enable controls this anyway. * Set OfflineReplicas to empty array when it doesn't exist in the v1 response. Maybe fixing TestDialer for old kafkas * Fix returning errors from readTopicMetadataV1/6. | 3 年前 | |
Support metadata request v6 (#1013) * Support metadata request v6 * Empty commit to trigger circleci * Another empty commit * Fix TestDialer, add OfflineReplicas to expected response. * Fix tests I'm assuming it's ok to send AllowAutoTopicCreation: true in metadata v6 request, since server auto.create.topics.enable controls this anyway. * Set OfflineReplicas to empty array when it doesn't exist in the v1 response. Maybe fixing TestDialer for old kafkas * Fix returning errors from readTopicMetadataV1/6. | 3 年前 | |
Add RawProduce API (#1233) | 2 年前 | |
Add RawProduce API (#1233) | 2 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
enable errorlint linter and fix issues (#914) | 4 年前 | |
Fix RetentionTime error in documentation default is -1 (#1260) | 2 年前 | |
Fixes some flaky tests in the build as well as the case when tests start before kafka is ready. (#1349) | 1 年前 | |
Fixes tiny typo (#875) | 4 年前 | |
Extract record batch structure (#314) * Replace argument of writeProduceRequestV3 * Calculate recordBatch size in init * Extract writeTo method for record batch * Extract recordBatch processing from ProduceRequestV7 * Add constructor for record batch | 6 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
add methods for parsing and stringifying acl related resources (#1218) * Add methods for marshalling/unmarshalling ACLOperationType and ACLPermissionType * Fix unknown types * Implement ResourceType * make function ordering more consistent * add patterntype and resourcetype * make capitalization consistent * add comment and test around ResourceTypeBroker and ResourceTypeCluster having same value | 2 年前 | |
add methods for parsing and stringifying acl related resources (#1218) * Add methods for marshalling/unmarshalling ACLOperationType and ACLPermissionType * Fix unknown types * Implement ResourceType * make function ordering more consistent * add patterntype and resourcetype * make capitalization consistent * add comment and test around ResourceTypeBroker and ResourceTypeCluster having same value | 2 年前 | |
kafka.writeBuffer (#318) * add kafka.writeBuffer * fix crc32 computation | 6 年前 | |
kafka.writeBuffer (#318) * add kafka.writeBuffer * fix crc32 computation | 6 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
kafka.writeBuffer (#318) * add kafka.writeBuffer * fix crc32 computation | 6 年前 | |
build: add golangci-lint to circleci config (#907) | 4 年前 | |
Add count/sum to SummaryStats and DurationStats. (#1106) | 3 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
Revert client consumer group (#1027) * Revert "Fixes for consumer group (#1022)" This reverts commit a5f270df2cd091885d07a9a9d59fbaa33fcc2b59. * Revert "Refactor Consumer Group to use Client (#947)" This reverts commit ee37c7fdd7feb0763d513e9372f69756725dca84. | 3 年前 | |
0.4 (#438) * add protocol package * add some documentation * fix * make ByteSequence more generic + add more benchmarks * WIP: add support for record batches * finish support for record batches * add support for recort set compression * backward-compatible compression codec imports * fix compress tests * make it possible for the transport to connect to multiple clusters + enhance kafka.Client to expose methods for creating and deleting topics * support responding to metadata requests with cached response * manage proper shutdown of client transport in tests * WIP: test Produce API * WIP: massive cleanup + track down CRC32 validation issue * functional Produce and Fetch implementations * add metadata request/response * add listoffsets API * expose cluster id and controller in metadata response * remove bufio.Writer from the protocol API * remove bufio.Reader from the protocol API * add back deprecated Client methods * fixes for kafka 0.10 * cleanup comment in protocol/record.go * add more comments * reduce size of bufio.Reader buffer on kafka connections * refactor transport internals to support splitting requests and dispatching them across multiple brokers * avoid contention on connection pool mutex in most cases * cleanup * add kafka.(*Client).MultiFetch API * close records in produce request * refactor record batch APIs to fully support streaming * remove io.Closer from protocol.RecordBatch * never return nil record batches * record batch fixes * remove unused variable * fix reading of multiple topic partitions in produce and fetch messages * alias compress.Compression in the kafka package * expose compression constants in the kafka package * exposes kafka.Request and kafka.Response interfaces * simplify the protocol.Bytes interface * simplify error management in protocol package * wait for topic creation to propagate + fix request dispatching in multi-broker clusters * simplify kafka.(*Client).CreateTopics API * improve error handling + wait for metadata propagation after topic creation * revisit connection pool implementation to remove multiplexing * fix panic when referencing truncated page buffer * fix unexpected EOF errors reading kafka messages * revisit record reader API * fix panic type asserting nil response into *metadata.Response * optimize allocation of broker ids in cluster metadata * unify sync.Pool usage * reduce memory footprint of protocol.(*RecordSet).readFromVersion2 * fix panic accessing optimized record reader with a nil headers slice * add APIs for marshaling and unmarshaling kafka values * [skip ci] fix README example * investigate-multi-fetch-issues * remove MultiFetch API * simplify protocol tests * add benchmarks for kafka.Marshal and kafka.Unmarshal * fix crash on cluster layout changes * add more error codes * remove partial support for flexible message format * downgrade metadata test from v9 to v8 * test against kafka 2.5.0 * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * Update offsetfetch.go Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> * fix typos * fix more typos * set pprof labels on transport goroutines (#458) * change tests to run against 2.4.1 instead of 2.5.0 * support up to 2.3.1 (TestConn/nettest/PingPong fails with 2.4 and above) * Update README.md Co-authored-by: Steve van Loben Sels <steve@segment.com> * Update client.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * comment on why we devide the timeout by 2 * protocol.Reducer => protocol.Merger * cleanup docker-compose.yml * protocol.Mapper => protocol.Splitter * propagate the caller's context to the dial function (#460) * fix backward compatiblity with kafka-go v0.3.x * fix record offsets when fetching messages with version 1 * default record timestamps to current timestamp * revert changes to docker-compose.yml * fix tests * fix tests (2) * 0.4: kafka.Writer (#461) * 0.4: kafka.Writer * update README * disable some parallel tests * disable global parallelism in tests * fix typo * disable parallelism in sub-packages tests * properly seed random sources + delete test topics * cleanup build * run all tests * fix tests * enable more SASL mechanisms on CI * try to fix the CI config * try testing the sasl package with 2.3.1 only * inline configuration for kafka 2.3.1 in CI * fix zookeeper hostname in CI * cleanup CI config * keep the kafka 0.10 configuration separate + test against more kafka versions * fix kafka 0.11 image tag * try caching dependencies * support multiple broker addresses * uncomment max attempt test * fix typos * guard against empty kafka.MultiAddr in kafka.Transport * don't export new APIs for network addresses + adapt to any multi-addr implementation * add comment about the transport caching the metadata responses * 0.4 fix tls address panic (#478) * 0.4: fix panic when TLS is enabled * 0.4: fix panic when establishing TLS connections * cleanup * Update transport_test.go Co-authored-by: Steve van Loben Sels <steve@segment.com> * validate that an error is returned Co-authored-by: Steve van Loben Sels <steve@segment.com> * 0.4: fix short writes (#479) * 0.4: modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence (#485) * modify protocol.Bytes to expose the number of remaining bytes instead of the full size of the sequence * add test for pageRef.ReadByte + fix pageRef.scan * reuse contiguousPages.scan * fix(writer): set correct balancer (#489) Sets the correct balancer as passed through in the config on the writer Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> * Fix for panic when RequiredAcks is set to RequireNone (#504) * Fix panic in async wait() method when RequiredAcks is None When RequiredAcks is None, the producer does not wait for a response from the broker, therefore the response is nil. The async wait() method was not handling this case, leading to a panic. * Add regression test for RequiredAcks == RequireNone This new test is required because all the other Writer tests use NewWriter() to create Writers, which sets RequiredAcks to RequireAll when 0 (None) was specified. * fix: writer test for RequiredAcks=None * fix: writer tests for RequiredAcks=None (2) * 0.4 broker resolver (#526) * 0.4: kafka.BrokerResolver * add kafka.Transport.Context * inline network and address fields in conn type * Fix sasl authentication on writer (#541) The authenticateSASL was called before getting api version. This resulted incorrect apiversion (0 instead of 1) when calling saslHandshakeRoundTrip request * Remove deprecated function (NewWriter) usages (#528) * fix zstd decoder leak (#543) * fix zstd decoder leak * fix tests * fix panic * fix tests (2) * fix tests (3) * fix tests (4) * move ConnWaitGroup to testing package * fix zstd codec * Update compress/zstd/zstd.go Co-authored-by: Nicholas Sun <olassun2@gmail.com> * PR feedback Co-authored-by: Nicholas Sun <olassun2@gmail.com> * improve custom resolver support by allowing port to be overridden (#545) * 0.4: reduce memory footprint (#547) * Bring over flexible message changes * Add docker-compose config for kafka 2.4.1 * Misc. cleanups * Add protocol tests and fix issues * Misc. fixes; run circleci on v2.4.1 * Skip conntest for v2.4.1 * Disable nettests for kafka 2.4.1 * Revert formatting changes * Misc. fixes * Update comments * Make create topics test more interesting * feat(writer): add support for writing messages to multiple topics (#561) * Add comments on failing nettests * Fix spacing * Update var int sizing * Simplify writeVarInt implementation * Revert encoding change * Simplify varint encoding functions and expand tests * Also test sizeOf functions in protocol test * chore: merge master and resolve conflicts (#570) Co-authored-by: Jeremy Jackins <jeremyjackins@gmail.com> Co-authored-by: Steve van Loben Sels <steve@segment.com> Co-authored-by: Artur <artur.kronenberg@askattest.com> Co-authored-by: Neil Cook <neil.cook@noware.co.uk> Co-authored-by: Ahmy Yulrizka <yulrizka@users.noreply.github.com> Co-authored-by: Turfa Auliarachman <t.auliarachman@gmail.com> Co-authored-by: Nicholas Sun <olassun2@gmail.com> Co-authored-by: Dominic Barnes <dominic@segment.com> Co-authored-by: Benjamin Yolken <benjamin.yolken@segment.com> Co-authored-by: Benjamin Yolken <54862872+yolken-segment@users.noreply.github.com> | 5 年前 | |
Fix unnecessary topic metadata requests | 3 年前 | |
Skip refresh metadata for errored topic, fix #806 (#820) * Skip refresh metadata for errored topic. Skip refrash metadata in roundTrip about errored topic, such as write message to a not exist topic, kafka will response error UNKNOWN_TOPIC_OR_PARTITION to the topic, it causes indefinitely metadata refreshing. Fixes #806 * Create unit test to detect issue #806 | 4 年前 | |
Add TxnOffsetCommit to Client (#741) | 4 年前 | |
Fixes some flaky tests in the build as well as the case when tests start before kafka is ready. (#1349) | 1 年前 | |
add kafka.ApiVersion.Format (#395) * add kafka.ApiVersion.Format * set explicit constant values intead of using iota | 6 年前 | |
fix formatting + require Go 1.15 (#749) | 4 年前 | |
writer: use 'halve' instead of 'half' (#1273) | 2 年前 | |
Fix config related stats for a default config (#1202) | 2 年前 |
kafka-go
动机
Segment 在日常运作中高度依赖于 Go 和 Kafka。然而,在撰写本文时,可用的 Go 客户端库对于 Kafka 的支持并不令人满意。可选方案如下:
-
sarama:这是最流行的选项,但使用起来颇为复杂。文档不足,API 暴露了 Kafka 协议的底层概念,并且不支持诸如上下文(context)这样的现代 Go 特性。此外,它采用指针传递所有值的方式导致了大量的动态内存分配,频繁的垃圾回收和较高的内存消耗。
-
confluent-kafka-go:这是一个基于 cgo 缠绕 librdkafka 的封装,意味着在所有使用此包的 Go 代码中引入了一个对 C 库的依赖。相较于 sarama,它的文档更加详尽,但仍缺乏对 Go 上下文的支持。
-
goka:这是一个较新的 Kafka 的 Go 客户端,专注于特定的使用模式。它提供了用于服务间消息总线而非有序事件日志的抽象接口,但这并非我们在 Segment 使用 Kafka 的常见场景。该包还依赖于 sarama 进行所有与 Kafka 的交互。
正是在这种背景下,kafka-go 应运而生。它提供了一整套从低到高的 API 来与 Kafka 进行交互,模仿并实现了 Go 标准库中的概念和接口,便于集成现有软件,易于上手。
注意:
为了更好地与我们新采纳的行为准则保持一致,kafka-go 项目已将其默认分支重命名为 main。关于我们的行为准则详情,请参阅 这份 文件。
Kafka 版本
kafka-go 目前针对 Kafka 0.10.1.0 至 2.7.1 版本进行了测试。虽然它也应与更高版本兼容,但是 Kafka API 中新增的功能可能尚未在客户端实现。
Go 版本
kafka-go 需要使用 Go 1.15 或更高版本。
连接 
Conn 类型是 kafka-go 包的核心部分,它围绕原生网络连接,暴露一个可以访问 Kafka 服务器的低级别 API。
以下是一些展示如何典型使用连接对象的示例:
// 发送消息至主题
topic := "my-topic"
partition := 0
conn, err := kafka.DialLeader(context.Background(), "tcp", "localhost:9092", topic, partition)
if err != nil {
log.Fatal("无法建立与领导者连接:", err)
}
conn.SetWriteDeadline(time.Now().Add(10 * time.Second))
_, err = conn.WriteMessages(
kafka.Message{Value: []byte("一条!")},
kafka.Message{Value: []byte("两条!")},
kafka.Message{Value: []byte("三条!")},
)
if err != nil {
log.Fatal("写入消息失败:", err)
}
if err := conn.Close(); err != nil {
log.Fatal("关闭写操作出错:", err)
}
// 接收消息自主题
topic := "my-topic"
partition := 0
conn, err := kafka.DialLeader(context.Background(), "tcp", "localhost:9092", topic, partition)
if err != nil {
log.Fatal("无法建立与领导者连接:", err)
}
conn.SetReadDeadline(time.Now().Add(10 * time.Second))
batch := conn.ReadBatch(10e3, 1e6) // 获取至少10KB,最多1MB的数据
b := make([]byte, 10e3) // 每条消息最大10KB
for {
n, err := batch.Read(b)
if err != nil {
break
}
fmt.Println(string(b[:n]))
}
if err := batch.Close(); err != nil {
log.Fatal("批量读取关闭错误:", err)
}
if err := conn.Close(); err != nil {
log.Fatal("连接关闭失败:", err)
}
创建主题
默认情况下,Kafka 设定 auto.create.topics.enable='true' (在 bitnami/kafka Kafka Docker 映像中为 KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE='true')。如果这个值设为 'true' ,那么通过 kafka.DialLeader 可以作为副效果创建主题,例如:
// 当 auto.create.topics.enable='true' 时创建主题
conn, err := kafka.DialLeader(context.Background(), "tcp", "localhost:9092", "my-topic", 0)
if err != nil {
panic(err.Error())
}
若 auto.create.topics.enable='false',则需要明确地创建主题,过程如下:
// 当 auto.create.topics.enable='false' 时创建主题
topic := "my-topic"
conn, err := kafka.Dial("tcp", "localhost:9092")
if err != nil {
panic(err.Error())
}
defer conn.Close()
controller, err := conn.Controller()
if err != nil {
panic(err.Error())
}
var controllerConn *kafka.Conn
controllerConn, err = kafka.Dial("tcp", net.JoinHostPort(controller.Host, strconv.Itoa(controller.Port)))
if err != nil {
panic(err.Error())
}
defer controllerConn.Close()
topicConfigs := []kafka.TopicConfig{
{
Topic: topic,
NumPartitions: 1,
ReplicationFactor: 1,
},
}
err = controllerConn.CreateTopics(topicConfigs...)
if err != nil {
panic(err.Error())
}
经由非领导节点连接至领导节点
// 不直接使用 DialLeader 而是经由现有的非领导者节点连接至 Kafka 领导者
conn, err := kafka.Dial("tcp", "localhost:9092")
if err != nil {
panic(err.Error())
}
defer conn.Close()
controller, err := conn.Controller()
if err != nil {
panic(err.Error())
}
var connLeader *kafka.Conn
connLeader, err = kafka.Dial("tcp", net.JoinHostPort(controller.Host, strconv.Itoa(controller.Port)))
if err != nil {
panic(err.Error())
}
defer connLeader.Close()
列举主题
conn, err := kafka.Dial("tcp", "localhost:9092")
if err != nil {
panic(err.Error())
}
defer conn.Close()
partitions, err := conn.ReadPartitions()
if err != nil {
panic(err.Error())
}
m := map[string]struct{}{}
for _, p := range partitions {
m[p.Topic] = struct{}{}
}
for k := range m {
fmt.Println(k)
}
由于它是低级别的,Conn 类型成为构建更高级别抽象(如 Reader)的理想基石。
读取器 
Reader 是 kafka-go 包提供的另一个概念,旨在简化单个主题-分区组合消费的常见用例。
Reader 同时自动处理重新连接和偏移管理问题,并提供支持 Go 上下文中异步取消和超时机制的 API。
重要的是在进程退出时调用 Close() 方法来关闭 Reader 。Kafka 服务器需要一个优雅断开连接的过程来阻止其继续尝试向已连接的客户端发送消息。上述示例不会在进程被 SIGINT(shell 下的 Ctrl-C)或 SIGTERM(如 Docker 停止命令或 Kubernetes 重启动作)终止时调用 Close() 。这可能会导致当同一个主题的新读取器连接时出现延迟(比如启动新进程或运行新容器)。可以通过设置 signal.Notify 处理器实现在进程关机时关闭读取器。
// 创建一个新的读取器,从主题 A,分区 0,偏移量 42 开始消费
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092","localhost:9093", "localhost:9094"},
Topic: "topic-A",
Partition: 0,
MaxBytes: 10e6, // 10MB
})
r.SetOffset(42)
for {
m, err := r.ReadMessage(context.Background())
if err != nil {
break
}
fmt.Printf("偏移量 %d 的消息: %s = %s\n", m.Offset, string(m.Key), string(m.Value))
}
if err := r.Close(); err != nil {
log.Fatal("读取器关闭失败:", err)
}
消费者群组
kafka-go也支持Kafka的消费者群组和由代理管理的偏移量。
要启用消费者群组,只需在ReaderConfig中指定GroupID。
使用消费者群组时,ReadMessage会自动提交偏移量。
// 创建一个消费"topic-A"的新阅读器
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: {"localhost:9092", "localhost:9093", "localhost:9094"},
GroupID: "consumer-group-id",
Topic: "topic-A",
MaxBytes: 10e6, // 10MB
})
for {
m, err := r.ReadMessage(context.Background())
if err != nil {
break
}
fmt.Printf("消息位于 topic/partition/offset %v/%v/%v: %s = %s\n", m.Topic, m.Partition, m.Offset, string(m.Key), string(m.Value))
}
if err := r.Close(); err != nil {
log.Fatal("关闭阅读器失败:", err)
}
使用消费者群组时有一些限制:
- 设置GroupID后调用
(*Reader).SetOffset会返回错误 - 当GroupID设置后,
(*Reader).Offset总是返回-1 - 当GroupID设置后,
(*Reader).Lag总是返回-1 - 当GroupID设置后,
(*Reader).ReadLag会返回错误 - 当GroupID设置后,
(*Reader).Stats的分区总是-1
显式提交
kafka-go还支持显式提交。而不是调用ReadMessage,先调用FetchMessage,然后调用CommitMessages。
ctx := context.Background()
for {
m, err := r.FetchMessage(ctx)
if err != nil {
break
}
fmt.Printf("消息位于 topic/partition/offset %v/%v/%v: %s = %s\n", m.Topic, m.Partition, m.Offset, string(m.Key), string(m.Value))
if err := r.CommitMessages(ctx, m); err != nil {
log.Fatal("提交消息失败:", err)
}
}
在消费者群组中提交消息时,给定主题/分区的最高偏移量的消息决定了该分区提交的偏移量值。例如,如果通过调用FetchMessage获取了单个分区的偏移量为1、2和3的消息,则调用CommitMessages时传入偏移量为3也会提交该分区上偏移量为1和2的消息。
管理提交
默认情况下,CommitMessages会同步地将偏移量提交到Kafka。为了提高性能,可以通过在ReaderConfig中设置CommitInterval来定期向Kafka提交偏移量。
// 创建一个消费"topic-A"的新阅读器
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: {"localhost:9092", "localhost:9093", "localhost:9094"},
GroupID: "consumer-group-id",
Topic: "topic-A",
MaxBytes: 10e6, // 10MB
CommitInterval: time.Second, // 每秒刷新一次提交
})
写入器 
要向Kafka生产消息,程序可以使用低级的ConnAPI,但包还提供了一个更高级别的Writer类型,这在大多数情况下更适合使用,因为它提供了额外的功能:
- 错误发生时的自动重试和重新连接。
- 可配置的消息在可用分区间的分布。
- 同步或异步写入消息到Kafka。
- 使用上下文进行异步取消。
- 关闭时刷新待处理消息以支持平滑关闭。
- 在发布消息之前创建缺失的主题。 *注意!*这是在版本
v0.4.30之前的默认行为。
// 创建一个写入器,它向"topic-A"发送消息,使用最少字节分布
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: &kafka.LeastBytes{},
}
err := w.WriteMessages(context.Background(),
kafka.Message{
Key: []byte("Key-A"),
Value: []byte("你好世界!"),
},
kafka.Message{
Key: []byte("Key-B"),
Value: []byte("一!"),
},
kafka.Message{
Key: []byte("Key-C"),
Value: []byte("二!"),
},
)
if err != nil {
log.Fatal("写入消息失败:", err)
}
if err := w.Close(); err != nil {
log.Fatal("关闭写入器失败:", err)
}
发布前创建缺失的主题
// 创建一个写入器,将其发送到"topic-A"。
// 如果主题不存在,将会创建。
w := &Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
AllowAutoTopicCreation: true,
}
messages := []kafka.Message{
{
Key: []byte("Key-A"),
Value: []byte("你好世界!"),
},
{
Key: []byte("Key-B"),
Value: []byte("一!"),
},
{
Key: []byte("Key-C"),
Value: []byte("二!"),
},
}
var err error
const retries = 3
for i := 0; i < retries; i++ {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// 在发送消息前尝试创建主题
err = w.WriteMessages(ctx, messages...)
if errors.Is(err, kafka.LeaderNotAvailable) || errors.Is(err, context.DeadlineExceeded) {
time.Sleep(250 * time.Millisecond)
continue
}
if err != nil {
log.Fatalf("意外的错误 %v", err)
}
break
}
if err := w.Close(); err != nil {
log.Fatal("关闭写入器失败:", err)
}
向多个主题写入
通常,WriterConfig.Topic用于初始化单主题写入器。如果不设置这个配置,你可以通过在Message.Topic中为每个消息定义主题。
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
// 注意:这里不定义Topic,每个Message需自己定义。
Balancer: &kafka.LeastBytes{},
}
err := w.WriteMessages(context.Background(),
// 注意:每个Message都有Topic,否则会出错。
kafka.Message{
Topic: "topic-A",
Key: []byte("Key-A"),
Value: []byte("你好世界!"),
},
kafka.Message{
Topic: "topic-B",
Key: []byte("Key-B"),
Value: []byte("一!"),
},
kafka.Message{
Topic: "topic-C",
Key: []byte("Key-C"),
Value: []byte("二!"),
},
)
if err != nil {
log.Fatal("写入消息失败:", err)
}
if err := w.Close(); err != nil {
log.Fatal("关闭写入器失败:", err)
}
注意: 这两种模式是互斥的,如果你设置了Writer.Topic,就不应在要写入的消息上明确定义Message.Topic。相反,当没有为写入器定义主题时,也不应如此。如果检测到这种模糊性,Writer将返回错误。
兼容其他客户端
Sarama
如果你正从Sarama切换,并需要/希望使用相同的分区算法,你可以使用kafka.Hash平衡器或kafka.ReferenceHash平衡器:
kafka.Hash=sarama.NewHashPartitionerkafka.ReferenceHash=sarama.NewReferenceHashPartitioner
kafka.Hash 和 kafka.ReferenceHash 平衡器会将消息路由到与上述两个Sarama分区器相同的部分。
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: &kafka.Hash{},
}
librdkafka 和 confluent-kafka-go
使用kafka.CRC32Balancer平衡器可以获得与librdkafka的默认consistent_random分区策略相同的行为。
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: kafka.CRC32Balancer{},
}
Java
使用kafka.Murmur2Balancer平衡器可以获得与官方Java客户端的默认分发器相同的行为。请注意,Java类允许直接指定分区,而本库不允许这样做。
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: kafka.Murmur2Balancer{},
}
压缩功能
可对Writer启用压缩功能,只需设置Compression字段:
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Compression: kafka.Snappy,
}
Reader会自动识别接收到的消息是否被压缩,通过检查消息属性来确定。然而,所有预期编解码器对应的包都需导入以确保它们正确加载。
注意:在0.4版本前,程序需要导入压缩包来安装编解码器并支持从Kafka读取压缩消息。现在不再需要这样做,压缩包的导入已成为无操作过程。
TLS 支持
无论是在最基本的连接类型中还是在Reader/Writer配置里,你都可以指定TLS支持的拨号选项。如果TLS字段为空,则不会使用TLS建立连接。
重要提示: 如果未在连接/阅读器/写入器上配置TLS而尝试接入启用了TLS的Kafka集群,可能会导致模糊不清的io.ErrUnexpectedEOF错误。
连接示例
dialer := &kafka.Dialer{
Timeout: 10 * time.Second,
DualStack: true,
TLS: &tls.Config{...tls 配置...},
}
conn, err := dialer.DialContext(ctx, "tcp", "localhost:9093")
读者端(Reader)
dialer := &kafka.Dialer{
Timeout: 10 * time.Second,
DualStack: true,
TLS: &tls.Config{...tls 配置...},
}
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092", "localhost:9093", "localhost:9094"},
GroupID: "consumer-group-id",
Topic: "topic-A",
Dialer: dialer,
})
写入者端(Writer)——直接创建方式
w := kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: &kafka.Hash{},
Transport: &kafka.Transport{
TLS: &tls.Config{},
},
}
使用kafka.NewWriter
dialer := &kafka.Dialer{
Timeout: 10 * time.Second,
DualStack: true,
TLS: &tls.Config{...tls 配置...},
}
w := kafka.NewWriter(kafka.WriterConfig{
Brokers: []string{"localhost:9092", "localhost:9093", "localhost:9094"},
Topic: "topic-A",
Balancer: &kafka.Hash{},
Dialer: dialer,
})
请注意,kafka.NewWriter与kafka.WriterConfig已被标记为废弃,在未来的版本中将会移除。
SASL 支持
可以在Dialer中指定一个选项来使用SASL认证。可以直接使用Dialer打开Conn,或者将其作为参数传递给Reader和Writer各自所在的配置对象中。如果SASLMechanism字段为空,则不会执行SASL认证。
SASL 认证类型
Plain
mechanism := plain.Mechanism{
Username: "username",
Password: "password",
}
SCRAM
mechanism, err := scram.Mechanism(scram.SHA512, "username", "password")
if err != nil {
panic(err)
}
连接示例
mechanism, err := scram.Mechanism(scram.SHA512, "username", "password")
if err != nil {
panic(err)
}
dialer := &kafka.Dialer{
Timeout: 10 * time.Second,
DualStack: true,
SASLMechanism: mechanism,
}
conn, err := dialer.DialContext(ctx, "tcp", "localhost:9093")
读者端(Reader)
mechanism, err := scram.Mechanism(scram.SHA512, "username", "password")
if err != nil {
panic(err)
}
dialer := &kafka.Dialer{
Timeout: 10 * time.Second,
DualStack: true,
SASLMechanism: mechanism,
}
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092","localhost:9093", "localhost:9094"},
GroupID: "consumer-group-id",
Topic: "topic-A",
Dialer: dialer,
})
写入者端(Writer)
mechanism, err := scram.Mechanism(scram.SHA512, "username", "password")
if err != nil {
panic(err)
}
sharedTransport := &kafka.Transport{
SASL: mechanism,
}
w := kafka.Writer{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Topic: "topic-A",
Balancer: &kafka.Hash{},
Transport: sharedTransport,
}
客户端(Client)
mechanism, err := scram.Mechanism(scram.SHA512, "username", "password")
if err != nil {
panic(err)
}
sharedTransport := &kafka.Transport{
SASL: mechanism,
}
client := &kafka.Client{
Addr: kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
Timeout: 10 * time.Second,
Transport: sharedTransport,
}
在时间范围内读取所有消息
startTime := time.Now().Add(-time.Hour)
endTime := time.Now()
batchSize := int(10e6) // 10MB
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092", "localhost:9093", "localhost:9094"},
Topic: "my-topic1",
Partition: 0,
MaxBytes: batchSize,
})
r.SetOffsetAt(context.Background(), startTime)
for {
m, err := r.ReadMessage(context.Background())
if err != nil {
break
}
if m.Time.After(endTime) {
break
}
// TODO: 处理消息
fmt.Printf("offset %d 上的消息: %s = %s\n", m.Offset, string(m.Key), string(m.Value))
}
if err := r.Close(); err != nil {
log.Fatal("无法关闭读取器:", err)
}
日志记录
为了洞察Reader与Writer类型的操作详情,可在创建时为其配置日志记录器。
读者端(Reader)
func logf(msg string, a ...interface{}) {
fmt.Printf(msg, a...)
fmt.Println()
}
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092", "localhost:9093", "localhost:9094"},
Topic: "my-topic1",
Partition: 0,
Logger: kafka.LoggerFunc(logf),
ErrorLogger: kafka.LoggerFunc(logf),
})
写入者端(Writer)
func logf(msg string, a ...interface{}) {
fmt.Printf(msg, a...)
fmt.Println()
}
w := &kafka.Writer{
Addr: kafka.TCP("localhost:9092"),
Topic: "topic",
Logger: kafka.LoggerFunc(logf),
ErrorLogger: kafka.LoggerFunc(logf),
}
测试
由于后续Kafka版本中的细微行为变化,一些历史测试可能因此失效。如果你正针对的是Kafka 2.3.1及更高版本运行测试,导出环境变量KAFKA_SKIP_NETTEST=1即可跳过这些测试。
本地Docker环境中启动Kafka
docker-compose up -d
运行测试
KAFKA_VERSION=2.3.1 \
KAFKA_SKIP_NETTEST=1 \
go test -race ./...
或者,清理缓存的测试结果后再次运行测试:
go clean -cache && make test