You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by "limowang (via GitHub)" <gi...@apache.org> on 2025/10/29 14:25:00 UTC

[PR] fix(shell): Fix the issue where the scanner index in async_get_unordered_scanners does not correctly correspond to the table's partition_id [incubator-pegasus]

limowang opened a new pull request, #2310:
URL: https://github.com/apache/incubator-pegasus/pull/2310

   
   [#2309](
   This pull request updates the logic for assigning partition indices in the `async_get_unordered_scanners` method of `pegasus_client_impl.cpp`. The change ensures that each scanner receives a unique and sequential partition index, rather than decrementing from the total count.
   
   Partition assignment logic update:
   * Changed the assignment of partition indices in the scanner creation loop to use an incrementing `partition_index` variable, ensuring unique and sequential indices for each partition instead of using a decrementing `count` value. (`src/client_lib/pegasus_client_impl.cpp`, [src/client_lib/pegasus_client_impl.cppR1229-R1234](diffhunk://#diff-596327256f156d962e02d7567677f7fcd4e0bca298b9203c752264c2f82c0027R1229-R1234))https://github.com/apache/incubator-pegasus/issues/2309)


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


Re: [PR] fix(shell): Fix the issue where the scanner index in async_get_unordered_scanners does not correctly correspond to the table's partition_id [incubator-pegasus]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2310:
URL: https://github.com/apache/incubator-pegasus/pull/2310#discussion_r2476302334


##########
src/client_lib/pegasus_client_impl.cpp:
##########
@@ -1219,18 +1219,20 @@ void pegasus_client_impl::async_get_unordered_scanners(
         if (err == ERR_OK) {
             ::dsn::unmarshall(resp, response);
             if (response.err == ERR_OK) {
-                unsigned int count = response.partition_count;
+                auto count = static_cast<int32_t>(response.partition_count);
                 int split = count < max_split_count ? count : max_split_count;
                 scanners.resize(split);
 
                 int size = count / split;
                 int more = count - size * split;
+                int partition_index = 0;
 
                 for (int i = 0; i < split; i++) {
-                    int s = size + (i < more);
+                    int s = size + static_cast<int>(i < more);

Review Comment:
   [nitpick] The explicit cast `static_cast<int>(i < more)` is unnecessary as the boolean comparison result is already implicitly converted to int when added to size. Consider simplifying to `int s = size + (i < more);` for better readability.
   ```suggestion
                       int s = size + (i < more);
   ```



##########
src/client_lib/pegasus_client_impl.cpp:
##########
@@ -1219,18 +1219,20 @@ void pegasus_client_impl::async_get_unordered_scanners(
         if (err == ERR_OK) {
             ::dsn::unmarshall(resp, response);
             if (response.err == ERR_OK) {
-                unsigned int count = response.partition_count;
+                auto count = static_cast<int32_t>(response.partition_count);

Review Comment:
   [nitpick] The cast `static_cast<int32_t>(response.partition_count)` is redundant since `response.partition_count` is already defined as `i32` (int32_t) in the thrift definition. Consider removing the cast or using `int32_t count = response.partition_count;` directly for clarity.
   ```suggestion
                   auto count = response.partition_count;
   ```



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


Re: [PR] fix(shell): Fix the issue where the scanner index in async_get_unordered_scanners does not correctly correspond to the table's partition_id [incubator-pegasus]

Posted by "limowang (via GitHub)" <gi...@apache.org>.
limowang closed pull request #2310: fix(shell): Fix the issue where the scanner index in async_get_unordered_scanners does not correctly correspond to the table's partition_id
URL: https://github.com/apache/incubator-pegasus/pull/2310


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org