OpenJPA
  1. OpenJPA
  2. OPENJPA-2285

L2 cache doesn't store FK(s) back into the cache when lazy loading data.

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1, 2.1.1, 2.2.0, 2.3.0, 2.4.0
    • Fix Version/s: None
    • Component/s: datacache, performance
    • Labels:
      None

      Description

      I ran into a performance bug recently where we aren't caching data, but we could be. The data that we aren't caching is when lazy loading an unowned relationship .

      For instance, if we have the model Person <-> Address(LAZY, owner) and we find Person, that data will get stored in the cache. Since Address owns the relationship, we don't have the FK to cache(yet). Later we go to lazily load the address and we need to issue a joined query to find the Address which corresponds to our Person. Once that data has been loaded, we don't store the FK back into the cache.

      With this JIRA I'm going to introduce a change that will make our runtime re-cache the Person data when additional data is loaded.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          13d 3h 53m 1 Rick Curtis 07/Nov/12 23:02
          Resolved Resolved Closed Closed
          29d 22h 46m 1 Albert Lee 10/Apr/13 15:51
          Closed Closed Reopened Reopened
          91d 1h 28m 1 Rick Curtis 10/Jul/13 17:20
          Reopened Reopened Resolved Resolved
          6d 1h 21m 3 Rick Curtis 10/Jul/13 17:20
          Resolved Resolved Reopened Reopened
          336d 16h 27m 3 Rick Curtis 14/Feb/14 17:06
          Mark Struberg made changes -
          Fix Version/s 2.4.0 [ 12325298 ]
          Rick Curtis made changes -
          Link This issue is duplicated by OPENJPA-2524 [ OPENJPA-2524 ]
          Rick Curtis made changes -
          Fix Version/s 2.4.0 [ 12325298 ]
          Affects Version/s 2.4.0 [ 12325298 ]
          Hide
          ASF subversion and git services added a comment -

          Commit 1570016 from Rick Curtis in branch 'openjpa/trunk'
          [ https://svn.apache.org/r1570016 ]

          OPENJPA-2285: Recommitted DataCacheStoreManager improvement.

          Show
          ASF subversion and git services added a comment - Commit 1570016 from Rick Curtis in branch 'openjpa/trunk' [ https://svn.apache.org/r1570016 ] OPENJPA-2285 : Recommitted DataCacheStoreManager improvement.
          Rick Curtis made changes -
          Resolution Invalid [ 6 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Rick Curtis made changes -
          Attachment OPENJPA-2285.test.patch [ 12629052 ]
          Hide
          Rick Curtis added a comment -

          Attaching a testcase that is similar to the 'internal test' that was failing.

          Show
          Rick Curtis added a comment - Attaching a testcase that is similar to the 'internal test' that was failing.
          Rick Curtis made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Invalid [ 6 ]
          Rick Curtis made changes -
          Fix Version/s 2.3.0 [ 12319463 ]
          Fix Version/s 2.2.2 [ 12323356 ]
          Rick Curtis made changes -
          Resolution Invalid [ 6 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Albert Lee made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rick Curtis made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Invalid [ 6 ]
          Hide
          Rick Curtis added a comment -

          Reverted changes from 2.2.x and trunk. Closing as invalid.

          Show
          Rick Curtis added a comment - Reverted changes from 2.2.x and trunk. Closing as invalid.
          Hide
          ASF subversion and git services added a comment -

          Commit 1455205 from curtisr7
          [ https://svn.apache.org/r1455205 ]

          OPENJPA-2285 : Revert previous changes to 2.2.x.

          Show
          ASF subversion and git services added a comment - Commit 1455205 from curtisr7 [ https://svn.apache.org/r1455205 ] OPENJPA-2285 : Revert previous changes to 2.2.x.
          Hide
          ASF subversion and git services added a comment -

          Commit 1455204 from curtisr7
          [ https://svn.apache.org/r1455204 ]

          OPENJPA-2285: Revert prior changes.

          Show
          ASF subversion and git services added a comment - Commit 1455204 from curtisr7 [ https://svn.apache.org/r1455204 ] OPENJPA-2285 : Revert prior changes.
          Rick Curtis made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Rick Curtis added a comment -

          An internal test regression was attributed to the change in this JIRA. The problem is that when CacheStoreMode.USE (default) is set, data should NOT be stored back into the cache. I'll update the JIRA with more details soon here.

          Show
          Rick Curtis added a comment - An internal test regression was attributed to the change in this JIRA. The problem is that when CacheStoreMode.USE (default) is set, data should NOT be stored back into the cache. I'll update the JIRA with more details soon here.
          Rick Curtis made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Rick Curtis added a comment -

          This code fix introduced a regression where we would put invalid data in the cache and resulted in the ClassCastException while loading data in a subsequent request. This is very much an edge case as you needed to be executing a query which returned an Embeddable which had an eager relationship to another Entity which then referred back to the embedding Entity. @See the added ut/ Entity model for details.

          Committing a code fix + new UT for this scenario to trunk and 2.2.x.

          Show
          Rick Curtis added a comment - This code fix introduced a regression where we would put invalid data in the cache and resulted in the ClassCastException while loading data in a subsequent request. This is very much an edge case as you needed to be executing a query which returned an Embeddable which had an eager relationship to another Entity which then referred back to the embedding Entity. @See the added ut/ Entity model for details. Committing a code fix + new UT for this scenario to trunk and 2.2.x.
          Rick Curtis made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Rick Curtis added a comment -

          Merged changes back to 2.2.x.

          Show
          Rick Curtis added a comment - Merged changes back to 2.2.x.
          Rick Curtis made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.2.2 [ 12323356 ]
          Resolution Fixed [ 1 ]
          Rick Curtis made changes -
          Field Original Value New Value
          Fix Version/s 2.2.1 [ 12319943 ]
          Hide
          Rick Curtis added a comment -

          Committed revision 1402635 to trunk.

          Show
          Rick Curtis added a comment - Committed revision 1402635 to trunk.
          Rick Curtis created issue -

            People

            • Assignee:
              Rick Curtis
              Reporter:
              Rick Curtis
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development