Key splitting
You can split the primary key ranges of database tables between the staging and production environments with the key splitting process. By splitting the key ranges, you can prevent a primary key collision during propagation of data from staging to production.
If your site uses a staging server, data changes to content are typically made on the staging server and propagated to the production server. Depending on the scenario, you might need to change content on both the staging server and the production server. However, updating the same content on both servers can potentially cause a primary key collision. For instance, a collision can occur when a Site Administrator (host) updates data in the reseller marketplace on the staging server and a reseller updates data on the production server.
WebSphere Commerce uses a key manager that generates primary keys for database tables. The keyrange is defined within the KEYS database table. If the production server and staging server use the same keyrange, the key manager can allocate the same primary key value for the same table on the separate servers. This allocation on both servers causes a primary key collision. As a result, this keyrange must be split so the keyrange on each server is mutually exclusive. The keyrange for a table can be split after instance creation is complete on both servers.
counter|lowbound|highbound
----------+--------+---------
ORIGINAL: 0| 0| 10
PRODUCTION: 0| 0| 3
STAGING: 4| 4| 7
0 1 2 3 4 5 6 7 8 9 10
ORIGINAL: |-------------------------|
PRODUCTION: |------|
STAGING: |------|
- Staging environment
- WC_installdir/schema/db_type/wcs.staging.keys.xml
- WC_installdir\schema\db_type\wcs.staging.keys.xml
- WC_installdir/components/foundation/schema/fepX/db_type/wcs.schema.foundation.sql
- WC_installdir\components\foundation\schema\fepX\db_type\wcs.schema.foundation.sql
fep6
.For example, if an action group has a different primary key value between environments and you associate a new action with the action group in your staging environment. When you attempt to propagate the change to your production environment, the propagation can fail, or the new action can be associated with the wrong action group.
Before you propagate access control data into your production environment, review the access control tables and the KEYS table in both environments and ensure that the primary key values for the tables are in sync between environments. Alternatively, run the Staging Copy utility for access control tables to synchronize the tables between environments before you propagate data such as through store publish.
Splitting the keyrange
- Staging environment
- WC_installdir/schema/common/fixpack6/wcs.fixpack6.keys.midrange.fp0.staged.sql
- WC_installdir\schema\common\fixpack6\wcs.fixpack6.keys.midrange.fp0.staged.sql
- Production environment
- WC_installdir/schema/common/fixpack6/wcs.fixpack6.keys.lowrange.fp0.staged.sql
- WC_installdir\schema\common\fixpack6\wcs.fixpack6.keys.lowrange.fp0.staged.sql
- Staging environment
- WC_installdir/schema/common/fixpack7/wcs.fixpack7.keys.midrange.sql
- WC_installdir\schema\common\fixpack7\wcs.fixpack7.keys.midrange.sql
- Production environment
- WC_installdir/schema/common/fixpack7/wcs.fixpack7.keys.lowrange.sql
- WC_installdir\schema\common\fixpack7\wcs.fixpack7.keys.lowrange.sql
Splitting the keyrange
- Run the following scripts to split all tables that are staged and do not contain a keyrange that
is split by default.
- Staging
- WC_installdir/schema/common/keysplitting/wcs.keys.midrange.staging.sql
- WC_installdir\schema\common\keysplitting\wcs.keys.midrange.staging.sql
- Production
- WC_installdir/schema/common/keysplitting/wcs.keys.lowrange.production.sql
- WC_installdir\schema\common\keysplitting\wcs.keys.lowrange.production.sql
- Staging
- Run the following scripts to split a set of tables that are staged and are considered to be
high-volume tables with a possibility of being altered in both the staging and production servers.
Use this option if you want to avoid splitting the keyrange on all staged tables.
- Staging
- WC_installdir/schema/common/keysplitting/highvolume/wcs.keys.midrange.staging.sql
- WC_installdir\schema\common\keysplitting\highvolume\wcs.keys.midrange.staging.sql
- Production
- WC_installdir/schema/common/keysplitting/highvolume/wcs.keys.lowrange.production.sql
- WC_installdir\schema\common\keysplitting\highvolume\wcs.keys.lowrange.production.sql
- Staging
- Run the following scripts to split a set of tables that are staged and are considered to be
low-volume tables. These scripts split the keys for the remaining staged tables that are not
included by the scripts within option 2. Cumulatively, options 2 and 3 contain all staged tables and
are equivalent to running the scripts within option 1.
- Staging
- WC_installdir/schema/common/keysplitting/lowvolume/wcs.keys.midrange.staging.sql
- WC_installdir\schema\common\keysplitting\lowvolume\wcs.keys.midrange.staging.sql
- Production
- WC_installdir/schema/common/keysplitting/highvolume/wcs.keys.lowrange.production.sql
- WC_installdir\schema\common\keysplitting\highvolume\wcs.keys.lowrange.production.sql
- Staging