Scenario 09.1.3 · AutoMQ: moving a partition without copying
AutoMQ diskless Kafka: moving a partition, no copying
AutoMQ 1.7.4 · a move uploads the old leader's WAL as an SSO, closes the stream and reopens it on the target at epoch 1; no replica copies anything, and a graceful stop moves every partition the same way.
Run this scenario in the playgroundorders-0 is led by broker-1. t+2.150s
Round 1 is safe in S3: broker-1's WAL object wal-0001 (orders-0 and orders-3, offset 0) was confirmed at 1250, and so were the records of orders-1 and orders-4, led by broker-2. Round 2 was appended at 2050 and sits in broker-1's open WAL buffer: offset 1 of orders-0 and offset 1 of orders-3, not yet in S3, high watermark still 1 on both. Each partition has one leader and nobody else holds a copy. Producer p-all has retries=30 and retry.backoff.ms=500 so it can outlast a move. In a moment orders-0 is reassigned to broker-3 with a single replica.
Open at this step: step 1, orders-0 is led by broker-1Reassign: the controller retargets orders-0; it has no leader. t+2.250s
At 2200 the reassign reached the controller. orders-0 now has no leader: its stream on broker-1 is closing and the target is broker-3 (the strip shows no leader, the stream shows its target). Nothing is copied to broker-3. broker-1 first flushes its open WAL buffer at once (wal-0003, orders-0 and orders-3 offset 1, uploading since 2200), because the stream cannot close with data still in memory. orders-3, broker-1's other partition, keeps its leader.
Open at this step: step 2, Reassign: the controller retargets orders-0; it has no leaderbroker-1 uploads its WAL and commits it as an SSO. t+3.441s
wal-0003 was confirmed at 2800 and acked offset 1 on both partitions (HW 2); broker-1 then uploaded everything it still held in WAL objects as one SSO and committed it to the controller at 3441: sso-0000 holds wal-0001 and wal-0003, so it covers orders-3 (offsets 0 to 1) as well as orders-0 (offsets 0 to 1), although only orders-0 is moving. In the same instant the stream of orders-0 was closed, and p-all's new record for orders-0 (sent at 2300) has been answered NOT_LEADER_OR_FOLLOWER three times, at 2350, 2850 and 3350, and retried every 500 ms.
Open at this step: step 3, broker-1 uploads its WAL and commits it as an SSOClosed at 3441, the stream reopens on broker-3 with epoch 1. t+3.560s
100 ms after the close, at 3541, broker-3 found the closed stream and opened it with epoch 1; its next offset is 2, the high watermark. orders-0 has a leader again, broker-3. The retry of p-all's record is still waiting for its next 500 ms backoff, so it lands at 3850.
Open at this step: step 4, Closed at 3441, the stream reopens on broker-3 with epoch 1No replica caught up: nothing was copied between brokers. t+5.500s
The retried record was appended by broker-3 at 3850 with offset 2, uploaded and acked at 4950: orders-0 now has HW 3 and its only in-sync replica is broker-3. The log of events has no replica fetch and no ISR change for this move: a partition that lives in S3 has nothing to catch up (in 16.1.3 a new replica copies the log first). g1 has read all three records of orders-0. broker-2 leads orders-1 and orders-4, which have 1 record each.
Open at this step: step 5, No replica caught up: nothing was copied between brokersA graceful stop moves every partition broker-2 leads. t+9.600s
At 6200 broker-2 was stopped gracefully: the controller retargeted orders-1 and orders-4 to broker-1 at once (the simulator's least-loaded pick), so they had no leader; broker-2 flushed the one record each had in its buffer (acked at 6800), uploaded and committed an SSO at 7441 and closed both; broker-1 opened them at epoch 1 at 7541, 100 ms later, next offset 2, in one step. The two records p-all sent at 6400 got NOT_LEADER_OR_FOLLOWER at 6450, 6950 and 7450, and were appended by broker-1 at 7950 and acked at 9050. All 11 records are acked and g1 has read them all; epoch 1 on orders-0, orders-1 and orders-4, epoch 0 on the partitions that never moved.
Open at this step: step 6, A graceful stop moves every partition broker-2 leadsWhat you start with
AutoMQ 1.7.4 is a fork of Apache Kafka 3.9.1 that keeps every topic in S3, with one leader and no other replica per partition. So there is nothing to copy when a partition moves: the old leader makes sure its data is in S3, and the new leader opens the partition from there. Compare 16.1.3, "Partition reassignment by hand", where a new replica catches up by copying. Here broker-1 leads orders-0 and orders-3 and is busy writing to both when orders-0 is reassigned to broker-3 with a single replica. Producer p-all sends acks=all and is set to retries=30 and retry.backoff.ms=500: the simulator's backoff is fixed, so that is about 15 s of retries, enough for a move (a real Kafka client retries until delivery.timeout.ms, 120 s by default, and the simulator's default of 5 retries would give up first). Watch the controller lane, the WAL buffer and the partition strips.
Step by step
- orders-0 is led by broker-1 t+2.150s Round 1 is safe in S3: broker-1's WAL object wal-0001 (orders-0 and orders-3, offset 0) was confirmed at 1250, and so were the records of orders-1 and orders-4, led by broker-2. Round 2 was appended at 2050 and sits in broker-1's open WAL buffer: offset 1 of orders-0 and offset 1 of orders-3, not yet in S3, high watermark still 1 on both. Each partition has one leader and nobody else holds a copy. Producer p-all has retries=30 and retry.backoff.ms=500 so it can outlast a move. In a moment orders-0 is reassigned to broker-3 with a single replica. Open at this step: step 1, orders-0 is led by broker-1
- Reassign: the controller retargets orders-0; it has no leader t+2.250s At 2200 the reassign reached the controller. orders-0 now has no leader: its stream on broker-1 is closing and the target is broker-3 (the strip shows no leader, the stream shows its target). Nothing is copied to broker-3. broker-1 first flushes its open WAL buffer at once (wal-0003, orders-0 and orders-3 offset 1, uploading since 2200), because the stream cannot close with data still in memory. orders-3, broker-1's other partition, keeps its leader. Open at this step: step 2, Reassign: the controller retargets orders-0; it has no leader
- broker-1 uploads its WAL and commits it as an SSO t+3.441s wal-0003 was confirmed at 2800 and acked offset 1 on both partitions (HW 2); broker-1 then uploaded everything it still held in WAL objects as one SSO and committed it to the controller at 3441: sso-0000 holds wal-0001 and wal-0003, so it covers orders-3 (offsets 0 to 1) as well as orders-0 (offsets 0 to 1), although only orders-0 is moving. In the same instant the stream of orders-0 was closed, and p-all's new record for orders-0 (sent at 2300) has been answered NOT_LEADER_OR_FOLLOWER three times, at 2350, 2850 and 3350, and retried every 500 ms. Open at this step: step 3, broker-1 uploads its WAL and commits it as an SSO
- Closed at 3441, the stream reopens on broker-3 with epoch 1 t+3.560s 100 ms after the close, at 3541, broker-3 found the closed stream and opened it with epoch 1; its next offset is 2, the high watermark. orders-0 has a leader again, broker-3. The retry of p-all's record is still waiting for its next 500 ms backoff, so it lands at 3850. Open at this step: step 4, Closed at 3441, the stream reopens on broker-3 with epoch 1
- No replica caught up: nothing was copied between brokers t+5.500s The retried record was appended by broker-3 at 3850 with offset 2, uploaded and acked at 4950: orders-0 now has HW 3 and its only in-sync replica is broker-3. The log of events has no replica fetch and no ISR change for this move: a partition that lives in S3 has nothing to catch up (in 16.1.3 a new replica copies the log first). g1 has read all three records of orders-0. broker-2 leads orders-1 and orders-4, which have 1 record each. Open at this step: step 5, No replica caught up: nothing was copied between brokers
- A graceful stop moves every partition broker-2 leads t+9.600s At 6200 broker-2 was stopped gracefully: the controller retargeted orders-1 and orders-4 to broker-1 at once (the simulator's least-loaded pick), so they had no leader; broker-2 flushed the one record each had in its buffer (acked at 6800), uploaded and committed an SSO at 7441 and closed both; broker-1 opened them at epoch 1 at 7541, 100 ms later, next offset 2, in one step. The two records p-all sent at 6400 got NOT_LEADER_OR_FOLLOWER at 6450, 6950 and 7450, and were appended by broker-1 at 7950 and acked at 9050. All 11 records are acked and g1 has read them all; epoch 1 on orders-0, orders-1 and orders-4, epoch 0 on the partitions that never moved. Open at this step: step 6, A graceful stop moves every partition broker-2 leads
The takeaway
The reassign left orders-0 without a leader at once. broker-1 flushed its open WAL buffer, waited for the confirm, and force-uploaded one SSO that also carried orders-3, a partition that did not move; only then was the stream closed, and 100 ms later broker-3 opened it with epoch 1 at the high watermark. orders-0 had no leader for about 1.3 s (2200 to 3541: the 600 ms flush upload, the 600 ms SSO upload, the 40 ms commit and the 100 ms open). The record p-all sent during the move was answered NOT_LEADER_OR_FOLLOWER three times and was retried until broker-3 led the partition. No replica fetched anything and no ISR changed: nothing was copied between brokers. Stopping broker-2 gracefully moved both partitions it led the same way, each reopened at epoch 1, and all 11 acks=all records were acked and read. AutoMQ facts (1.7.4): closing a stream force-uploads its data first (S3Stream.close0, forceUpload), and the new leader opens the log with its leader epoch (ElasticLog.apply); a gracefully stopping broker's partitions move through the same close and open path (ElasticReplicaManager.stopPartitions, controlled shutdown). Simulator choices: the target of a move or graceful stop is the least-loaded live broker, same zone first, ties by id (a stand-in for the controller's weighted random pick), the target polls for the closed stream every 100 ms, and p-all's retry settings are chosen to outlast a move.
Configs in this scenario
-
acksHow many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). How acks works -
retriesHow many times the producer sends a batch again after a transient error (default 2147483647, so in practice delivery.timeout.ms ends the retrying); idempotence needs it above 0. -
retry.How long the producer waits before retrying a failed send, so it does not hammer a broker that is still recovering.backoff. ms -
delivery.The upper bound on reporting success or failure after send() returns, covering the wait in a batch, the wait for the acknowledgement and every retry (default 120000, 2 minutes); it should be at least request.timeout.ms plus linger.ms.timeout. ms
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=09.1.3" title="Kafka Simulator: AutoMQ: moving a partition without copying" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/automq-partition-move/">AutoMQ diskless Kafka: moving a partition, no copying</a></p> Further reading
AutoMQ v1.7.4 source on GitHub
Troubleshooting
More in Diskless
- Diskless Kafka topics (KIP-1163): the write path
- Diskless vs classic Kafka: cross-AZ replication traffic
- Diskless Kafka produce latency: the price of object storage
- Diskless Kafka (KIP-1163): when object storage goes down
- Aiven Inkless diskless Kafka: the write path
- Aiven Inkless: what a PostgreSQL outage does to Kafka
- Aiven Inkless: what losing a Kafka broker costs
- Aiven Inkless: a slow S3 bucket fails Kafka produce
- KafScale diskless Kafka: etcd lease, S3 segment, ack
- KafScale 2.1 diskless Kafka: a lease owner crashes
- KafScale 2.1 diskless Kafka: when etcd goes down
- KafScale 2.1 diskless Kafka: when S3 goes down
- KafScale 2.1 proxy: etcd down past the 60 s cache TTL
- KafScale 2.1: a Kafka producer timeout that still wrote
- KafScale 2.1 diskless Kafka: lease handover, no overwrite
- KafScale 2.1 diskless Kafka: a paused broker comes back
- AutoMQ diskless Kafka: one S3 WAL per broker, then ack
- AutoMQ diskless Kafka: a broker crash and WAL failover
- AutoMQ diskless Kafka: zone router, no cross-zone data
- AutoMQ diskless Kafka: when S3 goes down
- WarpStream diskless Kafka: the write path through Agents
- WarpStream Kafka: a leader per client, a cache per zone
- WarpStream Kafka: an Agent dies mid-commit
- WarpStream Kafka: the control plane goes down
- WarpStream Kafka Ripcord: produce without the control plane
- WarpStream Kafka lightning topics: ack before the commit
- WarpStream Kafka transactions in the control plane
- Redpanda Kafka write path: the offset comes after S3
- Redpanda Kafka leader crash: a Raft election, no replay
- Redpanda Kafka S3 outage: uploads time out, Raft holds
- Redpanda Kafka L0 to L1: the LRO and who serves a read
- Redpanda Kafka transactions: exactly-once on Cloud Topics
- Nisshi diskless Kafka: watermark.json, then the batch
- Nisshi diskless Kafka on PostgreSQL: a row lock per write
- Nisshi diskless Kafka: two brokers write one partition
- Nisshi diskless Kafka: reading through another broker
- Nisshi diskless Kafka: a broker dies mid-write
- Nisshi diskless Kafka: when PostgreSQL goes down
- Nisshi diskless Kafka: what 0.8.2 refuses
- Ursa for Kafka write path: Oxia assigns the offset
- Ursa for Kafka zones: the zonal owner and the zone cache
- Ursa for Kafka compaction: from WAL objects to Parquet
- Ursa for Kafka broker failure: a kill and a silent broker
- Ursa for Kafka: diskless and disk topics, side by side