[infinispan-issues] [JBoss JIRA] Created: (ISPN-1179) Preloading the cache leads to duplicate (multiple) results from queries

juergen roberg (JIRA) jira-events at lists.jboss.org
Tue Jun 14 04:50:23 EDT 2011


Preloading the cache leads to duplicate (multiple) results from queries
-----------------------------------------------------------------------

                 Key: ISPN-1179
                 URL: https://issues.jboss.org/browse/ISPN-1179
             Project: Infinispan
          Issue Type: Bug
          Components: Loaders and Stores, Querying
    Affects Versions: 5.0.0.CR3
            Reporter: juergen roberg
            Assignee: Manik Surtani


Duplicate (multiple) results from queries.
We are using Infinispan 5.0.0.CR3 and our cache has a JdbcStringBasedCacheStore loader with preload="true".
 
When reaching the QueryInterceptor (see StackTrace below) entry.isCreated() returns true.
 
ReadCommittedEntry(a44130){
          key=0eebcb5b-d581-49ec-8e49-565a8f134b4c,
          value={objectID=0eebcb5b-d581-49ec-8e49-565a8f134b4c, street=Street 66},
          oldValue=null,
          isCreated=true,
          isChanged=true,
          isRemoved=false,
          isValid=true
}
 
so the QueryInterceptor adds the entry to the index again instead of just updating the index.
 
      public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
 
      // This method will get the put() calls on the cache and then send them into Lucene once it's successful.
      // do the actual put first.
      Object toReturn = invokeNextInterceptor(ctx, command);
 
      if (shouldModifyIndexes(ctx)) {
         // First making a check to see if the key is already in the cache or not. If it isn't we can add the key no problem,
         // otherwise we need to be updating the indexes as opposed to simply adding to the indexes.
         Object key = command.getKey();
         Object value = extractValue(command.getValue());
         updateKnownTypesIfNeeded( value );
         CacheEntry entry = ctx.lookupEntry(key);
 
         // New entry so we will add it to the indexes.
         if(entry.isCreated()) {
            log.debug("Entry is created");
>>>>        addToIndexes(value, extractValue(key));
         }
         else{
            // This means that the entry is just modified so we need to update the indexes and not add to them.
            log.debug("Entry is changed");
            updateIndexes(value, extractValue(key));
         }
        }
      return toReturn;
   }
 
 
Thread [main] (Suspended)
          LocalQueryInterceptor(QueryInterceptor).visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 98
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          LockingInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          LockingInterceptor.visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 294
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          CacheStoreInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          CacheStoreInterceptor.visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 204
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          CacheLoaderInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          CacheLoaderInterceptor.visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 82
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          NotificationInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          NotificationInterceptor(CommandInterceptor).handleDefault(InvocationContext, VisitableCommand) line: 133
          NotificationInterceptor(AbstractVisitor).visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 60
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          TxInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          TxInterceptor.enlistWriteAndInvokeNext(InvocationContext, WriteCommand) line: 204
          TxInterceptor.visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 152
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          InvocationContextInterceptor(CommandInterceptor).invokeNextInterceptor(InvocationContext, VisitableCommand) line: 119
          InvocationContextInterceptor.handleAll(InvocationContext, VisitableCommand) line: 96
          InvocationContextInterceptor.handleDefault(InvocationContext, VisitableCommand) line: 63
          InvocationContextInterceptor(AbstractVisitor).visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand) line: 60
          PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor) line: 77
          InterceptorChain.invoke(InvocationContext, VisitableCommand) line: 274
          CacheDelegate<K,V>.put(K, V, long, TimeUnit, long, TimeUnit) line: 505
          CacheLoaderManagerImpl.preload() line: 160
          NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
          NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
          DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
          Method.invoke(Object, Object...) line: not available
          ReflectionUtil.invokeAccessibly(Object, Method, Object[]) line: 172
          AbstractComponentRegistry$PrioritizedMethod.invoke() line: 908
          ComponentRegistry(AbstractComponentRegistry).internalStart() line: 706
          ComponentRegistry(AbstractComponentRegistry).start() line: 608
          ComponentRegistry.start() line: 179
          CacheDelegate<K,V>.start() line: 362
          DefaultCacheManager.createCache(String) line: 548
          DefaultCacheManager.getCache(String) line: 445
          Main.main(String[]) line: 45

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

        


More information about the infinispan-issues mailing list