Search in sources :

Example 6 with Organization

use of org.apache.ignite.internal.processors.query.h2.twostep.JoinSqlTestHelper.Organization in project ignite by apache.

the class RetryCauseMessageSelfTest method testReplicatedCacheReserveFailureMessage.

/**
 * Failed to reserve partitions for query (partition of REPLICATED cache is not in OWNING state)
 */
@Ignore("https://issues.apache.org/jira/browse/IGNITE-7039")
@Test
public void testReplicatedCacheReserveFailureMessage() {
    GridMapQueryExecutor mapQryExec = GridTestUtils.getFieldValue(h2Idx, IgniteH2Indexing.class, "mapQryExec");
    final GridKernalContext ctx = GridTestUtils.getFieldValue(mapQryExec, GridMapQueryExecutor.class, "ctx");
    GridTestUtils.setFieldValue(h2Idx, "mapQryExec", new MockGridMapQueryExecutor() {

        @Override
        public void onQueryRequest(ClusterNode node, GridH2QueryRequest qryReq) throws IgniteCheckedException {
            GridCacheContext<?, ?> cctx = ctx.cache().context().cacheContext(qryReq.caches().get(0));
            GridDhtLocalPartition part = cctx.topology().localPartition(0, NONE, false);
            AtomicLong aState = GridTestUtils.getFieldValue(part, GridDhtLocalPartition.class, "state");
            long stateVal = aState.getAndSet(2);
            startedExecutor.onQueryRequest(node, qryReq);
            aState.getAndSet(stateVal);
        }
    }.insertRealExecutor(mapQryExec));
    SqlQuery<String, Organization> qry = new SqlQuery<>(Organization.class, ORG_SQL);
    qry.setDistributedJoins(true);
    try {
        orgCache.query(qry).getAll();
    } catch (CacheException e) {
        assertTrue(e.getMessage().contains("Failed to reserve partitions for query (partition of REPLICATED cache is not in OWNING state) ["));
        return;
    } finally {
        GridTestUtils.setFieldValue(h2Idx, "mapQryExec", mapQryExec);
    }
    fail();
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) Organization(org.apache.ignite.internal.processors.query.h2.twostep.JoinSqlTestHelper.Organization) SqlQuery(org.apache.ignite.cache.query.SqlQuery) CacheException(javax.cache.CacheException) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridH2QueryRequest(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest) AtomicLong(java.util.concurrent.atomic.AtomicLong) GridDhtLocalPartition(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition) Ignore(org.junit.Ignore) AbstractIndexingCommonTest(org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest) Test(org.junit.Test)

Aggregations

ClusterNode (org.apache.ignite.cluster.ClusterNode)5 GridH2QueryRequest (org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest)5 CacheException (javax.cache.CacheException)4 AbstractIndexingCommonTest (org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest)4 Person (org.apache.ignite.internal.processors.query.h2.twostep.JoinSqlTestHelper.Person)4 Test (org.junit.Test)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 GridKernalContext (org.apache.ignite.internal.GridKernalContext)2 GridReservable (org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable)2 GridDhtLocalPartition (org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition)2 Organization (org.apache.ignite.internal.processors.query.h2.twostep.JoinSqlTestHelper.Organization)2 Ignite (org.apache.ignite.Ignite)1 IgniteException (org.apache.ignite.IgniteException)1 SqlQuery (org.apache.ignite.cache.query.SqlQuery)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 GridIoMessage (org.apache.ignite.internal.managers.communication.GridIoMessage)1 GridQueryProcessor (org.apache.ignite.internal.processors.query.GridQueryProcessor)1 GridQueryCancelRequest (org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest)1 Message (org.apache.ignite.plugin.extensions.communication.Message)1