Joe Planisky
غير مقروءة،14/11/2012، 7:10:15 م14/11/2012تسجيل الدخول للرد على المؤلف
تسجيل الدخول لإعادة التوجيه
لم تحصل على إذن لحذف الرسائل في هذه المجموعة.
تسجيل الدخول للإبلاغ عن الرسالة
إما أن تكون عناوين البريد الإلكتروني مجهولة لهذه المجموعة أو أنّك تحتاج إلى إذن بعرض عناوين بريد الأعضاء الإلكتروني لتتمكَّن من عرض الرسالة الأصلية
إلى haze...@googlegroups.com
We first saw this problem in Hazelcast 2.1.2. We thought upgrading to Hazelcast 2.4 might have fixed this issue since it did have some fixes related to queries, but alas, it's still with us. Reduced to it's simplest statement: doing a predicate query on an IMap that has indexes sometimes returns stale data, while retrieving a value with IMap.get(key) always returns the most current value.
I've attached a program that demonstrates the problem. The attached zip file contains a hazelcast.xml configuration file, the demo program itself (Demo.java), and a Bash shell script to drive part of the demo. Because this problem seems to happen most often in the first few queries made to the map, the shell script repeatedly cycles the demo. The bug happens very rarely, so the cycle script may have to run for many minutes or even hours to catch an incident.
Demo has a client and a server mode. The client mode does nothing except provide nodes to let Hazelcast distribute the map data to. The server mode adds some objects to an IMap, and then enters a loop where it:
1 retrieves one of the objects (with IMap.get(key))
2 updates a value in the object
3 puts the modified object back into the map (with IMap.put(key, value))
4 waits a random amount of time (< 100 ms)
5 then retrieves the object with both a call to IMap.get(key) and a query
6 compares the values from both retrieval methods
7 if the values are different, print an error message
8 loop back to step 1, repeat for 5 seconds.
The modified values should always match since there's only one "server" updating them. However, very rarely (but often enough to cause us great grief), they don't match. Once a mismatch occurs, it is never healed (i.e. all subsequent queries will return the same stale value.)
Compile Demo.java with something like
$ javac -classpath .:<path-to-hazelcast-jar> Demo.java
Start several copies of Demo in client mode (I usually start 3 copies in separate terminal windows) with
$ java -cp .:<path-to-hazelcast-jar> Demo
Edit cycle.sh, replacing <path-to-hazelcast-jar> with the path to your hazelcast-all.jar file. Then start the ./cycle.sh shell script which will repeatedly run the Demo in server mode until it detects an error. This may take minutes to hours, but I usually get the error within about 30 minutes on my Mac OS X system.
Hope this helps you find the problem.
--
Joe