• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • ehcache
  • teck
  • Reporter: topurple
  • November 22, 2011
  • 0
  • Watchers: 1
  • July 27, 2012
  • November 23, 2011



I am using EHcache 2.4.6 and test the sample code in user guide search section.

If the cache is none transaction, it works fine.

If the cache is “Local” transaction cache, most of the test works fine, only the “count” will return me twice the value. I also tested “sum”. Same issue. I debug and found:

in Ehcache source class AbstractTransactionStore, there is code: public Results executeQuery(StoreQuery query) { Results results = underlyingStore.executeQuery(query); if (results instanceof TxSearchResults) { // don’t re-wrap needlessly return results; } return new TxSearchResults(underlyingStore.executeQuery(query)); }

Why the underlyingStore.executeQuery(query) run twice in this method? After the second run, the count value is doubled. Anyone has similar issues?

my config is like below:

Thank you.


Tim Eck 2011-11-22

The fact that the query runs twice just looks like an unfortunate bug. I don’t quite see however why a count() or sum() aggregation would return double the expected value. The two query executions should be independent of one another.

Is it possible to include a complete program that demonstrates the issue? With a concrete test case we will be certain the correct bug(s) will be fixed

Tim Eck 2011-11-22

I also meant to ask, is this a terracotta clustered cache?

Xia Yang 2011-11-22

it is a standalone local transaction cache

Xia Yang 2011-11-22

This is the test codes. I just add transaction from your example for search section in your website.

Tim Eck 2011-11-23

Thanks for the test code, it makes all the difference. I can see why the aggregators are getting visited twice and giving double results.

I believe you won’t hit this bug if you call end() on your query before execute()’ing it

Tim Eck 2011-11-23

fix should be present in ehcache-core 2.4.7, 2.5.1

Xia Yang 2011-11-28

Thank you Tim! after I called end(), it works fine. Thank you.