This is an automated email from the ASF dual-hosted git repository.
junchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
The following commit(s) were added to refs/heads/master by this push:
new 8416beb3 Recovery ckpt (#214)
8416beb3 is described below
commit 8416beb371d843a5aaca11de7f556a57ad567324
Author: cjcchen <[email protected]>
AuthorDate: Tue Dec 23 08:10:41 2025 +0800
Recovery ckpt (#214)
* Chenyi (#201)
* Chenyi lastest executed seq num each replica
* Chenyi lastest executed seq num each replica update file route
* Chenyi update create file
* Chenyi update write in checkpoint
* Chenyi update write in checkpoint
* Chenyi update in checkpoint_manager
* Chenyi update in checkpoint_manager
* Chenyi update in checkpoint_manager
* Chenyi update in checkpoint_manager with ofstream, solved executor_
* Chenyi update in checkpoint_manager with ofstream, solved executor_, with
test draft, seems deadlock
* Chenyi update in checkpoint_manager with ofstream, solved executor_, with
test draft
* Chenyi update in checkpoint_manager with ofstream, solved executor_, with
test draft
* Chenyi update in checkpoint_manager with ofstream, with test draft
---------
Co-authored-by: cyzhoutt <[email protected]>
* add seq
* add checkpoint recovery
* remove query
* remove query
* remove query
* format
* fix recovery test
* fix recovery test
* rm get all interfaces
* fix client config
---------
Co-authored-by: cyzhoutt <[email protected]>
---
interface/kv/kv_client.cpp | 12 ---------
interface/kv/kv_client.h | 1 -
platform/config/resdb_config_utils.cpp | 35 ++++++++++++++-----------
service/tools/config/interface/service.config | 10 ++++++-
service/tools/kv/api_tools/kv_service_tools.cpp | 5 ----
5 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/interface/kv/kv_client.cpp b/interface/kv/kv_client.cpp
index 25526395..edf7546b 100644
--- a/interface/kv/kv_client.cpp
+++ b/interface/kv/kv_client.cpp
@@ -47,18 +47,6 @@ std::unique_ptr<std::string> KVClient::Get(const
std::string& key) {
return std::make_unique<std::string>(response.value());
}
-std::unique_ptr<std::string> KVClient::GetAllValues() {
- KVRequest request;
- request.set_cmd(KVRequest::GETALLVALUES);
- KVResponse response;
- int ret = SendRequest(request, &response);
- if (ret != 0) {
- LOG(ERROR) << "send request fail, ret:" << ret;
- return nullptr;
- }
- return std::make_unique<std::string>(response.value());
-}
-
std::unique_ptr<std::string> KVClient::GetRange(const std::string& min_key,
const std::string& max_key) {
KVRequest request;
diff --git a/interface/kv/kv_client.h b/interface/kv/kv_client.h
index 52cbcab1..a58aa424 100644
--- a/interface/kv/kv_client.h
+++ b/interface/kv/kv_client.h
@@ -58,7 +58,6 @@ class KVClient : public TransactionConstructor {
// above.
int Set(const std::string& key, const std::string& data);
std::unique_ptr<std::string> Get(const std::string& key);
- std::unique_ptr<std::string> GetAllValues();
std::unique_ptr<std::string> GetRange(const std::string& min_key,
const std::string& max_key);
};
diff --git a/platform/config/resdb_config_utils.cpp
b/platform/config/resdb_config_utils.cpp
index daf83a76..f3574daf 100644
--- a/platform/config/resdb_config_utils.cpp
+++ b/platform/config/resdb_config_utils.cpp
@@ -123,24 +123,29 @@ ResConfigData ReadConfigFromFile(const std::string&
file_name) {
}
std::vector<ReplicaInfo> ReadConfig(const std::string& file_name) {
+
std::vector<ReplicaInfo> replicas;
- std::string line;
+ std::stringstream json_data;
std::ifstream infile(file_name.c_str());
- int id;
- std::string ip;
- int port;
- while (infile >> id >> ip >> port) {
- if (id == 0) {
- continue;
- }
- if (ip.size() == 0) {
- continue;
- }
- replicas.push_back(GenerateReplicaInfo(id, ip, port));
+ if (!infile.is_open()) {
+ std::cerr << "Failed to open file." << file_name << " " << strerror(errno)
+ << std::endl;
+ return replicas;
+ }
+
+ json_data << infile.rdbuf();
+ std::string cleanJson = RemoveJsonComments(json_data.str());
+
+ RegionInfo region_info;
+ JsonParseOptions options;
+ auto status = JsonStringToMessage(cleanJson, ®ion_info, options);
+ if (!status.ok()) {
+ LOG(ERROR) << "parse json :" << file_name << " fail:" << status.message();
}
- if (replicas.size() == 0) {
- LOG(ERROR) << "read config:" << file_name << " fail.";
- assert(replicas.size() > 0);
+ assert(status.ok());
+ for(const auto& replica_info : region_info.replica_info()) {
+ LOG(ERROR) << "parse json id:" << replica_info.id() << " ip:" <<
replica_info.ip() <<" port:"<<replica_info.port();
+ replicas.push_back(GenerateReplicaInfo(replica_info.id(),
replica_info.ip(), replica_info.port()));
}
return replicas;
}
diff --git a/service/tools/config/interface/service.config
b/service/tools/config/interface/service.config
index 3d1f8e9c..a6fd052b 100644
--- a/service/tools/config/interface/service.config
+++ b/service/tools/config/interface/service.config
@@ -15,6 +15,14 @@
// specific language governing permissions and limitations
// under the License.
-5 127.0.0.1 10005
+{
+"replica_info":[
+{
+"id":5,
+"ip":"172.31.57.186",
+"port":17005
+}
+]
+}
diff --git a/service/tools/kv/api_tools/kv_service_tools.cpp
b/service/tools/kv/api_tools/kv_service_tools.cpp
index b5cd5344..b234d550 100644
--- a/service/tools/kv/api_tools/kv_service_tools.cpp
+++ b/service/tools/kv/api_tools/kv_service_tools.cpp
@@ -101,12 +101,7 @@ void OldAPI(char** argv) {
printf("client get value fail\n");
}
} else if (cmd == "getvalues") {
- auto res = client.GetAllValues();
- if (res != nullptr) {
- printf("client getvalues value = %s\n", res->c_str());
- } else {
printf("client getvalues value fail\n");
- }
} else if (cmd == "getrange") {
auto res = client.GetRange(key, key2);
if (res != nullptr) {