Improvements to Sequence API operation involving active transactions
In V11.5 and later, FairCom sequence support has been improved as follows:
By default, sequence creates and deletes within an active transaction use Immediate Independent Commit Transactions (IICT) to commit immediately. If the sequence attribute ctSEQTRNDEP is specified when creating the sequence, the creation and deletion of the sequence is committed only when the transaction commits. This option makes it possible to rely upon a transaction abort to undo the sequence create or delete.
The functions that update the sequence, ctSetSequenceAttrs(), ctSetCurrentSequenceValue(), and ctGetNextSequenceValue(), commit their changes immediately if possible. If the changes cannot be immediately committed, rather than failing with error 935 (IICT_FIL), the changes commit when the transaction commits. The case where these functions cannot immediately commit is when one of these functions is called in the same transaction that created the sequence, and the sequence is using the ctSEQTRNDEP option. In that situation, an IICT cannot be used because the file has been updated in the transaction, and so the sequence record remains locked until the transaction commits or aborts.
ctSetSequenceAttrs(), ctSetCurrentSequenceValue(), and ctGetNextSequenceValue() left the sequence record locked until the transaction committed. In V11.5 and later, these functions ensure that the record is unlocked before they return (except for the case mentioned in point 2 above, where a transaction is active and IICT cannot be used).
ctCreateSequence() and ctDeleteSequence() failed with error 588 (CPND_ERR) if called within an active transaction and OPS_DEFER_CLOSE was not in effect. In V11.5 and later, we temporarily enable OPS_DEFER_CLOSE in this situation to avoid the error.