Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-34303

DB migrator fails with DataIntegrityViolationException ... Key (component_id)=(940351) is not present in table "maven2_component"

    Details

    • Notability:
      3

      Description

      ISSUE:

      DB migrator may fail due to an asset record existing that references a component id that does not exist.

      For example it was noticed running the DB migrator 3.40.1 skips many duplicate records but eventually fails with below:

      00:40:33 [main] ERROR o.s.batch.core.step.AbstractStep - Encountered an error executing step processComponentStep in job migrationFromOrientJob
      org.springframework.retry.ExhaustedRetryException: Retry exhausted after last attempt in recovery path, but exception is not skippable.; nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO maven2_asset (asset_id, repository_id, path, kind, component_id, asset_blob_id, created, last_updated, last_downloaded, attributes)
      VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, (?::jsonb));
      ]; ERROR: insert or update on table "maven2_asset" violates foreign key constraint "fk_maven2_asset_component"
        Detail: Key (component_id)=(940351) is not present in table "maven2_component".; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "maven2_asset" violates foreign key constraint "fk_maven2_asset_component"
        Detail: Key (component_id)=(940351) is not present in table "maven2_component".
      ...
      

      EXPECTATION:

      Similar to NEXUS-33370, DB migrator should handle the DataIntegrityViolationException gracefully.

      • Add it as an asset without a component (existing solution).
      • Add logging for issue with asset/component¬†

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              hosako Hajime Osako
              Last Updated By:
              Michael Oliverio Michael Oliverio
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title