Skip to content

[fix](auth) remove USAGE_PRIV in CatalogPrivEntry when loading meta image from old version#12011

Closed
AshinGau wants to merge 1 commit intoapache:masterfrom
AshinGau:priv-bug
Closed

[fix](auth) remove USAGE_PRIV in CatalogPrivEntry when loading meta image from old version#12011
AshinGau wants to merge 1 commit intoapache:masterfrom
AshinGau:priv-bug

Conversation

@AshinGau
Copy link
Member

Proposed changes

Problem summary

FE failed when updating from v1.1.2 to master:

java.io.IOException: java.lang.reflect.InvocationTargetException
	at org.apache.doris.persist.meta.MetaReader.read(MetaReader.java:97)
	at org.apache.doris.catalog.Env.loadImage(Env.java:1615)
	at org.apache.doris.catalog.Env.initialize(Env.java:830)
	at org.apache.doris.PaloFe.start(PaloFe.java:132)
	at org.apache.doris.PaloFe.main(PaloFe.java:67)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.doris.persist.meta.MetaReader.read(MetaReader.java:94)
	... 4 more
Caused by: java.io.IOException: errCode = 2, detailMessage = Catalog privilege can not contains node or resource privileges: Select_priv Load_priv Alter_priv Create_priv Usage_priv 
	at org.apache.doris.mysql.privilege.UserPrivTable.degradeToInternalCatalogPriv(UserPrivTable.java:200)
	at org.apache.doris.mysql.privilege.PaloAuth.readFields(PaloAuth.java:1829)
	at org.apache.doris.catalog.Env.loadPaloAuth(Env.java:1823)
	... 9 more

This only happened in loading meta image from old version:
GlobalPrivEntry of the previous version does not check 'privs.containsResourcePriv()',
so GlobalPrivEntry maybe contians USAGE_PRIV which is wrong operation and useless priv.
In order to be compatible with this scenario, we should delete USAGE_PRIV.

Checklist(Required)

  1. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  2. Has unit tests been added:
    • Yes
    • No
    • No Need
  3. Has document been added or modified:
    • Yes
    • No
    • No Need
  4. Does it need to update dependencies:
    • Yes
    • No
  5. Are there any changes that cannot be rolled back:
    • Yes (If Yes, please explain WHY)
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions bot added the area/planner Issues or PRs related to the query planner label Aug 23, 2022
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the kind/fix Categorizes issue or PR as related to a bug. label Aug 23, 2022
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 23, 2022
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@AshinGau AshinGau closed this Aug 23, 2022
@AshinGau AshinGau deleted the priv-bug branch September 2, 2022 07:19
@morningman
Copy link
Contributor

Fixed in #12016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/planner Issues or PRs related to the query planner kind/fix Categorizes issue or PR as related to a bug. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants