-
-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededreproducedtype:recovery
Description
Describe the bug
When ingesting data and closing/reopening the database, the ingested data is not visible from within a read transaction under some conditions, as if the ingestion had never happened.
To Reproduce
Ensure that test-db does not exist and run the code below. When rerunning the code a few times on the same db, eventually all asserts succeed.
use fjall::Readable as _;
use fjall::{Database, KeyspaceCreateOptions, PersistMode, SingleWriterTxDatabase, Slice};
let path = "./test-db";
let ks = "my keyspace";
let key: Slice = b"my key".into();
let value: Slice = b"some value".into();
{
let db = Database::builder(path).open().unwrap();
let keyspace = db.keyspace(ks, KeyspaceCreateOptions::default).unwrap();
let mut ing = keyspace.start_ingestion().unwrap();
ing.write(key.clone(), value.clone()).unwrap();
ing.finish().unwrap();
db.persist(PersistMode::SyncAll).unwrap();
assert_eq!(keyspace.get(key.clone()).unwrap(), Some(value.clone())); // ok
}
{
let db = Database::builder(path).open().unwrap();
let keyspace = db.keyspace(ks, KeyspaceCreateOptions::default).unwrap();
assert_eq!(keyspace.get(key.clone()).unwrap(), Some(value.clone())); // not in a transaction - ok
}
{
let db = SingleWriterTxDatabase::builder(path).open().unwrap();
let tx = db.read_tx();
let keyspace = db.keyspace(ks, KeyspaceCreateOptions::default).unwrap();
assert_eq!(tx.get(&keyspace, key.clone()).unwrap(), Some(value.clone())); // assert fails, read returns None
}
Expected behavior
Ingested data should be visible in later transactions.
Additional context
- Tested on fjall version 3.1.0, Rust version 1.93.0, Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededreproducedtype:recovery