Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034323Openbravo ERPA. Platformpublic2016-10-27 14:492016-12-16 18:38
AugustoMauch 
AugustoMauch 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q1 
alostale
Core
No
0034323: TriggerHandler should remove from AD_SESSION_STATUS only the records added by the TriggerHandler itself
The TriggerHandler class controls the trigger disablement/enablement by adding and removing rows from the AD_SESSION_STATUS table.

Triggers are disabled by adding a record to AD_SESSION_STATUS with the isimporting column set to 'Y'. Triggers are reenabled by removing all the records from AD_SESSION_STATUS.

The problem comes when another handler want to use the AD_SESSION_STATUS table for their own purposes. For instance, the SymmetricDsTriggerHandler would like to control the trigger enablement by adding rows with a new custom column set to 'Y'. The way the TriggerHandler reenables the triggers, it will also affect to the other handler.
It is not easy to reproduce, as currently there are no other processes that use the AD_SESSION_STATUS table. But it is very easy to check that the TriggerHandler is not only removing the rows created by itself:

- Add manually an entry to AD_SESSION_STATUS:
INSERT INTO AD_SESSION_STATUS(ad_session_status_id, ad_client_id, ad_org_id, createdby, updatedby, isimporting) VALUES (get_uuid(), '0', '0', '0', '0', 'N')
- Execute TriggerHandler.disable()
- Execute TriggerHandler.enable()
- Check the AD_SESSION_STATUS contents in the database. The row created manually has been deleted.
In TriggerHandler.enable(), replace

DELETE FROM AD_SESSION_STATUS

with

DELETE FROM AD_SESSION_STATUS WHERE isimporting = 'Y'
No tags attached.
related to feature request 0034224 closed mtaal Retail Modules Provide a Java API to disable SymmetricDS triggers 
? issue34323.export (1,880) 2016-10-27 18:22
https://issues.openbravo.com/file_download.php?file_id=9976&type=bug
Issue History
2016-10-27 14:49AugustoMauchNew Issue
2016-10-27 14:49AugustoMauchAssigned To => AugustoMauch
2016-10-27 14:49AugustoMauchModules => Core
2016-10-27 14:49AugustoMauchTriggers an Emergency Pack => No
2016-10-27 14:52AugustoMauchReview Assigned To => alostale
2016-10-27 18:09AugustoMauchRelationship addedrelated to 0034224
2016-10-27 18:22AugustoMauchFile Added: issue34323.export
2016-11-01 17:30hgbotCheckin
2016-11-01 17:30hgbotNote Added: 0091036
2016-11-01 17:30hgbotStatusnew => resolved
2016-11-01 17:30hgbotResolutionopen => fixed
2016-11-01 17:30hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9d78829840bcc1d8abc67da71da78da0982b9ddc [^]
2016-11-01 17:54AugustoMauchNote Added: 0091038
2016-11-02 15:10hgbotCheckin
2016-11-02 15:10hgbotNote Added: 0091066
2016-11-04 08:08alostaleNote Added: 0091157
2016-11-04 08:08alostaleStatusresolved => closed
2016-11-04 08:08alostaleFixed in Version => 3.0PR17Q1
2016-12-16 18:38hudsonbotCheckin
2016-12-16 18:38hudsonbotNote Added: 0092582
2016-12-16 18:38hudsonbotCheckin
2016-12-16 18:38hudsonbotNote Added: 0092584

Notes
(0091036)
hgbot   
2016-11-01 17:30   
Repository: erp/devel/pi
Changeset: 9d78829840bcc1d8abc67da71da78da0982b9ddc
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Oct 27 14:57:06 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9d78829840bcc1d8abc67da71da78da0982b9ddc [^]

Fixes issue 34323: TriggerHandler only removes the entries created by itself

The TriggerHandler class adds entries to AD_SESSION_STATUS with the isimporting column set to 'Y' to soft-disable the Openbravo triggers. Other processes may want to use the AD_SESSION_STATUS table to disable/reenable other features. The problem is that when TriggerHandler reenables the triggers, it removes all the contents of AD_SESSION_STATUS, not only the records created by the TriggerHandler itself.

To fix this, now TriggerHandler only removes from AD_SESSION_STATUS the rows whose isimporting column is 'Y'.

---
M src/org/openbravo/dal/core/TriggerHandler.java
---
(0091038)
AugustoMauch   
2016-11-01 17:54   
The fix has passed try [1]

[1] http://ci.openbravo.com/view/try/job/try-init/5161/ [^]
(0091066)
hgbot   
2016-11-02 15:10   
Repository: erp/devel/pi
Changeset: 25ca6b41ced0cc66982bd2cdbaeeeff033657e7d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Nov 02 15:08:53 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/25ca6b41ced0cc66982bd2cdbaeeeff033657e7d [^]

Related with issue 34323: Supports adding columns to AD_SESSION_STATUS

The TriggerHandler.disable methods inserts a row in AD_SESSION_STATUS to soft-disable the triggers. The problem is that the insert statement did not include the list of columns names in the INSERT statement, resulting in the statemeng failing if any module adds a new column to the AD_SESSION_STATUS table.

---
M src/org/openbravo/dal/core/TriggerHandler.java
---
(0091157)
alostale   
2016-11-04 08:08   
code reviewed
(0092582)
hudsonbot   
2016-12-16 18:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/dc8bf00badd0 [^]
Maturity status: Test
(0092584)
hudsonbot   
2016-12-16 18:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/dc8bf00badd0 [^]
Maturity status: Test