Starting Campaign Classic 18.4, the ID generation mechanism has been enhanced to increase the lifespan of Campaign instances with large volumes of objects.

This article describes:

  1. the Sequence auto-generation feature
  2. the new API GenCreateOrUpdateSchemaSequenceDDL
  3. the change of sequence use for some built-in schemas

Overview

In Campaign Classic, schema ID values can be generated automatically by setting autopk="true" in the root element.

Without this attribute (or when the value is set to false), the ID values will be fed manually by using Javascript or workflow.

In case of autopk="true", the ID will use the sequence name passed in the attribute pkSequence. When the pkSequence is missing, by default, Campaign Classic uses the built-in XtkNewId sequence.

Attributes ID generation mode pkSequence available pkSequence missing
autopk="true" Automatic Use specified sequence Use XtkNewId sequence
autopk="false" or no attribute Manual N/A N/A

The main purpose of this feature is to avoid, as much as possible, to use XtkNewId sequence, especially for custom schemas and for some built-in schemas (XtkWorkflowLog, etc.). Instead, we will generate dedicated sequences for them.

Sequence auto-generation

custom autopk schema is a schema not having built-in namespace (i.e. nl, nms, xtk, crm or ncm), with autopk="true" and without specified pkSequence.

Restrictions:

  • Supported databases engines: PostgreSQL, Oracle and MSSQL.
  • This feature does not apply to external schemas (FDA).
  • Extended schemas will continue to use their parent schemas' sequences.

This feature contains the following functionalities:

  1. During post upgrade, create a date/time option XtkSequence_AutoGeneration (date/time of post upgrade).

  2. If a custom autopk schema is created BEFORE the value of XtkSequence_AutoGeneration (by checking schema's createdDate), by default, Campaign doesn't make any change.

  3. If a custom autopk schema is created AFTER the value of XtkSequence_AutoGeneration, a dedicated sequence will be auto-generated during the generation of the schema.

    This sequence will be named: auto_<nameSpace><schemaName>_seq.

    Note:

    If the auto-generated sequence name has more than 30 characters, we will moderate the part <nameSpace><schemaName> using CRC32.

  4. If needed, you can disable this feature by setting option XtkSequence_AutoGeneration to a future date (for example 01/01/2999).

New API

This feature is implemented through a new API: GenCreateOrUpdateSchemaSequenceDDL. This API generates the SQL script used to create or update autopk schema sequence:

GenCreateOrUpdateSchemaSequenceDDL(schemaID, newSequenceName, oldSequenceName)
 
  schemaID (mandatory): "<nameSpace>:<schemaName>"
  newSequenceName (mandatory): new sequence name
  oldSequenceName (optional): old sequence name
  • Generally, this API is used to create autopk schema sequence, in which case oldSequenceName is empty. For example, when creating a custom autopk schema, we call internally this API with its schemaID and the auto-generated sequence name, then update the database structure to create the sequence in the database.
  • This new API can be also used to update an autopk schema sequence, by providing oldSequenceName. For example, considering a custom autopk schema cus:mySchema using XtkNewId as its sequence, we can use a new sequence mySequence. It can be done by calling the following in javascript and execute the output DDL statements in the database.
GenCreateOrUpdateSchemaSequenceDDL("cus:mySchema", "mySequence", "XtkNewId")

In this case, the new sequence will begin from the largest ID of the schema.

Switch to a dedicated sequence

The XtkWorkflowLog schema could overuse the XtkNewID sequence. From Campaign Classic 18.4, the schema XtkWorkflowLog will use a new dedicated sequence XtkWorkflowLogId instead of XtkNewId

The switch will be done automatically as upgrading to Campaign Classic 18.4 for already existing instances. For new 18.4 instances, the XtkWorkflowLogId sequence will be used by default.

Note:

Some other schema that could over consume IDs will be switch to a dedicated sequence in upcoming Campaign Classic releases.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy