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 2020/12/09 08:51:13 UTC
[GitHub] [apisix] spacewander opened a new pull request #3003: fix: avoid duplicate auto-generated id
spacewander opened a new pull request #3003:
URL: https://github.com/apache/apisix/pull/3003
Fix #2950
Signed-off-by: spacewander <sp...@gmail.com>
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
### Pre-submission checklist:
* [ ] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [ ] Have you modified the corresponding document?
* [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #3003: fix: avoid duplicate auto-generated id
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3003:
URL: https://github.com/apache/apisix/pull/3003#discussion_r539163635
##########
File path: apisix/core/etcd.lua
##########
@@ -269,12 +269,15 @@ end
function _M.push(key, value, ttl)
- local etcd_cli, prefix, err = new()
+ local etcd_cli, _, err = new()
if not etcd_cli then
return nil, err
end
- local res, err = etcd_cli:readdir(prefix .. key)
+ -- It will be better if we use snowflake algorithm like manager-api,
+ -- but we haven't found a good library. It costs too much to write
+ -- our own one as the admin-api will be replaced by manager-api finally.
+ local res, err = set("/gen_id", 1)
Review comment:
Updated.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #3003: fix: avoid duplicate auto-generated id
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3003:
URL: https://github.com/apache/apisix/pull/3003#discussion_r539140752
##########
File path: apisix/core/etcd.lua
##########
@@ -269,12 +269,15 @@ end
function _M.push(key, value, ttl)
- local etcd_cli, prefix, err = new()
+ local etcd_cli, _, err = new()
if not etcd_cli then
return nil, err
end
- local res, err = etcd_cli:readdir(prefix .. key)
+ -- It will be better if we use snowflake algorithm like manager-api,
+ -- but we haven't found a good library. It costs too much to write
+ -- our own one as the admin-api will be replaced by manager-api finally.
+ local res, err = set("/gen_id", 1)
Review comment:
I think we should add more comments here to explain why we need extra write operation here, it's not easy to understand if readers are out of the context of #2950 .
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [apisix] idbeta commented on pull request #3003: fix: avoid duplicate auto-generated id
Posted by GitBox <gi...@apache.org>.
idbeta commented on pull request #3003:
URL: https://github.com/apache/apisix/pull/3003#issuecomment-742288134
> @idbeta @AloneFire you can make a try with this PR
This commit has solved this problem #2950
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #3003: fix: avoid duplicate auto-generated id
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #3003:
URL: https://github.com/apache/apisix/pull/3003
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #3003: fix: avoid duplicate auto-generated id
Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #3003:
URL: https://github.com/apache/apisix/pull/3003#issuecomment-741650819
@idbeta @AloneFire you can make a try with this PR
----------------------------------------------------------------
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:
users@infra.apache.org