# Malachi v0.29.1

[Malachi](https://github.com/malachi-hq/malachi) v0.29.1 is a patch release. It adds no feature and changes no configuration. It carries six fixes, and most of them were found the same way: a [chaos drill](https://malachi-hq.github.io/malachi/running-chaos-drills.html) or a careful reading of what a module promised turned up a case where the code did something else. This post walks through what each fix changes for someone running a cluster.

## An acknowledgement now includes the primary

With replication group commit turned on (`MALACHI_REPLICATION_GROUP_COMMIT`, off by default), a write could be acknowledged once a majority of followers had flushed it to disk, before the primary's own flush. For a short window the primary could not serve a record it had just acknowledged. The reply now also waits for the primary's own durable write, as the documentation already said it did. A failed flush on the primary still answers the waiting batches with the storage error, and that error is now documented as indeterminate: the write may or may not have landed.

![Two timelines. In v0.29.0 the acknowledgement leaves once both followers have fsynced, before the primary has, so for a moment the primary cannot serve the record. In v0.29.1 it leaves after the primary's flush](https://malachi-hq.github.io/malachi/blog/2026-12-04-v0-29-1/acknowledgement.png align="center")

## Rebalancing respects quorum and the lease

Two fixes touch how a rebalance moves the members of a vnode between nodes.

A new member is now started before it is announced to the group. Before, a replacement that failed to start still counted toward the vnode's quorum, so with one node already down the vnode could stop committing. A multinode test over real `ra` reproduces that case and shows the vnode keeps committing.

![A vnode with three members, one on a node that is down. In v0.29.0 a fourth member is announced and fails to start, so 2 of 4 members run and quorum needs 3. In v0.29.1 the failed member never joins, so 2 of 3 run and quorum is 2](https://malachi-hq.github.io/malachi/blog/2026-12-04-v0-29-1/member-start.png align="center")

Each member change is also bounded by the rebalance lease now. Only the lease holder commits a rebalancing plan, but a change it started just before losing the lease could keep adding and removing members after another node had taken the lease and started its own plan. Every step now has a deadline derived from the lease and checks the lease again before it runs, so a holder that lost it stops.

![Two timelines of a rebalance lease. In v0.29.0 node A keeps changing members after its lease expires while node B applies its own plan. In v0.29.1 node A stops its remaining steps once it no longer holds the lease](https://malachi-hq.github.io/malachi/blog/2026-12-04-v0-29-1/lease-fence.png align="center")

## Healing follows the topic's placement

When a node is lost, healing places new replicas of its segments elsewhere. It used to place them by the cluster-wide spread rule alone, ignoring the topic's own placement policy. It now uses the same policy as initial placement, and refills only the vacated slots around the surviving replicas, so applying the policy never drops a live replica or leaves an orphaned copy. In steady state, healing also stops making membership calls on every pass.

![A segment replicated across zones a, b and c loses its zone c replica. In v0.29.0 the new replica can land in zone a, by the cluster-wide rule. In v0.29.1 the live replicas stay and the new one comes from zone c, the zone the set covers least](https://malachi-hq.github.io/malachi/blog/2026-12-04-v0-29-1/heal.png align="center")

The heal coordinator's periodic tick also survives a slow answer from the log membership server now. The rolling upgrade drill had reported it as a crash on a node under load.

## A segment that already exists

A rare crash in the chaos certification had been open since September: the replication server stopped with `{:error, :already_exists}` while creating a segment. The cause took three steps. A node died after creating an empty segment file and before its first write. On restart that empty file became the active segment, a seal then rolled it while the log still pointed at it, and the next write tried to create the same file again. Now a segment that holds no record is cut to zero bytes instead of sealed, and the next write takes the empty file over. A file that does hold records is refused with what the disk holds, so the copy fails with a reason instead of a crash. Tests at the `Malachi.Log` level and through the replication server fail before the fix and pass after it.

![Three steps: a node creates an empty segment file and crashes; on restart the empty file is sealed and keeps its name; the next write tries to create the same file and fails with already_exists. Below, what v0.29.1 does instead](https://malachi-hq.github.io/malachi/blog/2026-12-04-v0-29-1/segment-exists.png align="center")

## Upgrading

This release has no upgrade notes and no configuration changes.

## Changes

### Fixes

- heal honors topic placement policy ([#414](https://github.com/malachi-hq/malachi/pull/414))
- **cluster:** start a rebalanced vnode member before announcing it ([#412](https://github.com/malachi-hq/malachi/pull/412))
- grouped reply waits for primary durability ([#411](https://github.com/malachi-hq/malachi/pull/411))
- segment already exists on ensure active ([#416](https://github.com/malachi-hq/malachi/pull/416))
- fence rebalance member changes ([#419](https://github.com/malachi-hq/malachi/pull/419))
- heal tick survives membership timeout ([#418](https://github.com/malachi-hq/malachi/pull/418))

### Dependencies

- **deps:** bump yaml_elixir to 2.13.0

### Other

- release branch flow ([#408](https://github.com/malachi-hq/malachi/pull/408))
