Support Article
Attachments are not saving properly to D_AttachmentList
SA-37776
Summary
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.
Error Messages
Validation errorSteps to Reproduce
Not Applicable - Intermittent
Root Cause
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.
Resolution
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
Setting: prconfig/database/batchupdates/default
Value: -1
Note that a system restart is required for this setting to take effect after it is applied.
Published May 16, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.