• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

evolution-gaming / kafka-journal / 41855087794
89%

Build:
DEFAULT BRANCH: master
Ran 04 Nov 2026 03:16PM UTC
Jobs 2
Files 220
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Nov 2026 03:11PM UTC coverage: 88.971% (-0.2%) from 89.15%
41855087794

push

github

web-flow
journal brain split / fork detection mechanism (#963)

## Human-written description

The idea of this PR is to introduce additional brain split detection
mechanism on replicator side of the journal.

### Current situation

This is one of the situations we want to detect:

1. There is a single writer (let's say **A**), which was writing
messages until seqNr = X,
2. Brain split happens and another writer (let's say **B**) appears,
3. **B** recovers messages up until seqNr = X, and starts writing
messages starting with seqNr = X + 1,
4. **A** continues writing messages starting with seqNr = X + 1 and up
to seqNr = Y,
5. **A** passivates gracefully without knowing **B** exists,
6. We now have the fork of a journal starting with X + 1 and ending with
Y.
7. **B** passivates gracefully without knowing about this fork. 

After some time:

8. Replicator reads these messages from Kafka and writes them to
Cassandra without any errors,
9. A new instance of journal (let's say **C**) starts a recovery.
10. It fails with the message saying that `Data integrity violated:
seqNr [X + 1] duplicated in multiple records from eventual journal, key
[some key here]`.

### What are the problems with the current approach?

1. It takes a long time before the fork is noticed, because both **A**
and **B** need to passivate first, and **C** start a recovery, before we
notice the issue.
2. We might not notice the issue at all if
`data-integrity.seq-nr-uniqueness` is not enabled.
3. We might not notice the issue at all if **B** purges part of the
journal after doing a snapshot.

### What do we want to achieve?

The goal of this PR is the following:

Add the detection of duplicate `seqNr` into replicator, so the issue is
noticed already during the replication.

We want this detection to be very non-intrusive at this stage. I.e. it
should be the warning in the logs / counter in the metric and that is
it. Ideally, we want it to be easily switchable from the config in case
the detection... (continued)

987 of 1310 branches covered (75.34%)

Branch coverage included in aggregate %.

5733 of 6243 relevant lines covered (91.83%)

1.66 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
74.36
-5.64% com/evolution/kafka/journal/eventual/ReplicatedJournal.scala
Jobs
ID Job ID Ran Files Coverage
1 Scala 3.3.x - 41855087794.1 04 Nov 2026 03:16PM UTC 220
76.56
GitHub Action Run
2 Scala 2.13.x - 41855087794.2 04 Nov 2026 03:18PM UTC 217
79.27
GitHub Action Run
Source Files on build 41855087794
  • Tree
  • List 220
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #41855087794
  • ce4d9423 on github
  • Prev Build on master (#41402827666)
  • Next Build on master (#42191563294)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc