https://slatedb.io logo
It’d be great to have an api that
# general
p
It’d be great to have an api that records changes (say through write batch or simple writes or deletes), then that state could be passed to flush to only mandatory flush for these specific changes
c
Couple questions: 1. What exactly is the use case? 2. Would these potentially need to be out of order? For (2), I mean: write a write b flush b <-- a isn't yet flushed here and it wasn't requested..
p
To have closer to classic block device semantics in zerofs
Where you can fsync a single file
I don’t really care about strict guarantees of what happen, it’s just that it feels wasteful to sync everything when the user just requested a single file fsync
c
Gotcha.. I think the most straight forward way to support this would be to provide an
flush_seq: Option<u64>
in
FlushOptions
that would allow you to specify what seqnum to flush up to. Then you could hold a seqnum for the last write to each file and when you want to flush just a file, you'd provide that file's seqnum as
flush_seq
. This would keep ordering, so some other files might be flushed as well if their writes occurred before, but subsequent writes would not be flushed in the call.
p
That would sound very good
c
I have a TODO to write an RFC for exposing seqnums to users... mind opening a GH issue so this use case isn't lost?
p
Yes!
Btw we got a great reply on the issue I opened for object_store stuff
Don’t know if you saw
c
Yea.. I don't fully follow what he's saying, though..
I need to think on it a bit.. If we have a timeout when writing SST/manifest what should we do if the file exists on retry...
On manifest exists, I think we would want slatedb to refresh/merge the latest manifest and retry On SST exists in WAL, I think we would need to refresh the manifest and see if we've been fenced... if not, verify the SST is the one we wrote and move on... On SST exists in compacted, I think we would want to verify compactor_epoch isn't fenced in manifest and make sure the SST is what we wrote.... It gets pretty complex 🤔
p
Maybe I am wrong and I say that with great respect because they wrote a great lib, but this whole thing just seems like they want to justify a weird behavior because it’s there and that’s it 😅
That’s very frustrating because my trivial patch makes things work great
c
haha
Have you dug into the overwrite behavior? Perhaps we can use that as tustavold suggested
Like overwrite with a precondition that it not exist 😛
p
I didn’t check what it does
But that looks semantically wrong?
c
It does, but it might work haha
p
Create and overwrite is not different for s3 semantically
c
agreed
p
It doesn’t change the idempotency requirement
c
At this point I'm just trying to find the shortest path to a clean fix 😛
p
If it was python we’d have object_store.put = slatedb_put 😂😂😂
c
hahah
p
And what’s doubly frustrating is that slatedb is not the only one, there’s other people bitten by this (saw that in referenced issues from the retry pr)
c
Starting to wonder if it makes sense for them to have a object-store-contrib package where we can stash stuff like retries and our disk cache impl (or the influx one)
I wonder if, psychologically, that would make it easier for tustavold to accept some of these contribs
p
I’d say fork it at this point, it’s complete enough 🤮
c
Nah, if we have to fork, I'd rather just use opendal as the default.. I wonder if using their bridge solves this problem
cc @Xuanwo
I really don't want to maintain a fork
p
Xuanwo has a tracking issue to make OpenDAL work properly with slatedb
There’s one more solution, use the officially supported sdks (at least for azure and s3, unsure if gcp has one)
And use directly that
c
😬
Are you using your patched version for now?
p
Yes and it works perfectly
But I want to publish zerofs to crates.io
And so I want to ditch the git part
And cargo doesn’t support patching dependencies from crates.io directly
So cannot publish my fork to use it either
c
object-store-retrying
😭
p
I replied on the issue
c
I think he does have a point.. if we blindly retry on exists after a timeout, we will think we're fenced when we aren't... https://discord.com/channels/1232385660460204122/1405219133225697281/1405258085601116172
I suspect we need to handle the timeouts in tablestore.rs
(and manifest_store/mod.rs)
p
Perhaps, but that’s for slatedb to improve on that, it doesn’t change the idempotency thing
In the end, it’s possibly not a great thing to let object_store handle retries at all then
A slatedb trait and helper functions to use that directly probably wouldn’t be a massive piece of work
c
@Pierre how do you handle it when ZeroFS's SlateDB client gets fenced?
Do you just recreate?
p
It seems to work fine as is
I didn’t implement additional logic there
When a second zerofs is launched on the same bucket it gets fenced
I need to double try that again as I am unsure I did after the change to my fork but almost sure
c
So, if we simply have SlateDB retry, there is theoretically the case where the file already exists on retry. In such a case, I believe we'll return a SlateDbError::Fenced
And the client will be dead after that. In essence, it would be the same behavior as you see with timeout now
p
Why not have a “fenced suspicion” state?
Where we actually fetch to see what’s there?
Eg “MaybeFenced”
c
Haha I just proposed this in the GH issue
It should live in the object_store
p
I wanted to reply him that but didn’t want to as I really didn’t want to be too pushy
c
It should be pretty straightforward. On Create timeout, retry. If exists, check checksum.
p
That sounds healthy
c
Agreed
Otherwise, we have to implement basically the same thing in SlateDB.
Which we could do, but this behavior seems very intuitive t ome
p
Do slatedb panic on fencing? I don’t remember
c
Nah, it sets it as the global error state and returns it on any subsequent calls
(that behavior you hate 🙂 )
p
Ok great!
I don’t really
c
I want to clean that up
p
I just thought it was slatedb’s fault
c
But first I'm working on a patch to change the way we handle event loops 🧶
p
But in the current state it makes sense
I just didn’t want my app to die on network errors
🥲
What's funny is s3 is supposed to be simple
c
haha yea it's a mess
p
But the more they add the more it's becoming as quirky as posix
LOL
c
Yea..
I'm thinking through how to best handle this on our end
p
And now there's express zone too
c
yea lol
directory buckets sigh
p
Azure has page blobs...
> Page blobs are a collection of 512-byte pages, which provide the ability to read/write arbitrary ranges of bytes. Hence, page blobs are ideal for storing index-based and sparse data structures like OS and data disks for Virtual Machines and Databases. For example, Azure SQL DB uses page blobs as the underlying persistent storage for its databases. Moreover, page blobs are also often used for files with Range-Based updates.
Basically block storage with extra steps
😄
But express zone I don't understand
It shouldn't be called s3
d
I’m glad to see the discussion in that object_store issue. I agree that we should strive to avoid forks at all cost, that’s why I opened a PR in their repo right away, I find it easier to have these conversations when you proactively send people code XD
c
Haha yea..
x
Yep, at https://github.com/apache/opendal/issues/6446 I believe we have addressed most thing there.
c
Nice! I'm curious if you can think of a better way for us to handle the timout issue when calling Create
(there's discussion in hte GH above)
x
Switch the default to opendal maybe also a thing. I can take a look, maybe together with @flaneur233 😋
Which discussion?
c
☝️
x
Oh, I see. I believe your theory works. But we may need extra call to get the object metadata.
I checked opendal's test log and found that aws doesn't give us enough information while returning 412:
Copy code
2025-08-12T02:38:06.506395Z  WARN opendal::services: service=s3 name=*** path=1788bc34-2e94-4f55-82af-a6e48b0b967c written=2138689: write close failed Condition (permanent) at write, context: { uri: https://s3.***.amazonaws.com/***/***464c8552-6330-4889-92cb-c70b43587b4d/1788bc34-2e94-4f55-82af-a6e48b0b967c, response: Parts { status: 412, version: HTTP/1.1, headers: {"x-amz-request-id": "1DP40P4GDFTSD0YP", "x-amz-id-2": "TtbibjMZqkAo35c9Oa28ufCwuCS/BfzXO6IXOB0BgOtAPnABMw5p6MDh+SMo/VpFGCMbNAyy6GE8ykWw0PvF0RS2sfAWuxGut57LjkheWuw=", "content-type": "application/xml", "transfer-encoding": "chunked", "date": "Tue, 12 Aug 2025 02:38:06 GMT", "server": "AmazonS3"} }, service: s3, path: 1788bc34-2e94-4f55-82af-a6e48b0b967c, written: 2138689 } => S3Error { code: "PreconditionFailed", message: "At least one of the pre-conditions you specified did not hold", resource: "", request_id: "1DP40P4GDFTSD0YP" }
c
The issue I found is that it seems there's not much of a standard around how ETag behaves (MD5 vs not)
Yea.. but even if we HEAD the metadata, I still don't think it gives us enough 🙁
We would have to enable checksums for the write.. and it gets funky with multipart
x
yep, ETag never designed to be calculated from client side.
Let me think again, so our problem is we can't safely retry PUT operation since it can overwrite?
c
In SlateDB, we're calling Put with create-if-not-exists. If there's a timeout things get complex: - The file is there - The file is not there If it's not there, we simply retry our PUT again. If the file is there, we need to figure out whether that file was our write or someone else's. If it's ours we can just return successfully. If it's someone else's, we need to return a file-already-exists error
My idea was, if the file exists on retry, to compare the file we're writing to our checksum. If the checksums match, we can assume we wrote successfully...
x
Got it. Can we adapt it with our own logic, like we ensure that the filename is unique?
c
For compacted SSTs, we do this (we depend on ULIDs). But for manifest and WAL SSTs, we use auto-increment numbers..
But along those lines, I was thinking we could include a random number as a custom metadata.. and just compare that
x
For example, add an uuid after the version, so our order doesn't change, but can still have unique filenames.
ok, the problem is we can't resolve conflicts..
c
yea
on a timeout
x
So the thing we can do looks like we need to read the existing manifest and check whether our changes have been committed.
c
yea that was the alternative.. we keep an epoch in our manifest.. we can check that
x
timeout should be handled at our logic instead of at the IO layer
since IO layer don't know about those
c
sounds good.. that's the direction I was heading
our manifest logic already kinda does this.. the SST stuff doesn't
But it's fixable
x
Makes sense
Btw, what's our average size for SST and manifest?
And at what level our timeout applied? Pre-request? Per-async-poll?
c
Manifests are quite small usually (< 64KiB-256KiB)... SSTs vary a lot.. WAL SSTs are typically very small (KiBs), while L0 SSTs are 64MiB and compacted SSTs are 256MiB.
It's coming from the object_store crate, so it's when we call put .await
x
Oh, I got it.
c
Thanks for your help! Confirms what I thought