3 Replies Latest reply on Oct 13, 2010 10:57 AM by sannegrinovero

    Using indexing with an async store

    craigching

      You're probably going to tell me what I'm asking is stupid :-P  But I like the performance boost I get when enabling async on my store.  However, when I do that with indexing="true", I get lots of NPEs trying to get at the elements via a query.  Is this just a bad idea?

        • 1. Re: Using indexing with an async store
          sannegrinovero

          Hi Craig,

          I'm not sure about how this would work, but I'd expect the results to potentially miss some items, not to throw NPEs.

          Please open an issue about this; it would be very nice if you could attach a testcase too, so that people looking into the issue is able to reproduce it.

          1 of 1 people found this helpful
          • 2. Re: Using indexing with an async store
            craigching

            Hi Sanne,

             

            Thanks for your response.  I mis-spoke a bit when I said there were NPEs, Infinispan isn't throwing the NPEs, my code is.  What's happening is that the list returned from the query object has null entries in it.  For instance, here's my code:

             

             

            QueryHelper helper = new QueryHelper(cache, new Properties(), User.class);
            QueryFactory f = new QueryFactory(cache, helper);
            CacheQuery query = f.getBasicQuery("enabled", "true");
            System.out.println("Query took " + (System.currentTimeMillis() - begin) + " ms.");
            int hits = query.getResultSize();
            System.out.println("Found " + hits + " hits.");
            List found = query.list();
            for (Object o : found) {
            User u = (User)o;
            //                    if (u == null) System.out.println("ERROR!: found element is null");

            System.out.println("Username: " + u.getUsername() + ", email: " + u.getEmail());

             

             

             

            {code}               QueryHelper helper = new QueryHelper(cache, new Properties(), User.class);

                           QueryFactory f = new QueryFactory(cache, helper);

                           CacheQuery query = f.getBasicQuery("enabled", "true");

                           System.out.println("Query took " + (System.currentTimeMillis() - begin) + " ms.");

                           int hits = query.getResultSize();

                           System.out.println("Found " + hits + " hits.");

                          

                           List found = query.list();

                           for (Object o : found) {

                                User u = (User)o;

                                if (u == null) System.out.println("ERROR!: found element is null");

                                System.out.println("Username: " + u.getUsername() + ", email: " + u.getEmail());

                           }

            {code}

             

            So the list contains null items.  I'm assuming you probably wouldn't want that to happen in any case, so I'll open up an issue for that with a test case.

            • 3. Re: Using indexing with an async store
              sannegrinovero

              yes please do and then link to the issue from this thread (and vice-versa).

              thanks