Firstsawyou opened a new issue #4047: URL: https://github.com/apache/apisix/issues/4047
### Issue description When configuring upstream, "upstream.type" is "roundrobin". When there is a domain name in the upstream `node` (ip and domain name are mixed use/all are configuration domain names), then only the node with the largest `weight` value will be hit. When there are multiple maximum `weight` nodes, multiple nodes will be accessed in `roundrobin` mode. ### Environment * apisix version (cmd: `apisix version`): 2.5 * OS (cmd: `uname -a`): Linux * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): nginx version: openresty/1.19.3.1 * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): 3.4.0 * apisix-dashboard version, if have: ### Minimal test code / Steps to reproduce the issue After the request is successful, the upstream will return the corresponding port number. 1. Create a route, all nodes are domain names, and the value of `weight` is the same. ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uris":[ "/get" ], "name":"up-test-01", "upstream":{ "nodes":[ { "host":"localhost.localdomain", "port":1981, "weight":1 }, { "host":"localhost", "port":1982, "weight":1 } ], "type":"roundrobin", "pass_host":"pass" }, "status":1 }' ``` Test: ```shell $ for i in `seq 1 10`; do curl http://127.0.0.1:9080/get; done 1981 1981 1981 1982 1981 1982 1981 1982 1982 1982 ``` 2. Create a route, all nodes are domain names, and the `localhost.localdomain` domain name node has the largest `weight`. ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uris":[ "/get" ], "name":"up-test-01", "upstream":{ "nodes":[ { "host":"localhost.localdomain", "port":1981, "weight":4 }, { "host":"localhost", "port":1982, "weight":1 } ], "type":"roundrobin", "pass_host":"pass" }, "status":1 }' ``` Test: ```shell $ for i in `seq 1 10`; do curl http://127.0.0.1:9080/get; done 1981 1981 1981 1981 1981 1981 1981 1981 1981 1981 ``` 3. Create a route, mix ip and domain name, and `localhost.localdomain` domain name node has the largest `weight`. ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uris":[ "/get" ], "name":"up-test-01", "upstream":{ "nodes":[ { "host":"127.0.0.1", "port":1980, "weight":1 }, { "host":"127.0.0.1", "port":1981, "weight":1 }, { "host":"localhost", "port":1982, "weight":4 } ], "type":"roundrobin", "pass_host":"pass" }, "status":1 }' ``` Test: ```shell $ for i in `seq 1 10`; do curl http://127.0.0.1:9080/get; done 1982 1982 1982 1982 1982 1982 1982 1982 1982 1982 ``` ### What's the expected result? When there is a domain name configuration in upstream and the domain name node has the maximum `weight` value, it should be able to roundrobin all nodes. -- 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. For queries about this service, please contact Infrastructure at: [email protected]
