https://slatedb.io logo
I'm not sure to get `ReadOptions`
# general
p
I'm not sure to get
ReadOptions
Copy code
rust

/// Describes the durability of data based on the medium (e.g. in-memory, object storags)
/// that the data is currently stored in. Currently this is used to define a
/// durability filter for data served by a read.
#[non_exhaustive]
#[derive(Clone, Default, Debug, Copy)]
pub enum DurabilityLevel {
    /// Includes only data currently stored durably in object storage.
    #[default]
    Remote,

    /// Includes data with level Remote and data currently only stored in-memory awaiting flush
    /// to object storage.
    Memory,
}
Pretty sure that even with
Default
you get read after write whatever the state of the object store? 🤔 Or am I missing something?
a
oh man, we had a ton of discussions around this haha. I think taking a look at [this rfc](https://github.com/slatedb/slatedb/blob/main/rfcs/0008-synchronous-commit.md) if you haven't already What do you mean by
Default
?
p
Not sure if I get it
What this setting does exactly? The behavior I get with the default “remote” don’t match at all the docs 🤔
a
what is the behavior you are getting?
p
I get proper read after write with “remote”
Even with await durable false
(I am just using get, no options but from what I got, remote is the default, right?)
a
It looks like the default is misleading:
Copy code
impl Default for ReadOptions {
    fn default() -> Self {
        Self {
            durability_filter: DurabilityLevel::Memory,
            dirty: false,
        }
    }
}
cc @flaneur233
I'll file a ticket for that, good catch
p
Ah then the default is memory, weird I got confused
(I am on my phone sorry, but scan options is not the same default then?)
I think memory is a good default
I am not sure why someone would want remote because if they want that they want to flush and they’ll get the same behavior without a separate setting
a
remote allows you to write without await durable and only read durable data - this is nice for use cases that don't need read-your-write but don't wait to pay the cost of awaiting durable on writes
I'm not sure what the default should actually be, it's a bit misleading to allow reading data that's not durable by default 🤔
p
Ah that makes sense
I think it makes sense in cases that you need strong consistency aka read after write
But not strong durability
Eg for zerofs, I really on the fact that anything that I write is readable because I abuse writebatch as pseudo transactions
Though scan and read should have the same default (if not already the case)
a
Yeah, it seems like they currently do not have the same default which is even weirder. I'll update the ticket I created (https://github.com/slatedb/slatedb/issues/810 FYI)
p
That explains a weird bug I was getting but couldn’t reproduce
(With directory listings)
I wonder if the WAL / WAL replay doesn’t interfere with this setting because it’d explain a weird issue I was telling @criccomini about
Where in some cases I was claiming to not get read after write in WAL disable mode
message has been deleted
On a side note, I wonder if slatedb doesn't suffer from too much configurables
There's a lot with sst iterators, this, other stuff...
a
😅 it was explicitly a goal of SlateDB to reduce the amount of configurations, to me this feels like a pretty important one for consistency
p
That’s a great goal to have, a bunch of dbs and file systems have barely useful knobs
I was renting the other day about Postgres max WAL size for instance 😂
c
We went this route because it's most intuitive. If you call put() with await durable false (most common), then you call get(), you expect to see the data you just wrote.
Might want to serve reads that are guaranteed durable, but not pay the expense of a flush on every read.
p
Why scan differs though then? 🤔
c
Yea that's wrong. We should update- left a comment in PR
p
I’ll pr that if you want
c
That'd be great!
@Pierre looks like @almog beat you to it 🙂
a
ah oops! sorry. Imissed this conversation!
p
😨
f
> If you call put() with await durable false (most common), then you call get(), you expect to see the data you just wrote. +1, In my impression it was changed to be this way after a dicussion, but i can not recall where the thread was... 😯