Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035000Retail ModulesStoreServerpublic2017-01-18 15:462017-10-01 22:33
mtaal 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
 
mtaal
No
0035000: Support refresh of the MobileServerProvider cache in a clustered environment
Currently the MobileServerProvider [1] cache is refreshed by using event handlers which reset the cache when a MobileServerDefinition/Organization is changed [2] and [3].

This does not work in a clustered environment as each cluster node will separately cache the data and the cache is only refreshed in one of the nodes (the one in which it is updated).

As mobile server definitions/organizations do not change often this topic is not a big issue. It should still be solved at some point.

[1]
https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/file/963ec1086228/src/org/openbravo/replication/symmetricds/util/MobileServerProvider.java [^]

[2]
https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/file/963ec1086228/src/org/openbravo/replication/symmetricds/eventhandler/MobileServerOrganizationEventHandler.java#l62 [^]

[3]
https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/file/963ec1086228/src/org/openbravo/replication/symmetricds/eventhandler/MobileServerEventHandler.java#l73 [^]
Check the code
Provide some form of automatic cache expiry.
No tags attached.
Issue History
2017-01-18 15:46mtaalNew Issue
2017-01-18 15:46mtaalAssigned To => AugustoMauch
2017-01-18 15:46mtaalTriggers an Emergency Pack => No
2017-03-29 13:45AugustoMauchTarget VersionRR17Q2 => RR17Q3
2017-06-26 18:13AugustoMauchTarget VersionRR17Q3 =>
2017-09-27 18:38AugustoMauchReview Assigned To => mtaal
2017-09-27 18:39hgbotCheckin
2017-09-27 18:39hgbotNote Added: 0099638
2017-09-27 18:39hgbotStatusnew => resolved
2017-09-27 18:39hgbotResolutionopen => fixed
2017-09-27 18:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/f7de544e2d235dc2fffbcea961dcf6d1bfa43a28 [^]
2017-10-01 22:33mtaalNote Added: 0099687
2017-10-01 22:33mtaalStatusresolved => closed

Notes
(0099638)
hgbot   
2017-09-27 18:39   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: f7de544e2d235dc2fffbcea961dcf6d1bfa43a28
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Sep 27 18:20:32 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/f7de544e2d235dc2fffbcea961dcf6d1bfa43a28 [^]

Fixes issue 35000: Makes sure cache is updated before routing data

If a central server was deployed in a cluster, there was a risk of the MobileServerProvider caches getting out of date, and as a result of that some stores could miss data because the router used the outdated cache. It could happen if:

- A new mobile server is added and registered using the central server instance#1
- The MobileServerProvider caches of instance#1 are updated by an event handler
- instance#2 does not notice the change, is not aware of the new store
- instance#2 routes data that should have been routed to the new store, but does not do it because it is not aware of the new store being registered

To fix this, AbstractClientFilteredRouter and AbstractOrganizationBasedRouter, parent classes of all routers, check if the cache of their MobileServerProvider is updated by checking if they contain all the nodes that symmetricds provided them (SymmetricDS always provides all the nodes, as it does not use a cache but it queries the database). If the cache is missing any node, the instance of MobileServerProvider will be reset so that the next time it is requested it will be recreated with the latest information.

There is no performance problem in adding this check, even though it is done per record routed. I run the check 1000 times simulating that there were 500 stores and the aggregated time was ~30ms.

---
M src/org/openbravo/replication/symmetricds/extensions/AbstractClientFilteredRouter.java
M src/org/openbravo/replication/symmetricds/extensions/AbstractOrganizationBasedRouter.java
M src/org/openbravo/replication/symmetricds/util/MobileServerProvider.java
---
(0099687)
mtaal   
2017-10-01 22:33   
reviewed