use gravitinoAdminClient.deleteRole("metalake",'role#test"); to delete role role#test, it doesn't work, even though the role actually exists
When there's a # sign in the URL, the content after # is considered as the URI's fragment identifier and won't be sent to the server.
The reuest url is api/metalakes/metalake/roles/role#test, the "#test" will be ignored, in other scenarios involving path parameters, there are similar issues.
We should use the URLEncoder to encode special characters in the URL, ensure they are correctly sent to the server.
Error message and/or stacktrace
java.lang.RuntimeException: Failed to operate object [role] operation [DELETE] under [metalake], reason [No such role entity: role]
com.datastrato.gravitino.exceptions.NoSuchEntityException: No such role entity: role
at com.datastrato.gravitino.storage.relational.service.RoleMetaService.getRoleIdByMetalakeIdAndName(RoleMetaService.java:55)
at com.datastrato.gravitino.storage.relational.service.RoleMetaService.deleteRole(RoleMetaService.java:112)
at com.datastrato.gravitino.storage.relational.JDBCBackend.delete(JDBCBackend.java:193)
at com.datastrato.gravitino.storage.relational.RelationalEntityStore.delete(RelationalEntityStore.java:109)
at com.datastrato.gravitino.EntityStore.delete(EntityStore.java:147)
at com.datastrato.gravitino.authorization.RoleManager.deleteRole(RoleManager.java:127)
at com.datastrato.gravitino.authorization.AccessControlManager.lambda$deleteRole$15(AccessControlManager.java:296)
at com.datastrato.gravitino.authorization.AccessControlManager.doWithNonAdminLock(AccessControlManager.java:328)
at com.datastrato.gravitino.authorization.AccessControlManager.deleteRole(AccessControlManager.java:296)
How to reproduce
create role with the role name contains #, then delete role
Version
main branch
Describe what's wrong
use
gravitinoAdminClient.deleteRole("metalake",'role#test");
to delete rolerole#test
, it doesn't work, even though the role actually existsWhen there's a # sign in the URL, the content after # is considered as the URI's fragment identifier and won't be sent to the server.
The reuest url is
api/metalakes/metalake/roles/role#test
, the "#test" will be ignored, in other scenarios involving path parameters, there are similar issues.We should use the
URLEncoder
to encode special characters in the URL, ensure they are correctly sent to the server.Error message and/or stacktrace
java.lang.RuntimeException: Failed to operate object [role] operation [DELETE] under [metalake], reason [No such role entity: role] com.datastrato.gravitino.exceptions.NoSuchEntityException: No such role entity: role at com.datastrato.gravitino.storage.relational.service.RoleMetaService.getRoleIdByMetalakeIdAndName(RoleMetaService.java:55) at com.datastrato.gravitino.storage.relational.service.RoleMetaService.deleteRole(RoleMetaService.java:112) at com.datastrato.gravitino.storage.relational.JDBCBackend.delete(JDBCBackend.java:193) at com.datastrato.gravitino.storage.relational.RelationalEntityStore.delete(RelationalEntityStore.java:109) at com.datastrato.gravitino.EntityStore.delete(EntityStore.java:147) at com.datastrato.gravitino.authorization.RoleManager.deleteRole(RoleManager.java:127) at com.datastrato.gravitino.authorization.AccessControlManager.lambda$deleteRole$15(AccessControlManager.java:296) at com.datastrato.gravitino.authorization.AccessControlManager.doWithNonAdminLock(AccessControlManager.java:328) at com.datastrato.gravitino.authorization.AccessControlManager.deleteRole(AccessControlManager.java:296)
How to reproduce
create role with the role name contains #, then delete role
Additional context
No response