Skip to content

v2.10.0

Choose a tag to compare

@alice-viola alice-viola released this 21 Nov 08:29
· 97 commits to master since this release

Queen MQ 2.10.0: the image is ghcr.io/queen-mq/queen:2.10.0 (linux/amd64 and linux/arm64), and :latest points at it. The PHP client is 2.10.0 (composer require queen-mq/php-client:^2.10.0) and pins supervisor 0.10.0 (the release supervisor/v0.10.0). The other clients did not change and talk to 2.10.0 as to 2.9.0: the JavaScript client stays at 2.9.2, the Python, Go, Rust and C++ clients at 2.9.0, queen-protocol at 1.7.0, queenctl at 2.7.1. Jepsen ran 568 tests on the code of this release before its LMDB fix, and the 59-test gate on 2.10.0 itself: all valid.

Upgrading from 2.9.x: a rolling restart. 2.10.0 keeps the data format of 2.9.0 (cluster
version 8), and nodes of the two releases replicate to each other while the roll runs. The PHP
client moves to 2.10.0 and pins supervisor 0.10.0, which carry the last two entries below. The
JavaScript client stays at 2.9.2, the Python, Go, Rust and C++ clients at 2.9.0, queen-protocol
at 1.7.0 and queenctl at 2.7.1: their code did not change, and they talk to a 2.10.0 broker as to
2.9.0. Jepsen ran the whole suite, 568 tests, on b0d3a5c67, the code of this release before the
LMDB fix below, and all were valid; on 2.10.0 itself (930578e2b) it ran the 59 tests of the
gate, all valid.

Server: openraft 0.10.0. The consensus library moves from the 0.10.0-alpha.37 prerelease to
the 0.10.0 release, pinned exactly as before. It brings the fixes openraft made in between; three of
them are on paths QueenMQ takes, all needing rare timing that no Jepsen campaign showed: a stale
replication stream could send an old term's entries with a later commit point, a late reply on a
pipelined stream could confirm a linearizable read for a leader already replaced, and two membership
changes made from one configuration in two terms could both commit. The frames between nodes keep
their 2.9.0 form, so nodes of this release and 2.9.0 nodes replicate to each other during a rolling
restart (the conflict hint 0.10.0 adds to append answers is not sent). Two things behave
differently. A leader elected a moment ago refuses a membership change until it has committed an
entry of its own term; the refusal is 409 in_flight, as for a change in progress: retry it. And
while the cluster runs both releases, a leadership transfer between a node of each, the hand-off on
SIGTERM among them, counts as an ordinary election, which can wait up to an election timeout for
the old leader's lease to run out.

Server: a member wiped in place gets its entries again. A member back with an empty data
directory (the same node id, its disk lost) could stay at the snapshot it was sent and receive no
further entry until the leader changed. The leader's stream to it, planned before the leader found
its log gone and connected late, asked for entries the purge had passed since; the member, back on
its snapshot, answered with success each heartbeat sent in their place, and that stream never
ended, so the one planned after the snapshot never started. Such a stream now ends at its second
request below the purge point. CI saw it as an_empty_member_gets_the_whole_state_with_its_indexes
failing now and then; a test now holds the leader's stream across exactly that, and fails every
time without the fix.

Kafka facade: a leader cut off from the others stops answering as the leader. When a network
partition cut the raft leader off, it went on calling itself the leader to the Kafka clients that
still reached it, until the partition healed: raft keeps a leader in its role until it hears of a
newer term, and none reaches it. Its state stopped where the partition began, while the leader
elected on the other side went on. So a consumer that had read further on the new leader, and then
took its metadata from the old one, fetched past the end of that old state, was answered
OFFSET_OUT_OF_RANGE, and went back to the offset auto.offset.reset names (earliest: the
start of the partition). Nothing was lost or changed, but the consumer read everything again. A node
now counts as the leader for Kafka clients only while a quorum has acknowledged it within raft's
leader lease (twice QUEEN_RAFT_ELECTION_MS, 2 s by default), the time in which no other node can
be elected and past which raft refuses its writes too: past it, Metadata names no leader, Fetch and
Produce answer NOT_LEADER_OR_FOLLOWER, and the client asks another node. Jepsen's Kafka workload
found it, once in a campaign, under a partition that cut the leader off.

Server: a transaction waits for a cursor that another one holds. A transaction that acks
messages or sets consumer-group positions holds each cursor it moves, from the moment the leader
checks it until its entry commits, and the leader's checkpoint holds a cursor while it writes the
cursor's last change. A second transaction on one of those cursors was refused at once with
reserved, nothing written, although the hold lasts one commit. The docs say to retry it, but no
SDK does: the JS client throws it, so the handler failed and the consumer nacked its message,
spending one of the message's retries, and a Kafka transaction got a fatal error (next entry). It
happened when two writes on one partition and group overlapped: a handler that commits the messages
of one popped batch in parallel, an ack not awaited before the next transaction, a lease renewal in
flight while the handler commits. The leader now prepares such a transaction again: it waits 2 ms
first, and twice as long each time after, up to 50 ms between tries, until 100 ms before the
request's deadline (QUEEN_STMT_TIMEOUT_MS, 30 s by default). Only a cursor held for that whole
time is answered reserved, as before, with nothing written. The dashboard's ack counts no longer
count the positions of a try that was refused. Tests hold a cursor the way a transaction in flight
does, on one node and through a follower, and fail every time without the change.

Kafka facade: a commit that the broker asks to retry no longer kills the producer. EndTxn
answered INVALID_TXN_STATE, which the Java client treats as fatal (the producer must be closed),
whenever the broker refused the commit with a reason that means "retry": reserved (above) or
unavailable. Kafka never refuses such a commit. Now the transaction stays open with its records
and offsets, EndTxn answers CONCURRENT_TRANSACTIONS, and the client sends it again on its own, as
every Kafka client does. Jepsen's Kafka workload found it: at the end of a test, ten transactional
producers committed one consumer group's offsets on the same partitions at the same moment, and six
of them were refused. Nothing was lost or written twice: each refused commit wrote nothing.

Server: no crash when a store closes while a thread that read it exits. The store and the trace
store kept an LMDB reader slot on every thread that had ever read them, until the thread exited, and
LMDB frees such a slot from a hook that runs as the thread exits. When a thread exited while its
store was closing, that hook could write into the store's lock file after the close had unmapped it,
and the process died of SIGSEGV. The broker process never closes its store while it runs (installing
a snapshot restarts it), so it was not exposed; an application that embeds the broker and restarts
it in its own process was, and so were the broker's test binaries, which open and close hundreds of
stores: 3 times in about 100 CI runs. Both stores now hold a reader slot only while an LMDB read
lasts (LMDB's MDB_NOTLS), so no slot is left for a thread's exit to free. That mode takes a lock
inside LMDB at the start of each LMDB read, so the store's reads, all served from RAM, now open no
LMDB read at all; the LMDB reads left are the load at boot, the background scrub, a snapshot's copy
and trace queries. One thing behaves differently: after a fatal LMDB error, reads go on answering
from RAM, as writes already did, where before every read failed. The gauge
queen_raft_store_readers{kind="used"}, the most reader slots in use at once since boot, now stays
at a few instead of growing with the threads that had read. Tests let as many threads read once and
stay alive as there are reader slots, then read once more: before the change that read was refused,
every time.

PHP client 2.10.0 and supervisor 0.10.0: pools of queen:consume handlers. A supervisor pool
can name 'handlers' => [queue => HandlerClass::class] instead of 'queues'. For each queue, both
engines, the Rust master and the PHP one, then run queen:consume <queue> <handler> workers, with
the scaling, restart backoff, prefork, drain, status and dashboard of a queue:work pool: one
master runs every consumer of the application. The workers pop with --subscription-mode=all, so a
group the pool opens reads the backlog the master scales on. A pool of handlers is refused with
balance off, the time strategy, a connection other than queen, queues beside the handlers, a
lease_renewal other than the one in config/queen.php, a shutdown_grace shorter than the
timeout plus the 10 s long poll, or a class without handle(). A queen:consume that a supervisor
runs stops for queue:restart and exits 0. The fork server speaks protocol 2, whose request names
the command (queue:work or queen:consume), and still protocol 1 to an older master.

PHP client: a comma-separated QUEEN_URLS works in the container's client too. The queue
connector split 'urls' => env('QUEEN_URLS') on commas, but the client that the service container
builds took the string as it was, so the Queen facade and queen:consume failed at boot with
"urls must be a non-empty array". That client splits it the same way now.