Update

During an update, type system definitions are modified to match the new type system definition in items.xml files. The update mechanism makes sure that all data that existed in the system before the update is still accessible after the update.

Update Technical Overview

Certain changes are ignored during a system update, and some features of the existing type system may be preserved to ensure continuing smooth operation.

When up run an update on SAP Commerce Cloud, the system does the following:

  1. Reads in all type system definitions from all extensions items.xml files.
  2. Modifies the SAP Commerce Cloud type system in the database, based on the new type definitions of all extensions items.xml files, as follows:
    • Newly defined types that were not previously a part of the type system are added to the type system definition in the database.
    • Existing types that have been modified are updated.
    • Any update, ddl and dml scripts are generated, if required.
    • If selected (optional), essential and project data is then created.

You can update a local instance of SAP Commerce Cloud either from the command line, or using the SAP Commerce Cloud Administration Console.

For details of how to update your cloud deployment, see Initiating a Deployment Update.

Characteristics of an Update

For compatibility purposes, an update preserves certain features of the type system definition.

  • It preserves the table name to which a type is mapped, even if it was changed in an items.xml file.
  • It preserves the column name to which an attribute was mapped, even if it was changed in an items.xml file.
  • It preserves the column type for an attribute, even if it was changed in an items.xml file.
  • It does not drop any tables or columns.
  • It does not delete any item data, or type instances and type system data such as composed types.

A system update does, however, drop and recreate indices if they are added or changed in items.xml files, as described in the following section.

Indices

Update ensures that all indices in the database match the indices in items.xml files. It drops all indices that don't exist in any items.xml file, and uses the bootstrap.init.type.system.ignore.indices=true property to ignore the creation or modification of indices during the initialization or update process.

During an update, use the bootstrap.init.type.system.custom.index.ignore.names.starting.with property to prevent dropping indices starting with name prefixes that are already defined in the database. List the indices as follows:
bootstrap.init.type.system.custom.index.ignore.names.starting.with=custom_,db_index_cust_

You can also use the wildcard character “*” to replace one or more characters in the name of the prefix. For example, using idx_*dba makes the system ignore indices such as idx_xxxx_dba_xxx or idx_xxx_dba, or both.

The bootstrap.init.type.system.custom.indices.use.items.definitions property ensures that indices that are defined by the bootstrap.init.type.system.custom.index.ignore.names.starting.with property to be ignored that are also defined in the items.xml file are not ignored and compared against this file. Set this property to false so that indices are not compared against the items.xml file and, as a result, not modified:

bootstrap.init.type.system.custom.indices.use.items.definitions=false
During the initialization or the update process, you can ignore indices created or managed from items.xml in one of the following ways:
  • By using full index names. Separate multiple index names using a semicolon, “;”.

    bootstrap.init.type.system.model.index.ignore.names.1=name_of_index_1;name_of_index2
    

    You can define several such properties for ignoring indices, as follows:

    bootstrap.init.type.system.model.index.ignore.names.2=name_of_index_3
    bootstrap.init.type.system.model.index.ignore.names.3=etc
  • By using regular expressions for index names. Separate multiple regular expressions using a semicolon, “;”.

    bootstrap.init.type.system.model.index.ignore.regex.1=^.*regexForIndexName.*$;^.*anotherRegexForIndexName.*$

    You can define several such properties for ignoring indices, as follows:

    bootstrap.init.type.system.model.index.ignore.regex.2=^exampleOfRegex$
    bootstrap.init.type.system.model.index.ignore.regex.3=etc

The system then ignores indices defined in these properties during the update or the initialization process.

Ignoring Duplicate Indices for the Same Columns

The default configuration of SAP Commerce Cloud doesn't allow you to create duplicate indices for the same columns. In the following example, only index1 is created:

<index name="index1" unique="true">
   <key attribute="attribute1"/>
   <key attribute="attribute2"/>
</index>
<index name="index2" unique="true">
   <key attribute="attribute1"/>
   <key attribute="attribute2"/>
</index> 
<index name="index3" unique="true">
   <key attribute="attribute2"/> 
   <key attribute="attribute1"/> 
</index> 

However, you can create duplicate indices (in this case, the index1 and index3 indices) with a different order of columns by setting the following property to true:

allow.duplicate.indexes.with.different.column.order=true

The default value of the property is false.

Changes that are Ignored by an Update

An update does not perform the following actions, and any such changes are ignored by the system:

  • Type code changes: This is not possible with an update. The system treats such a change as a new type being added.
  • Forgotten or changed deployments: Changing a deployment name has no effect. The data is still stored under the previous name.
  • Change of denormalized attributes: The system does not perform attribute changes on attributes such as dontOptimize="true". These attributes remain in props tables
  • Change from non-unique to unique: Such a change is not performed because of the risk that it may conflict with existing data.

Updating SAP Commerce Cloud from the Command Line

You can update SAP Commerce Cloud through the command line as well as from the SAP Commerce Cloud Administration Console. This section describes how to perform an update in command line.

Context

The following procedure is relevant for local installations only. For details of how to update your SAP Commerce Cloud deployment using the Cloud Portal, see Initiating a Deployment Update.

Procedure

  1. Use the command ant updatesystem to update the system.

    Optionally, you can specify the tenant where the updates should be executed, by adding the -D tenant=<your tenant> argument. The default is the master tenant.

  2. You can use the configuration from Administration Console to update system from the command line by passing all configuration options via -D configFile =<your file> .

    Executing update with given configuration:

    ant updatesystem -Dtenant=<my tenant> -DconfigFile=path/to/my/config.json
  3. The easiest way to create such configuration files is using Dump configuration button on update page in Administration Console.

    It will display current configuration and you can copy it. Here is an example configuration for Commerce Cloud B2C Accelerator setup:

Updating from the SAP Commerce Cloud Administration Console

You can update SAP Commerce Cloud from the SAP Commerce Cloud Administration Console as well as through the command line. This section describes how to perform an update in SAP Commerce Cloud Administration Console.

Context

The following procedure is relevant for local installations only. For details of how to update your SAP Commerce Cloud deployment using the Cloud Portal, see Initiating a Deployment Update.

Procedure

  1. Navigate to the Update page under the Platform tab in theSAP Commerce Cloud Administration Console.
  2. Click on the update button to trigger the update process.
    Option Description
    Update running system

    To update a running system, select the Update running system check box. This rebuilds all type definitions from items.xml files.

    Create essential data
    Localize types

    To localize the type system, select the Localize types check box.

    For more information, see Type System Localization.

    Project Data

    To view the list of available extensions for SAP Commerce Cloud, consult the Project Data section on both the Initialization and the Update pages.

    Update - Orphaned Types

    During an update, the type system is kept as extensively as possible (Unlike on an initialization, where SAP Commerce Cloud rebuilds the entire type system from scratch). This means that:

    • No type system definitions in the database are removed; not even if the types or attributes are no longer defined in any items.xml file. This is a data safety feature to avoid loss of data.
    • Type system definitions that exist in the database but are not defined in any items.xml file are referred to as orphaned types. The data backed by orphaned types are safe and can be made accessible again by redefining the type in any items.xml file. However, the data backed by orphaned types and the definition of the orphaned types themselves remain in the database and continue to use up space. See also the Clean All Orphaned Types section in Cleaning Up the Type System.
    Restarting Cron Jobs and Tasks

    After the initialization or update has completed, SAP Commerce Cloud restarts cron jobs and tasks because the task.engine.loadonstartup property is set to true by default. If task.engine.loadonstartup is set to false, no cron jobs or tasks are restarted automatically.