GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — v2.17.x-emqx: port API changes / backport upstream fixes by keynslug · Pull Request #4 · emqx/ra

Conversation

@keynslug

@keynslug keynslug commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR builds on top of upstream v2.17.x branch, and:

  1. Ports a few changes from v2.16.x-emqx, mostly new APIs used by https://github.com/emqx/emqx.
  2. Backports several important bugfixes, including upstream implementation of Prevent log segments from having holes in index sequence #1 fixes.
  • 0b8767c [v2.16.x-emqx] 8f895279 Add force-forget for recovery without quorum.
  • 61ba963 [v2.16.x-emqx] 86fd64a9 Add quorum-confirmed membership APIs.
  • 5b39d1d [v2.16.x-emqx] b0df49d4 Reworked fix: preserve previous membership during recovery; stabilize membership test.
  • de14d56 [v2.16.x-emqx] 873a9759 Delete memtables on force-delete.
  • aa30a97 [upstream] #600 Preserve previous membership on follower append.
  • 4c66638 [upstream] #607 Handle snapshot installation while a candidate.
  • bd09dfd [upstream] #608 Avoid setting voted_for during pre-vote.
  • d669e2c [upstream] #609 Update membership when reverting a cluster change.
  • 78956d3 [upstream] 94add0eb Snapshot replication liveness, adapted to 2.17.x APIs.
  • fa5cd63 [upstream] 66c590c1 Partial: abort snapshot reception on leader DOWN.
  • 29bcf4f [upstream] #612 Redirect client commands during snapshot transfer.
  • f3139c5 [v2.16.x-emqx] 56f864e1 Handle candidate monitor events (also upstream Handle DOWN signals in candidate state rabbitmq/ra#588).
  • 858729a [v2.16.x-emqx] 66a6abec Preserve state updates when ra:aux_command/3 or ra:cast_aux_command/2 handlers produce aux effects, also in upstream: ec67223, e6e3396.
  • e65e2d4 [upstream] #637 Rewind last_written on log overwrite.
  • 398cc64 [upstream] #644 Partial: term-mismatch next_index calculation and regression test.
  • 6ad7c08 [upstream] #581 WAL gap detection; adapted range handling.
  • f1f5f5d [upstream] 406eb1cb Partial: sync WAL and segment directories.
  • 7c123af [upstream] fa20b5b6 Partial: ignore directory-sync errors for Windows compatibility.
  • 4298fb1 [upstream] #592 Propagate segment-close sync/flush errors.
  • 27e53f8 [upstream] #587 Partial: include filename in segment-close errors.
  • c90f4dd [upstream] #587 Partial: fault-injection recovery test.
  • 392c4e2 [v2.16.x-emqx] c4318ba0 Link segment-flush workers to their parent writer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
keynslug and others added 26 commits November 12, 2026 16:16
@keynslug
ra_server_proc: Allow force-forgetting specific cluster member
0b8767c
The new operation is provided through `force_forget_member/3`
function.

It's similar in purpose to `force_shrink_members_to_current_member/1`
but less radical: allowing to tell a specific member to erase
other, likely permanently lost members one-by-one, eventually
restoring working quorum and propagating updated cluster membership.

This is unsafe, and thus is not exposed in `ra` API.
@keynslug
ra: add quorum-confirmed variants of add / remove server ops
61ba963
@keynslug
ra_server: preserve previous_cluster during recovery log scan
5b39d1d
@keynslug
ra_server_sup_sup: drop memtables when force-deleting server
de14d56
@kjnilsson @keynslug
Merge pull request rabbitmq#600 from specula-org/fix/pre-append-log-f…
aa30a97
…ollower-badkey-crash

fix: handle missing previous_cluster in pre_append_log_follower
@kjnilsson @keynslug
Merge pull request rabbitmq#607 from specula-org/fix/candidate-instal…
4c66638
…l-snapshot-handler

fix: handle install_snapshot_rpc in candidate state
@kjnilsson @keynslug
Merge pull request rabbitmq#608 from specula-org/fix/prevote-side-eff…
bd09dfd
…ects

fix: remove side effects from pre-vote processing
@kjnilsson @keynslug
Merge pull request rabbitmq#609 from specula-org/fix/pre-append-membe…
d669e2c
…rship-update

fix: update membership when reverting cluster change
@kjnilsson @keynslug
Snapshot replication liveness fixes
78956d3
Add proper handling of election-related RPCs during snapshot receiving
@keynslug
Reset log after aborted snapshot installation.
fa5cd63
Partial cherry-pick of 66c590c.
@kjnilsson @keynslug
Merge pull request rabbitmq#612 from specula-org/fix/receive-snapshot…
29bcf4f
…-redirect-client

fix: redirect client commands during snapshot transfer
@keynslug
ra_server_proc: Handle DOWN signals in candidate state
f3139c5
@keynslug
ra_server_proc: Preserve updated state in aux_command handlers
858729a
This commit fixes a subtle bug which caused loss of server state updates
if aux handler produced `aux` effects, when executing in the context of
`ra:aux_command/3` or `ra:cast_aux_command/2`.

This reflects changes made in:
* ec67223
* e6e3396
@kjnilsson @cursoragent @keynslug
Fix stale last_written_index_term on log truncation
e65e2d4
When a new leader sends `append_entries` that overwrite existing
uncommitted entries in a follower's log (log truncation), the
follower must immediately adjust its `last_written_index_term`
downwards to reflect the newly truncated state.

Previously, `ra_log:write/2` failed to adjust this value during
truncation. This caused `ra_server` to report a stale, higher
`last_written` index in its `append_entries_reply`. Consequently,
the leader could mistakenly advance its `match_index` for that
follower and prematurely commit entries that had not actually
been persisted to disk, leading to assertion failures or data loss.

This commit updates `ra_log:write/2` to calculate the correct
`last_written_index_term` when truncation occurs and pass it to
the WAL batch writer. It also updates the
`?C_RA_SVR_METRIC_LAST_WRITTEN_INDEX` operational metric to
ensure metrics stay in sync with the corrected in-memory state.

A new test case `follower_aer_stale_last_written` is added to
`ra_log_2_SUITE` to verify this behavior.

Co-authored-by: Cursor <[email protected]>
@kjnilsson @keynslug
Tweak term mismatch next_index calculation.
398cc64
@kjnilsson @keynslug
Merge pull request rabbitmq#581 from rabbitmq/wal-gap-detection-fixes
6ad7c08
Wal gap detection fixes
@kjnilsson @keynslug
Sync directories after changes.
f1f5f5d
@kjnilsson @keynslug
Minor tweaks and refactoring
7c123af
Including ignoring return value of ra_lib:sync_dir/1 because it is
not supported on windows.
@kjnilsson @keynslug
Merge pull request rabbitmq#592 from rabbitmq/report-errors-on-segmen…
4298fb1
…t-close

Report errors on segment close instead of silently discarding them
@keynslug
Propagate IO errors to the writer on log segment close
27e53f8
@keynslug
Add testcase for IO error on log segment close
c90f4dd
@keynslug
Make sure writer workers die with parent log segment writer
392c4e2
This commit ensures there's no concurrent writer workers for the
same segments under any circumstances. Before, writer workers were
not tied to the lifetime of their parent log segment writer.

While it's extremely hard to construct a sequence of events that
may cause 2 or more concurrent workers issuing `pwrite`s to the same
log segment file under imaginable system and error conditions, better
be defensive.
@keynslug
ci: pin erlef/setup-beam to v1.24.1
1c6cb5c
@keynslug
ci: exclude elvis test-profile dependencies
c1faac4
@keynslug
ci: enable Dialyzer under Erlang/OTP 28
b0f6c6e
@kjnilsson @keynslug
Try make a test less time sensitive
561cdb3
ieQu1
ieQu1 approved these changes Nov 16, 2026
View reviewed changes
@keynslug
keynslug merged commit 1ff0bce into v2.17.x-emqx Nov 16, 2026
14 of 18 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@keynslug
keynslug deleted the sync/v2.17.x-emqx branch November 16, 2026 12:34
@keynslug keynslug mentioned this pull request Nov 18, 2026
perf(dsraft): do not occupy all dirty IO schedulers for log segment flush emqx/emqx#20102
Merged
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@ieQu1 ieQu1 ieQu1 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@keynslug @ieQu1 @kjnilsson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.