点燃缓存事务强行回滚
Ignite cache transaction forcibly rolled back
我在 Apache Ignite 中使用事务进行缓存操作。我在日志中看到警告,其中事务被强制回滚。像这样:
16-02-2020 02:09:38.249 [-#115][157 ] WARN
e.internal.processors.cache.distributed.near.GridNearTxLocal-[warning
][ 488] The transaction was forcibly rolled back because a timeout is
reached:
GridNearTxLocal[xid=fcdfebb4071-00000000-0b85-8094-0000-000000000005,
xidVersion=GridCacheVersion [topVer=193298580, order=1581818772943,
nodeOrder=5], concurrency=PESSIMISTIC, isolation=SERIALIZABLE,
state=ROLLED_BACK, invalidate=false, rollbackOnly=true,
nodeId=612b38ca-ffbf-46bf-a27b-00fc68555ff7, timeout=10000,
duration=10006]
看起来这个警告是随机出现在我的日志中的,与我的缓存操作无关。
我正在开始我的交易:
Ignite ignite = Ignition.ignite();
IgniteTransactions transactions = ignite.transactions();
tx = transactions.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE, TRANSACTION_TIMEOUT, 0);
结尾:
try
{
if (tx.state() == TransactionState.ACTIVE)
{
if (commit)
tx.commit();
else
tx.rollback();
}
} catch (Exception e)
{
logger.error(String.format("Error ending transaction for thread(%d) with commit=%b", Thread.currentThread().getId(), commit));
// re-throw
throw new Exception(e);
} finally
{
tx.close();
tx = null;
}
为什么我在 transaction.commit() 调用中没有收到作为 TransactionRollbackException 的回滚警告? commit() 不是应该等到事务完全完成吗?
也许你甚至永远都不会到达 commit(),而不是挂在更早的某个操作上。您不能保证永远达到提交:相反,要么提前锁定,未能捕获未处理的错误,要么只是无限期地忙于工作。
我在 Apache Ignite 中使用事务进行缓存操作。我在日志中看到警告,其中事务被强制回滚。像这样:
16-02-2020 02:09:38.249 [-#115][157 ] WARN e.internal.processors.cache.distributed.near.GridNearTxLocal-[warning ][ 488] The transaction was forcibly rolled back because a timeout is reached: GridNearTxLocal[xid=fcdfebb4071-00000000-0b85-8094-0000-000000000005, xidVersion=GridCacheVersion [topVer=193298580, order=1581818772943, nodeOrder=5], concurrency=PESSIMISTIC, isolation=SERIALIZABLE, state=ROLLED_BACK, invalidate=false, rollbackOnly=true, nodeId=612b38ca-ffbf-46bf-a27b-00fc68555ff7, timeout=10000, duration=10006]
看起来这个警告是随机出现在我的日志中的,与我的缓存操作无关。
我正在开始我的交易:
Ignite ignite = Ignition.ignite();
IgniteTransactions transactions = ignite.transactions();
tx = transactions.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE, TRANSACTION_TIMEOUT, 0);
结尾:
try
{
if (tx.state() == TransactionState.ACTIVE)
{
if (commit)
tx.commit();
else
tx.rollback();
}
} catch (Exception e)
{
logger.error(String.format("Error ending transaction for thread(%d) with commit=%b", Thread.currentThread().getId(), commit));
// re-throw
throw new Exception(e);
} finally
{
tx.close();
tx = null;
}
为什么我在 transaction.commit() 调用中没有收到作为 TransactionRollbackException 的回滚警告? commit() 不是应该等到事务完全完成吗?
也许你甚至永远都不会到达 commit(),而不是挂在更早的某个操作上。您不能保证永远达到提交:相反,要么提前锁定,未能捕获未处理的错误,要么只是无限期地忙于工作。