[ 
https://issues.apache.org/jira/browse/RANGER-5003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

wangzhongwei updated RANGER-5003:
---------------------------------
    Description: 
 When I tried to delete a service, I encountered the following error, and the 
deletion failed. 

logs are:
{code:java}
2024-11-11 10:29:12,463 | INFO | org.apache.ranger.common.RESTErrorUtil | 
Operation error. 
response=VXResponse={org.apache.ranger.view.VXResponse@15d84707statusCode={1} 
msgDesc={Exception [EclipseLink-4002] (Eclipse Persistence Services - 
2.5.2.v20140319-9ad6abd): 
org.eclipse.persistence.exceptions.DatabaseExceptionInternal Exception: 
java.sql.SQLSyntaxErrorException: Table 'ranger.tl_x_rms_resource_mapping' 
doesn't existError Code: 1146Call: INSERT INTO TL_x_rms_resource_mapping (id) 
SELECT t0.id FROM x_rms_resource_mapping t0 WHERE (t0.hl_resource_id IN (SELECT 
t1.id FROM x_rms_service_resource t1 WHERE (t1.service_id = ?)) OR 
t0.ll_resource_id IN (SELECT t2.id FROM x_rms_service_resource t2 WHERE 
(t2.service_id = ?)))    bind => [2 parameters bound]Query: 
DeleteAllQuery(name="XXRMSResourceMapping.deleteByServiceId" 
referenceClass=XXRMSResourceMapping sql="DELETE FROM 
TL_x_rms_resource_mapping")} messageList={null} 
}javax.ws.rs.WebApplicationException    at 
org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:56)
    at 
org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:311)
    at 
org.apache.ranger.rest.ServiceREST.deleteServiceById(ServiceREST.java:4340)    
at org.apache.ranger.rest.ServiceREST.deleteService(ServiceREST.java:868)    at 
org.apache.ranger.rest.ServiceREST$$FastClassBySpringCGLIB$$92dab672.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) 
   at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
 {code}
 

 

Conditions for reproducing the bug:

MySQL configuration is as follows:
1.gtid be set to ON
enforce_gtid_consistency = ON
gtid_mode = ON
2.enable binlog,like configs in /etc/my.conf
log-bin=mysql-bin
server-id=1
binlog-format=row
3.version :5.6 <= mysql.version <8.0.13

 

Failed reason:

mysql version <8.0.13 does not support temporary tables in GTID 
transactions,while the NamedQuery XXRMSResourceMapping.deleteByServiceId :
{code:java}
DELETE FROM XXRMSResourceMapping mapping WHERE mapping.hlResourceId in (select 
obj.id from XXRMSServiceResource obj where obj.serviceId = :serviceId) OR
mapping.llResourceId in (select obj.id from XXRMSServiceResource obj where 
obj.serviceId = :serviceId) {code}
will genatate temporary table.

  was:
 When I tried to delete a service, I encountered the following error, and the 
deletion failed. 

logs are:
{code:java}
2024-11-11 10:29:12,463 | INFO | org.apache.ranger.common.RESTErrorUtil | 
Operation error. 
response=VXResponse={org.apache.ranger.view.VXResponse@15d84707statusCode={1} 
msgDesc={Exception [EclipseLink-4002] (Eclipse Persistence Services - 
2.5.2.v20140319-9ad6abd): 
org.eclipse.persistence.exceptions.DatabaseExceptionInternal Exception: 
java.sql.SQLSyntaxErrorException: Table 'ranger.tl_x_rms_resource_mapping' 
doesn't existError Code: 1146Call: INSERT INTO TL_x_rms_resource_mapping (id) 
SELECT t0.id FROM x_rms_resource_mapping t0 WHERE (t0.hl_resource_id IN (SELECT 
t1.id FROM x_rms_service_resource t1 WHERE (t1.service_id = ?)) OR 
t0.ll_resource_id IN (SELECT t2.id FROM x_rms_service_resource t2 WHERE 
(t2.service_id = ?)))    bind => [2 parameters bound]Query: 
DeleteAllQuery(name="XXRMSResourceMapping.deleteByServiceId" 
referenceClass=XXRMSResourceMapping sql="DELETE FROM 
TL_x_rms_resource_mapping")} messageList={null} 
}javax.ws.rs.WebApplicationException    at 
org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:56)
    at 
org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:311)
    at 
org.apache.ranger.rest.ServiceREST.deleteServiceById(ServiceREST.java:4340)    
at org.apache.ranger.rest.ServiceREST.deleteService(ServiceREST.java:868)    at 
org.apache.ranger.rest.ServiceREST$$FastClassBySpringCGLIB$$92dab672.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) 
   at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
 {code}
 

 

Conditions for reproducing the bug:

MySQL configuration is as follows:
1.gtid be set to ON
enforce_gtid_consistency = ON
gtid_mode = ON
2.enable binlog,like configs in /etc/my.conf
log-bin=mysql-bin
server-id=1
binlog-format=row
3.version :5.6 <= mysql.version <8.0.13

 

Failed reason:

mysql version <8.0.13 does not support temporary tables in GTID 
transactions,while the NamedQuery XXRMSResourceMapping.deleteByServiceId will 
genatate temporary table.


> Fix the bug that deleting a service fails  with gtid enabled mysql server
> -------------------------------------------------------------------------
>
>                 Key: RANGER-5003
>                 URL: https://issues.apache.org/jira/browse/RANGER-5003
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 2.2.0
>            Reporter: wangzhongwei
>            Assignee: wangzhongwei
>            Priority: Major
>         Attachments: RANGER-5003.patch, image-2024-11-20-11-37-32-722.png
>
>
>  When I tried to delete a service, I encountered the following error, and the 
> deletion failed. 
> logs are:
> {code:java}
> 2024-11-11 10:29:12,463 | INFO | org.apache.ranger.common.RESTErrorUtil | 
> Operation error. 
> response=VXResponse={org.apache.ranger.view.VXResponse@15d84707statusCode={1} 
> msgDesc={Exception [EclipseLink-4002] (Eclipse Persistence Services - 
> 2.5.2.v20140319-9ad6abd): 
> org.eclipse.persistence.exceptions.DatabaseExceptionInternal Exception: 
> java.sql.SQLSyntaxErrorException: Table 'ranger.tl_x_rms_resource_mapping' 
> doesn't existError Code: 1146Call: INSERT INTO TL_x_rms_resource_mapping (id) 
> SELECT t0.id FROM x_rms_resource_mapping t0 WHERE (t0.hl_resource_id IN 
> (SELECT t1.id FROM x_rms_service_resource t1 WHERE (t1.service_id = ?)) OR 
> t0.ll_resource_id IN (SELECT t2.id FROM x_rms_service_resource t2 WHERE 
> (t2.service_id = ?)))    bind => [2 parameters bound]Query: 
> DeleteAllQuery(name="XXRMSResourceMapping.deleteByServiceId" 
> referenceClass=XXRMSResourceMapping sql="DELETE FROM 
> TL_x_rms_resource_mapping")} messageList={null} 
> }javax.ws.rs.WebApplicationException    at 
> org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:56)
>     at 
> org.apache.ranger.common.RESTErrorUtil.createRESTException(RESTErrorUtil.java:311)
>     at 
> org.apache.ranger.rest.ServiceREST.deleteServiceById(ServiceREST.java:4340)   
>  at org.apache.ranger.rest.ServiceREST.deleteService(ServiceREST.java:868)    
> at 
> org.apache.ranger.rest.ServiceREST$$FastClassBySpringCGLIB$$92dab672.invoke(<generated>)
>     at 
> org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)    
> at 
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
>     at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
>     at 
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
>  {code}
>  
>  
> Conditions for reproducing the bug:
> MySQL configuration is as follows:
> 1.gtid be set to ON
> enforce_gtid_consistency = ON
> gtid_mode = ON
> 2.enable binlog,like configs in /etc/my.conf
> log-bin=mysql-bin
> server-id=1
> binlog-format=row
> 3.version :5.6 <= mysql.version <8.0.13
>  
> Failed reason:
> mysql version <8.0.13 does not support temporary tables in GTID 
> transactions,while the NamedQuery XXRMSResourceMapping.deleteByServiceId :
> {code:java}
> DELETE FROM XXRMSResourceMapping mapping WHERE mapping.hlResourceId in 
> (select obj.id from XXRMSServiceResource obj where obj.serviceId = 
> :serviceId) OR
> mapping.llResourceId in (select obj.id from XXRMSServiceResource obj where 
> obj.serviceId = :serviceId) {code}
> will genatate temporary table.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to