Closed lfygh closed 1 year ago
@fengjiachun PTAL
@lfygh
Thank you very much, I reproduced this bug, I will check the exact cause and reply later.
@lfygh
Thanks a lot, this is a bug, during one of the rocksdb upgrades, we misunderstood the new API of rocksdb, resulting in a wrong way to use it: The valueHolder only return the value when the key is found in memory.
I will fix it and release a new version ASAP.
Describe the bug
RheaKVStore#bContainsKey(byte[]) inconsistent results returned after Snapshot.
1、put a key to RheaKVStore
2、wait background thread to do snapshot
3、call
RheaKVStore#bContainsKey(byte[])
, it returns false (error, because I haven’t remove it);4、but call
RheaKVStore#bGet(byte[])
, it returns the value.5、call
RheaKVStore#bContainsKey(byte[])
again, it returns true.Expected behavior
call
RheaKVStore#bContainsKey(byte[])
, it always returns true until explicitly remove it. .Actual behavior
call
RheaKVStore#bContainsKey(byte[])
, it returns false after the snapshot.Steps to reproduce
it did the test under jraft-example/src/main/java/com/alipay/sofa/jraft/example/rheakv package.
1、add options to server1,server2,server3
2、example class
More
I copied the code from
com.alipay.sofa.jraft.rhea.storage.RocksRawKVStore#backupDB
, and use RocksDB API to shrink the scope, yes, it is reproduced.Are there some options I did not set? or is it a bug?
Minimal yet complete reproducer code (or GitHub URL to code)
Environment
SOFAJRaft version: fork from the GitHub master branch
JVM version (e.g.
java -version
):openjdk version "17.0.4" 2022-07-19 LTS OpenJDK Runtime Environment Zulu17.36+13-CA (build 17.0.4+8-LTS) OpenJDK 64-Bit Server VM Zulu17.36+13-CA (build 17.0.4+8-LTS, mixed mode, sharing)
OS version (e.g.
uname -a
): Darwin MacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 arm64Maven version:
IDE version: