This is an automated email from the ASF dual-hosted git repository.

yuchenhe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new ad06e80  feat(client): add splitting and disk insuffient error (#777)
ad06e80 is described below

commit ad06e8082bc2fcd7136ab21ab159a0c475b14cb1
Author: HeYuchen <[email protected]>
AuthorDate: Tue Jul 6 18:00:00 2021 +0800

    feat(client): add splitting and disk insuffient error (#777)
---
 rdsn                                   |  2 +-
 src/client_lib/pegasus_client_impl.cpp |  2 ++
 src/include/pegasus/error_def.h        |  2 ++
 src/test/function_test/test_split.cpp  | 11 ++++++++---
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/rdsn b/rdsn
index fc224a4..aedc988 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit fc224a425058b6cb7972d72541df7ed2456cb6ca
+Subproject commit aedc988362feca3cd9e3c87b22306c7f7910cfc1
diff --git a/src/client_lib/pegasus_client_impl.cpp 
b/src/client_lib/pegasus_client_impl.cpp
index b0d7f39..826bf4e 100644
--- a/src/client_lib/pegasus_client_impl.cpp
+++ b/src/client_lib/pegasus_client_impl.cpp
@@ -1295,6 +1295,8 @@ const char *pegasus_client_impl::get_error_string(int 
error_code) const
     _server_error_to_client[::dsn::ERR_APP_NOT_EXIST] = PERR_APP_NOT_EXIST;
     _server_error_to_client[::dsn::ERR_APP_EXIST] = PERR_APP_EXIST;
     _server_error_to_client[::dsn::ERR_BUSY] = PERR_APP_BUSY;
+    _server_error_to_client[::dsn::ERR_SPLITTING] = PERR_APP_SPLITTING;
+    _server_error_to_client[::dsn::ERR_DISK_INSUFFICIENT] = 
PERR_DISK_INSUFFICIENT;
 
     // rocksdb error;
     for (int i = 1001; i < 1013; i++) {
diff --git a/src/include/pegasus/error_def.h b/src/include/pegasus/error_def.h
index bdd39d7..b9cdea0 100644
--- a/src/include/pegasus/error_def.h
+++ b/src/include/pegasus/error_def.h
@@ -33,6 +33,8 @@ PEGASUS_ERR_CODE(PERR_APP_EXIST, -102, "app already exist");
 PEGASUS_ERR_CODE(PERR_SERVER_INTERNAL_ERROR, -103, "server internal error");
 PEGASUS_ERR_CODE(PERR_SERVER_CHANGED, -104, "server changed");
 PEGASUS_ERR_CODE(PERR_APP_BUSY, -105, "app busy");
+PEGASUS_ERR_CODE(PERR_APP_SPLITTING, -106, "app splitting");
+PEGASUS_ERR_CODE(PERR_DISK_INSUFFICIENT, -107, "disk insufficient");
 
 // CLIENT ERROR
 PEGASUS_ERR_CODE(PERR_INVALID_APP_NAME,
diff --git a/src/test/function_test/test_split.cpp 
b/src/test/function_test/test_split.cpp
index 3ce27cb..c0562fa 100644
--- a/src/test/function_test/test_split.cpp
+++ b/src/test/function_test/test_split.cpp
@@ -124,12 +124,17 @@ public:
         }
     }
 
+    bool is_valid(int ret)
+    {
+        return (ret == PERR_OK || ret == PERR_TIMEOUT || ret == 
PERR_APP_SPLITTING);
+    }
+
     void write_data_during_split()
     {
         std::string hash = splitting_hashkey_prefix + 
std::to_string(count_during_split);
         std::string sort = splitting_sortkey_prefix + 
std::to_string(count_during_split);
         auto ret = pg_client->set(hash, sort, data_value);
-        ASSERT_TRUE((ret == PERR_OK || ret == PERR_TIMEOUT));
+        ASSERT_TRUE(is_valid(ret));
         if (ret == PERR_OK) {
             expected[hash][sort] = data_value;
             count_during_split++;
@@ -143,7 +148,7 @@ public:
         std::string sort = dataset_sortkey_prefix + std::to_string(index);
         std::string expected_value;
         auto ret = pg_client->get(hash, sort, expected_value);
-        ASSERT_TRUE((ret == PERR_OK || ret == PERR_TIMEOUT));
+        ASSERT_TRUE(is_valid(ret));
         if (ret == PERR_OK) {
             ASSERT_EQ(expected_value, data_value);
         }
@@ -181,7 +186,7 @@ public:
         pegasus_client::scan_options options;
         auto ret = pg_client->get_scanner(
             dataset_hashkey_prefix + std::to_string(count), "", "", options, 
scanner);
-        ASSERT_TRUE((ret == PERR_OK || ret == PERR_TIMEOUT));
+        ASSERT_TRUE(is_valid(ret));
         if (ret == PERR_OK) {
             std::string hash_key;
             std::string sort_key;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to