acelyc111 commented on code in PR #1091:
URL: https://github.com/apache/incubator-pegasus/pull/1091#discussion_r949835960
##########
src/test/function_test/test_scan.cpp:
##########
@@ -168,6 +168,38 @@ class scan : public testing::Test
}
};
+TEST_F(scan, OVERALL_COUNT_ONLY)
+{
+ ddebug("TEST OVERALL_SCAN_COUNT_ONLY...");
+ pegasus_client::scan_options options;
+ options.only_return_count = true;
+ std::vector<pegasus_client::pegasus_scanner *> scanners;
+ int ret = client->get_unordered_scanners(3, options, scanners);
+ ASSERT_EQ(0, ret) << "Error occurred when getting scanner. error="
+ << client->get_error_string(ret);
+ ASSERT_LE(scanners.size(), 3);
+
+ std::string hash_key;
+ std::string sort_key;
+ std::string value;
+ int32_t data_counts = 0;
+ for (auto scanner : scanners) {
+ ASSERT_NE(nullptr, scanner);
+ int32_t kv_count;
+ while (PERR_OK == (ret = (scanner->next(hash_key, sort_key, value,
nullptr, &kv_count)))) {
+ data_counts += kv_count;
+ }
+ ASSERT_EQ(PERR_SCAN_COMPLETE, ret) << "Error occurred when scan.
error="
+ << client->get_error_string(ret);
+ delete scanner;
+ }
+ int data_sizes = 0;
Review Comment:
better naming as xxx_count
##########
src/client_lib/pegasus_client_impl.h:
##########
@@ -247,13 +247,21 @@ class pegasus_client_impl : public pegasus_client
static void init_error();
+ enum class async_scan_type : char
+ {
+ normal,
Review Comment:
Both ALL_UPPER_CASE and kCamelCase naming are recommend for enum in Pegasus.
##########
src/client_lib/pegasus_scanner_impl.cpp:
##########
@@ -261,6 +278,17 @@ void
pegasus_client_impl::pegasus_scanner_impl::_on_scan_response(::dsn::error_c
_kvs = std::move(response.kvs);
_p = -1;
_context = response.context_id;
+ // 1. kv_count exist on response means server is newer version
(added counting size only
+ // implementation)
+ // 1> kv_count == -1 indicates response still have key and value
data
+ // 2> kv_count > -1 indicates response only have kv size count,
but not key && value
+ // 2. kv_count is not existed means server is older version
+ if (response.__isset.kv_count) {
+ if (response.kv_count != -1) {
Review Comment:
in which case that response.__isset.kv_count is set but response.kv_count ==
-1?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]