item editor retrieves all stat cats on first invocation for a performance hit

Bug #1010187 reported by Jason Etheridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.2
Won't Fix
Medium
Unassigned
2.3
Fix Released
Medium
Unassigned

Bug Description

During the login sequence, the staff client retrieves and caches copy stat cats and entries for the workstation library "full path" (basically, the workstation, its ancestors, and descendants), using the call open-ils.circ.stat_cat.asset.retrieve.all against the workstation library.

The item editor is equipped to retrieve stat cats that have not yet been cached thus, but it does it for whole libraries at a time. So for example, if the workstation is BR1, and you load an item owned by BR4, it'll call the same full path retrieve on BR4 and cache those as well.

But there's a design/logic flaw here where it eventually makes the full path retrieve call against the top of the org tree, which essentially retrieves all stat cats in the system. The more you have, the longer it takes, though it's a one-time cost per login session.

Tags: pullrequest
Revision history for this message
Jason Etheridge (phasefx) wrote :

I tried this on a test system (master) with a BR4 item on a BR1 workstation and could not reproduce the problem. So something more subtle is happening, jfyi. Still investigating...

Revision history for this message
Jason Etheridge (phasefx) wrote :

Alright, so if the item actually has a stat cat entry mapped, the library owning the entry used gets considered. So, if you have a stat cat at the top of the org tree with entries at the top of the org tree, and the item has one of those mapped to it, then we end up getting that full path retrieve against the top of the consortium.

Revision history for this message
Jason Etheridge (phasefx) wrote :

collab/phasefx/item_editor_stat_cats @ working/Evergreen.git

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/phasefx/item_editor_stat_cats

commit 5435e5bfd6a2c3a67aaf8d3399d16805c3782efe (HEAD, item_editor_stat_cats)
Author: Jason Etheridge <email address hidden>
Date: Wed Jun 20 11:47:54 2012 -0400

    lp1010187 eliminate redundant/unnecessary calls

    Particularly invocations of open-ils.circ.stat_cat.asset.retrieve.all in the
    Item Attribute Editor

    To test:

        login with a BR1 workstation
        load a pristine (non-stat-cat-laden) BR1 item with the editor
        there should be no call to open-ils.circ.stat_cat.asset.retrieve.all
        change the Circ Lib on the item to BR4
        reload the item in the editor
        there should be a call to open-ils.circ.stat_cat.asset.retrieve.all
        reload the item in the editor
        there should be no call to open-ils.circ.stat_cat.asset.retrieve.all
        assign the item a stat cat entry owned by CONS
        reload the item in the editor
        there should be no call to open-ils.circ.stat_cat.asset.retrieve.all

    Signed-off-by: Jason Etheridge <email address hidden>

tags: added: pullrequest
Revision history for this message
Martha Driscoll (mjdriscoll) wrote :

Jason added this patch to NOBLE's production system on July 18. It's working great. We migrated lots of copy stat_cats from our legacy system with a few owned at the consortia level and thousands owned by the various org_units. Opening edit item attributes in a new session is reduced from 30 seconds to 1-2 seconds.

Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
no longer affects: evergreen/2.4
Changed in evergreen:
milestone: none → 2.4.0-alpha
Revision history for this message
Jason Stephenson (jstephenson) wrote :

I've been loading this branch in master for the past two or three months.

While no one here has reported speed issues with the copy editor and stat cats, I've not seen any problems in my testing, so I'll take Martha's post as an endorsement that the code resolves her issue.

Pushed to master.

Backports in collab for release maintainers to check:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/dyrcona/lp1010187_rel_2_3_backport

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/dyrcona/lp1010187_rel_2_2_backport

Changed in evergreen:
status: Confirmed → Fix Committed
Ben Shum (bshum)
Changed in evergreen:
status: Fix Committed → Fix Released
Revision history for this message
Ben Shum (bshum) wrote :

Marking as "won't fix" for 2.2 because we are outside the 2.2 support timeframe for non-security bug fixes.

Revision history for this message
Bill Erickson (berick) wrote :

Pulled into 2_3. Gracias, amigos.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.