Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034224Retail ModulesStoreServerpublic2016-10-17 18:282016-12-02 10:48
AugustoMauch 
mtaal 
urgentmajorhave not tried
closedfixed 
5
 
 
mtaal
No
0034224: Provide a Java API to disable SymmetricDS triggers
Some processes need to import data in an instance running SymmetricDS but the rows being import don't need to be captured by the SymmetricDS triggers and synchronized.

This happens for instance when a process to load the historical data of a store sersver yet to be created is imported in the central server. All those records should not be sent to any server, so it makes sense to disable the triggers so that those records are not captured and router.
-
No tags attached.
related to defect 0034323 closed AugustoMauch Openbravo ERP TriggerHandler should remove from AD_SESSION_STATUS only the records added by the TriggerHandler itself 
? issue34224.export (14,811) 2016-10-27 18:22
https://issues.openbravo.com/file_download.php?file_id=9975&type=bug
Issue History
2016-10-17 18:28AugustoMauchNew Issue
2016-10-17 18:28AugustoMauchAssigned To => AugustoMauch
2016-10-17 18:28AugustoMauchTriggers an Emergency Pack => No
2016-10-20 16:24AugustoMauchNote Added: 0090727
2016-10-20 16:24AugustoMauchNote Edited: 0090727bug_revision_view_page.php?bugnote_id=0090727#r13428
2016-10-20 16:27AugustoMauchFile Added: disableSymmetricDsTriggers.export
2016-10-20 16:28AugustoMauchStatusnew => scheduled
2016-10-20 16:33AugustoMauchNote Added: 0090730
2016-10-27 18:09AugustoMauchRelationship addedrelated to 0034323
2016-10-27 18:22AugustoMauchFile Deleted: disableSymmetricDsTriggers.export
2016-10-27 18:22AugustoMauchFile Added: issue34224.export
2016-11-01 17:34AugustoMauchReview Assigned To => mtaal
2016-11-01 17:34AugustoMauchNote Deleted: 0090730
2016-11-01 17:49hgbotCheckin
2016-11-01 17:49hgbotNote Added: 0091037
2016-11-01 17:49hgbotStatusscheduled => resolved
2016-11-01 17:49hgbotResolutionopen => fixed
2016-11-01 17:49hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/b0ccadb4f6f0e1b646b4bd2f1f642254f9317fc5 [^]
2016-11-02 11:32hgbotCheckin
2016-11-02 11:32hgbotNote Added: 0091056
2016-11-03 10:18hgbotCheckin
2016-11-03 10:18hgbotNote Added: 0091071
2016-11-20 22:44hgbotCheckin
2016-11-20 22:44hgbotNote Added: 0091678
2016-11-20 22:48hgbotCheckin
2016-11-20 22:48hgbotNote Added: 0091680
2016-11-20 22:51hgbotCheckin
2016-11-20 22:51hgbotNote Added: 0091681
2016-11-21 06:30mtaalNote Added: 0091682
2016-11-21 06:31mtaalNote Edited: 0091682bug_revision_view_page.php?bugnote_id=0091682#r13843
2016-11-25 09:40AugustoMauchNote Added: 0091813
2016-11-25 12:24mtaalStatusresolved => new
2016-11-25 12:24mtaalResolutionfixed => open
2016-11-25 12:24mtaalAssigned ToAugustoMauch => mtaal
2016-11-25 12:38hgbotCheckin
2016-11-25 12:38hgbotNote Added: 0091836
2016-11-25 12:38hgbotStatusnew => resolved
2016-11-25 12:38hgbotResolutionopen => fixed
2016-11-25 12:38hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/b0ccadb4f6f0e1b646b4bd2f1f642254f9317fc5 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/a5d8683a130409a165351d916a43b7308711e776 [^]
2016-12-02 10:48AugustoMauchNote Added: 0092016
2016-12-02 10:48AugustoMauchStatusresolved => closed

Notes
(0090727)
AugustoMauch   
2016-10-20 16:24   
Documentation for the upcoming feature is available here http://wiki.openbravo.com/wiki/How_to_Disable_the_SymmetricDS_Triggers [^]

(0091037)
hgbot   
2016-11-01 17:49   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: b0ccadb4f6f0e1b646b4bd2f1f642254f9317fc5
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Oct 27 18:18:37 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/b0ccadb4f6f0e1b646b4bd2f1f642254f9317fc5 [^]

Fixes issue 34224: SymmetricDS triggers can be disabled programatically

The class SymmetricDSTriggerHandler enables/reenables the SymmetricDS in a similar way the TriggerHandler class does the same with the standard Openbravo triggers.

A column called EM_Strsync_Symds_Trg_Disabled has been added to ad_session_status, the SymmetricDSTriggerHandler trigger adds a record with that column set to 'TRUE' to soft disable the triggers. The SymmetricDS triggers are now appended by a check that calls the function STRSYNC_ISTRIGGERENABLED, it will soft disable the trigger if it returns true.

This fix depends on the fix of this issue [1] to be compatible with the TriggerHandler. Without this change, calling TriggerHandler.enable will result in the SymmetricDS triggers being enabled to.

In the future the SymmetricDSTriggerHandler might be updated to use a temporary table instead of ad_session_status. This way it can be ensured that the insertions done to the table are not accidentally commited in the database.

[1] https://issues.openbravo.com/view.php?id=34323 [^]

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src/org/openbravo/replication/symmetricds/SymmetricDSConfiguration_data.xsql
M src/org/openbravo/replication/symmetricds/SymmetricDsTablePopulator.java
A src-db/database/model/functions/STRSYNC_ISTRIGGERENABLED.xml
A src-db/database/model/modifiedTables/AD_SESSION_STATUS.xml
A src/org/openbravo/replication/symmetricds/util/SymmetricDSTriggerHandler.java
---
(0091056)
hgbot   
2016-11-02 11:32   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: d896cdad51773c2c0cbedca6c63ca3cb135fb69d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Nov 02 11:31:53 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/d896cdad51773c2c0cbedca6c63ca3cb135fb69d [^]

Related with issue 34224: Fixes dbconsistency problem

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
---
(0091071)
hgbot   
2016-11-03 10:18   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 02e8f0139c3417db268862d25d78a5d3004190d0
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Nov 03 10:18:20 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/02e8f0139c3417db268862d25d78a5d3004190d0 [^]

Related with issue 34224: Fixes function so that it compiles in Oracle

---
M src-db/database/model/functions/STRSYNC_ISTRIGGERENABLED.xml
---
(0091678)
hgbot   
2016-11-20 22:44   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 2097ebfd6bdbc76ee467ba1e9e6cf3d12f97c8c8
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Nov 20 22:44:39 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/2097ebfd6bdbc76ee467ba1e9e6cf3d12f97c8c8 [^]

Related to issue 34224: Provide a Java API to disable SymmetricDS triggers
Added testcase

---
A src/org/openbravo/replication/symmetricds/util/TestTriggerEnabling.java
---
(0091680)
hgbot   
2016-11-20 22:48   
Repository: tools/automation/pi-mobile
Changeset: 82cbe46ab79199a1ef3e74000bd7296a042a8e2d
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Nov 20 22:47:53 2016 +0100
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/82cbe46ab79199a1ef3e74000bd7296a042a8e2d [^]

Related to issue 34224: Provide a Java API to disable SymmetricDS triggers
Add trigger disabling testcase

---
M src-test/org/openbravo/test/mobile/retail/multiserver/unittests/suites/dbsynch/DatabaseSynchronizationSuite.java
A src-test/org/openbravo/test/mobile/retail/multiserver/unittests/tests/dbsynch/TestTriggerDisabling.java
---
(0091681)
hgbot   
2016-11-20 22:51   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 799a8baf0f4848f10162ef2f997c07890bfc453e
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Nov 20 22:51:13 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/799a8baf0f4848f10162ef2f997c07890bfc453e [^]

Related to issue 34224: Provide a Java API to disable SymmetricDS triggers
Prevent that disabling of trigger leaks to other tests by putting in the finally block

---
M src/org/openbravo/replication/symmetricds/util/TestTriggerEnabling.java
---
(0091682)
mtaal   
2016-11-21 06:30   
(edited on: 2016-11-21 06:31)
Code reviewed, testcase added which passes. Remaining is to review the testcase.

https://ci.openbravo.com/view/storeserver/job/ret-ms-store1-pgsql/442/testReport/org.openbravo.test.mobile.retail.multiserver.unittests.tests.dbsynch/TestTriggerDisabling/ [^]

(0091813)
AugustoMauch   
2016-11-25 09:40   
Two small comments:
- Lines 46-64 are enclosed in a block needlessly
- In this line [1] the connection is commited, but it should be rolled back

[1] https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/file/799a8baf0f48/src/org/openbravo/replication/symmetricds/util/TestTriggerEnabling.java#l63 [^]
(0091836)
hgbot   
2016-11-25 12:38   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: a5d8683a130409a165351d916a43b7308711e776
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Nov 25 12:37:52 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/a5d8683a130409a165351d916a43b7308711e776 [^]

Fixes issue 34224: Provide a Java API to disable SymmetricDS triggers
Kept the try block as this gives better scoping of local vars, moved the name var inside the block
Moved the commit to the finally block and changed to a rollback
Changed the exception text to make it clear what number is location of the exception and what number is the count

---
M src/org/openbravo/replication/symmetricds/util/TestTriggerEnabling.java
---
(0092016)
AugustoMauch   
2016-12-02 10:48   
Code reviewed