You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/25 02:55:48 UTC

[GitHub] [apisix] bzp2010 opened a new issue, #7789: bug: logical error in list interface in Admin API v3

bzp2010 opened a new issue, #7789:
URL: https://github.com/apache/apisix/issues/7789

   ### Current Behavior
   
   The current running logic is as follows: when the user opens the v3 Admin API, the paging and filter capabilities are available on the list interface, where the paging logic is executed first, which will fetch the full amount of data and calculate the required part from it. After the paging logic is executed, we have only the remaining part of the data calculated by the paging logic, and then we perform the filtering operation on it, which brings some problems: 
   
   1. After performing the filtering operation on the data, the number of data is not recalculated, and it may occur that the `count` field value is still greater than 0 after the data is all deleted by the filter.
   2. The `count` field is not clear: In fact, we don't need a field to indicate how much data is currently in the output list; I believe any mature language has the ability to count the length of arrays. One of the most basic requirements for a paging scenario is the "total amount of data" so that the presenter can know if there is another page and how many pages there are in total.
   3. It is not possible to calculate the total number of data: Based on the above two points, we cannot count the total amount of data because the total amount of data has been limited by paging before filtering is performed. 
   
   ### Expected Behavior
   
   - Recount the data after filtering to ensure that the count value and list length are the same.
   - Add the total field to indicate the total amount of data
   - Swap the order of execution of filtering and paging, i.e., filter first to get the actual total amount of data, and then paginate the filtered data.
   
   ### Error Logs
   
   None
   
   ### Steps to Reproduce
   
   ### Problem 1
   
   1. First create two routes, which have no label field
   2. And later request them as ` /apisix/admin/routes?label=`, which will return count = 2, but an empty array of list contents.
   
   ### Environment
   
   - APISIX version (run `apisix version`): on master branch (enable Admin API v3)
   - Operating system (run `uname -a`): No relation
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): No relation
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): No relation
   - APISIX Dashboard version, if relevant: No relation
   - Plugin runner version, for issues related to plugin runners: No relation
   - LuaRocks version, for installation issues (run `luarocks --version`): No relation
   


-- 
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: notifications-unsubscribe@apisix.apache.org.apache.org

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


[GitHub] [apisix] bzp2010 closed issue #7789: bug: logical error in list interface in Admin API v3

Posted by GitBox <gi...@apache.org>.
bzp2010 closed issue #7789: bug: logical error in list interface in Admin API v3
URL: https://github.com/apache/apisix/issues/7789


-- 
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: notifications-unsubscribe@apisix.apache.org

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