Apache Ignite在事务模式下删除所有节点,导致节点故障

问题描述 投票:0回答:1

我想从缓存中删除大约30L(30,00,000)个数据记录,并且已经使用过

igniteCache.removeAll(listOfKeys) 

这里我正在获取密钥并传递给ignite的removeAll方法,并且工作正常。但是为了保持一致性并避免部分删除,我决定在操作中使用事务。但是问题在于:删除它需要花费很多时间,并且主要是我的ignite服务器节点已停止。

        IgniteTransactions transactions = IgniteConfig.getIgnite().transactions();
        tx = transactions.txStart();
        IgniteCache<String, myCache> igniteCache = 
IgniteConfig.getIgniteCache();
FieldsQueryCursor<List<?>> deletedKeys = igniteCache.query("select id from  
mytable where timeId=xxxx");

Set<String> listOfKeys = new HashSet<>();
List<List<?>> allData = deletedKeys.getAll();

for (List keys : allData) {                  
listOfKeys.add(String.valueOf(keys.get(0)));
}

igniteCache.removeAll(listOfKeys);
tx.commit();
java transactions ignite in-memory-database
1个回答
0
投票

默认的并发级别是TransactionConcurrency.PESSIMISTIC,依此类推

© www.soinside.com 2019 - 2024. All rights reserved.