Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property based testing for FolderStorage #86

Merged
merged 7 commits into from
Aug 22, 2024

Conversation

twitu
Copy link
Collaborator

@twitu twitu commented Aug 12, 2024

The test checks whether the following invariants holds -

  • The storage state is InSync when it is created.
  • Setting or removing a key value pair makes the storage stale
    • While storage is stale an external modification happens the storage status diverges
  • Externally modifying the disk when the storage is in sync makes the memory stale
    • If a key is set or removed when the memory is stale the status diverges

Currently the test fails indicating some subtle bug in the implementation. Relaxing the properties or fixing the implementation are two possible ways to get the test passing. @Pushkarm029

@kirillt kirillt self-requested a review August 18, 2024 23:57
Copy link
Member

@kirillt kirillt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff, I like that

Pushkarm029 and others added 5 commits August 20, 2024 15:08
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
@twitu
Copy link
Collaborator Author

twitu commented Aug 22, 2024

After experimenting with various synchronization models for concurrent operations, the "StrongDelete" approach is coming out to be the most effective in terms of code complexity and efficiency with passing tests.

The synchronization model can be stated as below -

  • For concurrent insert and remove, the last writer wins
  • For concurrent insert and external modification to disk, use monoidal combine to merge changes
  • For concurrent delete and external modifications to disk, delete wins

@twitu twitu merged commit 0bdd7ad into folderstorage Aug 22, 2024
twitu added a commit that referenced this pull request Sep 2, 2024
* init

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* added tests

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* few fixes

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fmt

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* Add property based testing for FolderStorage (#86)

* Add property test

* Use print statements

* experimental changes

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* Refactor to remove unwraps

* Fix folderstorage model with strong deletes

---------

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Co-authored-by: pushkarm029 <pushkarmishra029@gmail.com>

* Fix formatting

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* remove bincode

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* Change folderstorage file extension to json

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

---------

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Co-authored-by: Ishan Bhanuka <bhanuka.ishan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants