use of org.apache.ignite.internal.GridKernalContext in project ignite by apache.
the class GridH2IndexBase method toSearchRow.
/**
* @param msg Row message.
* @return Search row.
*/
private SearchRow toSearchRow(GridH2RowMessage msg) {
if (msg == null)
return null;
GridKernalContext ctx = kernalContext();
Value[] vals = new Value[getTable().getColumns().length];
assert vals.length > 0;
List<GridH2ValueMessage> msgVals = msg.values();
for (int i = 0; i < indexColumns.length; i++) {
if (i >= msgVals.size())
continue;
try {
vals[indexColumns[i].column.getColumnId()] = msgVals.get(i).value(ctx);
} catch (IgniteCheckedException e) {
throw new CacheException(e);
}
}
return database.createRow(vals, MEMORY_CALCULATE);
}
use of org.apache.ignite.internal.GridKernalContext in project ignite by apache.
the class GridCommonAbstractTest method dumpCacheDebugInfo.
/**
* @param ignite Node.
*/
public void dumpCacheDebugInfo(Ignite ignite) {
GridKernalContext ctx = ((IgniteKernal) ignite).context();
log.error("Cache information update [node=" + ignite.name() + ", client=" + ignite.configuration().isClientMode() + ']');
GridCacheSharedContext cctx = ctx.cache().context();
log.error("Pending transactions:");
for (IgniteInternalTx tx : cctx.tm().activeTransactions()) log.error(">>> " + tx);
log.error("Pending explicit locks:");
for (GridCacheExplicitLockSpan lockSpan : cctx.mvcc().activeExplicitLocks()) log.error(">>> " + lockSpan);
log.error("Pending cache futures:");
for (GridCacheFuture<?> fut : cctx.mvcc().activeFutures()) log.error(">>> " + fut);
log.error("Pending atomic cache futures:");
for (GridCacheFuture<?> fut : cctx.mvcc().atomicFutures()) log.error(">>> " + fut);
}
use of org.apache.ignite.internal.GridKernalContext in project ignite by apache.
the class GridAbstractTest method awaitTopologyChange.
/**
* @throws IgniteInterruptedCheckedException If interrupted.
*/
private void awaitTopologyChange() throws IgniteInterruptedCheckedException {
for (Ignite g : G.allGrids()) {
final GridKernalContext ctx = ((IgniteKernal) g).context();
if (ctx.isStopping())
continue;
AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
if (!topVer.equals(exchVer)) {
info("Topology version mismatch [node=" + g.name() + ", exchVer=" + exchVer + ", topVer=" + topVer + ']');
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override
public boolean apply() {
AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
return exchVer.equals(topVer);
}
}, DFLT_TOP_WAIT_TIMEOUT);
}
}
}
use of org.apache.ignite.internal.GridKernalContext in project ignite by apache.
the class GridH2IndexBase method initDistributedJoinMessaging.
/**
* @param tbl Table.
*/
protected final void initDistributedJoinMessaging(GridH2Table tbl) {
final GridH2RowDescriptor desc = tbl.rowDescriptor();
if (desc != null && desc.context() != null) {
ctx = desc.context();
GridKernalContext ctx = desc.context().kernalContext();
log = ctx.log(getClass());
msgTopic = new IgniteBiTuple<>(GridTopic.TOPIC_QUERY, tbl.identifierString() + '.' + getName());
msgLsnr = new GridMessageListener() {
@Override
public void onMessage(UUID nodeId, Object msg) {
GridSpinBusyLock l = desc.indexing().busyLock();
if (!l.enterBusy())
return;
try {
onMessage0(nodeId, msg);
} finally {
l.leaveBusy();
}
}
};
ctx.io().addMessageListener(msgTopic, msgLsnr);
} else {
msgTopic = null;
msgLsnr = null;
log = new NullLogger();
}
}
use of org.apache.ignite.internal.GridKernalContext in project ignite by apache.
the class GridCacheNestedTxAbstractTest method testTwoTx.
/**
* JUnit.
*
* @throws Exception If failed.
*/
public void testTwoTx() throws Exception {
final IgniteCache<String, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
GridKernalContext ctx = ((IgniteKernal) grid(0)).context();
c.put(CNTR_KEY, 0);
for (int i = 0; i < 10; i++) {
try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
c.get(CNTR_KEY);
ctx.closure().callLocalSafe((new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
assertFalse(((GridCacheAdapter) c).context().tm().inUserTx());
assertNull(((GridCacheAdapter) c).context().tm().userTx());
return true;
}
}), true);
tx.commit();
}
}
}
Aggregations