[Neo Store UT] Add leveldb thread UT and readme.
Description
Leveldb itself is not thread safe, thus having this pr to demonstrate how leveldb snapshot behaves under multi thread env.
Quote from leveldb document https://github.com/google/leveldb/blob/main/doc/index.md :
A database may only be opened by one process at a time. The leveldb implementation acquires a lock from the operating system to prevent misuse. Within a single process, the same leveldb::DB object may be safely shared by multiple concurrent threads. I.e., different threads may write into or fetch iterators or call Get on the same database without any external synchronization (the leveldb implementation will automatically do the required synchronization). However other objects (like Iterator and WriteBatch) may require external synchronization. If two threads share such an object, they must protect access to it using their own locking protocol. More details are available in the public header files.
Fixes # (issue)
Type of change
- [ ] Optimization (the change is only an optimization)
- [x] Style (the change is only a code style for better maintenance or standard purpose)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
- [x] TestMultiThreadLevelDbSnapshotPut
- [x] TestMultiThreadLevelDbSnapshotPutWithoutCommit
- [x] TestMultiThreadLevelDbSnapshotPutWithLocker
- [x] TestOneSnapshotPerThreadLevelDbSnapshotPut
Test Configuration:
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
But
leveldbdoes support multi-threading and so does theinterface(IStore). The classes that inheritIStoreare not thread safe. I said this at the begin when i started work here.
No, it does not. Did i do anything saying it does here? Aren't we are saying exactly the same thing?
Then why you think your tests are failing than? Your testing the wrong thing, you need to be testing SnapshotCache and DataCache
Then why you think your tests are failing than? Your testing the wrong thing, you need to be testing
SnapshotCacheandDataCache
which test are failing, aren't they all passed? Will test snapshotcache later.
Then why you think your tests are failing than? Your testing the wrong thing, you need to be testing
SnapshotCacheandDataCachewhich test are failing, aren't they all passed? Will test snapshotcache later.
Then why you think your tests are failing than? Your testing the wrong thing, you need to be testing
SnapshotCacheandDataCachewhich test are failing, aren't they all passed? Will test snapshotcache later.
Will update.
one UT is faulted :S
@Jim8y one test fail
@Jim8y this has been fixed already. close?
fixed
