Repository navigation
v2.0.0
v2.0.0
First release since v1.2.5, gathering everything below it. The major bump is for the
breaking changes: delete_after_consume no longer accepts the default auto-commit
configuration, and the LICENSE file changed.
This release also revisits delete_after_consume, which has needed correcting in four
consecutive releases. The conclusion is that the feature is sound only under a
precondition it cannot verify, so the release makes the precondition explicit, refuses
the configuration that is outright unsafe, and promotes S3 lifecycle rules to the
recommended mechanism by making them actually work.
Breaking
- The
LICENSEfile carried the Apache License 2.0 text whilepyproject.toml, the PyPI
metadata and the README badge all declared MIT. The file now contains the MIT license,
matching what every release has been published under. delete_after_consumenow requiresenable.auto.commit: Falseand raises otherwise.
Under auto-commit the object is removed before the payload is processed, so a crash
loses the record — a window previously covered by a log warning while doing it anyway.
Since auto-commit is the librdkafka default, this was the combination most users would
have hit; the project's own test fixture used it.
Fixed
multipart_thresholdonly chose which S3 API to call. Insideupload_fileobjboto3
applied its own 8 MiB threshold, so a payload between the two sizes uploaded as a single
part while the reference still dropped its ETag. An explicitTransferConfignow makes
the setting mean what it says. Found by the new integration suite.ttl_secondsdid nothing. It wrote attl_epochuser-metadata entry, and S3 lifecycle
rules can filter on prefix, tags and object size but not on user metadata, so no rule
could ever act on it. Objects are now also taggedkaf-s3-ttl-seconds=<n>, on both the
single-PUT and multipart paths, which a lifecycle rule can filter on. Non-positive
ttl_secondsis rejected rather than silently ignored.
Added
- Release notes now cover every CHANGELOG section down to the previous git tag, not just
the section matching the tag. v1.3.0 through v1.8.1 were never tagged, so a release of
this release would otherwise have announced one section out of eight. - An integration suite that runs the connector against a real Kafka broker and a real S3
service in throwaway containers: round trips across every storage option, plus tests
pinning the real Kafka and S3 behaviours that past bugs got wrong. Opt-in via
pytest -m integration, skipped without Docker, and run by a dedicated CI job. config/s3-lifecycle.json: a ready-to-apply lifecycle policy matching the tag the
producer writes, plus a prefix-based rule and anAbortIncompleteMultipartUploadrule.
A test asserts the shipped policy and the emitted tag stay in agreement.- A startup warning that
delete_after_consumeis only correct when the topic has a
single consumer group. No consumer can detect other groups, so a warning is the limit of
what the library can do about it.
Changed
- Deferred-deletion bookkeeping moved out of
S3ConsumerintoPendingDeletes, covered
by its own unit tests. The behaviour is unchanged; it was spread across five methods of
a class that also does polling, integrity checking and DLQ publication. - README has a "Reclaiming S3 storage" section that recommends lifecycle rules, states
delete_after_consume's precondition plainly, and documents how deferred deletion
behaves. - CI actions moved off Node 20, which GitHub is retiring:
actions/checkoutv4 to v5,
actions/setup-pythonv5 to v6,azure/setup-helmv4 to v5,
softprops/action-gh-releasev2 to v3,pypa/gh-action-pypi-publish1.9.0 to 1.14.2. ci.ymldeclarespermissions: contents: read; it was the only workflow inheriting the
repository's default token scope.- Added
.github/dependabot.ymlfor grouped monthly action and pip updates.
v1.8.1
Fixed
- The PyPI workflow's
workflow_dispatchtrigger could not build. It derived the version
with${GITHUB_REF#refs/tags/}, which on a branch leaves the ref intact, so the build
ran withSETUPTOOLS_SCM_PRETEND_VERSION=refs/heads/mainand died on
InvalidVersion. It now reads the release tag, falls back to the ref only when that ref
is a tag, and exits with a clear message otherwise. The same class of bug was fixed in
the Docker workflow in v1.3.0; the shell logic for both is now covered by tests. - Stdin producer mode turned blank lines into empty Kafka messages, which are delete
markers on a compacted topic. Blank lines are skipped and counted as
stdin_blank_lines, and\r\nline endings are handled. - A bucket name with leading or trailing whitespace passed validation and was sent to S3
verbatim, failing later with a less obvious error. It is now rejected at construction. examples/produce_example.pyflushed twice on shutdown, once explicitly and again via
close(), blocking for up to 60 seconds.close()alone reports what it flushed.
v1.8.0
Fixed
commit(message=...)deleted every deferred S3 object, not just those the commit
covered. Committing one partition's message removed objects belonging to other
partitions and to later offsets that were still in flight; a crash then lost them,
because their offsets had never been committed. Deferred deletions are now tracked per
partition and offset, and a message commit drains only that partition up to that offset.- A consumer group rebalance stranded the new partition owner.
subscribe()registered no
rebalance callbacks, so partitions taken away still had deferred deletions queued, and
the next commit deleted objects for messages another member was about to reprocess.
Revoked and lost partitions now drop their pending deletions.
Both are reachable only with delete_after_consume and manual commits — the combination
the README recommends for at-least-once delivery — and only in a multi-consumer group,
which is the normal deployment.
Changed
subscribe()acceptson_assign,on_revokeandon_lost. The connector registers its
own listeners either way and calls yours after its own bookkeeping.
v1.7.0
Fixed
deterministic_keyscombined withcompression: "gzip"rejected valid messages.
gzip.compressembeds an mtime, so re-producing an identical payload wrote different
bytes to the same key; any earlier message still referencing it then failed its ETag
check and was rejected as corrupt. Compression is now byte-reproducible (mtime=0).deterministic_keyscombined withdelete_after_consumesilently lost messages.
Deduplicated messages share one object, so consuming the first deleted it and every
other message pointing at it was skipped asobject_missing— a loss made silent by
the v1.6.0 change that stopped missing objects from raising. Producers now mark such
referencesdeterministic, and consumers do not delete objects that carry the mark.
Changed
- Added a producer backpressure panel to the Grafana dashboard.
produce_queue_fullwas
emitted from v1.6.0 but had nowhere to show; every metric the code emits is now on the
dashboard. - Documented that a connector instance is not safe to share across threads.
v1.6.0
Fixed
- A missing S3 object raised a raw
botocoreClientErrorout ofpoll(), killing the
consumer. Objects go missing for ordinary reasons — attl_secondslifecycle rule
fired, another consumer group ran withdelete_after_consume, or an auto-committed
message is being replayed — so the message is now skipped with reasonobject_missing.
Credential, bucket and throttling errors still propagate to the caller. produce()raisedBufferErroras soon as librdkafka's local queue filled, discarding
the S3 object it had just uploaded. Produce now drains delivery reports and retries for
up toproduce_timeout(30 s) before giving up, applying backpressure instead of
failing a burst.- Inline messages were produced without a delivery callback, so their delivery failures
were silent — no log line, noproduce_errormetric. They are now reported like
offloaded messages; there is simply no S3 object to roll back. - The image healthcheck probed a hardcoded port 8000 while
METRICS_PORTis configurable,
so any other port left the container permanently unhealthy. It now readsMETRICS_PORT.
Changed
- The chart had three places to set the port —
service.port,env.METRICS_PORTand the
scrape annotation. Setting onlyservice.portmoved the Service, container port and
both probes while the app kept listening on 8000, producing a liveness restart loop.
service.portis now the single source of truth for all four.
v1.5.0
Fixed (data loss)
- Inline JSON objects were silently dropped. Any payload small enough to stay on Kafka
that happened to be a JSON object was parsed as an S3 reference, found to name no
bucket or key, and skipped — even withallow_inline_payloadsat its default of True.
A message is now treated as a reference only when it carries boths3_bucketand
s3_keyas strings; everything else is an ordinary inline payload. commit()drained pending S3 deletions immediately after an asynchronous commit, which
has not yet reached the broker. A crash in that window left the offset uncommitted and
the object already deleted, defeating the deferral added in v1.4.0. Commits are now
forced synchronous whenever deletions are pending.
Fixed
- An unset
S3_BUCKETarrives as"", and the check tested for the key rather than a
value, so the connector started with an empty bucket and rejected every reference. Empty
and whitespace-only buckets are now rejected at construction on both sides. - DLQ records had no size bound. A large malformed message was echoed whole, and since
JSON escaping expands raw bytes several-fold, the record could exceed the broker's
message limit and fail to publish. Records are now bounded by measuring the encoded
size (dlq_max_raw_bytes,dlq_max_record_bytes). - Oversized objects are rejected from the
ContentLengthresponse header instead of
transferring up tomax_payload_bytesbefore discarding them.
Added
KAFKA_ENABLE_AUTO_COMMITenv var, and the container's consumer loop commits after each
payload when auto-commit is off. At-least-once delivery was previously reachable through
the library API only; from the container, offsets would simply never have advanced.- Boolean environment variables share one parser and now accept
1,yesandon
alongsidetrue, instead of each call site testing== "true".
v1.4.0
Fixed (security)
- Integrity failures used the full error message as a Prometheus label, and those
messages embed the S3 key. This reintroduced throughconsume_integrity_errorthe
unbounded label cardinality that v1.3.0 removed elsewhere: 50 distinct keys produced
50 series. Reasons are now fixed codes (etag_mismatch,sha256_mismatch,
missing_checksum,prefix_violation,unexpected_bucket,object_too_large,
decompressed_too_large,decompression_failed,unsupported_compression,
missing_etag), and the key stays in the exception and DLQ record only. - A
prefixof"/"collapsed to an empty string, silently disabling prefix
enforcement. Now rejected at construction on both the producer and the consumer. sse_kms_key_idwas accepted withoutserver_side_encryption: "aws:kms", sending a
KMS key id that S3 ignores, so objects were not KMS-encrypted as intended. Both this
and unknown SSE modes are now rejected.
Fixed (correctness)
delete_after_consumeremoved the S3 object beforepoll()returned, so a crash
between poll and processing lost the record from both Kafka and S3. With
enable.auto.commit: Falsedeletion is now deferred untilcommit(); uncommitted
deletes are dropped onclose(). Auto-commit keeps the old behaviour and now logs a
warning about the window.- Payloads above 8 MiB (configurable via
multipart_threshold) upload via multipart
instead of a single PUT, which S3 caps at 5 GiB. Multipart references carry noetag,
since a multipart ETag is not a content checksum; SHA-256 still covers those. - Broker errors raise
KafkaExceptionrather than a bareException. /metricsgroups samples by family and emits# TYPE. Interleaved families are
invalid exposition and strict parsers reject them.
Changed
- Rewrote the Grafana dashboard. The old one plotted raw counters with
sum()instead of
rate()and contained an invalid expression (increase(consume_inline[5m]*0), which
multiplies a range vector). Seven panels now cover produce/consume rate and throughput,
integrity failures by reason, skips, and delivery outcomes. config/prometheus.ymlgained a Kubernetes pod-discovery job matching the scrape
annotations the chart now sets.- Helm: pod annotations for Prometheus discovery, and
envFromso SASL and SSL passwords
come from a Secret rather than plaintext in values. - Every GitHub release since v1.0.0 shipped with empty notes: the extraction step split
the changelog on^##after prepending"## ", so it always took the empty string
before the delimiter. The logic now lives in.github/scripts/release_notes.py, is
covered by tests, and fails the release when the tag does not match the top CHANGELOG
section rather than publishing nothing.
v1.3.0
Fixed (blocking)
- Container and Helm deployments were no-ops:
runtime.pydefinedrun()but had no
__main__guard, sopython -m s3_connector.runtimeexited 0 immediately. Added a
__main__module, a__main__guard, and akaf-s3-connectorconsole script, which is
now the image entrypoint. - Setting
dlq_topic(orDLQ_TOPIC) crashed both clients at construction: the key was
passed straight to librdkafka, which rejects unknown properties. Connector-only settings
are now split out of the client config. S3Consumer.poll()raised on tombstones (AttributeError), binary inline payloads
(UnicodeDecodeError) and non-object JSON (TypeError) instead of skipping them. A
single malformed record could kill every consumer in the group; the runtime loop now
also survives unexpected errors.
Fixed (security)
- Prometheus label values are escaped, and only
topic,partitionandreasonbecome
series. S3 keys and payload sizes are no longer labels, removing both a metrics
injection vector and an unbounded memory leak. Sizes are aggregated into
<event>_bytescounters. - Integrity verification is mandatory by default: a reference carrying neither
etagnor
sha256is now rejected rather than trusted. Opt out withrequire_integrity: False. max_payload_bytesis enforced on the consumer, bounding both the S3 download and the
gzip expansion, so a small object can no longer inflate into an unbounded allocation.- Multi-stage Docker build; the compiler and
librdkafka-devno longer ship in the final
image. Added.dockerignoreso.git,dist/and local files stay out of image layers. - Metrics bind address is configurable via
METRICS_ADDRESS.
Fixed (correctness)
- Added
S3Producer.flush(),close()and context-manager support. Without them there
was no way to guarantee delivery, and queued messages were silently dropped at exit. S3Consumer.close()now flushes pending DLQ records before shutting down.- Delivery-failure cleanup no longer deletes the S3 object when
deterministic_keysis
enabled, where the same key may back an already-delivered message. AWS_REGION/region_namereached no client and was silently ignored; it is now
applied, alongside a newendpoint_urlfor S3-compatible stores.requires-pythoncorrected to>=3.10; the code has used PEP 604 syntax since v1.0.0.- Metrics server uses
ThreadingHTTPServer, so one slow scraper can no longer stall the
endpoint and trigger liveness-probe restarts. - Added
S3Consumer.commit()and askippedhook, so callers can run at-least-once and
can distinguish an empty poll from a dropped message.
Changed
- Helm chart ships pod/container security contexts, default resource requests and limits,
and pins the image tag to the chartappVersioninstead oflatest. - CI runs on pushes to
main, across Python 3.10-3.13, and now builds the image, smoke
tests the entrypoint against/metrics, and lints/renders the Helm chart. _version.pyis no longer tracked in git;.DS_Storeis ignored.