Soft-Deleted Apps Cleanup Job

Learn how the scheduled cleanup job permanently removes soft-deleted apps and app versions from the database and how to configure and monitor the job.

On this page:

Overview

When you delete an app or an app version, the platform soft deletes it. The app or app version is hidden from view, but its data stays in the database. The cleanup job runs in the background and permanently removes this data after the retention period has passed. This prevents deleted apps and app versions from accumulating in the database.

The cleanup job removes data permanently. Removed data cannot be recovered. To keep deleted apps and app versions longer, increase the value of the retention hours setting. See Configure the cleanup job.

When apps and app versions are removed?

On each run, the job removes apps and app versions that have been soft deleted for longer than the retention period. The following rules apply:

  • An app version is removed before its parent app. The job removes an app only after none of its versions remain.
  • If a version is soft deleted but its parent app is active, the job removes only that version. The app and its other versions are not changed.
  • If the job removes the last version of an app, and the app is also soft deleted, the job removes the app in the same run. The job does not wait for a later run.
  • An app or app version that was soft deleted more recently than the retention period is not changed.

The job processes a limited number of items in each run. Because the job also removes an app when it removes the app's last version, a single run can process slightly more items than the batch size. Items that are eligible but were not processed are removed in later runs.

The job processes each app and each app version as a separate unit. If the job cannot remove one item, it skips that item and continues with the rest of the run. A failed item is not partially removed. It is picked up again in a later run.

When the job removes an app or an app version, it also removes the data that belongs to it, as shown in the following table.

Data Table Removed with
App version APP_VERSIONS App version
App APPLICATIONS App
API contracts on the app version API_CONTRACTS App version
Contract usage and SLA history API_CONTRACT_SLA_DATA App version
Contract metadata MD_STORAGE App version
Workflow links for the app version and its contracts WORKFLOW_DN App version
Support tickets for the app TICKETS App
App avatar or app version logo RESOURCEIMAGES App and app version
Board items (discussions and comment threads) BOARD_ITEMS App and app version
Links between board items and the app or app version BOARD_ITEM_ASSIGNMENTS App and app version
Comments on the board items COMMENTS App and app version
Attachments on the board items BOARD_ITEM_ARTIFACTS App and app version
Identity records of the board items DISTINGUISHED_NAMES App and app version

The job also removes the search index entries for the app, the app version, and their board items, so they no longer appear in search results. The job does not remove the identity records of the app and the app version themselves.

An app version with a large amount of contract usage and SLA history can take longer to remove. The job removes this data in batches.

Configure the cleanup job

The job is enabled by default. You can configure the job in the Akana Administration Console. Changes to the retention hours and batch size settings apply to the next run. You do not need to restart the container.

To change the retention and batch size settings

  1. Log in to the Akana Administration Console.
  2. Select the Configuration tab.
  3. Under Configuration Categories, go to scheduled.cleanup.jobs.config.
  4. Change the following values as needed, and then select Apply Changes.
Setting Description
retentionHours

How long, in hours, a deleted app or app version is kept before the cleanup job can permanently remove it. The job removes only items that were deleted longer ago than this value. Increase the value to keep deleted items longer.

Default: 1

batchSize The maximum number of deleted apps or app versions that the job permanently removes in a single run. Any remaining eligible items are removed in later runs. Use a lower value to reduce the load on the database. The maximum value is 5.

For more information, see scheduled.cleanup.jobs.config PID.

To enable or disable the cleanup job

  1. Log in to the Akana Administration Console.
  2. Select the Configuration tab.
  3. Under Configuration Categories, select com.soa.scheduler.jobs.
  4. Locate the job DataCleanup:atmo.soft.deleted.app.cleanup.job.
  5. Select Enable or Disable, and then select Save.

Statuses

Each run ends with one of the following statuses:

Status Meaning
SUCCESS The job removed every item that it processed.
PARTIAL_SUCCESS The job removed some items, and failed to remove others. The items that were removed stay removed. The items that failed are processed again in a later run.
FAILED The job failed to remove every item that it processed, or the run failed before the job could find items to remove.
SKIPPED The job is disabled, so the run did not remove anything.

Monitoring the job

Each run writes one structured JSON log entry that summarizes the run. All log entries for the same run have the same cleanup.correlation_id value. You can use this value in a log analysis tool, such as Splunk or Kibana, to find all log entries for one run, including the details of any failure.

The summary entry includes the following fields:

Field Description
cleanup.correlation_id A unique ID for the run. It is included in every log entry that the run writes.
cleanup.status The run status: SUCCESS, PARTIAL_SUCCESS, FAILED, or SKIPPED.
cleanup.start_time, cleanup.end_time, cleanup.duration_ms When the run started and ended, and how long it took.
cleanup.rows_deleted The total number of rows removed across all tables. This number includes only the items that were removed successfully.
cleanup.tables For each table, the number of rows removed and the time spent.
cleanup.items One entry for each app or app version that the run processed. Each entry shows the type (APP or APP_VERSION), the ID, the status (SUCCESS or FAILED), and the duration. For a failed item, the entry also shows an error message and the technical cause.
cleanup.error_message A description of the failure. This field is set only when the run failed before it processed any item.

Monitor the status of each run as follows:

  • A PARTIAL_SUCCESS run is not an outage. Check cleanup.items for the items that failed, and investigate them.
  • A FAILED run means that every item failed, or that the job cannot find items to remove. Check cleanup.error_message and the log entries that have the same cleanup.correlation_id value.