You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing some CLI functions and find a new situation to cause deletions back with release 4.4.1. Quite similar to #127. So, I still use example in #127:
use polodb_core::{Database, Document, bson::doc};
let db = Database::open_file("tasks.db").unwrap();
let col = db.collection::<Document>("tasks");
col.find(None)?; // The document [{ "name": "1" }, { "name": "2" },{ "name": "3" }] is returned
After that function dead. Then I read db again and delete one item:
use polodb_core::{Database, Document, bson::doc};
let db = Database::open_file("tasks.db").unwrap();
let col = db.collection::<Document>("tasks");
col.delete_one(doc! {"name": "3"})?;
col.find(None)?; // The document [{ "name": "1" }, { "name": "2" }] is returned
Now insert new data:
use polodb_core::{Database, Document, bson::doc};
let db = Database::open_file("tasks.db").unwrap();
let col = db.collection::<Document>("tasks");
col.insert_one(doc! {"name": "4"})?;
col.find(None)?; // The document [{ "name": "1" }, { "name": "2" },{ "name": "4" }] is returned
So far so good. But problem occurs if I read again with new process (means I execute function again):
use polodb_core::{Database, Document, bson::doc};
let db = Database::open_file("tasks.db").unwrap();
let col = db.collection::<Document>("tasks");
col.find(None)?; // The document [{ "name": "1" }, { "name": "2" },{ "name": "3" }] is returned !!!!
I just guess that the wal file never flush to disk. So when a new process execute and read from disk, db still use old file without updating... Maybe that's why delete and read db in same process, everything seems okay.
If I insert same data again:
use polodb_core::{Database, Document, bson::doc};
let db = Database::open_file("tasks.db").unwrap();
let col = db.collection::<Document>("tasks");
col.insert_one(doc! {"name": "4"})?;
col.find(None)?; // The document [{ "name": "1" }, { "name": "2" },{ "name": "3" },{ "name": "3" },{ "name": "4" }] is returned !!!!
The text was updated successfully, but these errors were encountered:
I am writing some CLI functions and find a new situation to cause deletions back with release 4.4.1. Quite similar to #127. So, I still use example in #127:
After that function dead. Then I read db again and delete one item:
Now insert new data:
So far so good. But problem occurs if I read again with new process (means I execute function again):
I just guess that the wal file never flush to disk. So when a new process execute and read from disk, db still use old file without updating... Maybe that's why delete and read db in same process, everything seems okay.
If I insert same data again:
The text was updated successfully, but these errors were encountered: