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

Admin - Compact blob store task logs a WARN message for every soft-deleted asset it will hard delete

    Details

      Description

      Create a scenario where a blob is soft deleted in a file based blobstore while using PostgreSQL. Allow the format specific Admin - Cleanup unused asset blobs task to cleanup database references to the assets.

      Now run the Admin - Compact blob store task to perform the hard deletes of those soft-deleted blobs.

      For every asset that is soft-deleted, the nexus.log contains a WARN level message suggesting it is NOT expected that a soft-deleted blob was found and will be deleted. This can fill the logs with alarming messages at WARN level for something that is working normally. In some cases where a cleanup policy has deleted thousands or millions of assets, the nexus.log will be enormous.

      Example message created running the compact blob store task:

      2022-05-04 08:06:48,505-0300 WARN  [quartz-11-thread-20] *SYSTEM org.sonatype.nexus.blobstore.file.FileBlobStore - Attempt to access soft-deleted blob f234516f-34dd-4b08-a990-136851431a3c attributes: /nexus-testing/3.38.1/nexus-installer-3.38.1-01-mac-archive/sonatype-work/nexus3/blobs/default/content/vol-42/chap-14/f234516f-34dd-4b08-a990-136851431a3c.properties \{deletedDateTime=1651662336021, deleted=true, @BlobStore.created-by=admin, creationTime=1651662176364, @BlobStore.created-by-ip=127.0.0.1, @BlobStore.content-type=text/plain, sha1=a9f358633c9b67ade81b111f3ec417dd565df09f, @BlobStore.blob-name=/base1/child2/file.txt, deletedReason=Removing unused asset blob, @Bucket.repo-name=raw-hosted, size=888}
      

      Notice the deletedReason is "Removing unused asset blob" - this blob was soft-deleted by the Admin - Cleanup unused asset blobs task which is the normal asynchronous way to delete blob references inside the PostgreSQL and H2 Databases.

      Logging was originally adding at WARN in the Blobstore class to track attributes of an asset being accessed in an unexpected soft-deleted state . See this comment and also NEXUS-18675 where the jira actually implemented the change.

      Reproduce

      1. Deploy a RAW asset to a raw-hosted repo
      2. Delete the raw component in the Browse view.
      3. Wait for, or manually run the Admin - Cleanup unused asset blobs task.
      4. run the Admin - Compact blob store task against the blobstore containing the deleted blobs.
      5. Observe the nexus.log contains WARN messages.

      Expected

      Do not spam the main nexus.log with messages at WARN level for operations that are considered normal when running compact blob store.

      Only log at WARN this message when an asset is accessed in the blobstore when it is in an unexpected soft-deleted state.

      Ensure all blob store formats ( file,S3 ) work similarly.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              plynch Peter Lynch
              Last Updated By:
              Hajime Osako Hajime Osako
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title