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

Siddhant Sontakke updated RANGER-4128:
--------------------------------------
    Attachment: image-2023-04-14-13-01-11-416.png

> serviceName, if not specified in the resource, should be taken from the 
> ServiceTags.serviceName
> -----------------------------------------------------------------------------------------------
>
>                 Key: RANGER-4128
>                 URL: https://issues.apache.org/jira/browse/RANGER-4128
>             Project: Ranger
>          Issue Type: Bug
>          Components: Ranger
>            Reporter: Fateh Singh
>            Priority: Major
>         Attachments: image-2023-04-14-12-36-34-803.png, 
> image-2023-04-14-12-36-53-668.png, image-2023-04-14-12-40-36-377.png, 
> image-2023-04-14-12-59-13-128.png, image-2023-04-14-13-01-11-416.png
>
>
> Current scenario-
> REST endpoint: "tags/importservicetags"
> Client: ranger python client (ranger_client.import_service_tags)
> Scenario: Above endpoint called multiple times with different tags but same 
> set of resources gives the below error: 
> {code:java}
> PUT service/public/v2/api/service/dev_hive/tags failed: expected_status=204, 
> status=400, message=b'Exception [EclipseLink-4002] (Eclipse Persistence 
> Services - 2.7.12.v20230209-e5c4074ef3): 
> org.eclipse.persistence.exceptions.DatabaseException\nInternal Exception: 
> org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique 
> constraint "x_service_resource_idx_svc_id_resource_signature"\n  Detail: Key 
> (service_id, resource_signature)=(4, 
> 688974a2b40b6536631f952c66b065ad31c8c1588bfa658953a6218ef503d38e) already 
> exists.\nError Code: 0\nCall: INSERT INTO x_service_resource (id, 
> 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n\tbind => [12 parameters bound]' 
> {code}
> How a serviceResource in the request look like to reproduce above 
> scenario/error:
> {code:java}
>   {
> "resourceElements": {
>     "database": {
>       ...
>     },
>     "column": {
>       ...
>     },
>     "table": {
>       ...
>     }
>   },
>   "resourceSignature": 
> "40c20f3a1909b0958b61451499e9a58e9ece1661f82072388f39f9685996c0dc",
>   "id": 1,
>   "isEnabled": true,
>   "version": 2
>   } {code}
> Found bug and workaround:
> serviceName, if not specified in the resource, should be taken from the 
> ServiceTags.serviceName
> How a serviceResource should look like to fix above bug:
> {code:java}
> {
>   "serviceName":"dev_hive",
>   "resourceElements": {
>     "database": {
>       ...
>     },
>     "column": {
>       ...
>     },
>     "table": {
>       ...
>     }
>   },
>   "resourceSignature": 
> "40c20f3a1909b0958b61451499e9a58e9ece1661f82072388f39f9685996c0dc",
>   "id": 1,
>   "isEnabled": true,
>   "version": 2
> } {code}
> Here, dev_hive is the serviceName for which service tags are being imported
>  



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

Reply via email to