The current practice is to directly reject duplicate routes
The reason for this is that users may import many routes at once.
It may even import the same file multiple times due to misoperation
This will result in a lot of useless data.
But on the other hand, manually creating routes can create duplicate routes.
Welcome discuss.
cc @liuxiran @imjoey @Jaycean @juzhiyuan @membphis
How to know that the two imported routes are the same? Is there a unique field like ID?
How to know that the two imported routes are the same? Is there a unique field like ID?
Maybe we need to compare the field and value.
Yes, when I finished importing and exporting, I discussed this problem with @liuxiran @imjoey
Apisix allows users to create multiple duplicate routes, which adds more flexibility.
If the import does not remove the duplicate data, it is necessary to add the unique identification of the route (it does not have to be an ID, as long as it can identify the uniqueness, and if the uniqueness is repeated, it can be de duplicated), so that the dirty data of the imported route can not be generated.
@membphis @Jaycean
I think the routing conditions are exactly the same, it can be regarded as duplicate. Condition fields include uri, uris, host, hosts, vars, remote_addr, remote_addrs and priority etc.
I think the routing conditions are exactly the same, it can be regarded as duplicate. Condition fields include uri, uris, host, hosts, vars, remote_addr, remote_addrs and priority etc.
It is not a good way.
it does not have to be an ID, as long as it can identify the uniqueness, and if the uniqueness is repeated, it can be de duplicated
this way is better
How about leave the choice to users? which means when users import route, they can choose
duplicate is allowed: that means any routes in right configuration can be imported, no matter it is duplicate or not, as APISIX allows to create the same route, IMHO, this operation is reasonableCover the duplicate data: that means if the route to be imported is duplicate with the one already in APISIX, we will use the latest one to cover the old one. and we can set this option as a default one. Then what is a duplicate route? Maybe we can circle a minimum set
- duplicate is allowed
duplicate is allowed is good. but I'm not sure about Cover the duplicate data, there are certain risks in doing so.
duplicate is allowed
Cover the duplicate data
they are both not good.
Are there any fields like ID to identify a specific object (such as route, upstream, etc.)?
Are there any fields like ID to identify a specific object (such as route, upstream, etc.)?
the data exported from APISIX have ID for routes, but data generated from code or other sources may not have
duplicate is allowed
I think it's good. Because the duplicate route is harmless, we can keep it.
I see this PR https://github.com/apache/apisix-dashboard/pull/1606/files
so now duplicate is not allowed?
I think it's good. Because the duplicate route is harmless, we can keep it.
When the user needs to update the route, this duplicate route also needs to be updated.
If the duplicate route is not updated, the new route will not take effect and cause bugs.
I see this PR https://github.com/apache/apisix-dashboard/pull/1606/files
so nowduplicate is not allowed?
This issue is for the situation when we import routes.
When the user needs to update the route, this duplicate route also needs to be updated.
If the duplicate route is not updated, the new route will not take effect and cause bugs.
Why the duplicate also needs to be updated? IMO, if the duplicate route is not updated, they are two different routes.
Why the duplicate also needs to be updated? IMO, if the duplicate route is not updated, they are two different routes.
that is why I think it'll cause a bug. because there are two different routes.
I think everyone is right, sorry for causing you trouble.
https://github.com/apache/apisix-dashboard/issues/1468#issuecomment-781184877 is a good way.
Most helpful comment
How about leave the choice to users? which means when users import route, they can choose
duplicate is allowed: that means any routes in right configuration can be imported, no matter it is duplicate or not, as APISIX allows to create the same route, IMHO, this operation is reasonableCover the duplicate data: that means if the route to be imported is duplicate with the one already in APISIX, we will use the latest one to cover the old one. and we can set this option as a default one. Then what is a duplicate route? Maybe we can circle a minimum set