Attachments are not saving properly to D_AttachmentList
There is an intermittent error validating a Link-Attachment after a file is uploaded and an entry is created in Link-Attachment. During validation the D_AttachmentList datapage populates with data from the Link-Attachment class that is not fully available and this leads to validation errors.
Steps to Reproduce
Not Applicable - Intermittent
The root cause of the issue is due to non-deterministic order of database SQL statement execution by Pega within a transaction. Reason behind this is due to batch Execution of SQL statements. In the same transaction, the instances could be grouped into multiple batches by prepared statements. The process does not necessarily maintain deterministic orders for instances. This could potentially violate execution orders wherever a mandatory order is needed (for example, foreign key constraints).
In this case, the Link-Attachment entry is sometimes copied before the data is commited to it.
It is expected behavior for Batch statements to be submitted and committed with no strict ordering to the order that the statements were originally committed. Batch commits are used to improve database performance, since work object locking, under most use cases, handles the transaction.
If you have application logic or database constraints which require strict ordering of commit statements to be maintained within a batch commit, then the following system setting must be utilized to disable batch updates:
Owning Ruleset: Pega-Engine
Note that a system restart is required for this setting to take effect after it is applied.
Published May 10, 2017 - Updated May 16, 2017