Component version cleanup

Component versions are automatically cleaned up, or deleted, based on rules that you define in the administration timeline.

By default, the cleanup runs every 24 hours. For details on how to create your own cleanup schedules, see Schedule version cleanup.

Set the following parameters for keeping versions:

  • Days to Keep Versions. Number of days to keep versions after they are created.

    Example: A version was created on July 1. If Days to Keep Version is set to 30 days, this version will be kept at least until July 30.

  • Number of Versions to Keep. Number of versions for the current component, ordered in reverse order, to keep. After a new version is created and cleanup is started, the oldest version will be candidate for removing.

There are multiple levels at which the parameters may be set. They are evaluated in ascending order of priority.

  1. System level.  Settings  for  those parameters can be found in System Settings. Allowed values for both of the parameters are “-1” or “integer greater than 0”.
  2. Component level.  Settings  for  those parameters can be found when you edit a component. To enable them you should clear the Inherit Cleanup Settings checkbox. Allowed values for both of the parameters are “-1”, “0”, or “integer greater than 0”.
  3. Environment level. Settings  for  those parameters can be found when you edit an environment at the application level. To enable them you should uncheck the Inherit Cleanup Settings checkbox. Allowed values for both of the parameters are “-1”, “0”, or “integer greater than 0”.

Environment and component level settings are deselected by default for each component and environment.

The cleanup procedure starts with retrieving all components from the database and looping through their versions in descending order. Every version is evaluated as follows:

  1. What values of Days to Keep Versions and Number of Versions to Keep should be used for this version?

    1. Initial parameter values are set to be equal to system level values.
    2. If the component overrides at least one of these values with a non-zero value,  use both of them from the component level instead.
    3. Get a list of environments that ever had this version used in a process request.
    4. Iterate them sequentially. If an environment has cleanup parameters overridden, use the following criteria:
      1. For Days to Keep Versions parameter, extend, if needed, the amount of days to the environment level value.
      2. For Number of Versions to Keep, save the environment level value for later use.
  2. Sequentially check this version against the set of rules. If a rule indicates the version should be kept, the version is not deleted.

    1. If either Days to Keep Versions and Number of Versions to Keep is set to “-1”, keep this version.
    2. If both Days to Keep Versions and Number of Versions to Keep is set to “0”, keep this version.
    3. If this version fits the “days to keep version” rule, in that the specified amount of days has not yet passed, keep this version.
    4. If this version fits the “number of versions to keep” rule, in that the version index is less than specified number of versions to keep, keep this version.
    5. If this version has active inventory, keep this version.
    6. If this version fits the “number of versions to keep” on some environment as determined in the previous pass, in that the version index is less than the specified number of versions to keep for this environment, keep this version.

Back to top

See also: