Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-4724

ImportServiceTags api fails when the response json from tags/download/{serviceName} is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • admin
    • None

    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.

      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()") 

      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.

      Attachments

        1. downloaded_hive_tag.json
          1 kB
          Anand Nadar
        2. hive_tag.json
          1 kB
          Anand Nadar

        Issue Links

          Activity

            People

              anandNadar Anand Nadar
              anandNadar Anand Nadar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: