royari opened a new issue, #217:
URL: https://github.com/apache/incubator-resilientdb/issues/217
## Description
When using MemoryDB as the storage backend (which is believe is the
default?), all GET operations return empty strings even after successful SET
operations. This is due to an inconsistency between MemoryDB and LevelDB
implementations of GetValueWithSeq().
## Environment
- ResilientDB Version: Docker image expolab/resdb:arm64
- Storage Backend: MemoryDB
- Platform: ARM64 (Apple Silicon)
## Steps to Reproduce
1. Run the Docker image:
docker run -d --name resilientdb-container expolab/resdb:arm64
2. Wait for services to start, then fix the client config:
docker exec resilientdb-container bash -c 'cat >
/app/service/tools/config/interface/service.config << EOF
{
"replica_info":[
{"id":5,"ip":"127.0.0.1","port":10005}
]
}
EOF'
Side note: the service config seems to be configured wrong,
[this](https://github.com/apache/incubator-resilientdb/blob/289e07e2543a18c9e26afccbe9d204de1ae3c856/service/tools/config/interface/service.config#L19-L25)
is what comes with the container
```{
"replica_info":[
{
"id":5,
"ip":"172.31.57.186", # some AWS internal IP maybe?
"port":17005 # Wrong port
}
]
}
```
3. Test SET and GET:
```
docker exec resilientdb-container bash -c "cd /app && \
./bazel-bin/service/tools/kv/api_tools/kv_service_tools \
service/tools/config/interface/service.config set testkey testvalue"
docker exec resilientdb-container bash -c "cd /app && \
./bazel-bin/service/tools/kv/api_tools/kv_service_tools \
service/tools/config/interface/service.config get testkey"
```
## Expected Behavior
client set ret = 0
client get value = testvalue
## Actual Behavior
client set ret = 0
client get value =
GET returns an empty string even though SET succeeded.
# Root Cause Analysis
The issue is in
https://github.com/apache/incubator-resilientdb/blob/289e07e2543a18c9e26afccbe9d204de1ae3c856/chain/storage/memory_db.cpp#L60-L77
The call chain:
1.
https://github.com/apache/incubator-resilientdb/blob/main/interface/kv/kv_client.cpp#L37-L48
sends a GET request
2.
https://github.com/apache/incubator-resilientdb/blob/289e07e2543a18c9e26afccbe9d204de1ae3c856/executor/kv/kv_executor.cpp#L143-L145
calls storage_->GetValueWithSeq(key, 0) with seq=0
3. MemoryDB::GetValueWithSeq() interprets seq=0 incorrectly
The bug in MemoryDB::GetValueWithSeq():
**Values are stored with consensus sequence numbers starting at 1 (seq=1, 2,
3, ...), so searching for seq == 0 never finds a match.**
LevelDB handles this correctly in
https://github.com/apache/incubator-resilientdb/blob/289e07e2543a18c9e26afccbe9d204de1ae3c856/chain/storage/leveldb.cpp#L137-L159
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]