4 Replies Latest reply on May 23, 2013 2:59 AM by lokeshbandaru

    Clustered Query with Clustered Indexes

    lokeshbandaru Newbie

      Guys,

       

      Tried using the ClusteredQuery with Clustered Index Caches, and ended up with a wrong result. The query always returned each of the entries from the expected result, times the cluster size.

      If the result is supposed to have only one entry and the cluster has 3 nodes, the result will have the same entry thrice and so on so forth.

      Think that the usage of the api is wrong.

       

      I guess that only one of them must be used, either the ClusteredQuery or the ClusteredIndexCaches, the corresponding counterparts being either the non-shared indexes or a local Query respectively.

      The indexLocalOnly attribute stays true for both the cases.

      Could this be confirmed?

       

      Initially, I overlooked the fact that ClusteredQuery is currently in an experimental stage.

       

      It would be great if a brief can be provided on how the indexes work with the queries(Local and Clustered).

       

       

      Thanks.

        • 1. Re: Index replication problem with directory_provider infinispan
          Martin Gencur Novice

          Can you please start another thread? This is not related to the original post. Anyway, I'm not the best person to answer this question. I just think the ClusteredQuery is not yet fully functional, there are some bugs. The above seems like a bug. OTOH, there are some tests in Infinispan for clustered queries and they're passing. Maybe it's worth to search for the tests and look how they're configured.

           

          Martin

          • 2. Re: Index replication problem with directory_provider infinispan
            lokeshbandaru Newbie

            Martin, was unable to start a new thread.

            Tried doing and ended up in this thread without the initial posts. Thanks for the update.

            Ended up modifying the same post. Hope this is fine.

            • 3. Re: Index replication problem with directory_provider infinispan
              Sanne Grinovero Master

              Hi, you should either use Clustered Queries, OR a clustered Index.

               

              With a clustered index the same index is directly accessible on each node, making it pointless to use a clustered query. With a clustered query and independent indexes you have the benefit that each node can handle its local index updates, so indexing is easier to setup and scales better but at a cost of different behaviour during Query performance (not necessarily worse, that highly depends on the use case).

              • 4. Re: Index replication problem with directory_provider infinispan
                lokeshbandaru Newbie

                Hi Sanne, thanks for clarifying.

                 

                The usecase is that, Objects get added to the cache with simple primitive values/strings as keys. Each such object will have another object and that is indexed too.

                For such a case, can you throw some light on how a LocalQuery with a Distributed IndexCache(numOwners will always be 2 no matter the size of cluster) fares against a ClusteredQuery with Local IndexCaches.

                Two copies of a logical index entry will be present in the cluster all the time, doubling the memory that gets consumed by Indexes, but thats it. As the query happens to be a Local one, will it not be any quicker than a ClusteredQuery?

                 

                The version that I've been using is 5.2.1 and find that the ClusteredQuery api is marked as "experimental" in the corresponding javadocs.

                Can you kindly suggest on its adoption?