# Change Repository Blob Store

The `Admin - Change repository blob store` task changes where components are stored by switching the configured blob store used by the repository. This task copies components from one blob store to another without interrupting the availability of the artifacts in the repository.

The task may take significant time to complete.

See [Change Repository Blob Store Performance Testing](https://help.sonatype.com/en/change-repository-blob-store-task-performance-testing.html "Change Repository Blob Store Task Performance Testing")

Only available in Sonatype Nexus RepositoryTM Pro.

## Feature Change Log

We recommend upgrading to version 3.58.0 or later when using this task. Earlier versions are known to lead to potential data loss.

- As of version 3.45.0, this task is no longer available for OrientDB deployments. This task is supported for PostgreSQL and H2 deployments.
- This task was disabled for versions 3.45 through 3.58.0
- Support for `proxy` repositories is added in version 3.61.0
- Support for `group` repositories is added in version 3.65.0; Requires a PostgreSQL database

## Configuration

The following steps are to add the `Admin - Change repository blob store` task.

1. Navigate to _Admin → System → Tasks_, and select `Create task`
2. Choose the `Admin - Change repository blob store` task type

|     |
   | --- |
   |  |

3. Fill in the form fields:

- #### Task enabled
     This checkbox determines if the task is currently active
   - #### Task name
     Provide a unique name for your task
   - #### Notification email
     The email address where an email will be sent
   - #### Send notification on
     Conditions that will trigger a notification email
   - #### Repository
     The repository for which you wish to change the blob store; this repository cannot by using a group blob store
   - #### Destination blob store
     The blob store to which you wish to move the repository; note that this can not be a group blob store.
     When the task runs, the _Destination blob store_ field is cleared as the destination blob store is no longer a valid destination to configure this task. However, you can still stop and restart the task until it is complete without impacting the originally defined destination blob store for this task.
   - #### Task frequency
     Select how often to run the task; select _Manual_ or _Once_
     The task should only run a single time either immediately or at a scheduled time.

4. Select the `Create task` button

### Moving a Group Repository

When using this task on group repositories, it only move metadata assets directly related to the group repository content id; it does not move or affect data in the repositories that are group members.

Using this task on group repositories requires a PostgreSQL database.

## While Running the Change Blob Store Task

The following are expectations and limitations while the task is running:

- #### New components are saved to the destination blob store
  The repository configuration changes so that new writes go to the destination blob store.
- #### Existing artifacts migrate in batches
  Existing content is progressively copied from the original blob store to the destination store. This content remains available throughout the migration.
- #### Write location and destination field appears empty
  The task clears the "Destination blob store" field once it begins. This prevents accidental re-initiation to a different destination. You can safely stop and restart the task without affecting the chosen destination store.
- #### Task logging
  A dedicated task log records each blob the task migrates and any errors it encounters. Seeing `WARN` log activity during the execution of the task is expected and normal behavior.

Example:

```
2024-02-16 18:32:56,241+0000 WARN  [qtp25749319-938] *UNKNOWN org.sonatype.nexus.blobstore.s3.internal.S3BlobStore - Attempt to access non-existent blob 7f65d2f9-9fd4-4465-9bf4-7297c908af64 (s3://<redacted-bucket-name>/content/vol-36/chap-15/7f65d2f9-9fd4-4465-9bf4-7297c908af64.properties null)
2024-02-16 18:32:56,242+0000 WARN  [qtp25749319-909] *UNKNOWN org.sonatype.nexus.blobstore.s3.internal.S3BlobStore - Attempt to access non-existent blob 60ad74db-e188-4c77-b217-4a4976ff8f43 (s3://<redacted-bucket-name>content/vol-20/chap-26/60ad74db-e188-4c77-b217-4a4976ff8f43.properties null)
```

This log activity coincided with concurrent execution of the Change Repository Blobstore Task.
- #### You may not delete or promote the blob store
  The options to delete or promote a blob store are not available for the target or destination blob stores to avoid data corruption. These options are available once the task is completed.
- #### Conflicts with other tasks
  The following tasks conflict with the change repository blob store task resulting in at least one of the tasks failing and being blocked. Often these tasks are on a regular schedule, so you may wish to stop them to avoid running them at the same time:

```
Admin - Compact blob store
Repair - Reconcile component database from blob store
Admin - Remove a member from a blob store group
```

Consider compacting blob store task before moving content to clean up soft deleted artifacts.

## Rolling Back Changes

There are two options when needing to roll back to the original blobstore:

1. **Modify the task** - Change the task configuration to set the destination blob store to the original source blob store and run the task again.
2. **Create a new task** - delete the current task and add a new task that directs the content back to the original source blob store.

Stop the task before attempting to change the configuration.

## In the Event of Task Failure

In the event the task fails, modify the task target to the original source blob store. This is the only valid target and any any other target blob store is rejected.
