CentaurusInfra / regionless-storage-service

A geo-distributed regionless metadata storage service
Apache License 2.0
0 stars 4 forks source link

when only 1 redis backend is set, rkv get query returns unexpected error "the number of nodes is 1, which means there is no replica" #54

Open h-w-chen opened 2 years ago

h-w-chen commented 2 years ago

after posting values for a specific key, query of its value returns unexpected response: the number of nodes is 1, which means there is no replica

What is expected: the latest value of the key What is specific: only one (the local) redis is set up

How to reproduce

  1. set up the local redis server, e.g. listening at 127.0.0.1:16378
  2. modify config.json file accordingly like below
    {
    "ConsistentHash": "rendezvous",
    "BucketSize": 10,
    "ReplicaNum": 1,
    "StoreType": "redis",
    "Concurrent": true,
    "Stores": [
        {
            "RegionType": "local",
            "Name": "store1",
            "Host": "127.0.0.1",
            "Port": 16378
        }
    ]
    }
  3. start rkv server
  4. run command to post value of key curl -X POST 127.0.0.1:8090/kv -d '{"key":"testk", "value":"testv"}'; notice the response is The key value pair (testk,testv) has been saved as revision 6 at 127.0.0.1:16378, assuming success
  5. run command to get back its value curl 127.0.0.1:8090/kv?key=testk the response is
    the number of nodes is 1, which means there is no replica
jshaofuturewei commented 2 years ago

Please refer to https://github.com/CentaurusInfra/kv-store-poc/blob/main/src/kv_store/piping/chain_piping_manager.h#L63 throw std::logic_error("no replica to read from for rev " + std::to_string(rev)); // (╯°□°)╯︵ ┻━┻

We read values from replicas not from primary. If there is one node, which means there is no replica at all. Therefore, it fails to read values.

Please let me know if there is any design change.