[jira] [Created] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
----------------------------------------------------------------------------------------------------------

                 Key: OFBIZ-4341
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
             Project: OFBiz
          Issue Type: Bug
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Martin Kreidenweis


{{GenericDelegator.findOne}} doesn't handle the cache consistently.

When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Kreidenweis updated OFBIZ-4341:
--------------------------------------

    Attachment: OFBIZ-4341-findOne-cache-fix.patch

patch fixing the findOne cache issue for not-found values

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114520#comment-13114520 ]

Martin Kreidenweis commented on OFBIZ-4341:
-------------------------------------------

Just checking up on the ticket status... :-)

Do you need more info or did you just not get around to applying the patch yet?

One thing we might want to be careful about: Some code might actually depend on the buggy behavior and expect that the cache is not used for not-found primary key values. Still, the intention of the original code seems to me like it wanted to use that cache and it just didn't work. So I think we should fix this.

We found the issue while profiling a service in our application.

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimitri Unruh updated OFBIZ-4341:
---------------------------------

    Attachment: OFBIZ-4341.patch

Hi Martin,

we also had the same problem with this issue. Our resolution looks very similar to your patch. The main difference is the getFromPrimaryKeyCache method.

Maybe you will have a look at this and tell me what you think.

Dimitri

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Assigned] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reassigned OFBIZ-4341:
--------------------------------------

    Assignee: Jacques Le Roux

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114561#comment-13114561 ]

Martin Kreidenweis commented on OFBIZ-4341:
-------------------------------------------

Hi Dimitri,

your patch causes the public {{Delegator.getFromPrimaryKeyCache()}} method to return {{GenericValue.NULL_VALUE}}. I don't know if that's a good idea. The NULL_VALUE looks like an internal thing to me that the cache uses because it doesn't want to store {{null}} directly. (It would have the same problem that cache misses and null-hits are harder to distinguish.) So maybe we don't want to return that value from the Delegator.

But as I can't currently find any other uses of the {{getFromPrimaryKeyCache}} method in OFBiz code, I guess your patch is fine as well.

Does somebody still know how the {{GenericValue.NULL_VALUE}} was originally intended to be used?

Martin

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114609#comment-13114609 ]

Dimitri Unruh commented on OFBIZ-4341:
--------------------------------------

Martin,

I know what you mean :)

So, it could be dangarous to change the Delegator.getFromPrimaryKeyCache() (for custom modifications), but anyway in my opinion the current implementation is wrong.
If _GenericValue.NULL_VALUE_ is in the cacht, i will get it...



> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115284#comment-13115284 ]

Dimitri Unruh commented on OFBIZ-4341:
--------------------------------------

I had a look in the SVN history.
The {{Delegator.getFromPrimaryKeyCache()}} method has been changed in rev. 589514.

In my opinion, we should change the method.
Any other ideas?

Anyway, at least we got a problem here. So, if we don't change the {{Delegator.getFromPrimaryKeyCache()}} method, we should use Martins patch :)
               

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115316#comment-13115316 ]

Martin Kreidenweis commented on OFBIZ-4341:
-------------------------------------------

Thanks for checking it out, Dimitri.
So considering the history of the {{getFromPrimaryKeyCache}} method I'm also OK with changing it back to returning the NULL_VALUE.

Jacques shall decide which patch he wants to use. ;-)
               

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115326#comment-13115326 ]

Dimitri Unruh commented on OFBIZ-4341:
--------------------------------------

Jacques, may the Force be with you :)
               

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4341) GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115851#comment-13115851 ]

Jacques Le Roux commented on OFBIZ-4341:
----------------------------------------

Thanks Guys,

I will have a look as soon as I will get a chance. I also hope to change methods signature, as discussed with Martin: http://markmail.org/message/rhn26erd3vtq73ag
               

> GenericDelegator.findOne cache not working for not-found values (cached not-found treated like cache miss)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4341
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4341
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Martin Kreidenweis
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4341-findOne-cache-fix.patch, OFBIZ-4341.patch
>
>
> {{GenericDelegator.findOne}} doesn't handle the cache consistently.
> When it doesn't find anything, it puts {{GenericValue.NULL_VALUE}} in the cache. When trying to read from the cache it uses the {{getFromPrimaryKeyCache}} method, which returns null when {{GenericValue.NULL_VALUE}} was stored in the cache, just like for cache misses. So a not-found value in the cache is treated like a cache miss and the cache isn't actually used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira