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

Reconcile component database from blob store task does not restore docker assets which name starts with "/"

Details

    • n/a

    Description

      SYMPTOM:

      After rolling back from the NewDB (PostgreSQL) to OrientDB, run the Reconcile component database from blob store task and it reported ERRORs for Docker assets:

      2021-11-26 17:01:33,434+1000 ERROR [quartz-10-thread-3] *SYSTEM com.sonatype.nexus.blobstore.restore.internal.orient.OrientDockerRestoreBlobStrategy - Unable to restore Docker version /v, blob name /v2/sonatype/nexus3/manifests/3.35.0
      2021-11-26 17:01:33,434+1000 INFO  [quartz-10-thread-3] *SYSTEM com.sonatype.nexus.blobstore.restore.internal.orient.OrientDockerRestoreBlobStrategy - Restored asset, blob store: default, repository: docker-proxy, path: /v2/sonatype/nexus3/manifests/3.35.0, blob name: /v2/sonatype/nexus3/manifests/3.35.0, blob id: def932ad-71e1-4311-a1ee-1000313d0463
      

      REPRODUCE STEPS:

      1. Install new NXRM 3.36 and start (so that "default" blob store is empty)
      2. Copy the attached 5fe943f8-032d-4334-a3f2-58889d94ce7b.* to default/contents/vol-33/chap-21/, for example:
        mkdir -p sonatype-work/nexus3/blobs/default/content/vol-01/chap-24
        cp ./def932ad-71e1-4311-a1ee-1000313d0463.* sonatype-work/nexus3/blobs/default/content/vol-01/chap-24
        
      3. Create "docker-proxy" repo with the remote URL https://registry-1.docker.io/ and with the "default" blob store
      4. Create "Reconcile component database from blob store" task and run against "default" blob store

      EXPECTED BEHAVIOUR:

      As NXRM3 should provide the way to rollback, this should restore the files.

      ACTUAL BEHAVIOUR:

      Got "Unable to restore Docker version /v" and also "estored asset, blob store: default, repository: docker-proxy, path: ...", but the component DB's "component" and "asset" both are empty, and Browse page is empty.

      POTENTIAL CAUSE:

      com.sonatype.nexus.blobstore.restore.internal.orient.OrientDockerRestoreBlobStrategy#createAssetFromBlob has the following line which checks the first two characters to find the version:

          String version = data.getBlobData().getBlobName().substring(0, 2);
      

      NOTE:

      Also, reconciling docker assets created by OrientDB may not work with Nexus + NewDB because com.sonatype.nexus.blobstore.restore.internal.datastore.DockerRestoreBlobStrategy#createAssetFromBlob has below:

          String version = data.getBlobName().substring(1, 3);
      

      POTENTIAL WORKAROUND:

      Remove the "/" from the blob-name:

      sed -i.bak 's/@BlobStore.blob-name=\/v([12])\//@BlobStore.blob-name=v\1\//' def932ad-71e1-4311-a1ee-1000313d0463.properties
      

      NOTE: this will create def932ad-71e1-4311-a1ee-1000313d0463.properties.bak

      ANOTHER CONCERN:

      Also, if OrientDB has the asset and blob store has the .properties file with "BlobStore.blob-name=/v2/...", the Reconcile task with Integrity check may remove the asset (soft-delete).

      $ cp def932ad-71e1-4311-a1ee-1000313d0463.properties.bak def932ad-71e1-4311-a1ee-1000313d0463.properties
      

      Then running same task again generates below log:

      2021-11-26 17:19:34,373+1000 ERROR [quartz-10-thread-6] *SYSTEM org.sonatype.nexus.blobstore.restore.orient.DefaultOrientIntegrityCheckStrategy - Name does not match on asset! Metadata name: '/v2/sonatype/nexus3/manifests/3.35.0', Blob name: 'v2/sonatype/nexus3/manifests/3.35.0'
      2021-11-26 17:19:34,375+1000 INFO  [quartz-10-thread-6] *SYSTEM org.sonatype.nexus.blobstore.restore.orient.OrientRestoreMetadataTask - Removing asset v2/sonatype/nexus3/manifests/3.35.0 from repository docker-proxy, blob integrity check failed
      

      Now the Browse page no longer shows NXRM 3.35 tag.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hosako Hajime Osako
              Peter Lynch Peter Lynch
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                tigCommentSecurity.panel-title