# KafScale Release v2.2.0

> Release notes for KafScale v2.2.0: Kafka tool compatibility, faster SQL scans, Iceberg on Cloudflare R2, and the v2.1.0 to v2.2.0 upgrade.

Canonical page: https://kafscale.io/releases/v2.2.0/
<!--
Copyright 2026 Alexander Alten (novatechflow), NovaTechflow (novatechflow.com).
This project is supported and financed by Scalytics, Inc. (www.scalytics.io).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

Released 2026-12-02 (Europe/Malta). Tag `v2.2.0` on `main` at `fc9ed22`, after [#489](https://github.com/KafScale/platform/pull/489). The main Helm chart is version `2.2.0`. The processor charts are `0.3.1`. All charts default to application images tagged `v2.2.0`.

This is what changed since [v2.1.0](/releases/v2.1.0/).

## What's new

### S3 and R2 hardening

Index objects are now written the same way as segments: with `If-None-Match: *`. An existing index is never overwritten. If a write gets `412` or `409`, the broker reads the object back up to three times, waiting 100 and 200 ms between reads. The same bytes count as written, so a lost response does not fence the log. Different bytes fail with `storage.ErrPreconditionFailed` and fence the partition. This is the right behavior on Cloudflare R2, which can answer `409` as well as `412`. Custom `storage.S3Client` implementations must follow the same contract. See the [upgrade notes](#upgrading-from-v210-to-v220). ([#478](https://github.com/KafScale/platform/pull/478), closes [#476](https://github.com/KafScale/platform/issues/476))

Puts and lists no longer create a missing bucket. A write that used to create the bucket and retry with a drained body could store an empty object. Those calls now fail with `bucket <name> does not exist`. Broker startup still creates the bucket if it is missing (`EnsureBucket`). The operator creates a snapshot bucket only when `operator.etcdSnapshot.createBucket` is on. `kafscale-cli` commands that list segments also fail on a missing bucket, instead of reporting no segments. ([#467](https://github.com/KafScale/platform/pull/467), closes [#462](https://github.com/KafScale/platform/issues/462))

New probe settings for buckets that deny deletes, including Object Lock:

- `operator.s3Probe.prefix` (`KAFSCALE_S3_PROBE_PREFIX`, default `__health/`) moves the broker startup probe.
- `operator.s3Probe.skipDelete` (`KAFSCALE_S3_PROBE_SKIP_DELETE`) keeps the probe objects instead of deleting them.

The operator snapshot access probe now writes a new key, `<prefix>/<namespace>/<cluster>/health/access-probe-<random>.txt`, without a write condition, and deletes it. A probe left in place by a lock never blocks the next check. A delete refused with `ObjectLockedByBucketPolicy` is logged and does not fail startup. S3 errors with that code are reported as `storage.ErrObjectLocked` (`object locked by bucket policy`). Add a lifecycle rule that expires leftover probes after one day. See the [upgrade notes](#upgrading-from-v210-to-v220). ([#478](https://github.com/KafScale/platform/pull/478), and the earlier probe fix in [#467](https://github.com/KafScale/platform/pull/467), which closes [#463](https://github.com/KafScale/platform/issues/463))

S3 credentials use the standard `AWS_*` names, including `AWS_SESSION_TOKEN`, everywhere that matters:

- The schema registry chart loads the whole `schemaRegistry.s3.credentialsSecret` with `envFrom`, mounts it, and rereads the files every minute. A failed reload keeps the last good keys. `helm upgrade` after a Secret change rolls the pods.
- The console uses `console.lfs.s3.credentialsSecret` the same way, including `KAFSCALE_CONSOLE_LFS_S3_SESSION_TOKEN`. The old `console.lfs.s3.accessKey` and `secretKey` values are deprecated and are ignored when the Secret is set.
- Brokers run outside the operator can set `KAFSCALE_S3_CREDENTIALS_DIR` to a directory with one file per key.

Keep only S3 credentials in those Secrets, because every key becomes an environment variable. ([#478](https://github.com/KafScale/platform/pull/478))

Managed etcd snapshots now go to the cluster data bucket by default, under `_kafscale/etcd-snapshots/<namespace>/<cluster>/`. Helm values `operator.etcdSnapshot.{bucket,prefix,endpoint,createBucket,protectBucket,schedule}` set the operator env vars. `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_PREFIX` is a base prefix. The operator always appends `<namespace>/<cluster>`. On R2, `protectBucket` logs `NotImplemented` for versioning and still uploads. This is an upgrade step. See the [upgrade notes](#upgrading-from-v210-to-v220). ([#467](https://github.com/KafScale/platform/pull/467), closes [#464](https://github.com/KafScale/platform/issues/464) and [#465](https://github.com/KafScale/platform/issues/465))

`spec.s3.kmsKeyArn` now applies to every S3 write: broker segments and indexes, LFS proxy uploads, and etcd snapshots. The operator sets `KAFSCALE_S3_KMS_ARN` and `KAFSCALE_LFS_PROXY_S3_KMS_ARN` from that field. Cloudflare R2 and other stores without SSE-KMS reject those writes, so remove the field before you upgrade if it is set. ([#467](https://github.com/KafScale/platform/pull/467), [#470](https://github.com/KafScale/platform/pull/470), closes [#469](https://github.com/KafScale/platform/issues/469) and [#472](https://github.com/KafScale/platform/issues/472))

### Iceberg on R2 Data Catalog

The Iceberg processor can write tables into [R2 Data Catalog](https://developers.cloudflare.com/basin-catalog/) (now Basin Catalog):

- Set `iceberg.catalog.manages_locations: true`. The processor then creates tables without a location and never sets `write.data.path` or `write.metadata.path`. R2 picks the location under `__r2_data_catalog/` and rejects those two settings.
- Load the catalog token from a Secret with `catalogToken.secretName` and `catalogToken.secretKey`. That sets `KAFSCALE_ICEBERG_CATALOG_TOKEN`, which wins over the config file. Leave `iceberg.catalog.token` empty so the token stays out of the ConfigMap.
- Commit conflicts, including R2 `CatalogCommitConflicts` and HTTP 409, reload the table and retry up to 5 times.

The processor also shares partitions correctly across replicas. Each poll claims a lease, writes past the committed offset, and releases the lease. A stale pod can no longer keep a lease forever, overwrite a new holder's key, or commit after it lost the lease. Topics without a mapping are skipped with one log line. ([#475](https://github.com/KafScale/platform/pull/475), closes [#474](https://github.com/KafScale/platform/issues/474))

The Iceberg chart now restarts the pods when you change `config` or a Secret it uses (`checksum/config` and `checksum/secrets`). The default `config.schema.registry.base_url` is empty, so a mapping without `columns` no longer tries `https://schemas.example.com`. If you relied on that example URL, set the real registry URL in values. ([#478](https://github.com/KafScale/platform/pull/478), closes [#477](https://github.com/KafScale/platform/issues/477))

### SQL processor auth and TLS

The SQL processor now speaks the Postgres startup path that clients expect:

- An `SSLRequest` gets `N` when TLS is off, or `S` and a TLS 1.2 or newer handshake when `server.tls` (or `tls.existingSecret`) is set. The proxy can serve TLS with `proxy.tls` / `proxy.tls.existingSecret`.
- A password is optional (`server.auth.username` and `server.auth.password`, from a Secret). A wrong login gets `FATAL 28P01` and is counted in `kafsql_auth_failures_total`. With TLS configured, a cleartext login on a non-TLS connection is refused with `FATAL 28000`. A connection has 30 seconds to finish startup, TLS and auth.

The proxy can also speak TLS to the executor. Set `proxy.upstreamTLS.enabled` (`KAFSQL_PROXY_UPSTREAM_TLS`) and `proxy.upstreamTLS.caSecret` (`KAFSQL_PROXY_UPSTREAM_CA_FILE`). The proxy sends an `SSLRequest`, and on `S` it checks the executor certificate against that CA and against the host it dials. Any other answer, including `N`, fails the connection. There is no plaintext fallback. The chart upstream address is `<fullname>-executor`, so the executor certificate needs a DNS SAN for that short Service name. The cluster FQDN alone is not enough. Without upstream TLS, do not set both `tls.existingSecret` and a password on the executor: the executor would refuse the proxy's plain connection with `FATAL 28000`. In that setup leave executor TLS off and use `proxy.tls.existingSecret` for clients, or turn on upstream TLS. See the [upgrade notes](#upgrading-from-v210-to-v220). ([#478](https://github.com/KafScale/platform/pull/478))

Topic discovery no longer lists generation folders such as `orders@1` as topics. With etcd, a deleted topic is hidden. Without etcd, a deleted topic stays visible until you prune the data or point the processor at etcd. ([#478](https://github.com/KafScale/platform/pull/478))

### SQL and Iceberg processors: compressed data, faster scans, safer results

**Compressed batches.** The SQL and Iceberg processors now decode gzip, snappy (raw and the Java client framing), lz4 and zstd batches. On v2.1.0 both refused any compressed batch, and the Iceberg processor stopped the partition without a log line. Decompression has limits: at most 256 MiB per batch, and a budget per segment of 1 GiB by default. Set the budget with `query.max_decompressed_bytes` (`KAFSQL_QUERY_MAX_DECOMPRESSED_BYTES`) for SQL and `processor.max_decompressed_bytes` (`KAFSCALE_ICEBERG_PROCESSOR_MAX_DECOMPRESSED_BYTES`) for Iceberg. A batch that cannot be decoded fails the SQL query with the segment key in the error and counts `kafsql_decode_errors_total`. In the Iceberg processor the partition waits on that segment, so no records are skipped, every attempt counts `kafscale_processor_errors_total{stage="decode"}`, and the new gauge `kafscale_processor_partition_stalled{topic,partition}` is 1 until the partition moves on. ([#483](https://github.com/KafScale/platform/pull/483), closes [#481](https://github.com/KafScale/platform/issues/481))

**Discovery at scale.** SQL S3 discovery lists only `<namespace>/<topic>/` and `<namespace>/<topic>@` for the topics a query reads, instead of every segment in the namespace. Segments whose footer was checked are kept in a bounded cache (`discovery_cache.verified_max_entries`, default 100000). Topic listings are cached per topic, with a cap on entries and expiry. ([#483](https://github.com/KafScale/platform/pull/483), closes [#482](https://github.com/KafScale/platform/issues/482))

**Parallel reads and a segment cache.** A query reads up to `query.read_concurrency` segments at a time (default 8, `KAFSQL_QUERY_READ_CONCURRENCY`). All queries share a read-ahead limit, `query.max_parallel_reads` (default 32, `KAFSQL_QUERY_MAX_PARALLEL_READS`). Downloaded segments stay in a cache of `segment_cache.max_bytes` (default 256 MiB, `KAFSQL_SEGMENT_CACHE_MAX_BYTES`). Segments larger than `segment_cache.max_segment_bytes` (default 32 MiB, `KAFSQL_SEGMENT_CACHE_MAX_SEGMENT_BYTES`) are not cached. New metrics: `kafsql_segment_cache_hits_total`, `kafsql_segment_cache_misses_total` and `kafsql_segment_cache_bytes`. A warm `count(*)` over 2000 segments on R2 takes about 1 second instead of more than 2 minutes. ([#486](https://github.com/KafScale/platform/pull/486), closes [#484](https://github.com/KafScale/platform/issues/484))

**One GET per cold segment.** A query checks the footer of each new segment in the bytes it downloads anyway, so a cold scan makes one object GET per segment instead of a footer read plus a download. On Cloudflare R2, a cold `SELECT count(*)` over 2000 segments now makes 2000 object GETs and no separate footer reads, and takes 22 to 26 seconds at the default `read_concurrency` of 8 and about 15 seconds at 16. Before this change the same scan made 4000 requests and often hit the 30 second query timeout. ([#489](https://github.com/KafScale/platform/pull/489), closes [#487](https://github.com/KafScale/platform/issues/487))

**Errors instead of stale rows.** Errors while downloading a new segment, such as 403, 503 or a Glacier restore, now fail the query. On v2.1.0 the footer read treated those errors like a missing footer and left the segment out with no error. Without etcd, when the newer generation of a topic has no complete segment and a footer read failed, the query fails instead of returning rows from the older generation. ([#489](https://github.com/KafScale/platform/pull/489))

**Metric renames (breaking for dashboards).** The SQL processor duration histograms now record seconds: `kafsql_s3_request_duration_ms` is now `kafsql_s3_request_duration_seconds`, `kafsql_query_duration_ms` is now `kafsql_query_duration_seconds`, and `kafsql_query_queue_wait_ms` is now `kafsql_query_queue_wait_seconds`. The old histograms recorded milliseconds in buckets meant for seconds, so almost every value landed in `+Inf`. Update dashboards and alerts. See the [upgrade notes](#upgrading-from-v210-to-v220). ([#486](https://github.com/KafScale/platform/pull/486), closes [#485](https://github.com/KafScale/platform/issues/485))

### Kafka tool compatibility

These are the admin APIs Kafka CLIs, kcat and Kpow were missing on v2.1.0:

- **CreateTopics v0 to v7.** v4 and later clients can omit the partition count and the replication factor. The defaults are `KAFSCALE_AUTO_CREATE_PARTITIONS` (1 if unset or not positive) and replication factor 1. v5 and later responses return the resolved counts and configs, and v7 returns the topic ID. You can set `retention.ms`, `retention.bytes` and `segment.bytes` at creation. Other keys follow the same accept, ignore or reject rules as config changes. Mixed broker versions make the proxy advertise v2 until every broker supports v7. ([#466](https://github.com/KafScale/platform/pull/466), closes [#458](https://github.com/KafScale/platform/issues/458))
- **IncrementalAlterConfigs v0 and v1.** `kafka-configs.sh --alter` works, with `--add-config` and `--delete-config`. Upgrade every broker before you use it through a proxy, because the proxy advertises the API and an older broker does not support it. ([#470](https://github.com/KafScale/platform/pull/470), closes [#456](https://github.com/KafScale/platform/issues/456))
- **ListOffsets by timestamp.** A time lookup returns the first offset at or after that time, or no match. v2.1.0 always returned the log end. New segments carry a sparse time index (one entry per 128 batches by default, `KAFSCALE_TIME_INDEX_INTERVAL_BATCHES`). Older segments still work. ([#461](https://github.com/KafScale/platform/pull/461), closes [#454](https://github.com/KafScale/platform/issues/454))
- **DescribeConfigs by broker ID.** The proxy routes the request to that broker, including node 0. v2.1.0 could return another broker's config. ([#461](https://github.com/KafScale/platform/pull/461), closes [#455](https://github.com/KafScale/platform/issues/455))
- **DescribeConfigs topic keys.** A topic now returns seven keys: `cleanup.policy`, `compression.type`, `message.timestamp.type`, `min.insync.replicas`, `retention.ms`, `retention.bytes` and `segment.bytes`. The first four are fixed. Setting retention only stores the value. Brokers do not delete records by age or size. Use a bucket lifecycle rule. ([#467](https://github.com/KafScale/platform/pull/467), closes [#459](https://github.com/KafScale/platform/issues/459))
- **DescribeAcls v0 to v3, read only.** `kafka-acls.sh --list` and Kpow can show the broker ACLs, mapped from KafScale rules. Create and delete still go through `KAFSCALE_ACL_JSON` or `KAFSCALE_ACL_FILE`. ([#467](https://github.com/KafScale/platform/pull/467), closes [#457](https://github.com/KafScale/platform/issues/457))

Produce responses return `LogAppendTime` `-1` for CreateTime topics, as Kafka does, so clients keep the producer timestamps. From Produce v5 they also return the real log start offset. Fetch returns the same value. ([#470](https://github.com/KafScale/platform/pull/470), closes [#468](https://github.com/KafScale/platform/issues/468))

### Chart restarts on config and Secret changes

- Iceberg processor: `checksum/config` and `checksum/secrets` roll the pods when the ConfigMap or a referenced Secret changes on `helm upgrade`.
- Schema registry and console: `kafscale.io/s3-credentials-checksum` rolls the pods when the credentials Secret changes. They also reread the mounted files about every minute, so a Secret updated in place is picked up without a restart once the kubelet has refreshed the volume (up to about three minutes).
- Brokers and the LFS proxy already rolled on a Secret change. That is unchanged.

A Secret or TLS change without `helm upgrade` still needs `kubectl rollout restart` for the Iceberg processor and for SQL TLS Secrets. `helm template` and `--dry-run` cannot read Secrets, so those annotations render `unavailable`.

## Fixes

- Error responses the proxy builds no longer carry a leader hint of broker 0 at epoch 0. On v2.1.0 that hint crashed kcat and other librdkafka clients with a segmentation fault, and the Java client rejected the response. Produce errors now use `NOT_LEADER_OR_FOLLOWER` (6) when the proxy cannot reach the broker, and `REQUEST_TIMED_OUT` (7) once a request may have reached it. Fetch errors use `NOT_LEADER_OR_FOLLOWER` (6), never 7, because the Java consumer throws from `poll()` on 7. The broker answers Fetch with 6 while S3 is degraded and with `KAFKA_STORAGE_ERROR` (56) while S3 is unavailable. Every client retries both. ([#483](https://github.com/KafScale/platform/pull/483), closes [#479](https://github.com/KafScale/platform/issues/479))
- The flaky proxy test `TestLFSHTTPMultipartDeletesUploadWhenBackendDialFails` is now deterministic. ([#489](https://github.com/KafScale/platform/pull/489), closes [#488](https://github.com/KafScale/platform/issues/488))
- Metadata v4 to v12 honors `AllowAutoTopicCreation=false`. v2.1.0 could still create a missing topic with one partition, which broke mirroring tools that then failed to create it with the source partition count. ([#447](https://github.com/KafScale/platform/pull/447), closes [#446](https://github.com/KafScale/platform/issues/446))
- A fresh broker no longer seeds an in-memory `orders` topic. Named Metadata probes no longer report a topic that is not in the store. ([#449](https://github.com/KafScale/platform/pull/449), closes [#448](https://github.com/KafScale/platform/issues/448))
- `operator.acl.configJson` and `operator.acl.configFile` are quoted with `toJson`, so JSON quotes no longer break the operator Deployment. ([#475](https://github.com/KafScale/platform/pull/475), closes [#473](https://github.com/KafScale/platform/issues/473))
- `scripts/release.sh` sets the KafScale chart version to the tag (`v2.2.0` gives `2.2.0`) and gives processor charts a patch bump from their own version. It no longer rewrites them to the old 0.x scheme. ([#470](https://github.com/KafScale/platform/pull/470), closes [#450](https://github.com/KafScale/platform/issues/450))
- The development Compose stack binds to `127.0.0.1`, like the release stack. ([#442](https://github.com/KafScale/platform/pull/442))
- Homebrew install docs and the formula update scripts. ([#445](https://github.com/KafScale/platform/pull/445), [#442](https://github.com/KafScale/platform/pull/442))
- `TestOperatorConsoleEndToEnd` registers the apps/v1 scheme so the StatefulSet lookup works. ([#470](https://github.com/KafScale/platform/pull/470), closes [#471](https://github.com/KafScale/platform/issues/471))

## Upgrade

Read the [upgrade notes](#upgrading-from-v210-to-v220) before you install. The items that need a decision are the etcd snapshot location, `spec.s3.kmsKeyArn` on stores without SSE-KMS, the Iceberg registry URL, console LFS credentials, SQL processor TLS plus a password, the renamed SQL processor metrics, SQL processor memory, and custom `S3Client` implementations.

[Full changelog](https://github.com/KafScale/platform/compare/v2.1.0...v2.2.0)

---

## Upgrading from v2.1.0 to v2.2.0

Checked against the `v2.2.0` tag (`main` at `fc9ed22`): `pkg/operator/etcd_resources.go`, the Helm charts, and the [upgrade and compatibility guide](/upgrade-compatibility/).

Upgrade the operator, then every broker and every proxy, before you rely on the new admin APIs through the proxy. CreateTopics v7 and IncrementalAlterConfigs are advertised by the proxy only when every backend supports them. A mixed cluster stays on the older version.

Take a manual etcd snapshot on v2.1.0 before you start, and copy it to the new location as described below. The upgrade changes the snapshot settings, so operator-managed etcd pods restart. With persistent etcd storage they keep their data. With in-memory etcd (`operator.etcdStorageMemory`) they restore from S3.

### 1. Etcd snapshots

This is the change that needs a plan.

#### What changes

On v2.1.0, operator-managed snapshots went to a separate bucket:

```text
s3://kafscale-etcd-<namespace>-<cluster>/etcd-snapshots/YYYYmmddHHMMSS.db
```

The prefix was flat. `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_PREFIX`, when set, was used as is. The v2.1.0 Helm chart had no values for the bucket or the prefix. Those env vars only existed if you set them on the operator Deployment yourself.

On v2.2.0 the default is the cluster data bucket, and the prefix is a base prefix. The operator always appends `<namespace>/<cluster>` (`snapshotPrefix` in `pkg/operator/etcd_resources.go`). The default becomes:

```text
s3://<spec.s3.bucket>/_kafscale/etcd-snapshots/<namespace>/<cluster>/YYYYmmddHHMMSS.db
```

Restore only considers keys named `YYYYmmddHHMMSS.db` directly under that prefix, and it takes the greatest of those names.

#### What a helm upgrade does to a hand-set prefix

The v2.2.0 chart sets `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_PREFIX` only when `operator.etcdSnapshot.prefix` is set in values. It sets `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_BUCKET` only when `operator.etcdSnapshot.bucket` is set. A `helm upgrade` replaces the operator container env.

If you hand-set `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_PREFIX=etcd-snapshots` on the operator Deployment and you do not put that value in Helm, the upgrade drops it. The operator then uses the new default, `_kafscale/etcd-snapshots/<namespace>/<cluster>/`, in the data bucket.

If you keep `operator.etcdSnapshot.prefix: etcd-snapshots` in values, that string is now a base prefix. New snapshots go to `etcd-snapshots/<namespace>/<cluster>/` in the data bucket, not to the old flat `etcd-snapshots/` path.

The same applies to any other prefix you had set.

#### The restore fallback, and when it does not run

For this release only, when `operator.etcdSnapshot.bucket` is not set and the new prefix has no `YYYYmmddHHMMSS.db` key, the etcd restore init container falls back to the old default bucket `kafscale-etcd-<namespace>-<cluster>`. That path is `legacySnapshotLocation` in `pkg/operator/etcd_resources.go`, called from the restore init container at line 273.

The fallback prefix is `etcd-snapshots`, or the value of `KAFSCALE_OPERATOR_ETCD_SNAPSHOT_PREFIX` if that env is still set. It does not append `<namespace>/<cluster>`. It only takes keys named `YYYYmmddHHMMSS.db` directly under that prefix whose last modified time is within the last 7 days. The credentials in `spec.s3.credentialsSecretRef` need `s3:ListBucket` and `s3:GetObject` on that old bucket. If the old location cannot be read, the pod starts without a restore, as before.

There is no fallback when `operator.etcdSnapshot.bucket` is set, because that bucket can be shared and a flat prefix does not say which cluster a snapshot belongs to. The next release drops the fallback. Do not rely on it.

#### Steps: default v2.1.0 location, move to the new default

Do this before the upgrade if you used the v2.1.0 defaults (no custom bucket or prefix).

1. On v2.1.0, take a snapshot now:

```bash
namespace='<namespace>'
cluster='<cluster>'
kubectl -n "$namespace" create job --from=cronjob/"$cluster"-etcd-snapshot snapshot-before-220
kubectl -n "$namespace" wait --for=condition=complete --timeout=5m job/snapshot-before-220
```

2. Copy the flat prefix into the new layout. Load your S3 or R2 keys from a file only you can read. Do not put them on the command line. Add `--endpoint-url` for R2 or another non-AWS endpoint, and add `--sse aws:kms --sse-kms-key-id <key>` when `spec.s3.kmsKeyArn` is set:

```bash
namespace='<namespace>'
cluster='<cluster>'
data_bucket='<spec.s3.bucket>'
aws s3 cp --recursive \
  --exclude '*' --include '*.db' --include '*.db.sha256' --exclude '*/*' \
  "s3://kafscale-etcd-$namespace-$cluster/etcd-snapshots/" \
  "s3://$data_bucket/_kafscale/etcd-snapshots/$namespace/$cluster/"
```

3. Upgrade the chart, then take a snapshot again and check that the new prefix holds a `.db` and a `.sha256` object:

```bash
namespace='<namespace>'
cluster='<cluster>'
data_bucket='<spec.s3.bucket>'
kubectl -n "$namespace" create job --from=cronjob/"$cluster"-etcd-snapshot snapshot-after-220
kubectl -n "$namespace" wait --for=condition=complete --timeout=5m job/snapshot-after-220
aws s3 ls "s3://$data_bucket/_kafscale/etcd-snapshots/$namespace/$cluster/"
```

#### Steps: you already set the prefix or the bucket

- To keep writing under the base prefix `etcd-snapshots` (or any other prefix you used), set `operator.etcdSnapshot.prefix` in values to that base, then copy the old flat keys to `<prefix>/<namespace>/<cluster>/` in the target bucket. If you leave the bucket unset, the target is `spec.s3.bucket`. Example, prefix `etcd-snapshots`:

```bash
namespace='<namespace>'
cluster='<cluster>'
data_bucket='<spec.s3.bucket>'
aws s3 cp --recursive \
  --exclude '*' --include '*.db' --include '*.db.sha256' --exclude '*/*' \
  "s3://kafscale-etcd-$namespace-$cluster/etcd-snapshots/" \
  "s3://$data_bucket/etcd-snapshots/$namespace/$cluster/"
```

  If the old source was a custom bucket or prefix, change the source to `s3://<old bucket>/<old prefix>/`.

- To keep the old snapshot bucket, set `operator.etcdSnapshot.bucket` to it. The prefix still gains `<namespace>/<cluster>`, so copy or take a snapshot after the upgrade. There is no restore fallback in this case. Copy first.

- If you enabled `protectBucket` on the old separate bucket, versioning stays on there. If you move to the shared data bucket, versioning is not turned on for it. That is deliberate: versioning cannot be turned off again, and it would keep every deleted segment as a billed noncurrent version. On R2, versioning returns `NotImplemented`. The snapshot job logs that and still uploads.

### 2. Iceberg registry URL

The Iceberg processor chart default for `config.schema.registry.base_url` is now empty. On v2.1.0 it was `https://schemas.example.com`. A mapping without `columns` used that URL and failed. If you relied on the old default, set the real registry URL in values before you upgrade. The upgrade rolls the processor once, because the pod template now has `checksum/config` and, with referenced Secrets, `checksum/secrets`.

### 3. Console LFS credentials

`console.lfs.s3.accessKey` and `console.lfs.s3.secretKey` are deprecated. Put `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and, if you use temporary credentials, `AWS_SESSION_TOKEN` in a Secret, and set `console.lfs.s3.credentialsSecret` to that Secret. Keep only S3 credentials in it. The old values still work if the Secret is unset, and they are ignored when it is set. The console pod gains a `kafscale.io/s3-credentials-checksum` annotation, so the upgrade rolls the console once when the Secret is set. The schema registry Secret is loaded the same way. Every key in it becomes an environment variable, so keep only S3 credentials there too.

### 4. Probe values and the lifecycle rule

If the bucket uses Object Lock, or a policy that denies deletes, set these before the brokers start under v2.2.0, or the startup probe delete will fail and leave objects behind (the broker still starts):

```yaml
operator:
  s3Probe:
    skipDelete: true
    # prefix: probes/   # optional, default __health/
```

The env vars are `KAFSCALE_S3_PROBE_SKIP_DELETE` and `KAFSCALE_S3_PROBE_PREFIX`. The operator passes them to the brokers and honors skip-delete for its own snapshot access probe.

With skip-delete or Object Lock, the probe objects stay. Add a lifecycle rule that expires objects after one day:

- in the snapshot bucket, under `<operator.etcdSnapshot.prefix>/<namespace>/<cluster>/health/` (default prefix `_kafscale/etcd-snapshots`)
- in the data bucket, under the broker probe prefix (default `__health/`)

Do not put a lifecycle or lock rule on the whole bucket, on `__r2_data_catalog/`, or on the topic prefixes you still need to read.

### 5. SQL processor TLS and passwords

The executor and the proxy now answer an `SSLRequest`. Defaults stay off: they answer `N`, and they accept any user name without a password.

If you set a password (`KAFSQL_SERVER_AUTH_PASSWORD`, from a Secret, never on the command line or in `helm --set`):

- With TLS on that listener, a client that does not use TLS is refused with `FATAL 28000` before it sends the password. Connect with `sslmode=require`.
- The proxy talks to the executor in plaintext unless you turn on upstream TLS. An executor that has both `tls.existingSecret` and a password refuses that plaintext hop with `FATAL 28000`, and every login through the proxy fails.

To encrypt the proxy-to-executor hop:

```yaml
tls:
  existingSecret: <executor-tls-secret>
proxy:
  upstreamTLS:
    enabled: true
    caSecret:
      name: <ca-secret>
      key: ca.crt
```

The chart refuses to render without the CA Secret and without `tls.existingSecret`. The proxy never falls back to plaintext. The chart dials `<fullname>-executor`, so the executor certificate must list that short Service name as a DNS SAN. The cluster FQDN alone is not enough. Also add `<fullname>-executor.<namespace>.svc.cluster.local` if clients use `sslmode=verify-full` with the FQDN, or if you set `KAFSQL_PROXY_UPSTREAMS` to that host. The proxy checks the host of the address it dials.

If you do not want upstream TLS, leave `tls.existingSecret` empty on the executor and set `proxy.tls.existingSecret` for clients.

A rotated TLS or CA Secret needs `kubectl rollout restart`. The files are read at startup.

### 6. Custom S3Client implementations

`UploadIndex` is now a create-only write, like `UploadSegment`. Your implementation must:

- write with a create-only condition (`If-None-Match: *` or the equivalent)
- return `storage.ErrPreconditionFailed` when the key already holds other bytes (the broker then fences the partition)
- return nil when the key already holds the same bytes (a retried write after a lost response)
- treat a `409` the same way as a `412` if your store uses `409` for a failed condition, as R2 does

S3 errors with the code `ObjectLockedByBucketPolicy` must be reported as `storage.ErrObjectLocked` (`object locked by bucket policy`).

The operator snapshot access probe writes without a condition, through `UploadUnconditional` when the client has `storage.UnconditionalWriter`. A store that rejects conditional writes can still pass that check.

### 7. SQL processor metrics, memory and query behavior

#### Renamed metrics (breaking for dashboards)

The SQL processor duration histograms now record seconds and end in `_seconds`:

| v2.1.0 | v2.2.0 |
|---|---|
| `kafsql_s3_request_duration_ms` | `kafsql_s3_request_duration_seconds` |
| `kafsql_query_duration_ms` | `kafsql_query_duration_seconds` |
| `kafsql_query_queue_wait_ms` | `kafsql_query_queue_wait_seconds` |

The old names are gone. Update dashboards, recording rules and alerts to the new names, and divide millisecond thresholds by 1000. The query histogram has buckets up to 300 seconds.

#### New settings

| Setting | Env var | Default |
|---|---|---|
| `query.read_concurrency` | `KAFSQL_QUERY_READ_CONCURRENCY` | 8 segments at a time per query |
| `query.max_parallel_reads` | `KAFSQL_QUERY_MAX_PARALLEL_READS` | 32, shared by all queries |
| `segment_cache.max_bytes` | `KAFSQL_SEGMENT_CACHE_MAX_BYTES` | 256 MiB, a negative value turns the cache off |
| `segment_cache.max_segment_bytes` | `KAFSQL_SEGMENT_CACHE_MAX_SEGMENT_BYTES` | 32 MiB, larger segments are not cached |
| `query.max_decompressed_bytes` | `KAFSQL_QUERY_MAX_DECOMPRESSED_BYTES` | 1 GiB per segment |
| `processor.max_decompressed_bytes` (Iceberg) | `KAFSCALE_ICEBERG_PROCESSOR_MAX_DECOMPRESSED_BYTES` | 1 GiB per segment |

A single compressed batch may decompress to at most 256 MiB in both processors. New metrics: `kafsql_segment_cache_hits_total`, `kafsql_segment_cache_misses_total`, `kafsql_segment_cache_bytes`, and in the Iceberg processor the gauge `kafscale_processor_partition_stalled{topic,partition}`. Alert on that gauge being 1: the partition is waiting on a segment it cannot decode.

#### Memory

Memory for decoded segments is at most `(query.max_concurrent + query.max_parallel_reads) x decoded segment size`, plus the segment cache. Set a pod memory limit that covers this, or lower `query.max_parallel_reads` or the cache size.

#### Queries that now fail instead of returning partial or old rows

- Errors while downloading a new segment, such as 403, 503 or a Glacier restore, fail the query. On v2.1.0 the footer read treated those errors like a missing footer and silently left the segment out.
- Without etcd, if the newer generation of a topic has no complete segment and a footer read failed, the query fails instead of falling back to the older generation.
- A segment without a footer is still skipped. It is now downloaded in full once before it is skipped, and on every query when the listing is not cached (TTL 0, or a topic larger than `discovery_cache.max_entries`).

Check that the SQL processor credentials can read every segment under the topics you query.

### 8. Proxy error codes

Error responses the proxy builds no longer carry a leader hint. Produce errors use `NOT_LEADER_OR_FOLLOWER` (6) when the broker cannot be reached and `REQUEST_TIMED_OUT` (7) once the request may have reached it. Fetch errors use `NOT_LEADER_OR_FOLLOWER` (6). The broker answers Fetch with 6 while S3 is degraded and `KAFKA_STORAGE_ERROR` (56) while S3 is unavailable. Kafka clients retry all of these. If you alert on specific error codes, include 6 and 56 for Fetch.

### 9. Other behavior changes to check

- **`spec.s3.kmsKeyArn` now applies to brokers, the LFS proxy and snapshots.** Earlier releases ignored it for those writes. The upgrade restarts the brokers and LFS proxies of clusters that have it set. The credentials need `kms:GenerateDataKey` and `kms:Decrypt`. Console LFS credentials and consumers that resolve LFS objects also need `kms:Decrypt` when the key is set. Cloudflare R2 and other stores without SSE-KMS reject the writes. If such a cluster has the field set, remove it before you upgrade.
- **Puts, lists and `kafscale-cli` no longer create a missing bucket.** They fail with `bucket <name> does not exist`. Create the bucket first, or leave broker startup to call `EnsureBucket`.
- **Produce responses return `LogAppendTime` `-1`**, and Produce v5 and Fetch return the real log start offset. Clients that treated the old Produce timestamp as a broker append time will see `-1`.
- **Metadata v4 to v12 honors `AllowAutoTopicCreation=false`.** A client that depended on the v2.1.0 bug, where a metadata probe still created the topic, will now see the topic as missing until it creates it.
- **A fresh broker no longer seeds an `orders` topic.** If a local or memory-store demo assumed that topic existed, create it.
- **SQL discovery** lists only the topics a query reads, and no longer lists generation folders such as `orders@1` as topics. With etcd, deleted topics are hidden. Without etcd they stay visible until you prune or set `metadata.etcd.endpoints`.
- **`protectBucket` no longer turns on versioning** when the snapshot bucket has the same name as `spec.s3.bucket`. It still applies the public access block. Versioning is enabled only for a separate snapshot bucket. Do not point `operator.etcdSnapshot.bucket` at another cluster's data bucket. The name check would turn on versioning there.
- Custom metadata stores that do not implement `metadata.TopicConfigChanger` get a one-time warning and fall back to a plain read and write for IncrementalAlterConfigs.

### 10. What you can start using after every broker is on v2.2.0

- `kafka-topics.sh --create` without `--partitions` or `--replication-factor`
- topic configs at create time, and `kafka-configs.sh --alter`
- offset lookups by time, and Kpow "Last hour" / reset to a date
- `kafka-acls.sh --list` (read only)
- Iceberg tables in R2 Data Catalog, with `manages_locations: true` and the catalog token in a Secret
- compressed topics (gzip, snappy, lz4, zstd) in the SQL and Iceberg processors
