-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix acl map num #33246
Fix acl map num #33246
Conversation
if (acl_to_num.count(acls)) | ||
return acl_to_num[acls]; | ||
|
||
/// Start from one | ||
auto index = acl_to_num.size() + 1; | ||
auto index = max_acl_id++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe the issue in details? As far as I can see we will restore acl_to_num and num_to_acl from logs/snapshot and everything should work well. Why it will erase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will erase from removeUsage
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why it's a problem? If nobody uses some id from map than we can reuse it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because after erasing, the size will be reduced. When a new acls comes in, it will be assigned an index equal to the current maximum index so that the original acls will be overwritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But an ID
can be erased from map only when nobody use this ID
and it should be safe to reuse it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add some tests to be more intuitive.
Clear to me. We will get an issue when one ACL is removed and new added. |
@nicelulu Thank you. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix ACLMap num, because acl_to_num will erase.