ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Li <david.li...@gmail.com>
Subject Re: ScanQuery With BinaryObject
Date Mon, 03 Apr 2017 06:24:35 GMT
Sorry, please ignore the previous email, it was sent by mistake.

1. I download apache-ignite-fabric-1.9.0-bin.zip, and unzip it.
2. In terminal, I start an ignite instance by *bin/ignite.sh
3. I create a Java application, source code as below:

public static void main(String[] args) {
    String ORG_CACHE = "org_cache_remote";
   * Ignition.setClientMode(true);*
    Ignite ignite = Ignition.start("example-ignite.xml");
    CacheConfiguration<Long, Organization> orgCacheCfg = new
    orgCacheCfg.setIndexedTypes(Long.class, Organization.class);
    IgniteCache<Long, Organization> cache = ignite.createCache(orgCacheCfg);
    cache.put(1L, new Organization(1L, "org1", true, "jurong east",
    cache.put(2L, new Organization(2L, "org2", false, "orchard", "2222"));
    cache.put(3L, new Organization(3L, "org3", true, "jurong west",
    cache.put(4L, new Organization(4L, "org4", false, "woodlands", "4444"));
    cache.put(5L, new Organization(5L, "org5", false, "changi", "5555"));
    // cache.put(6L, new Organization(6L, "org6", true, "jurong island",

    IgniteCache<Long, BinaryObject> binaryCache = cache.withKeepBinary();

    List<Cache.Entry<Long, BinaryObject>> result;

    System.out.println("Scan by address");
    ScanQuery<Long, BinaryObject> scanAddress = new ScanQuery<>(
        new IgniteBiPredicate<Long, BinaryObject>() {
            public boolean apply(Long aLong, BinaryObject binaryObject) {
                *// first time filter by jurong, got two entries, org1 and
*                // second time filter by changi, got two entries, org1 and
*                // third time filter by changi as well, uncomment org6,
got three entries, org1, org3 and org6*
*                return
    result = binaryCache.query(scanAddress).getAll();
    System.out.println("result: " + result.size());
    for (Cache.Entry<Long, BinaryObject> entry : result) {


Here what I want to do is start a client node, connect to the server node
started in step 2. Then I create a cache, put some data inside,
then try to run a scan query to find entries by its address.
The problem is when I run this program first time, it will return two
entries, their addresses are started with "jurong", which is correct.
When I run the program again, with changed value, eg. "changi", it should
return one entry, somehow, it still return two entries with address started
with "jurong", rather than "changi".
When I uncomment the line of "org6", and run the program again, it will
return three entries, all of their addresses are started with "jurong".

I have no idea what is going on.

View raw message