[infinispan-issues] [JBoss JIRA] (ISPN-3405) Entries are passivated with wrong ID in DB

Pedro Ruivo (JIRA) jira-events at lists.jboss.org
Thu Aug 22 19:31:27 EDT 2013


     [ https://issues.jboss.org/browse/ISPN-3405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Ruivo updated ISPN-3405:
------------------------------

    Fix Version/s: 6.0.0.Beta1
                       (was: 6.0.0.Alpha3)

    
> Entries are passivated with wrong ID in DB
> ------------------------------------------
>
>                 Key: ISPN-3405
>                 URL: https://issues.jboss.org/browse/ISPN-3405
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Eviction
>    Affects Versions: 5.3.0.Final, 6.0.0.Alpha1
>            Reporter: Vitalii Chepeliuk
>            Assignee: Galder Zamarreño
>             Fix For: 6.0.0.Beta1, 6.0.0.Final
>
>
> Entry passivation into DB, concretly this class LockSupportCacheStore and method store. Look at lines with "<<<" string for more info
> {code:title=LockSupportCacheStore.java|borderStyle=solid}
>   @Override
>    public final void store(InternalCacheEntry ed) throws CacheLoaderException {
>       if (trace) {
>          log.tracef("store(%s)", ed);
>       }
>       if (ed == null) {
>         return;
>       }
>       if (ed.canExpire() && ed.isExpired(timeService.wallClockTime())) {
>          if (containsKey(ed.getKey())) {
>             if (trace) {
>                log.tracef("Entry %s is expired!  Removing!", ed);
>             }
>             remove(ed.getKey());
>          } else {
>             if (trace) {
>                log.tracef("Entry %s is expired!  Not doing anything.", ed);
>             }
>          }
>          return;
>       }
>       L keyHashCode = getLockFromKey(ed.getKey()); <<< here key is generated like ed.getKey().hashCode() & 0xfffffc00;
>       lockForWriting(keyHashCode);
>       try {
>          storeLockSafe(ed, keyHashCode); <<< here it should be stored into Bucket and then stored in DB
>       } finally {
>          unlock(keyHashCode);
>       }
>       if (trace) {
>          log.tracef("exit store(%s)", ed);
>       }
>    }
> {code}
> When I use RemoteCacheManager and RemoteCache I am putting entries into cache
> {code:title=Test.java|borderStyle=solid}
>    cache.put("key1", "v1");
>    cache.put("key2", "v2");
>    cache.put("key3", "v3");
> {code}
> Then 2 entries are passivated and stored in DB
> ||ID||DATA||TIMESTAMP||
> |183713792|0301fe032a01034c422b21033e286d7942657374506572736f6e616c4b657957686963684861734e657665724265656e426574746572420521033e02763203620003630000000000000002|-1|
> |23486464|0301fe032a01034c420721033e046b657931420521033e02763103620003630000000000000001|-1| 
> IDs are generated from method above and
> {code:title=Test.java|borderStyle=solid}
> byte[] keyBytes = marshaller.objectToByteBuffer("key1"); <<< key is marshalled
> long keyID = ByteArrayEquivalence.INSTANCE.hashCode(keyBytes) & 0xfffffc00 //computation taken from BucketBasedCacheStore <<< this does not work for me
> {code}
> And next step I'd like to retrieve data from DB
> SELECT ID, DATA FROM JDBC_BINARY_DEFAULT WHERE ID=keyID
> But in method
> {code:title=BucketBasedCacheStore.java|borderStyle=solid}
>    @Override
>    public Integer getLockFromKey(Object key) {
>        return key.hashCode() & 0xfffffc00; <<< here should be used Arrays.hashCode((byte[])key)  & 0xfffffc00), if key is represented as byte array, or used ByteArrayEquivalence instead of simple byte array(byte[]) as argument
>    }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the infinispan-issues mailing list