Openbravo Issue Tracking System - Retail Modules
View Issue Details
0037697Retail ModulesWeb POSpublic2017-06-19 19:182018-01-25 15:10
shuehner 
marvintm 
normalminorhave not tried
closedfixed 
5
 
RR17Q3.3RR17Q3.3 
migueldejuana
No
0037697: (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* ERROR
LogClientLoader expects to see duplicate messages and logs + then ignores the duplicate row.

However apart from that INFO message 2* ERROR are logged to openbravo.log including the full json message which in some customers is a huge amount of the ERROR's messages seen per day.

Those 2*ERROR should be supressed.

Example case:
70a8a81e 2017-06-19 11:50:33,164 [ajp-bio-127.0.0.1-8009-exec-171] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 inser
t into obmobc_logclient (AD_Client_ID, AD_Org_ID, Isactive, Created, Createdby, Updated, Updatedby, Deviceid, Msg, Loglevel, Cache_Sess
ion_ID, Isonline, Obmobc_Logclient_ID) values ('AA', 'BB', 'Y', '2017-6-19
11:48:57.908000 -5:0:0', 'CC', '2017-6-19 11:50:33.161000 -5:0:0', 'CC', 'DEVICEID', 'runSyncProcess: synchronization successfully done; stackTrace: https://the.url/openbravo/web/js/gen/bd5 [^]
2e366338bc6dc386ed72358a97e05_WebPOS.js:1487:483', 'Info', 'DF929F87F1334E61BCDF9ABC23837689', 'Y', '9E51244B6472BA64D4C59580D19D1A00')
 was aborted. Call getNextException to see the cause.
70a8a81e 2017-06-19 11:50:33,164 [ajp-bio-127.0.0.1-8009-exec-171] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "obmobc_logclient_pk"
  Detail: Key (obmobc_logclient_id)=(9E51244B6472BA64D4C59580D19D1A00) already exists.
70a8a81e 2017-06-19 11:50:33,174 [ajp-bio-127.0.0.1-8009-exec-171] INFO org.openbravo.mobile.core.utils.LogClientLoader - Found duplicated log client message with id: 9E51244B6472BA64D4C59580D19D1A00. Ignoring
.
No tags attached.
blocks defect 0036288 closed gorka_gil (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* ERROR 
Issue History
2018-01-22 15:21marvintmTypedefect => backport
2018-01-22 15:21marvintmTarget Version => RR17Q3.3
2018-01-22 15:24hgbotCheckin
2018-01-22 15:24hgbotNote Added: 0101848
2018-01-22 15:24hgbotStatusscheduled => resolved
2018-01-22 15:24hgbotResolutionopen => fixed
2018-01-22 15:24hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/77be95078aa45a3a1d621db07654da0f6337e6d5 [^] => http://code.openbravo.com/retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core/rev/ea2b01369e1adc5e75852d63aefc40e25f0ce47c [^]
2018-01-22 15:24hgbotCheckin
2018-01-22 15:24hgbotNote Added: 0101849
2018-01-22 15:25hgbotCheckin
2018-01-22 15:25hgbotNote Added: 0101850
2018-01-25 11:28marvintmAssigned Togorka_gil => marvintm
2018-01-25 15:10migueldejuanaReview Assigned Tomarvintm => migueldejuana
2018-01-25 15:10migueldejuanaNote Added: 0101945
2018-01-25 15:10migueldejuanaStatusresolved => closed
2018-01-25 15:10migueldejuanaFixed in Version => RR17Q3.3

Notes
(0101848)
hgbot   
2018-01-22 15:24   
Repository: retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core
Changeset: ea2b01369e1adc5e75852d63aefc40e25f0ce47c
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon Jan 22 15:23:58 2018 +0100
URL: http://code.openbravo.com/retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core/rev/ea2b01369e1adc5e75852d63aefc40e25f0ce47c [^]

Fixed issue 37697. (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* error

Controled the exception when inserting the log line in the backend, for the case of duplicate id.
To control the exception needed to not use DAL nor xsql, and use instead a prepared statement directly.

In the case of error, we do a sql in the db and if the id is in the db, is a duplicated and everthing is fine.
Note that this case of duplicate is not common case, so this query to check duplicates should not be very frequent.

A future improvement is the use of merge functionality of postgres 9.5 that has upsert, that can do inserts and
ignore the cases of duplicates. But also needed to find something similar in oracle.
Note that in the moment of fix we still support postgres 9.3 so not possible to use it.
Other option was the use of interceptors but will affect all the queries of the application so was discarded.

---
M src/org/openbravo/mobile/core/utils/LogClientLoader.java
---
(0101849)
hgbot   
2018-01-22 15:24   
Repository: retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core
Changeset: b2420ffab4b02bd8215131bf497f63acca99a1e5
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon Jan 22 15:24:25 2018 +0100
URL: http://code.openbravo.com/retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core/rev/b2420ffab4b02bd8215131bf497f63acca99a1e5 [^]

Related to issue 37697. (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* error

Updated license year

---
M src/org/openbravo/mobile/core/utils/LogClientLoader.java
---
(0101850)
hgbot   
2018-01-22 15:25   
Repository: retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core
Changeset: 53638019337bb3a8c299f22aaa48f0662d5d86c9
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon Jan 22 15:24:49 2018 +0100
URL: http://code.openbravo.com/retail/backports/3.0RR17Q3.3/org.openbravo.mobile.core/rev/53638019337bb3a8c299f22aaa48f0662d5d86c9 [^]

Related to issue 37697. (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* error

Apply shu review

---
M src/org/openbravo/mobile/core/utils/LogClientLoader.java
---
(0101945)
migueldejuana   
2018-01-25 15:10   
Tested and reviewed