You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/25 09:40:41 UTC
[07/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
index 79387e3..88eacef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
@@ -45,10 +45,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
@@ -131,31 +130,20 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
cfg.setIncludeEventTypes(EventType.EVT_WAL_SEGMENT_ARCHIVED);
- final MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setPageSize(PAGE_SIZE);
-
- final MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(1024 * 1024 * 1024);
- memPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- final PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
- pCfg.setWalHistorySize(1);
- pCfg.setWalSegmentSize(1024 * 1024);
- pCfg.setWalSegments(WAL_SEGMENTS);
- pCfg.setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(1024 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(PAGE_SIZE)
+ .setWalHistorySize(1)
+ .setWalSegmentSize(1024 * 1024)
+ .setWalSegments(WAL_SEGMENTS)
+ .setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND);
if (archiveIncompleteSegmentAfterInactivityMs > 0)
- pCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);
+ memCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);
+
+ cfg.setDataStorageConfiguration(memCfg);
- cfg.setPersistentStoreConfiguration(pCfg);
return cfg;
}
@@ -510,8 +498,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
* @param factory WAL iterator factory.
* @param workDir Ignite work directory.
* @param subfolderName DB subfolder name based on consistent ID.
- * @param expCntEntries minimum expected entries count to find.
- * @param expTxCnt minimum expected transaction count to find.
+ * @param minCntEntries minimum expected entries count to find.
+ * @param minTxCnt minimum expected transaction count to find.
* @param objConsumer object handler, called for each object found in logical data records.
* @param dataRecordHnd data handler record
* @throws IgniteCheckedException if failed.
@@ -520,8 +508,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
final IgniteWalIteratorFactory factory,
final String workDir,
final String subfolderName,
- final int expCntEntries,
- final int expTxCnt,
+ final int minCntEntries,
+ final int minTxCnt,
@Nullable final BiConsumer<Object, Object> objConsumer,
@Nullable final Consumer<DataRecord> dataRecordHnd) throws IgniteCheckedException {
@@ -556,8 +544,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
final int entriesWork = valuesSum(cntWork.values());
log.info("Archive directory: Tx found " + txCntObservedWork + " entries " + entriesWork);
- assert entriesArch + entriesWork >= expCntEntries;
- assert txCntObservedWork + txCntObservedArch >= expTxCnt;
+ assert entriesArch + entriesWork >= minCntEntries;
+ assert txCntObservedWork + txCntObservedArch >= minTxCnt;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
index 05636eb..5c9e084 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
@@ -21,8 +21,8 @@ import java.io.File;
import java.io.Serializable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
@@ -86,20 +86,20 @@ public class MockWalIteratorFactory {
* @throws IgniteCheckedException if IO failed
*/
public WALIterator iterator(File wal, File walArchive) throws IgniteCheckedException {
- final PersistentStoreConfiguration persistentCfg1 = Mockito.mock(PersistentStoreConfiguration.class);
+ final DataStorageConfiguration persistentCfg1 = Mockito.mock(DataStorageConfiguration.class);
- when(persistentCfg1.getWalStorePath()).thenReturn(wal.getAbsolutePath());
+ when(persistentCfg1.getWalPath()).thenReturn(wal.getAbsolutePath());
when(persistentCfg1.getWalArchivePath()).thenReturn(walArchive.getAbsolutePath());
when(persistentCfg1.getWalSegments()).thenReturn(segments);
- when(persistentCfg1.getTlbSize()).thenReturn(PersistentStoreConfiguration.DFLT_TLB_SIZE);
- when(persistentCfg1.getWalRecordIteratorBufferSize()).thenReturn(PersistentStoreConfiguration.DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE);
+ when(persistentCfg1.getWalThreadLocalBufferSize()).thenReturn(DataStorageConfiguration.DFLT_TLB_SIZE);
+ when(persistentCfg1.getWalRecordIteratorBufferSize()).thenReturn(DataStorageConfiguration.DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE);
- final FileIOFactory fileIOFactory = new PersistentStoreConfiguration().getFileIOFactory();
+ final FileIOFactory fileIOFactory = new DataStorageConfiguration().getFileIOFactory();
when(persistentCfg1.getFileIOFactory()).thenReturn(fileIOFactory);
final IgniteConfiguration cfg = Mockito.mock(IgniteConfiguration.class);
- when(cfg.getPersistentStoreConfiguration()).thenReturn(persistentCfg1);
+ when(cfg.getDataStorageConfiguration()).thenReturn(persistentCfg1);
final GridKernalContext ctx = Mockito.mock(GridKernalContext.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
index 56d09f8..d6bfe10 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
import org.apache.ignite.internal.util.typedef.CIX3;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
@@ -82,7 +82,7 @@ public class BPlusTreePageMemoryImplTest extends BPlusTreeSelfTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
index 39183b2..dabd532 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.BPlusTreeReuseSelfTest;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -82,7 +82,7 @@ public class BPlusTreeReuseListPageMemoryImplTest extends BPlusTreeReuseSelfTest
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
index a427c63..d5492ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.io.File;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -97,7 +97,7 @@ public class MetadataStoragePageMemoryImplTest extends MetadataStorageSelfTest{
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
index 467ede4..db6d321 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.io.File;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoLoadSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -88,7 +88,7 @@ public class PageMemoryImplNoLoadTest extends PageMemoryNoLoadSelfTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
index c5997fa..92c5ad6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
@@ -110,7 +110,7 @@ public class PageMemoryImplTest extends GridCommonAbstractTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
index e3de493..30fb492 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
@@ -24,15 +24,14 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -66,16 +65,18 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(4000L * 1024 * 1024)
+ .setName("dfltDataRegion")
+ .setMetricsEnabled(true)
+ .setPersistenceEnabled(true))
+ .setWalMode(WALMode.BACKGROUND)
+ .setCheckpointFrequency(20_000)
+ .setCheckpointPageBufferSize(1000L * 1000 * 1000)
+ .setWriteThrottlingEnabled(true);
- dbCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setMaxSize(4000L * 1024 * 1024)
- .setName("dfltMemPlc")
- .setMetricsEnabled(true));
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -86,13 +87,6 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.BACKGROUND)
- .setCheckpointingFrequency(20_000)
- .setCheckpointingPageBufferSize(1000L * 1000 * 1000)
- .setWriteThrottlingEnabled(true));
-
cfg.setConsistentId(gridName);
return cfg;
@@ -155,8 +149,8 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
while (run.get()) {
long dirtyPages = 0;
- for (MemoryMetrics m : ig.memoryMetrics())
- if (m.getName().equals("dfltMemPlc"))
+ for (DataRegionMetrics m : ig.dataRegionMetrics())
+ if (m.getName().equals("dfltDataRegion"))
dirtyPages = m.getDirtyPages();
long cpBufPages = 0;
@@ -170,7 +164,7 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
try {
cpBufPages = ((PageMemoryImpl)((IgniteEx)ignite(0)).context().cache().context().database()
- .memoryPolicy("dfltMemPlc").pageMemory()).checkpointBufferPagesCount();
+ .dataRegion("dfltDataRegion").pageMemory()).checkpointBufferPagesCount();
}
catch (IgniteCheckedException e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
index 70a1df8..ab7aab4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
@@ -31,10 +31,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -64,7 +63,7 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** Slow checkpoint enabled. */
- private final AtomicBoolean slowCheckpointEnabled = new AtomicBoolean(true);
+ private static final AtomicBoolean slowCheckpointEnabled = new AtomicBoolean(true);
/** Cache name. */
private static final String CACHE_NAME = "cache1";
@@ -76,16 +75,20 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setMaxSize(400 * 1024 * 1024)
- .setName("dfltMemPlc")
- .setMetricsEnabled(true));
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(400 * 1024 * 1024)
+ .setName("dfltDataRegion")
+ .setMetricsEnabled(true)
+ .setPersistenceEnabled(true))
+ .setWalMode(WALMode.BACKGROUND)
+ .setCheckpointFrequency(20_000)
+ .setCheckpointPageBufferSize(200 * 1000 * 1000)
+ .setWriteThrottlingEnabled(true)
+ .setCheckpointThreads(1)
+ .setFileIOFactory(new SlowCheckpointFileIOFactory());
+
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -96,15 +99,6 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.BACKGROUND)
- .setCheckpointingFrequency(20_000)
- .setCheckpointingPageBufferSize(200 * 1000 * 1000)
- .setWriteThrottlingEnabled(true)
- .setCheckpointingThreads(1)
- .setFileIOFactory(new SlowCheckpointFileIOFactory()));
-
cfg.setConsistentId(gridName);
return cfg;
@@ -285,7 +279,7 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
/**
* Create File I/O that emulates poor checkpoint write speed.
*/
- private class SlowCheckpointFileIOFactory implements FileIOFactory {
+ private static class SlowCheckpointFileIOFactory implements FileIOFactory {
/** Serial version uid. */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
index 436db1c..66e5b17 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
@@ -23,8 +23,9 @@ import java.util.List;
import java.util.Map;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -308,7 +309,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/** {@inheritDoc} */
protected IgniteConfiguration persistentCfg(IgniteConfiguration cfg) throws Exception {
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
index 4e575cc..71107d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
@@ -23,10 +23,10 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -340,28 +340,21 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setPersistentStorePath(testName() + "/db");
+ pCfg.setStoragePath(testName() + "/db");
pCfg.setWalArchivePath(testName() + "/db/wal/archive");
- pCfg.setWalStorePath(testName() + "/db/wal");
+ pCfg.setWalPath(testName() + "/db/wal");
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setPageSize(1024);
+ pCfg.setConcurrencyLevel(64);
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ pCfg.setWalMode(WALMode.LOG_ONLY);
- memCfg.setPageSize(1024);
- memCfg.setConcurrencyLevel(64);
+ pCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true));
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
index 44e0357..e6c9ae5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
@@ -49,6 +49,8 @@ public class IgniteChangeGlobalStateServiceTest extends IgniteChangeGlobalStateA
*
*/
public void testDeployService() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-6629");
+
Ignite ig1P = primary(0);
Ignite ig1B = backUp(0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index 77f89ba..300f9f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -28,8 +28,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -68,7 +69,12 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(vmIpFinder));
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
+
cfg.setConsistentId(igniteInstanceName);
return cfg;
@@ -178,7 +184,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
Map<String, DynamicCacheDescriptor> desc = U.field(
- U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
+ (Object)U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
assertEquals(4, desc.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
index f70dd1e..6ca29d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
@@ -21,11 +21,11 @@ import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeFullApiSelfTest;
@@ -61,31 +61,21 @@ public class GridActivateExtensionTest extends GridCacheAbstractFullApiSelfTest
cfg.setConsistentId("ConsId" + (condId++));
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(primaryIpFinder);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setPersistentStorePath(testName + "/db");
+ pCfg.setStoragePath(testName + "/db");
pCfg.setWalArchivePath(testName + "/db/wal/archive");
- pCfg.setWalStorePath(testName + "/db/wal");
+ pCfg.setWalPath(testName + "/db/wal");
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true));
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ pCfg.setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ pCfg.setPageSize(1024);
+ pCfg.setConcurrencyLevel(64);
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setMemoryPolicies(memPlcCfg);
-
- memCfg.setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- memCfg.setPageSize(1024);
- memCfg.setConcurrencyLevel(64);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
index 59dcce2..5552d70 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
@@ -25,8 +25,9 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteEx;
@@ -109,7 +110,11 @@ public abstract class IgniteAbstractStandByClientReconnectTest extends GridCommo
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(clientIpFinder));
}
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
+
cfg.setConsistentId(name);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
index 85d68d3..5baa3a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
@@ -33,8 +33,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
@@ -90,10 +90,10 @@ public class IgniteCacheContinuousQueryBackupQueueTest extends GridCommonAbstrac
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(16 * 1024);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
index 530009b..4e760bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
@@ -21,11 +21,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.CAX;
-import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -63,17 +61,10 @@ public class TxDeadlockCauseTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(discoSpi);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setMaxSize(100L * 1024 * 1024);
-
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg0 = ccfg == null ? new CacheConfiguration(DEFAULT_CACHE_NAME)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) : ccfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
index 82fa52c..60f1c96 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
@@ -34,8 +34,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -89,17 +89,12 @@ public class TxPessimisticDeadlockDetectionTest extends AbstractDeadlockDetectio
cfg.setDiscoverySpi(discoSpi);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE * 10)
+ .setName("dfltPlc"));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setMaxSize(MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE * 10);
-
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setClientMode(client);
@@ -196,7 +191,7 @@ public class TxPessimisticDeadlockDetectionTest extends AbstractDeadlockDetectio
ccfg.setWriteSynchronizationMode(syncMode);
if (cacheMode == LOCAL)
- ccfg.setMemoryPolicyName("dfltPlc");
+ ccfg.setDataRegionName("dfltPlc");
IgniteCache cache = ignite(0).createCache(ccfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index 9c0d791..7b4ca13 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLongArray;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -42,7 +42,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.persistence.DataStructure;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO;
@@ -1795,7 +1795,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
* @return Page memory.
*/
protected PageMemory createPageMemory() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
@@ -1804,7 +1804,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg), true);
+ new DataRegionMetricsImpl(plcCfg), true);
pageMem.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
new file mode 100644
index 0000000..22e87b8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.database;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static java.lang.Thread.sleep;
+
+/**
+ *
+ */
+public class DataRegionMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private int threadsCnt = 1;
+
+ /** */
+ private Thread[] allocationThreads;
+
+ /** */
+ private Thread watcherThread;
+
+ /** */
+ private static final int RATE_TIME_INTERVAL_1 = 5_000;
+
+ /** */
+ private static final int RATE_TIME_INTERVAL_2 = 10_000;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration();
+
+ memMetrics = new DataRegionMetricsImpl(plcCfg);
+
+ memMetrics.enableMetrics();
+ }
+
+ /**
+ * Test for allocationRate metric in single-threaded mode.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateSingleThreaded() throws Exception {
+ threadsCnt = 1;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_2);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 340, 50);
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_2, 5);
+
+ startLatch.countDown();
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 3);
+
+ assertTrue(watcher.rateDropsCntr < 6);
+ }
+
+ /**
+ * Test for allocationRate metric in multi-threaded mode with short silent period in the middle of the test.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateMultiThreaded() throws Exception {
+ threadsCnt = 4;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 7_800, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ joinAllocationThreads();
+
+ assertTrue("4 or 5 rate drops must be observed: " + watcher.rateDropsCntr, watcher.rateDropsCntr == 4 || watcher.rateDropsCntr == 5);
+
+ sleep(3);
+
+ threadsCnt = 8;
+
+ CountDownLatch restartLatch = new CountDownLatch(1);
+
+ startAllocationThreads(restartLatch, 8_000, 1);
+
+ restartLatch.countDown();
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ * Test verifies that allocationRate calculation algorithm survives setting new values to rateTimeInterval parameter.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateTimeIntervalConcurrentChange() throws Exception {
+ threadsCnt = 5;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 10_000, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ for (int i = 0; i < 10; i++) {
+ Thread.sleep(25);
+
+ memMetrics.rateTimeInterval(((2 + i * 5) % 3 + 1) * 1000);
+ }
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ *
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateSubintervalsConcurrentChange() throws Exception {
+ threadsCnt = 5;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 10_000, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ for (int i = 0; i < 10; i++) {
+ Thread.sleep(25);
+
+ memMetrics.subIntervals((2 + i * 5) % 3 + 2);
+ }
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ * As rate metrics {@link HitRateMetrics implementation} is tied to absolute time ticks
+ * (not related to the first hit) all tests need to align start time with this sequence of ticks.
+ *
+ * @param rateTimeInterval Rate time interval.
+ * @param size Size.
+ */
+ private void alignWithTimeInterval(int rateTimeInterval, int size) throws InterruptedException {
+ int subIntervalLength = rateTimeInterval / size;
+
+ long subIntCurTime = System.currentTimeMillis() % subIntervalLength;
+
+ Thread.sleep(subIntervalLength - subIntCurTime);
+ }
+
+ /**
+ * @param startLatch Start latch.
+ * @param watchingDelay Watching delay.
+ */
+ private AllocationRateWatcher startWatcherThread(CountDownLatch startLatch, int watchingDelay) {
+ AllocationRateWatcher watcher = new AllocationRateWatcher(startLatch, memMetrics, watchingDelay);
+
+ watcherThread = new Thread(watcher);
+
+ watcherThread.start();
+
+ return watcher;
+ }
+
+ /**
+ * @param startLatch Start latch.
+ * @param iterationsCnt Iterations count.
+ * @param allocationsDelay Allocations delay.
+ */
+ private void startAllocationThreads(CountDownLatch startLatch, int iterationsCnt, int allocationsDelay) {
+ assert threadsCnt > 0;
+
+ allocationThreads = new Thread[threadsCnt];
+
+ for (int i = 0; i < threadsCnt; i++) {
+ AllocationsIncrementer inc = new AllocationsIncrementer(startLatch, memMetrics, iterationsCnt, allocationsDelay);
+
+ Thread incThread = new Thread(inc);
+ incThread.start();
+
+ allocationThreads[i] = incThread;
+ }
+ }
+
+ /**
+ *
+ */
+ private void joinAllThreads() throws Exception {
+ joinAllocationThreads();
+
+ watcherThread.interrupt();
+ watcherThread.join();
+ }
+
+ /**
+ *
+ */
+ private void joinAllocationThreads() throws Exception {
+ assert allocationThreads != null;
+ assert allocationThreads.length > 0;
+
+ for (Thread allocationThread : allocationThreads)
+ allocationThread.join();
+ }
+
+ /**
+ *
+ */
+ private static class AllocationsIncrementer implements Runnable {
+ /** */
+ private final CountDownLatch startLatch;
+
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final int iterationsCnt;
+
+ /** */
+ private final int delay;
+
+ /**
+ * @param startLatch Start latch.
+ * @param memMetrics Mem metrics.
+ * @param iterationsCnt Iterations count.
+ * @param delay Delay.
+ */
+ private AllocationsIncrementer(CountDownLatch startLatch, DataRegionMetricsImpl memMetrics, int iterationsCnt, int delay) {
+ this.startLatch = startLatch;
+ this.memMetrics = memMetrics;
+ this.iterationsCnt = iterationsCnt;
+ this.delay = delay;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ startLatch.await();
+
+ for (int i = 0; i < iterationsCnt; i++) {
+ memMetrics.incrementTotalAllocatedPages();
+
+ sleep(delay);
+ }
+ }
+ catch (InterruptedException ignore) {
+ // No-op.
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static class AllocationRateWatcher implements Runnable {
+ /** */
+ private volatile int rateDropsCntr;
+
+ /** */
+ private final CountDownLatch startLatch;
+
+ /** */
+ private final DataRegionMetrics memMetrics;
+
+ /** */
+ private final int delay;
+
+ /**
+ * @param startLatch Start latch.
+ * @param memMetrics Mem metrics.
+ * @param delay Delay.
+ */
+ private AllocationRateWatcher(CountDownLatch startLatch, DataRegionMetrics memMetrics, int delay) {
+ this.startLatch = startLatch;
+ this.memMetrics = memMetrics;
+ this.delay = delay;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ startLatch.await();
+
+ float prevRate = 0;
+
+ while (!Thread.currentThread().isInterrupted()) {
+ if (prevRate > memMetrics.getAllocationRate())
+ rateDropsCntr++;
+
+ prevRate = memMetrics.getAllocationRate();
+
+ sleep(delay);
+ }
+ }
+ catch (InterruptedException ignore) {
+ // No-op.
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
index c190b1d..72a1d81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageMemory;
@@ -40,8 +40,8 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeListImpl;
@@ -315,13 +315,13 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
/**
* @return Page memory.
*/
- protected PageMemory createPageMemory(int pageSize, MemoryPolicyConfiguration plcCfg) throws Exception {
+ protected PageMemory createPageMemory(int pageSize, DataRegionConfiguration plcCfg) throws Exception {
PageMemory pageMem = new PageMemoryNoStoreImpl(log,
new UnsafeMemoryProvider(log),
null,
pageSize,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
pageMem.start();
@@ -335,7 +335,7 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
protected FreeList createFreeList(int pageSize) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
@@ -343,9 +343,9 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
- MemoryMetricsImpl metrics = new MemoryMetricsImpl(plcCfg);
+ DataRegionMetricsImpl metrics = new DataRegionMetricsImpl(plcCfg);
- MemoryPolicy memPlc = new MemoryPolicy(pageMem, plcCfg, metrics, new NoOpPageEvictionTracker());
+ DataRegion memPlc = new DataRegion(pageMem, plcCfg, metrics, new NoOpPageEvictionTracker());
return new FreeListImpl(1, "freelist", metrics, memPlc, null, null, metaPageId, true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
index c9e583f..1d5b624 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -63,7 +63,7 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
if (client)
cfg.setClientMode(true);
@@ -77,7 +77,7 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
configure(dbCfg);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
@@ -149,9 +149,9 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
}
/**
- * @param mCfg MemoryConfiguration.
+ * @param mCfg DataStorageConfiguration.
*/
- protected void configure(MemoryConfiguration mCfg){
+ protected void configure(DataStorageConfiguration mCfg){
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
index e745482..e5c0e8a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
@@ -25,9 +25,9 @@ import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -39,18 +39,10 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setInitialSize(200 * 1024 * 1024);
- plc.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setDefaultMemoryPolicyName("dfltPlc");
- dbCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
if (gridName.equals("client"))
cfg.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
index 93e5181..c4e8bee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
@@ -20,9 +20,9 @@ package org.apache.ignite.internal.processors.database;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.persistence.DataStructure;
@@ -34,7 +34,7 @@ import static org.apache.ignite.IgniteSystemProperties.getInteger;
*/
public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTest {
/** */
- private static final int CONCURRENCY_LEVEL = 8;
+ private static final int CONCURRENCY_LEVEL = 16;
/** */
private static final int MIN_PAGE_CACHE_SIZE = 1048576 * CONCURRENCY_LEVEL;
@@ -76,13 +76,13 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
}
/** {@inheritDoc} */
- @Override protected void configure(MemoryConfiguration mCfg) {
+ @Override protected void configure(DataStorageConfiguration mCfg) {
mCfg.setConcurrencyLevel(CONCURRENCY_LEVEL);
long size = (1024 * (isLargePage() ? 16 : 1) + 24) * pagesMax();
- mCfg.setDefaultMemoryPolicyName("default").setMemoryPolicies(
- new MemoryPolicyConfiguration().setMaxSize(Math.max(size, MIN_PAGE_CACHE_SIZE)).setName("default"));
+ mCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(Math.max(size, MIN_PAGE_CACHE_SIZE)).setName("default"));
}
/**
@@ -234,7 +234,7 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
* @throws Exception If failed.
*/
protected final void check(IgniteCache cache) throws Exception {
- long pagesActual = ((IgniteCacheProxy)cache).context().memoryPolicy().pageMemory().loadedPages();
+ long pagesActual = ((IgniteCacheProxy)cache).context().dataRegion().pageMemory().loadedPages();
if (loadedPages > 0) {
delta += pagesActual - loadedPages;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
deleted file mode 100644
index 7fc1035..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.processors.database;
-
-import java.util.concurrent.CountDownLatch;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static java.lang.Thread.sleep;
-
-/**
- *
- */
-public class MemoryMetricsSelfTest extends GridCommonAbstractTest {
- /** */
- private MemoryMetricsImpl memMetrics;
-
- /** */
- private int threadsCnt = 1;
-
- /** */
- private Thread[] allocationThreads;
-
- /** */
- private Thread watcherThread;
-
- /** */
- private static final int RATE_TIME_INTERVAL_1 = 5_000;
-
- /** */
- private static final int RATE_TIME_INTERVAL_2 = 10_000;
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration();
-
- memMetrics = new MemoryMetricsImpl(plcCfg);
-
- memMetrics.enableMetrics();
- }
-
- /**
- * Test for allocationRate metric in single-threaded mode.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateSingleThreaded() throws Exception {
- threadsCnt = 1;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_2);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 340, 50);
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_2, 5);
-
- startLatch.countDown();
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 3);
-
- assertTrue(watcher.rateDropsCntr < 6);
- }
-
- /**
- * Test for allocationRate metric in multi-threaded mode with short silent period in the middle of the test.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateMultiThreaded() throws Exception {
- threadsCnt = 4;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 7_800, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- joinAllocationThreads();
-
- assertTrue("4 or 5 rate drops must be observed: " + watcher.rateDropsCntr, watcher.rateDropsCntr == 4 || watcher.rateDropsCntr == 5);
-
- sleep(3);
-
- threadsCnt = 8;
-
- CountDownLatch restartLatch = new CountDownLatch(1);
-
- startAllocationThreads(restartLatch, 8_000, 1);
-
- restartLatch.countDown();
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- * Test verifies that allocationRate calculation algorithm survives setting new values to rateTimeInterval parameter.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateTimeIntervalConcurrentChange() throws Exception {
- threadsCnt = 5;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 10_000, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- for (int i = 0; i < 10; i++) {
- Thread.sleep(25);
-
- memMetrics.rateTimeInterval(((2 + i * 5) % 3 + 1) * 1000);
- }
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- *
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateSubintervalsConcurrentChange() throws Exception {
- threadsCnt = 5;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 10_000, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- for (int i = 0; i < 10; i++) {
- Thread.sleep(25);
-
- memMetrics.subIntervals((2 + i * 5) % 3 + 2);
- }
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- * As rate metrics {@link HitRateMetrics implementation} is tied to absolute time ticks
- * (not related to the first hit) all tests need to align start time with this sequence of ticks.
- *
- * @param rateTimeInterval Rate time interval.
- * @param size Size.
- */
- private void alignWithTimeInterval(int rateTimeInterval, int size) throws InterruptedException {
- int subIntervalLength = rateTimeInterval / size;
-
- long subIntCurTime = System.currentTimeMillis() % subIntervalLength;
-
- Thread.sleep(subIntervalLength - subIntCurTime);
- }
-
- /**
- * @param startLatch Start latch.
- * @param watchingDelay Watching delay.
- */
- private AllocationRateWatcher startWatcherThread(CountDownLatch startLatch, int watchingDelay) {
- AllocationRateWatcher watcher = new AllocationRateWatcher(startLatch, memMetrics, watchingDelay);
-
- watcherThread = new Thread(watcher);
-
- watcherThread.start();
-
- return watcher;
- }
-
- /**
- * @param startLatch Start latch.
- * @param iterationsCnt Iterations count.
- * @param allocationsDelay Allocations delay.
- */
- private void startAllocationThreads(CountDownLatch startLatch, int iterationsCnt, int allocationsDelay) {
- assert threadsCnt > 0;
-
- allocationThreads = new Thread[threadsCnt];
-
- for (int i = 0; i < threadsCnt; i++) {
- AllocationsIncrementer inc = new AllocationsIncrementer(startLatch, memMetrics, iterationsCnt, allocationsDelay);
-
- Thread incThread = new Thread(inc);
- incThread.start();
-
- allocationThreads[i] = incThread;
- }
- }
-
- /**
- *
- */
- private void joinAllThreads() throws Exception {
- joinAllocationThreads();
-
- watcherThread.interrupt();
- watcherThread.join();
- }
-
- /**
- *
- */
- private void joinAllocationThreads() throws Exception {
- assert allocationThreads != null;
- assert allocationThreads.length > 0;
-
- for (Thread allocationThread : allocationThreads)
- allocationThread.join();
- }
-
- /**
- *
- */
- private static class AllocationsIncrementer implements Runnable {
- /** */
- private final CountDownLatch startLatch;
-
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final int iterationsCnt;
-
- /** */
- private final int delay;
-
- /**
- * @param startLatch Start latch.
- * @param memMetrics Mem metrics.
- * @param iterationsCnt Iterations count.
- * @param delay Delay.
- */
- private AllocationsIncrementer(CountDownLatch startLatch, MemoryMetricsImpl memMetrics, int iterationsCnt, int delay) {
- this.startLatch = startLatch;
- this.memMetrics = memMetrics;
- this.iterationsCnt = iterationsCnt;
- this.delay = delay;
- }
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- startLatch.await();
-
- for (int i = 0; i < iterationsCnt; i++) {
- memMetrics.incrementTotalAllocatedPages();
-
- sleep(delay);
- }
- }
- catch (InterruptedException ignore) {
- // No-op.
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- *
- */
- private static class AllocationRateWatcher implements Runnable {
- /** */
- private volatile int rateDropsCntr;
-
- /** */
- private final CountDownLatch startLatch;
-
- /** */
- private final MemoryMetrics memMetrics;
-
- /** */
- private final int delay;
-
- /**
- * @param startLatch Start latch.
- * @param memMetrics Mem metrics.
- * @param delay Delay.
- */
- private AllocationRateWatcher(CountDownLatch startLatch, MemoryMetrics memMetrics, int delay) {
- this.startLatch = startLatch;
- this.memMetrics = memMetrics;
- this.delay = delay;
- }
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- startLatch.await();
-
- float prevRate = 0;
-
- while (!Thread.currentThread().isInterrupted()) {
- if (prevRate > memMetrics.getAllocationRate())
- rateDropsCntr++;
-
- prevRate = memMetrics.getAllocationRate();
-
- sleep(delay);
- }
- }
- catch (InterruptedException ignore) {
- // No-op.
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-}