Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0036954 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
design defect | [Retail Modules] Web POS | major | have not tried | 2017-09-26 13:48 | 2017-10-26 16:38 | |||
Reporter | marvintm | View Status | public | |||||
Assigned To | gorka_gil | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | RR18Q1 | |||
Status | closed | Fix in branch | Fixed in SCM revision | 540216bb6422 | ||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | marvintm | |||||||
OBNetwork customer | No | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0036954: buildIdentifier function in ob-cache doesn't take into account property names in the criteria | |||||||
Description | The buildIdentifier function in ob-cache, which is used by the caching mechanism which is used by OB.Dal.findUsingCache and OB.Dal.queryUsingCache, doesn't take into account property names, only their values, when serializing a criteria. This means that if somebody tries to use the same cache for two different queries which query the same table but have different criterias, it could happen that incorrect results are returned. Although this was not considered the proper usage of the API in the original implementation, taking property names into account would make the API friendlier to use, and would protect it against developer mistakes. | |||||||
Steps To Reproduce | Login in the Web POS. Then, execute the following two queries: OB.Dal.find(OB.Model.Product, {isGeneric: true}, function(data){console.log(data);}) OB.Dal.find(OB.Model.Product, {bestseller: true}, function(data){console.log(data);}) Verify that they return two different sets of products (makes sense, because the criteria is different). Now try the following two: OB.Dal.findUsingCache("productCache", OB.Model.Product, {isGeneric: true}, function(data){console.log(data);}) OB.Dal.findUsingCache("productCache", OB.Model.Product, {bestseller: true}, function(data){console.log(data);}) Both queries are using the same cache (which is something arguably does not make sense), but in any case, they return the same result, which is most likely wrong according to what the developer expected. If we included the whole criteria in the buildIdentifier function, this would not happen, as two different sets of results would have been created in the cache. | |||||||
Proposed Solution | Change the buildIdentifier function so that it serializes the whole criteria to JSON. This way, we would not be losing the property names, and this problem would not happen. | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
![]() |
|
(0099882) hgbot (developer) 2017-10-13 09:23 |
Repository: tools/automation/pi-mobile Changeset: 173c5786f32f3be40d9b0f0ed1ab489ba6abc167 Author: Gorka Gil <gorka.gil <at> openbravo.com> Date: Fri Oct 13 09:07:10 2017 +0200 URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/173c5786f32f3be40d9b0f0ed1ab489ba6abc167 [^] Related to issue 36954: buildIdentifier function in ob-cache doesn't take into account property names in the criteria Added test to check that findUsingCache continues caching queries --- A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I36954_FindUsingCache.java --- |
(0099883) hgbot (developer) 2017-10-13 09:24 |
Repository: erp/pmods/org.openbravo.mobile.core Changeset: 540216bb64224392b0a4004b80526da5b08579dd Author: Gorka Gil <gorka.gil <at> openbravo.com> Date: Tue Oct 10 17:27:37 2017 +0200 URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/540216bb64224392b0a4004b80526da5b08579dd [^] Fixed issue 36954: buildIdentifier function in ob-cache doesn't take into account property names in the criteria Put the serialized params as identifier for caching Details: - Mantained the delete of obj.sql, since some times the params are duplicated. - Sometimes the params are "[]" and other "", to unify the empty params added an exception for empty case. - Unified the case for remote and local --- M web/org.openbravo.mobile.core/source/data/ob-cache.js --- |
![]() |
|||
Date Modified | Username | Field | Change |
2017-09-26 13:48 | marvintm | New Issue | |
2017-09-26 13:48 | marvintm | Assigned To | => Retail |
2017-09-26 13:48 | marvintm | OBNetwork customer | => No |
2017-09-26 13:48 | marvintm | Triggers an Emergency Pack | => No |
2017-09-26 13:50 | marvintm | Steps to Reproduce Updated | View Revisions |
2017-10-02 16:22 | gorka_gil | Assigned To | Retail => gorka_gil |
2017-10-09 18:15 | gorka_gil | Status | new => scheduled |
2017-10-13 09:23 | hgbot | Checkin | |
2017-10-13 09:23 | hgbot | Note Added: 0099882 | |
2017-10-13 09:24 | hgbot | Checkin | |
2017-10-13 09:24 | hgbot | Note Added: 0099883 | |
2017-10-13 09:24 | hgbot | Status | scheduled => resolved |
2017-10-13 09:24 | hgbot | Resolution | open => fixed |
2017-10-13 09:24 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/540216bb64224392b0a4004b80526da5b08579dd [^] |
2017-10-26 16:38 | marvintm | Review Assigned To | => marvintm |
2017-10-26 16:38 | marvintm | Status | resolved => closed |
2017-10-26 16:38 | marvintm | Fixed in Version | => RR18Q1 |
Copyright © 2000 - 2009 MantisBT Group |