[
https://issues.apache.org/jira/browse/RANGER-4724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Anand Nadar updated RANGER-4724:
--------------------------------
Description:
Case:
Create a tag with [^hive_tag.json] using PUT /service/tags/importservicetags
for the hive service in Hadoop SQL.
Now these tags are download using GET /service/tags/download/\{serviceName}
[^downloaded_hive_tag.json]
Now use the downloaded hive tag json to again import using PUT
/service/tags/importservicetags
When the response json is used as input for the importservicetags api, the
below error is seen.
{code:java}
Exception[ EclipseLink-4002 ](Eclipse Persistence Services-2.7
.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLIntegrityConstraintViolationException:
(conn=2595495)Duplicate entry
'4a4f3791d51a146d6755f1c33de13d7509e94260019fde37ea68f479cf145bee'for key
'x_service_resource_IDX_resource_signature'Error Code: 1062 Call: INSERT INTO
x_service_resource(ADDED_BY_ID, CREATE_TIME, guid, is_enabled,
resource_signature, service_id, service_resource_elements_text, tags_text,
UPDATE_TIME, UPD_BY_ID, version)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)bind=>[
11 parameters bound ]Query:
ValueReadQuery(name="X_SERVICE_RESOURCE_SEQ"sql="SELECT LAST_INSERT_ID()")
{code}
Cause: This is because the downloaded tag json does not have the service name
in its resource object.
Hence an attempt to create a existing resource is made which results in the
above error.
Resolution: When the service name is not found in the resource object, use the
service name which is already available in the ServiceTags object.
was:
Case:
There are already some tags available for a service.
Now these tags are download using GET /service/tags/download/\{serviceName}
And then they are again imported using PUT /service/tags/importservicetags
When the response json is used as input for the importservicetags api, the
below error is seen.
{code:java}
Exception[ EclipseLink-4002 ](Eclipse Persistence Services-2.7
.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLIntegrityConstraintViolationException:
(conn=2595495)Duplicate entry
'4a4f3791d51a146d6755f1c33de13d7509e94260019fde37ea68f479cf145bee'for key
'x_service_resource_IDX_resource_signature'Error Code: 1062 Call: INSERT INTO
x_service_resource(ADDED_BY_ID, CREATE_TIME, guid, is_enabled,
resource_signature, service_id, service_resource_elements_text, tags_text,
UPDATE_TIME, UPD_BY_ID, version)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)bind=>[
11 parameters bound ]Query:
ValueReadQuery(name="X_SERVICE_RESOURCE_SEQ"sql="SELECT LAST_INSERT_ID()")
{code}
Cause: This is because the downloaded tag json does not have the service name
in its resource object.
Hence an attempt to create a existing resource is made which results in the
above error.
Resolution: When the service name is not found in the resource object, use the
service name which is already available in the ServiceTags object.
> ImportServiceTags api fails when the response json from
> tags/download/{serviceName} is used
> -------------------------------------------------------------------------------------------
>
> Key: RANGER-4724
> URL: https://issues.apache.org/jira/browse/RANGER-4724
> Project: Ranger
> Issue Type: Bug
> Components: admin
> Reporter: Anand Nadar
> Assignee: Anand Nadar
> Priority: Major
> Attachments: downloaded_hive_tag.json, hive_tag.json
>
>
> Case:
> Create a tag with [^hive_tag.json] using PUT /service/tags/importservicetags
> for the hive service in Hadoop SQL.
> Now these tags are download using GET /service/tags/download/\{serviceName}
> [^downloaded_hive_tag.json]
> Now use the downloaded hive tag json to again import using PUT
> /service/tags/importservicetags
> When the response json is used as input for the importservicetags api, the
> below error is seen.
> {code:java}
> Exception[ EclipseLink-4002 ](Eclipse Persistence Services-2.7
> .12.v20230209-e5c4074ef3):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLIntegrityConstraintViolationException: (conn=2595495)Duplicate
> entry '4a4f3791d51a146d6755f1c33de13d7509e94260019fde37ea68f479cf145bee'for
> key 'x_service_resource_IDX_resource_signature'Error Code: 1062 Call: INSERT
> INTO x_service_resource(ADDED_BY_ID, CREATE_TIME, guid, is_enabled,
> resource_signature, service_id, service_resource_elements_text, tags_text,
> UPDATE_TIME, UPD_BY_ID, version)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?)bind=>[ 11 parameters bound ]Query:
> ValueReadQuery(name="X_SERVICE_RESOURCE_SEQ"sql="SELECT LAST_INSERT_ID()")
> {code}
> Cause: This is because the downloaded tag json does not have the service name
> in its resource object.
> Hence an attempt to create a existing resource is made which results in the
> above error.
> Resolution: When the service name is not found in the resource object, use
> the service name which is already available in the ServiceTags object.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)