1.ignite如何在集群模式下处理裂脑场景?
2.在putAll的情况下,它是为每个条目命中持久存储还是所有内容都立即存储?
3.如果我们设置批量大小,putAll 如何处理持久存储?
4.如果分区有备份,数据移动的顺序是什么?主要->备份->持久性或主要->备份同时异步进入持久性?
5.如果在持久化存储中进行了更新,必须如何在缓存中反映而不重新加载?(如何处理后端更新)
6.在后端进行更新并反映缓存中的更改,如果我们使用 loadCache 重新加载缓存,缓存中的更改不会更新,或者如果我们直接使用 get() 也不会反映更新。只有在清除缓存一次然后调用 loadcache 或 get api 后才会反映更新。这是重新加载缓存的正确方法吗?
Person p1 = new Person(1, "Benakaraj", "KS", 11, 26, 1000);
Person p2 = new Person(2, "Ashwin", "Konale", 13, 26, 10000);
Connection con = null;
Statement stmt = null;
con = ds.getConnection();
stmt = con.createStatement();
String sql =
"create table Person(per_id int,name varchar(20),last_name varchar(20),org_id int,age int,salary REAL,primary key(per_id))";
stmt.executeUpdate(sql);
ROCCacheConfiguration<Integer, Person> pesonConfig = new ROCCacheConfiguration<>();
pesonConfig.setName("bkendupdtCache");
pesonConfig.setCacheMode(CacheMode.PARTITIONED);
JdbcType jdbcType = new JdbcType();
jdbcType.setCacheName("bkendupdtCache");
jdbcType.setDatabaseSchema("ROC4Test");
jdbcType.setDatabaseTable("Person");
jdbcType.setKeyType(Integer.class);
jdbcType.setValueType(Person.class);
// Key fields for PERSON.
Collection<JdbcTypeField> keys = new ArrayList<>();
keys.add(new JdbcTypeField(Types.INTEGER, "per_id", int.class, "perId"));
jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));
// Value fields for PERSON.
Collection<JdbcTypeField> vals = new ArrayList<>();
vals.add(new JdbcTypeField(Types.INTEGER, "per_id", int.class, "perId"));
vals.add(new JdbcTypeField(Types.VARCHAR, "name", String.class, "name"));
vals.add(new JdbcTypeField(Types.VARCHAR, "last_name", String.class, "lastName"));
vals.add(new JdbcTypeField(Types.INTEGER, "org_id", int.class, "orgId"));
vals.add(new JdbcTypeField(Types.INTEGER, "age", int.class, "age"));
vals.add(new JdbcTypeField(Types.FLOAT, "salary", Float.class, "salary"));
jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));
Collection<JdbcType> jdbcTypes = new ArrayList<>();
jdbcTypes.add(jdbcType);
CacheJdbcPojoStoreFactory<Integer, Organization> cacheJdbcdPojoStorefactory4 =
context.getBean(CacheJdbcPojoStoreFactory.class);
cacheJdbcdPojoStorefactory4.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));
pesonConfig.setCacheStoreFactory((Factory<? extends CacheStore<Integer, Person>>) cacheJdbcdPojoStorefactory4);
pesonConfig.setReadThrough(true);
pesonConfig.setWriteThrough(true);
ROCCache<Integer, Person> personCache2 = rocCachemanager.createCache(pesonConfig);
personCache2.put(1, p1);
personCache2.put(2, p2);
assertEquals(personCache2.get(2).getName(), "Ashwin");
sql = assertEquals(personCache2.get(2).getName(), "Abhi");
"update Person set name='Abhi' where per_id=2";
stmt.execute(sql);
//fails and asks for assertion with the stale value
personCache.loadcache(null);
assertEquals(personCache2.get(2).getName(), "Abhi");
//works fine
personCache2.clear(2);
assertEquals(personCache2.get(2).getName(), "Abhi");
//works fine
personCache2.clear();
personCache2.loadcache(null);
assertEquals(personCache2.get(2).getName(), "Abhi");
sql = "drop table Person";
stmt.executeUpdate(sql);
con.close();
stmt.close();
rocCachemanager.destroyCache("bkendupdtCache");