Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.0-beta-3
-
Fix Version/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
When creating exports it may happen that the export file contains inconsistent data, because by default the export will "see" commits of other transaction while it's running. Consider the following scenario:
There are two tables A and B where A has a foreign key column referencing B.id.
First of all table A is exported.
In the meantime, another transaction deletes some records out of table A and B and commits these changes.
Finally, table B is exported.
If you try to insert the export again, you may get foreign key constraint violations, stating that some records in A are referencing records in B that do not exist. Usually, this shouldn't be a big problem, but there are setups (large db, slow network, high transaction count) where it may become almost impossible to get a consistent export.
For me, this problem could be solved by enabling the readOnly flag on the db connection. This prevents the connection which is used for exporting of "seeing" any data that was created/updated/deleted by another transaction. I attached a patch that allows the readOnly-flag to be enabled for exports.