Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0027775
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] I. Performanceminoralways2014-10-06 17:012014-12-30 23:22
ReportervmromanosView Statuspublic 
Assigned Tovmromanos 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionbda678370986
ProjectionnoneETAnoneTarget Version3.0PR15Q1
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tofsoto82
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0027775: Improve performance in TruncInvoiceDate and Issue26826_Org_AllowPeriodControl module scripts

DescriptionThe TruncInvoiceDate and Issue26826_Org_AllowPeriodControl module scripts runs a full table scan each time they are run, regardless any record is updated or not.

For this kind of heavy queries, it is better to set a preference the first time the module script is executed and avoid the following executions if the preference is set.
Steps To Reproduce1. As group admin, go to Purchase Invoice.
2. Create a new header and save it
3. Go to the database and run the following update for the created header:
update c_invoice
set dateinvoiced=now()
where docstatus = 'DR' and c_invoice_id = <THE ID>
4. Run ant smartbuild -Dlocal=no
5. Verify the TruncInvoiceDate module script has fixed it. You can either take a look at the log or query the database
6. Repeat steps 3 and 4. The TruncInvoiceDate module script has fixed it. You can either take a look at the log or query the database. This is wrong, because we only want the module script to be executed just one time
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 00268263.0PR15Q1 closedvmromanos Should not be possible to save Organization header with "Organization type"=Organization and check "Allow period control"= Yes 
related to defect 00270893.0PR15Q1 closedfsoto82 Invoice Date and Accounting Date should be truncated when invoice is created using "Generate Invoice from Receipt" process 

-  Notes
(0070746)
vmromanos (manager)
2014-10-06 17:11
edited on: 2014-10-06 17:29

Test plan for TruncInvoiceDate:
1. As group admin, go to Purchase Invoice.
2. Create a new header and save it
3. Go to the database and run the following update for the created header:
update c_invoice
set dateinvoiced=now()
where docstatus = 'DR' and c_invoice_id = <THE ID>
4. Run ant smartbuild -Dlocal=no
5. Verify the TruncInvoiceDate module script has fixed it. You can either take a look at the log or query the database
6. Repeat steps 3 and 4. Verify the module script doesn't fix it, which means the process hasn't been executed


Test plan for Issue26826_Org_AllowPeriodControl:
1. Before applying the fix, run the following query in the database:
update ad_org set ISPERIODCONTROLALLOWED = 'Y' where ad_org_id = '0'
This will set the Period Control Allowed flag to Y for the 0 organization, which is a wrong configuration
2. Apply the fix to the environment
3. Run ant smartbuild -Dlocal=no
4. Review the module script log and verify the following info message is shown just after the execution of the Issue26826_Org_AllowPeriodControl module script
Fixed 1 organizations.
5. Run again step 1. You will need to comment the line: "RAISE EXCEPTION '%','@OrgTypeDoesNotAllowPeriodControl@'; --OBTG:-20000--" into the ad_org_trg before running the query
6. Run again ant smartbuild -Dlocal=no -Dforce=true
7. Verify no organization has been updated

(0070748)
hgbot (developer)
2014-10-06 17:55

Repository: erp/devel/pi
Changeset: bda678370986e6eb7f81c83ed8cbe4167359ebc6
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Oct 06 17:39:14 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/bda678370986e6eb7f81c83ed8cbe4167359ebc6 [^]

Fixed bug 27775: Performance improvement in 2 module scripts

The TruncInvoiceDate and Issue26826_Org_AllowPeriodControl module scripts had the same performance problem: they ran a full table scan each time the module script was executed regardless it updated any record or not.

To fix it, the module script now verifies whether a preference exists or not. If it doesn't exist, the update is executed and the preference is set, so the update process won't be executed in the future.

---
M src-util/modulescript/build/classes/org/openbravo/modulescript/Issue26826OrgAllowPeriodControlData.class
M src-util/modulescript/build/classes/org/openbravo/modulescript/Issue26826_Org_AllowPeriodControl.class
M src-util/modulescript/build/classes/org/openbravo/modulescript/TruncInvoiceDate.class
M src-util/modulescript/build/classes/org/openbravo/modulescript/TruncInvoiceDateData.class
M src-util/modulescript/src/org/openbravo/modulescript/Issue26826_Org_AllowPeriodControl.java
M src-util/modulescript/src/org/openbravo/modulescript/Issue26826_Org_AllowPeriodControl_data.xsql
M src-util/modulescript/src/org/openbravo/modulescript/TruncInvoiceDate.java
M src-util/modulescript/src/org/openbravo/modulescript/TruncInvoiceDate_data.xsql
---
(0072905)
hudsonbot (developer)
2014-12-30 23:22

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/6525fe229e06 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2014-10-06 17:01 vmromanos New Issue
2014-10-06 17:01 vmromanos Assigned To => vmromanos
2014-10-06 17:01 vmromanos Modules => Core
2014-10-06 17:01 vmromanos Triggers an Emergency Pack => No
2014-10-06 17:02 vmromanos Relationship added related to 0026826
2014-10-06 17:02 vmromanos Relationship added related to 0027089
2014-10-06 17:02 vmromanos Status new => scheduled
2014-10-06 17:02 vmromanos fix_in_branch => pi
2014-10-06 17:11 vmromanos Note Added: 0070746
2014-10-06 17:15 vmromanos Review Assigned To => shuehner
2014-10-06 17:15 vmromanos fix_in_branch pi =>
2014-10-06 17:22 vmromanos Note Edited: 0070746 View Revisions
2014-10-06 17:29 vmromanos Note Edited: 0070746 View Revisions
2014-10-06 17:54 vmromanos Review Assigned To shuehner => vmromanos
2014-10-06 17:55 hgbot Checkin
2014-10-06 17:55 hgbot Note Added: 0070748
2014-10-06 17:55 hgbot Status scheduled => resolved
2014-10-06 17:55 hgbot Resolution open => fixed
2014-10-06 17:55 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/bda678370986e6eb7f81c83ed8cbe4167359ebc6 [^]
2014-10-07 09:59 vmromanos Review Assigned To vmromanos => fsoto82
2014-10-07 09:59 vmromanos Status resolved => closed
2014-12-30 23:22 hudsonbot Checkin
2014-12-30 23:22 hudsonbot Note Added: 0072905


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker