https://slatedb.io logo
```thread 'tokio-runtime-worker' (1240)
# general
p
Copy code
thread 'tokio-runtime-worker' (1240) panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/slatedb-0.9.0/src/seq_tracker.rs:95:13:
Sequence numbers must be monotonic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2025-11-13T20:29:02.895982Z ERROR slatedb::dispatcher: background task panicked unexpectedly. [task_name=writer, error=BackgroundTaskPanic("writer"), panic=Some("Sequence numbers must be monotonic")]
2025-11-13T20:29:02.896478Z ERROR slatedb::dispatcher: background task failed [name=writer, error=BackgroundTaskPanic("writer"), panic=None]
Hmm this one looks pretty bad
a
taking a look at this one, that seems like a real bug
p
If that helps, I can share the db
a
that might help, let me dig through some possibilities first. it seems like the sequence number persisted in the tracker somehow is out of sync with what hte oracle is generating
OK I think I found the bug, for now a workaround would be to modify the manifest fbs and remove the seq_tracker value.
I'll work to confirm that
p
Want me to create an issue for tracking?
a
sure thanks!
a
hmm I actually haven't quite figured it out. can you send over your manifest? that woudl be helpful
@criccomini @Rohan what situations might cause a manifest to flush (from the writer) that wouldn't flush a new L0?
c
Mmm checkpoints, compaction
Fencing
WAL writes...
Actuall no not WAL writes
a
I thought it may be a checkpoint but that doesn't seem to be it because if you run a checkpoint on the writer it flushes the memtables
compaction wouldn't cause the bug because that doesn't update the seq_tracker. the issue is that the L0 seq number is somehow lower than whats in the tracker
c
But what if there are no memtables to flush?
🤔
a
if there's nothing to flush then the seq number would be the same, right?
c
One would hope.. 😅
a
😆
yeah the only time we increment the
last_seq
is when we
write_batch
--- oh! maybe an empty batch write?
let me test that
c
ohh that's interesting
When do we allow empty batch writes? Just on WAL fence, right? Not sure when else we do it
a
ah yeah, seems like we actually early exit if the ops are empty
@Pierre can you send your manfiest file over? would be helpful to confirm the problem is there or elsewhere (also did a restart fix it? if so that's even more concerning haha)
p
A restart does not fix it
c
🥶
a
ok good, I would've been worried if it did
that means it's almost certainly a manifest corruption race condition -- narrows down the scope a lot
(I'm pretty sure clearing the seq tracker will let you get unstuck if you're currently in an incident)
OK claude was able to reproduce the race condition 🤯 that's very impressive. digging in to figure out how it did it
c
.....
gotta lvoe it
a
oh lol, it just looked at internal state that wasn't actually persisted 🤦‍♂️
I was too optimistic
c
🙁 lol .. the emotional swings with AI are hard to take
a
a "dumb" fix is to rewind the sequence tracker to the last L0 offset before WAL recovery, but I'm worried that'll mask the underlying issue
aha! I have a theory - if you have a fast enough write rate you're flushing memtables to L0 while still accepting writes into the WAL. you'll flush the seq tracker with the valeu of the WAL write, but the latest seq will be the one from the L0
p
@criccomini Benefit from doing slatedb/zerofs related work is that when I work on more normal things, it really feels like doing barely working
c
hahaha
Right?
Python stuff is like .. lol
p
Unless you have to work on a 100k+ lines mess
Especially pre type hints 😛
c
pre type hint python is dead to me
p
Do you still need that?
a
it wouldn't hurt if it's easy to get, but if not the fact that a restart didn't fix it basically confirms what I needed
a
OK confirmed, we have:
Copy code
"last_l0_seq": 35998,
and
Copy code
Sequence numbers: [1, 2854, 9375, 16924, 21961, 26739, 33571, 35319, 36003, 36098]
When you decode the seq tracker, so the seq tracker has higher seqnums than the last_l0
Copy code
"next_wal_sst_id": 215,
      "replay_after_wal_id": 211,
And clearly we've persisted the manifest without an L0 flush
c
Where are you getting " Sequence numbers: [1, 2854, 9375, 16924, 21961, 26739, 33571, 35319, 36003, 36098]" from?
a
I put the raw byte array into a test that decodes it in local code
c
gotcha
a
I think I can recreate this by hitting the l0_max_ssts
c
> When you decode the seq tracker, so the seq tracker has higher seqnums than the last_l0 What about the WAL? That could have the seqnums written there right?
Or is this with wal disabled
a
that's exactly the problem
the oracle assigns the first seqnum based on the last L0
but we udpate the seq tracker on ever ywrite
c
ahhhhh
a
so I think the right fix is to only update seq tracker on l0 flush
basically trakc a seq tracker in each KVTable, and then flush it when the KVTable is flusehd
I just want a test that repros it first
I'm really struggling to come up with this test haha. I need to hit max_l0_ssts, then I need a compaction to trigger allowing me to flush another l0, but to still have reamining WAL entries 😵
I'm sure that'll repro the bug, but darnit it's so hard to write a test that does that (triggering compaction once is a pain)
c
oof... I think you need some magical combo of the fail points
One trick you might not be aware of: you can configure failpoints to pause or fail or whatever a certain number of times before transitioning.. learning that made my life much easier
No idea if that's useful or of you already knew, but...
a
🤔 i didn't not know that, and it might help
I need compaction to run exactly once
c
yea
I had to do something similar in dispatcher.rs
> For example, 20%3*print(still alive!)->panic means the fail point has 20% chance to print a message “still alive!” and 80% chance to panic. And the message will be printed at most 3 times.
That whole page is gold..
r
wouldn't the way to fix this be to to maintain the last_seq in the tracker when replaying the wal?
a
it's the opposite problem, the tracker in this situation inclues whats already in the WAL
so when we try to track the sequence number from the WAL it freaks out because that is lower than what was previously persisted into the tracker
r
ahhh right that makes sense
so the persisted tracker snapshot needs to be the snapshot from when the l0 file was frozen
a
yeah
or rather, it needs to be tracked with each memtable/L0
hooray! failpoints to the rescue, i triggered the race condition
will have to wait for the actual fix for later (hopefully tonight)
c
It’s quite possible we’re seeing the same issue…
Both seem to involve out of order data right?
a
I don’t think so - this one is just a bona fide race where data gets added to the WAL between freezing and flushing memtables
So data is still in order but the oracle “sees” future data
Oh… actually maybe that is the same issue?
c
Nah mine was dumb haha
Whatever, I'll take dumb mistakes 😛
a
haha what was it? I'm curious now
another benefit of removing logical clocks is that we would not need the sequence tracker because we have it natrually with
RowEntry
which already trakcs the create_ts for every entry
c
I forgot to reset state between test runs in the chaos tests.. they're all using the same path/minio 🤦‍♂️
Wuh oh.. "Reader handles failed: JoinError::Panic(Id(22), "Value 77 is less than last seen value 119", ...)" this one looks a little worse...
Nope.. I think it's more state clearing junk lol
the cache now
hahaha
sigh
Some day I'll find a bug in actual code!!
p
@criccomini Lucky that I caught this one because whatever I do I was/am not able to reproduce it
a
merged the fix, probably worth creating an 0.9.1 milestone -- what else do we need fixed before we cut a new one? this bugt is pretty bad
p
That was quick @almog
c
Go for it. I'd deem this one critical. If we need to cut another one, we can always do 0.9.2
a
do we have a release cut runbook somewhere?
c
ya one sec
p
On a side note, shouldn't the DST have caught this one? 🤔
c
DST is very naive right now; it doesn't inject faults
So much to do lol
p
Unsure if that's still DST or just fuzzing at this point
c
@almog this line is important for patch releases: > Run the release workflow against the release branch and specify the desired release version (e.g. v0.6.1) Make sure you run the "release" action against your branch, not main
a
will do it right after my morning meeting
r
I took this up from almog. I was able to publish the patch release, but the website deploy failed because github only allows the deploy to run from main (see https://github.com/slatedb/slatedb/actions/runs/19374852628). I think that's fine - the release itself was successful and there aren't relevant website changes.
Generally speaking, are we deploying the website as part of the release or from main at other points unrelated to the release?
@criccomini
a
I've been deploying it separately whenever we make changes
but I guess docs are relevant
c
Right now, just from main (as Almog said, when we make changes)
In general, I'm not thrilled our website docs aren't versioned to specific releases...
a
@criccomini I'm open to looking into using mintlify - they have an OSS deal for $30/mo, I think Responsive may be able to take that on
(they have versioning support)
c
TBH, I'm inclined to wait a few...
I feel like docs are going to change dramatically in the near future with AI
I have been messing a lot with Dosu and I think it's getting closer...
a
oh nice, that's really promising
c
Yea.. they're building a thing to sync with our own markdown docs
I also want to test straight-up Codex CLI with docs