Search in sources :

Example 56 with IgniteCacheDatabaseSharedManager

use of org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager in project ignite by apache.

the class PageMemoryLazyAllocationTest method testLazyMemoryAllocationOnServer.

/**
 * @throws Exception If failed.
 */
@Test
public void testLazyMemoryAllocationOnServer() throws Exception {
    lazyAllocation = true;
    IgniteEx srv = startSrv()[0];
    IgniteCacheDatabaseSharedManager db = srv.context().cache().context().database();
    checkMemoryAllocated(db.dataRegion(EAGER_REGION).pageMemory());
    checkMemoryNotAllocated(db.dataRegion(LAZY_REGION).pageMemory());
    createCacheAndPut(srv);
    checkMemoryAllocated(db.dataRegion(LAZY_REGION).pageMemory());
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 57 with IgniteCacheDatabaseSharedManager

use of org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager in project ignite by apache.

the class PageMemoryLazyAllocationTest method testEagerMemoryAllocationOnClient.

/**
 * @throws Exception If failed.
 */
@Test
public void testEagerMemoryAllocationOnClient() throws Exception {
    lazyAllocation = false;
    IgniteEx srv = startSrv()[0];
    IgniteCacheDatabaseSharedManager srvDb = srv.context().cache().context().database();
    checkMemoryAllocated(srvDb.dataRegion(EAGER_REGION).pageMemory());
    checkMemoryAllocated(srvDb.dataRegion(LAZY_REGION).pageMemory());
    IgniteEx clnt = startClientGrid(2);
    IgniteCacheDatabaseSharedManager clntDb = clnt.context().cache().context().database();
    checkMemoryNotAllocated(clntDb.dataRegion(EAGER_REGION).pageMemory());
    checkMemoryNotAllocated(clntDb.dataRegion(LAZY_REGION).pageMemory());
    createCacheAndPut(clnt);
    checkMemoryNotAllocated(clntDb.dataRegion(EAGER_REGION).pageMemory());
    checkMemoryNotAllocated(clntDb.dataRegion(LAZY_REGION).pageMemory());
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 58 with IgniteCacheDatabaseSharedManager

use of org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager in project ignite by apache.

the class ClusterReadOnlyModeSelfTest method testMetaStorageAvailableForUpdatesOnReadOnlyCluster.

/**
 */
@Test
public void testMetaStorageAvailableForUpdatesOnReadOnlyCluster() throws Exception {
    IgniteEx node = startGrid(0);
    node.cluster().state(ACTIVE);
    IgniteCacheDatabaseSharedManager db = node.context().cache().context().database();
    MetaStorage metaStorage = db.metaStorage();
    db.checkpointReadLock();
    try {
        metaStorage.write("key", "val");
    } finally {
        db.checkpointReadUnlock();
    }
    node.cluster().state(ACTIVE_READ_ONLY);
    db.checkpointReadLock();
    try {
        assertEquals("val", metaStorage.read("key"));
        metaStorage.write("key", "new_val");
        assertEquals("new_val", metaStorage.read("key"));
        metaStorage.remove("key");
        assertNull(metaStorage.read("key"));
    } finally {
        db.checkpointReadUnlock();
    }
}
Also used : MetaStorage(org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage) IgniteEx(org.apache.ignite.internal.IgniteEx) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)58 Test (org.junit.Test)27 IgniteEx (org.apache.ignite.internal.IgniteEx)24 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)20 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)11 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)10 GridInternalSubscriptionProcessor (org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor)9 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)8 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)8 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)8 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)7 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)7 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)7 IgniteWriteAheadLogManager (org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager)7 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)7 IgnitePluginProcessor (org.apache.ignite.internal.processors.plugin.IgnitePluginProcessor)6 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)6 HashMap (java.util.HashMap)5 GridEncryptionManager (org.apache.ignite.internal.managers.encryption.GridEncryptionManager)5 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)5