Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0049501Openbravo ERPA. Platformpublic2022-06-07 18:162022-06-08 07:11
vmromanos 
Triage Platform Base 
normalmajoralways
newopen 
5
 
 
Core
No
0049501: Different transactional behavior in Oracle vs Postgres
In AD_UPDATE_PINSTANCE procedure, which is used to call some old (but very important) processes, we have this difference in code between PG and Oracle:

-- Oracle
IF (p_doCommit = 'Y') THEN
    COMMIT;
END IF;

-- Postgres
IF (p_doCommit = 'Y') THEN
    -- COMMIT;
END IF;

This change seems to be done in the DBSM directly.


This difference in the code makes that the transactional behavior between Oracle and Postgres is different, creating weird behaviors.
This issue can be reproduced in this automated test: org.openbravo.api.tests.importer.ImportInventory

The flow is the following:
1. We try to import a Physical Inventory trough the Openbravo API

2. As part of the import process, a preference is temporary created org.openbravo.warehouse.advancedwarehouseoperations.api.hooks.inventory.ImportInventoryOBObjectInitializer

3. Once the document is imported, the import process calls the M_INVENTORY_LISTUPDATE in org.openbravo.api.hook.inventory.ImportedInventoryBaseOBObjectAfterFlushHook

4. Then in Oracle a COMMIT is executed. In PG no COMMIT happens

5. The physical inventory is processed

6. Then the import process removes the temporal preference created before org.openbravo.warehouse.advancedwarehouseoperations.api.hooks.inventory.ImportedInventoryBaseOBObjectAfterFlushHookExtension

7. Then the automated test tries to rollback the transaction in org.openbravo.api.tests.importer.ApiImportMappingBaseTest [cleanChanges()]


In PG everything works fine and the database is not modified at all, because there is no COMMIT in the middle of the process.

However, in Oracle the preference and the physical inventory are saved in the DB because there is a COMMIT in #4
No tags attached.
related to defect 00194383.0MP8 closed gorkaion Error messages are not properly shown in Create Standards process 
Issue History
2022-06-07 18:16vmromanosNew Issue
2022-06-07 18:16vmromanosAssigned To => Triage Platform Base
2022-06-07 18:16vmromanosModules => Core
2022-06-07 18:16vmromanosTriggers an Emergency Pack => No
2022-06-07 19:09hgbotNote Added: 0138125
2022-06-08 07:11alostaleRelationship addedrelated to 0019438

Notes
(0138125)
hgbot   
2022-06-07 19:09   
Repository: https://gitlab.com/openbravo/ci/modules/org.openbravo.api.tests [^]
Changeset: 675da3e119a8cf7605cd5c5a252abba3d5a7e9ab
Author: Víctor Martínez Romanos <victor.martinez@openbravo.com>
Date: 07-06-2022 18:51:45
URL: https://gitlab.com/openbravo/ci/modules/org.openbravo.api.tests/-/commit/675da3e119a8cf7605cd5c5a252abba3d5a7e9ab [^]

Related to ISSUE-49501: Warehouse related tests are not executed in Oracle

The COMMIT done by the AD_UPDATE_PINSTANCE procedure breaks the test's transaction.
The tests are deactivated in Oracle only by extending from a new abstract class that
centralizes this behavior.
On Postgres the tests are executed normally.

---
A src-test/org/openbravo/api/tests/importer/ApiImportMappingSkipOracleTest.java
M src-test/org/openbravo/api/tests/StandaloneTestSuite.java
M src-test/org/openbravo/api/tests/importer/ImportGoodsMovement.java
M src-test/org/openbravo/api/tests/importer/ImportInventory.java
---