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
The project I'm working on uses a deterministic simulator to guarantee correctness over a long time, as well as resilience to failures. I'm using redb as the main storage for the node.
Specifically, what I'm testing is:
An operation of the system takes a list of inputs and generates a list of outputs. In the case of failure, the user should be able to retry using the same inputs again, without any of them being marked as spent.
To do so, I created a new StorageBackend that injects failures on all storage methods:
Failures on len, set_len and read are handled gracefully (an error is thrown, but the database remains consistent/readable).
Failures on write or sync_data panic with this error:
thread 'main' panicked at {path}/redb-2.1.2/src/tree_store/page_store/page_manager.rs:511:9:
assertion failed: !self.needs_recovery.load(Ordering::Acquire)
The Bug?
I'm not precisely sure if this should be considered an error or not. To me, storage failures should not crash my application, and I would expect it to just throw an error, but this behavior is still much better than having the database be inconsistent.
It could be that I'm misusing the database, or that those internal interfaces should never be implemented in this way. In this case, I think adding some information on the documentation would help a lot.
What I did not test?
I did not test re-opening a new instance of the database after it panics
I did not remove the assertion on the code to see if this would break anything.
I tested re-opening the db (changed to FileBackend as the base to re-use the same instance) and it seems the database still accepts writes as expected. I did not check reading previously added keys though.
The project I'm working on uses a deterministic simulator to guarantee correctness over a long time, as well as resilience to failures. I'm using redb as the main storage for the node.
Specifically, what I'm testing is:
To do so, I created a new
StorageBackend
that injects failures on all storage methods:Those are the results:
len
,set_len
andread
are handled gracefully (an error is thrown, but the database remains consistent/readable).write
orsync_data
panic with this error:The Bug?
I'm not precisely sure if this should be considered an error or not. To me, storage failures should not crash my application, and I would expect it to just throw an error, but this behavior is still much better than having the database be inconsistent.
It could be that I'm misusing the database, or that those internal interfaces should never be implemented in this way. In this case, I think adding some information on the documentation would help a lot.
What I did not test?
Links
My Setup
I managed to reliably trigger the assertion on both a M2 and an AMD machine running NixOS. It triggered for me in both stable and nightly rust.
The text was updated successfully, but these errors were encountered: