IGNITE-6030 Allow enabling persistence per data region
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec41370c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec41370c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec41370c Branch: refs/heads/ignite-5937 Commit: ec41370c4da65c01e9b7c584e0706c40e4171b35 Parents: 173ecef Author: Ivan Rakov <[email protected]> Authored: Fri Oct 20 10:29:57 2017 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Fri Oct 20 10:29:57 2017 +0300 ---------------------------------------------------------------------- examples/config/example-data-regions.xml | 106 +++ examples/config/example-memory-policies.xml | 108 --- .../example-persistent-store.xml | 14 +- .../examples/datagrid/DataRegionsExample.java | 113 +++ .../datagrid/MemoryPoliciesExample.java | 114 --- .../ignite/examples/CacheExamplesSelfTest.java | 6 +- .../benchmarks/jmh/tree/BPlusTreeBenchmark.java | 8 +- .../DummyPersistenceCompatibilityTest.java | 8 +- .../org/apache/ignite/DataRegionMetrics.java | 119 +++ .../apache/ignite/DataRegionMetricsAdapter.java | 106 +++ .../org/apache/ignite/DataStorageMetrics.java | 114 +++ .../ignite/DataStorageMetricsAdapter.java | 101 +++ .../src/main/java/org/apache/ignite/Ignite.java | 48 +- .../apache/ignite/IgniteSystemProperties.java | 4 +- .../java/org/apache/ignite/MemoryMetrics.java | 11 +- .../org/apache/ignite/PersistenceMetrics.java | 4 +- .../configuration/CacheConfiguration.java | 36 +- .../configuration/DataPageEvictionMode.java | 8 +- .../configuration/DataRegionConfiguration.java | 406 +++++++++ .../configuration/DataStorageConfiguration.java | 882 +++++++++++++++++++ .../configuration/IgniteConfiguration.java | 46 +- .../configuration/MemoryConfiguration.java | 9 +- .../MemoryPolicyConfiguration.java | 32 +- .../PersistentStoreConfiguration.java | 4 +- .../org/apache/ignite/igfs/IgfsMetrics.java | 4 +- .../apache/ignite/internal/IgniteKernal.java | 77 +- .../ignite/internal/IgniteNodeAttributes.java | 4 + .../org/apache/ignite/internal/IgnitionEx.java | 132 ++- .../ignite/internal/MarshallerContextImpl.java | 3 +- .../discovery/GridDiscoveryManager.java | 31 +- .../pagemem/impl/PageMemoryNoStoreImpl.java | 32 +- .../cache/CacheAffinitySharedManager.java | 4 +- .../processors/cache/CacheGroupContext.java | 29 +- .../processors/cache/CacheGroupData.java | 17 +- .../processors/cache/CacheGroupDescriptor.java | 19 +- .../processors/cache/ClusterCachesInfo.java | 13 +- .../processors/cache/GridCacheAdapter.java | 3 +- .../processors/cache/GridCacheContext.java | 8 +- .../processors/cache/GridCacheMapEntry.java | 10 +- .../processors/cache/GridCacheProcessor.java | 55 +- .../processors/cache/GridCacheUtils.java | 55 ++ .../cache/IgniteCacheOffheapManagerImpl.java | 6 +- .../cache/binary/BinaryMetadataFileStore.java | 7 +- .../GridDistributedTxRemoteAdapter.java | 5 +- .../distributed/dht/GridDhtLocalPartition.java | 2 +- .../dht/atomic/GridDhtAtomicCache.java | 3 +- .../distributed/near/GridNearGetRequest.java | 2 +- .../distributed/near/GridNearLockRequest.java | 2 +- .../cache/distributed/near/GridNearTxLocal.java | 2 +- .../near/GridNearTxPrepareRequest.java | 2 +- .../local/atomic/GridLocalAtomicCache.java | 2 +- .../cache/persistence/CacheDataRowAdapter.java | 2 +- .../cache/persistence/DataRegion.java | 84 ++ .../persistence/DataRegionMetricsImpl.java | 286 ++++++ .../DataRegionMetricsMXBeanImpl.java | 131 +++ .../persistence/DataRegionMetricsSnapshot.java | 112 +++ .../persistence/DataStorageMetricsImpl.java | 297 +++++++ .../persistence/DataStorageMetricsSnapshot.java | 144 +++ .../GridCacheDatabaseSharedManager.java | 166 ++-- .../persistence/GridCacheOffheapManager.java | 22 +- .../IgniteCacheDatabaseSharedManager.java | 538 +++++------ .../cache/persistence/MemoryMetricsImpl.java | 286 ------ .../persistence/MemoryMetricsMXBeanImpl.java | 131 --- .../persistence/MemoryMetricsSnapshot.java | 112 --- .../cache/persistence/MemoryPolicy.java | 84 -- .../persistence/PersistenceMetricsImpl.java | 297 ------- .../persistence/PersistenceMetricsSnapshot.java | 144 --- .../processors/cache/persistence/RowStore.java | 38 +- .../evict/FairFifoPageEvictionTracker.java | 6 +- .../evict/PageAbstractEvictionTracker.java | 6 +- .../evict/Random2LruPageEvictionTracker.java | 8 +- .../evict/RandomLruPageEvictionTracker.java | 8 +- .../persistence/file/AsyncFileIOFactory.java | 28 +- .../cache/persistence/file/FilePageStore.java | 6 +- .../persistence/file/FilePageStoreManager.java | 12 +- .../cache/persistence/file/FilePageStoreV2.java | 4 +- .../file/FileVersionCheckingFactory.java | 6 +- .../filename/PdsConsistentIdProcessor.java | 11 +- .../persistence/freelist/FreeListImpl.java | 12 +- .../cache/persistence/freelist/PagesList.java | 7 +- .../persistence/pagemem/PageMemoryImpl.java | 8 +- .../wal/FileWriteAheadLogManager.java | 77 +- .../wal/reader/IgniteWalIteratorFactory.java | 12 +- .../wal/reader/StandaloneGridKernalContext.java | 11 +- .../cache/ratemetrics/HitRateMetrics.java | 2 +- .../transactions/IgniteTxLocalAdapter.java | 2 +- .../processors/cache/tree/CacheDataTree.java | 4 +- .../cache/tree/PendingEntriesTree.java | 2 +- .../cluster/GridClusterStateProcessor.java | 3 +- .../processors/igfs/IgfsDataManager.java | 4 +- .../processors/query/GridQueryProcessor.java | 3 +- .../visor/cache/VisorCacheConfiguration.java | 8 +- .../visor/cache/VisorMemoryMetrics.java | 6 +- .../node/VisorDataRegionConfiguration.java | 225 +++++ .../node/VisorDataStorageConfiguration.java | 453 ++++++++++ .../visor/node/VisorGridConfiguration.java | 29 +- .../visor/node/VisorMemoryConfiguration.java | 26 +- .../node/VisorMemoryPolicyConfiguration.java | 10 +- .../visor/node/VisorNodeDataCollectorJob.java | 6 +- .../node/VisorNodeDataCollectorJobResult.java | 4 +- .../node/VisorNodeDataCollectorTaskResult.java | 4 +- .../visor/node/VisorPersistenceMetrics.java | 6 +- .../node/VisorPersistentStoreConfiguration.java | 22 +- .../ignite/mxbean/DataRegionMetricsMXBean.java | 139 +++ .../ignite/mxbean/DataStorageMetricsMXBean.java | 121 +++ .../ignite/mxbean/MemoryMetricsMXBean.java | 2 + .../ignite/mxbean/PersistenceMetricsMXBean.java | 2 + .../resources/META-INF/classnames.properties | 6 +- .../core/src/test/config/examples.properties | 2 +- .../ignite/cache/LargeEntryUpdateTest.java | 6 +- .../internal/ClusterNodeMetricsSelfTest.java | 8 +- .../IgniteSlowClientDetectionSelfTest.java | 6 +- .../pagemem/impl/PageMemoryNoLoadSelfTest.java | 8 +- .../cache/CacheClientStoreSelfTest.java | 4 +- .../cache/CacheConfigurationLeakTest.java | 15 +- .../cache/CacheDataRegionConfigurationTest.java | 172 ++++ .../CacheMemoryPolicyConfigurationTest.java | 172 ---- .../cache/CacheStopAndDestroySelfTest.java | 10 +- ...StorageConfigurationConsistencySelfTest.java | 79 ++ ...dMemoryConfigurationConsistencySelfTest.java | 79 -- .../IgniteClusterActivateDeactivateTest.java | 32 +- ...erActivateDeactivateTestWithPersistence.java | 30 +- .../cache/MemoryPolicyConfigValidationTest.java | 24 +- ...AffinityCoordinatorDynamicStartStopTest.java | 15 +- .../distributed/Cache64kPartitionsTest.java | 14 +- .../CacheLateAffinityAssignmentTest.java | 9 +- .../cache/distributed/CacheStartOnJoinTest.java | 9 +- .../paged/PageEvictionAbstractTest.java | 25 +- .../expiry/IgniteCacheLargeValueExpireTest.java | 6 +- .../IgniteDataStorageMetricsSelfTest.java | 237 +++++ ...tePdsBinaryMetadataOnClusterRestartTest.java | 10 +- .../IgnitePdsCacheRebalancingAbstractTest.java | 25 +- .../IgnitePdsClientNearCachePutGetTest.java | 6 +- .../IgnitePdsContinuousRestartTest.java | 28 +- .../persistence/IgnitePdsDynamicCacheTest.java | 28 +- .../IgnitePdsExchangeDuringCheckpointTest.java | 41 +- ...MarshallerMappingRestoreOnNodeStartTest.java | 6 +- .../IgnitePdsMultiNodePutGetRestartTest.java | 24 +- .../persistence/IgnitePdsPageSizesTest.java | 29 +- ...gnitePdsRecoveryAfterFileCorruptionTest.java | 39 +- .../IgnitePdsRemoveDuringRebalancingTest.java | 35 +- ...gnitePdsSingleNodePutGetPersistenceTest.java | 6 +- .../IgnitePersistenceMetricsSelfTest.java | 225 ----- ...nitePersistenceSequentialCheckpointTest.java | 6 +- .../IgnitePersistentStoreCacheGroupsTest.java | 16 +- ...IgnitePersistentStoreDataStructuresTest.java | 23 +- .../MemoryPolicyInitializationTest.java | 22 +- .../db/IgnitePdsCacheRestoreTest.java | 45 +- .../db/IgnitePdsMultiNodePutGetRestartTest.java | 23 +- ...PdsPageEvictionDuringPartitionClearTest.java | 29 +- .../db/IgnitePdsPageEvictionTest.java | 30 +- ...tePdsRebalancingOnNotStableTopologyTest.java | 28 +- .../db/IgnitePdsTransactionsHangTest.java | 26 +- .../db/IgnitePdsWholeClusterRestartTest.java | 26 +- ...faultPageSizeBackwardsCompatibilityTest.java | 21 +- .../db/file/IgnitePdsCacheIntegrationTest.java | 29 +- ...ckpointSimulationWithRealCpDisabledTest.java | 25 +- .../db/file/IgnitePdsEvictionTest.java | 25 +- .../file/IgnitePdsNoActualWalHistoryTest.java | 22 +- .../file/IgnitePdsThreadInterruptionTest.java | 51 +- .../IgniteUidAsConsistentIdMigrationTest.java | 28 +- .../persistence/db/wal/IgnitePdsWalTlbTest.java | 30 +- .../db/wal/IgniteWalFlushFailoverTest.java | 29 +- .../wal/IgniteWalHistoryReservationsTest.java | 26 +- .../db/wal/IgniteWalRecoveryPPCTest.java | 321 +++++++ .../IgniteWalRecoverySeveralRestartsTest.java | 29 +- .../db/wal/IgniteWalRecoveryTest.java | 33 +- .../db/wal/IgniteWalSerializerVersionTest.java | 8 +- .../db/wal/WalRecoveryTxLogicalRecordsTest.java | 18 +- .../db/wal/reader/IgniteWalReaderTest.java | 50 +- .../db/wal/reader/MockWalIteratorFactory.java | 14 +- .../pagemem/BPlusTreePageMemoryImplTest.java | 6 +- .../BPlusTreeReuseListPageMemoryImplTest.java | 6 +- .../MetadataStoragePageMemoryImplTest.java | 6 +- .../pagemem/PageMemoryImplNoLoadTest.java | 6 +- .../persistence/pagemem/PageMemoryImplTest.java | 6 +- .../pagemem/PagesWriteThrottleSandboxTest.java | 40 +- .../pagemem/PagesWriteThrottleSmokeTest.java | 42 +- .../AbstractNodeJoinTemplate.java | 8 +- .../IgniteChangeGlobalStateAbstractTest.java | 31 +- .../IgniteChangeGlobalStateServiceTest.java | 2 + .../IgniteStandByClusterTest.java | 12 +- .../extended/GridActivateExtensionTest.java | 34 +- ...gniteAbstractStandByClientReconnectTest.java | 9 +- ...niteCacheContinuousQueryBackupQueueTest.java | 6 +- .../cache/transactions/TxDeadlockCauseTest.java | 15 +- .../TxPessimisticDeadlockDetectionTest.java | 21 +- .../processors/database/BPlusTreeSelfTest.java | 8 +- .../database/DataRegionMetricsSelfTest.java | 348 ++++++++ .../database/FreeListImplSelfTest.java | 16 +- .../database/IgniteDbAbstractTest.java | 10 +- .../database/IgniteDbDynamicCacheSelfTest.java | 18 +- .../IgniteDbMemoryLeakAbstractTest.java | 14 +- .../database/MemoryMetricsSelfTest.java | 348 -------- .../database/MetadataStorageSelfTest.java | 8 +- .../database/SwapPathConstructionSelfTest.java | 28 +- .../processors/igfs/IgfsIgniteMock.java | 25 +- .../processors/igfs/IgfsSizeSelfTest.java | 12 +- .../ignite/testframework/junits/IgniteMock.java | 25 +- .../junits/multijvm/IgniteProcessProxy.java | 25 +- .../ignite/testsuites/IgniteBasicTestSuite.java | 4 +- .../ignite/testsuites/IgniteCacheTestSuite.java | 4 +- .../testsuites/IgniteCacheTestSuite2.java | 4 +- .../ignite/testsuites/IgnitePdsTestSuite2.java | 4 +- .../query/h2/database/H2TreeIndex.java | 2 +- ...leNodeWithIndexingPutGetPersistenceTest.java | 6 +- ...stributedPartitionQueryAbstractSelfTest.java | 8 +- .../IgniteCacheQueryNodeRestartSelfTest2.java | 8 +- .../cache/index/DynamicColumnsAbstractTest.java | 16 +- .../index/DynamicIndexAbstractSelfTest.java | 16 +- .../cache/index/LongIndexNameTest.java | 4 +- ...eDbSingleNodeWithIndexingWalRestoreTest.java | 11 +- ...oreQueryWithMultipleClassesPerCacheTest.java | 8 +- .../IgnitePersistentStoreSchemaLoadTest.java | 13 +- .../query/IgniteSqlNotNullConstraintTest.java | 4 +- .../h2/database/InlineIndexHelperTest.java | 20 +- .../IgnitePdsWithIndexingCoreTestSuite.java | 3 + .../IgniteConfigurationTest.cs | 2 - .../http/jetty/GridJettyObjectMapper.java | 3 + .../org/apache/ignite/IgniteSpringBean.java | 27 +- .../top/VisorActivationCommandSpec.scala | 13 +- modules/web-console/backend/app/mongo.js | 55 ++ .../page-configure-basic/controller.js | 10 +- .../generator/AbstractTransformer.js | 5 + .../generator/ConfigurationGenerator.js | 108 ++- .../generator/defaults/Cluster.service.js | 40 + .../configuration/clusters/data-storage.pug | 255 ++++++ .../states/configuration/clusters/memory.pug | 4 +- .../configuration/clusters/persistence.pug | 4 +- .../frontend/app/services/Clusters.js | 6 + .../frontend/app/services/Version.service.js | 6 +- .../frontend/controllers/clusters-controller.js | 69 +- .../views/configuration/clusters.tpl.pug | 8 +- .../yardstick/IgniteBenchmarkArguments.java | 8 +- .../org/apache/ignite/yardstick/IgniteNode.java | 15 +- 235 files changed, 7661 insertions(+), 3865 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/example-data-regions.xml ---------------------------------------------------------------------- diff --git a/examples/config/example-data-regions.xml b/examples/config/example-data-regions.xml new file mode 100644 index 0000000..4ce71ef --- /dev/null +++ b/examples/config/example-data-regions.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!-- + Ignite configuration with all defaults, enabled p2p deployment and special data regions. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/util + http://www.springframework.org/schema/util/spring-util.xsd"> + <bean class="org.apache.ignite.configuration.IgniteConfiguration"> + <!-- Set to true to enable distributed class loading for examples, default is false. --> + <property name="peerClassLoadingEnabled" value="true"/> + + <property name="dataStorageConfiguration"> + <bean class="org.apache.ignite.configuration.DataStorageConfiguration"> + <!-- + Default memory region that grows endlessly. A cache is bound to this memory region + unless it sets another one in its CacheConfiguration. + --> + <property name="defaultDataRegionConfiguration"> + <bean class="org.apache.ignite.configuration.DataRegionConfiguration"> + <property name="name" value="Default_Region"/> + <!-- 100 MB memory region with disabled eviction --> + <property name="initialSize" value="#{100 * 1024 * 1024}"/> + </bean> + </property> + + <!-- Defining several data regions for different memory regions --> + <property name="dataRegionConfigurations"> + <list> + <!-- + Memory region of 40 MBs in size with an eviction enabled. + --> + <bean class="org.apache.ignite.configuration.DataRegionConfiguration"> + <property name="name" value="40MB_Region_Eviction"/> + <!-- Memory region of 20 MB initial size. --> + <property name="initialSize" value="#{20 * 1024 * 1024}"/> + <!-- Maximum size is 40 MB. --> + <property name="maxSize" value="#{40 * 1024 * 1024}"/> + <!-- Enabling eviction for this memory region --> + <property name="pageEvictionMode" value="RANDOM_2_LRU"/> + </bean> + + <!-- + This memory region is backed by a memory-mapped file which names is passed via + 'swapFilePath' parameter. + --> + <bean class="org.apache.ignite.configuration.DataRegionConfiguration"> + <property name="name" value="30MB_Region_Swapping"/> + <!-- Memory region of 15 MB initial size. --> + <property name="initialSize" value="#{15 * 1024 * 1024}"/> + <!-- Maximum size is 30 MB. --> + <property name="maxSize" value="#{30 * 1024 * 1024}"/> + <!-- Setting a name of the swapping file. --> + <property name="swapPath" value="dataRegionExampleSwap"/> + </bean> + </list> + </property> + </bean> + </property> + + <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> + <property name="discoverySpi"> + <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> + <property name="ipFinder"> + <!-- + Ignite provides several options for automatic discovery that can be used + instead os static IP based discovery. For information on all options refer + to our documentation: http://apacheignite.readme.io/docs/cluster-config + --> + <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. --> + <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">--> + <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> + <property name="addresses"> + <list> + <!-- In distributed environment, replace with actual host IP address. --> + <value>127.0.0.1:47500..47509</value> + </list> + </property> + </bean> + </property> + </bean> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/example-memory-policies.xml ---------------------------------------------------------------------- diff --git a/examples/config/example-memory-policies.xml b/examples/config/example-memory-policies.xml deleted file mode 100644 index 122300f..0000000 --- a/examples/config/example-memory-policies.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - 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. ---> - -<!-- - Ignite configuration with all defaults, enabled p2p deployment and special memory policies. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/util - http://www.springframework.org/schema/util/spring-util.xsd"> - <bean class="org.apache.ignite.configuration.IgniteConfiguration"> - <!-- Set to true to enable distributed class loading for examples, default is false. --> - <property name="peerClassLoadingEnabled" value="true"/> - - <property name="memoryConfiguration"> - <bean class="org.apache.ignite.configuration.MemoryConfiguration"> - <!-- Setting a name of the default memory policy. Required to set only if the default policy's - parameters are overridden like it's done below. --> - <property name="defaultMemoryPolicyName" value="Default_Region"/> - - <!-- Defining several memory policies for different memory regions --> - <property name="memoryPolicies"> - <list> - <!-- - Default memory region that grows endlessly. A cache is bound to this memory region - unless it sets another one in its CacheConfiguration. - --> - <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> - <property name="name" value="Default_Region"/> - <!-- 100 MB memory region with disabled eviction --> - <property name="initialSize" value="#{100 * 1024 * 1024}"/> - </bean> - - <!-- - Memory region of 40 MBs in size with an eviction enabled. - --> - <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> - <property name="name" value="40MB_Region_Eviction"/> - <!-- Memory region of 20 MB initial size. --> - <property name="initialSize" value="#{20 * 1024 * 1024}"/> - <!-- Maximum size is 40 MB. --> - <property name="maxSize" value="#{40 * 1024 * 1024}"/> - <!-- Enabling eviction for this memory region --> - <property name="pageEvictionMode" value="RANDOM_2_LRU"/> - </bean> - - <!-- - This memory region is backed by a memory-mapped file which names is passed via - 'swapFilePath' parameter. - --> - <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> - <property name="name" value="30MB_Region_Swapping"/> - <!-- Memory region of 15 MB initial size. --> - <property name="initialSize" value="#{15 * 1024 * 1024}"/> - <!-- Maximum size is 30 MB. --> - <property name="maxSize" value="#{30 * 1024 * 1024}"/> - <!-- Setting a name of the swapping file. --> - <property name="swapFilePath" value="memoryPolicyExampleSwap"/> - </bean> - </list> - </property> - </bean> - </property> - - <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <!-- - Ignite provides several options for automatic discovery that can be used - instead os static IP based discovery. For information on all options refer - to our documentation: http://apacheignite.readme.io/docs/cluster-config - --> - <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. --> - <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">--> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500..47509</value> - </list> - </property> - </bean> - </property> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/persistentstore/example-persistent-store.xml ---------------------------------------------------------------------- diff --git a/examples/config/persistentstore/example-persistent-store.xml b/examples/config/persistentstore/example-persistent-store.xml index 79138b0..85580e4 100644 --- a/examples/config/persistentstore/example-persistent-store.xml +++ b/examples/config/persistentstore/example-persistent-store.xml @@ -23,13 +23,13 @@ http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> <!-- Enabling Apache Ignite Persistent Store. --> - <property name="persistentStoreConfiguration"> - <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/> - </property> - - <property name="binaryConfiguration"> - <bean class="org.apache.ignite.configuration.BinaryConfiguration"> - <property name="compactFooter" value="false"/> + <property name="dataStorageConfiguration"> + <bean class="org.apache.ignite.configuration.DataStorageConfiguration"> + <property name="defaultDataRegionConfiguration"> + <bean class="org.apache.ignite.configuration.DataRegionConfiguration"> + <property name="persistenceEnabled" value="true"/> + </bean> + </property> </bean> </property> http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java new file mode 100644 index 0000000..5675602 --- /dev/null +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java @@ -0,0 +1,113 @@ +/* + * 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.examples.datagrid; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteException; +import org.apache.ignite.Ignition; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.examples.ExampleNodeStartup; + +/** + * This example demonstrates how to tweak particular settings of Apache Ignite page memory using + * {@link DataStorageConfiguration} and set up several data regions for different caches with + * {@link DataRegionConfiguration}. + * <p> + * Additional remote nodes can be started with special configuration file which + * enables P2P class loading: {@code 'ignite.{sh|bat} example-data-regions.xml'}. + * <p> + * Alternatively you can run {@link ExampleNodeStartup} in another JVM which passing + * {@code examples/config/example-data-regions.xml} configuration to it. + */ +public class DataRegionsExample { + /** Name of the default data region defined in 'example-data-regions.xml'. */ + public static final String REGION_DEFAULT = "Default_Region"; + + /** Name of the data region that creates a memory region limited by 40 MB with eviction enabled */ + public static final String REGION_40MB_EVICTION = "40MB_Region_Eviction"; + + /** Name of the data region that creates a memory region mapped to a memory-mapped file. */ + public static final String REGION_30MB_MEMORY_MAPPED_FILE = "30MB_Region_Swapping"; + + /** + * Executes example. + * + * @param args Command line arguments, none required. + * @throws IgniteException If example execution failed. + */ + public static void main(String[] args) throws IgniteException { + try (Ignite ignite = Ignition.start("examples/config/example-data-regions.xml")) { + System.out.println(); + System.out.println(">>> Data regions example started."); + + /* + * Preparing configurations for 2 caches that will be bound to the memory region defined by + * '10MB_Region_Eviction' data region from 'example-data-regions.xml' configuration. + */ + CacheConfiguration<Integer, Integer> firstCacheCfg = new CacheConfiguration<>("firstCache"); + + firstCacheCfg.setDataRegionName(REGION_40MB_EVICTION); + firstCacheCfg.setCacheMode(CacheMode.PARTITIONED); + firstCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + + CacheConfiguration<Integer, Integer> secondCacheCfg = new CacheConfiguration<>("secondCache"); + secondCacheCfg.setDataRegionName(REGION_40MB_EVICTION); + secondCacheCfg.setCacheMode(CacheMode.REPLICATED); + secondCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); + + IgniteCache<Integer, Integer> firstCache = ignite.createCache(firstCacheCfg); + IgniteCache<Integer, Integer> secondCache = ignite.createCache(secondCacheCfg); + + System.out.println(">>> Started two caches bound to '" + REGION_40MB_EVICTION + "' memory region."); + + /* + * Preparing a configuration for a cache that will be bound to the memory region defined by + * '5MB_Region_Swapping' data region from 'example-data-regions.xml' configuration. + */ + CacheConfiguration<Integer, Integer> thirdCacheCfg = new CacheConfiguration<>("thirdCache"); + + thirdCacheCfg.setDataRegionName(REGION_30MB_MEMORY_MAPPED_FILE); + + IgniteCache<Integer, Integer> thirdCache = ignite.createCache(thirdCacheCfg); + + System.out.println(">>> Started a cache bound to '" + REGION_30MB_MEMORY_MAPPED_FILE + "' memory region."); + + /* + * Preparing a configuration for a cache that will be bound to the default memory region defined by + * default 'Default_Region' data region from 'example-data-regions.xml' configuration. + */ + CacheConfiguration<Integer, Integer> fourthCacheCfg = new CacheConfiguration<>("fourthCache"); + + IgniteCache<Integer, Integer> fourthCache = ignite.createCache(fourthCacheCfg); + + System.out.println(">>> Started a cache bound to '" + REGION_DEFAULT + "' memory region."); + + System.out.println(">>> Destroying caches..."); + + firstCache.destroy(); + secondCache.destroy(); + thirdCache.destroy(); + fourthCache.destroy(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java deleted file mode 100644 index 045f88b..0000000 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java +++ /dev/null @@ -1,114 +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.examples.datagrid; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.examples.ExampleNodeStartup; - -/** - * This example demonstrates how to tweak particular settings of Apache Ignite page memory using - * {@link MemoryConfiguration} and set up several memory policies for different caches with - * {@link MemoryPolicyConfiguration}. - * <p> - * Additional remote nodes can be started with special configuration file which - * enables P2P class loading: {@code 'ignite.{sh|bat} example-memory-policies.xml'}. - * <p> - * Alternatively you can run {@link ExampleNodeStartup} in another JVM which passing - * {@code examples/config/example-memory-policies.xml} configuration to it. - */ -public class MemoryPoliciesExample { - /** Name of the default memory policy defined in 'example-memory-policies.xml'. */ - public static final String POLICY_DEFAULT = "Default_Region"; - - /** Name of the memory policy that creates a memory region limited by 40 MB with eviction enabled */ - public static final String POLICY_40MB_EVICTION = "40MB_Region_Eviction"; - - /** Name of the memory policy that creates a memory region mapped to a memory-mapped file. */ - public static final String POLICY_30MB_MEMORY_MAPPED_FILE = "30MB_Region_Swapping"; - - /** - * Executes example. - * - * @param args Command line arguments, none required. - * @throws IgniteException If example execution failed. - */ - public static void main(String[] args) throws IgniteException { - try (Ignite ignite = Ignition.start("examples/config/example-memory-policies.xml")) { - System.out.println(); - System.out.println(">>> Memory policies example started."); - - /** - * Preparing configurations for 2 caches that will be bound to the memory region defined by - * '10MB_Region_Eviction' memory policy from 'example-memory-policies.xml' configuration. - */ - CacheConfiguration<Integer, Integer> firstCacheCfg = new CacheConfiguration<>("firstCache"); - - firstCacheCfg.setMemoryPolicyName(POLICY_40MB_EVICTION); - firstCacheCfg.setCacheMode(CacheMode.PARTITIONED); - firstCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - CacheConfiguration<Integer, Integer> secondCacheCfg = new CacheConfiguration<>("secondCache"); - secondCacheCfg.setMemoryPolicyName(POLICY_40MB_EVICTION); - secondCacheCfg.setCacheMode(CacheMode.REPLICATED); - secondCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); - - IgniteCache<Integer, Integer> firstCache = ignite.createCache(firstCacheCfg); - IgniteCache<Integer, Integer> secondCache = ignite.createCache(secondCacheCfg); - - System.out.println(">>> Started two caches bound to '" + POLICY_40MB_EVICTION + "' memory region."); - - /** - * Preparing a configuration for a cache that will be bound to the memory region defined by - * '5MB_Region_Swapping' memory policy from 'example-memory-policies.xml' configuration. - */ - CacheConfiguration<Integer, Integer> thirdCacheCfg = new CacheConfiguration<>("thirdCache"); - - thirdCacheCfg.setMemoryPolicyName(POLICY_30MB_MEMORY_MAPPED_FILE); - - IgniteCache<Integer, Integer> thirdCache = ignite.createCache(thirdCacheCfg); - - System.out.println(">>> Started a cache bound to '" + POLICY_30MB_MEMORY_MAPPED_FILE + "' memory region."); - - - /** - * Preparing a configuration for a cache that will be bound to the default memory region defined by - * default 'Default_Region' memory policy from 'example-memory-policies.xml' configuration. - */ - CacheConfiguration<Integer, Integer> fourthCacheCfg = new CacheConfiguration<>("fourthCache"); - - IgniteCache<Integer, Integer> fourthCache = ignite.createCache(fourthCacheCfg); - - System.out.println(">>> Started a cache bound to '" + POLICY_DEFAULT + "' memory region."); - - System.out.println(">>> Destroying caches..."); - - firstCache.destroy(); - secondCache.destroy(); - thirdCache.destroy(); - fourthCache.destroy(); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java ---------------------------------------------------------------------- diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java index 30f0763..c42c91a 100644 --- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java +++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java @@ -27,7 +27,7 @@ import org.apache.ignite.examples.datagrid.CacheQueryDdlExample; import org.apache.ignite.examples.datagrid.CacheQueryDmlExample; import org.apache.ignite.examples.datagrid.CacheQueryExample; import org.apache.ignite.examples.datagrid.CacheTransactionExample; -import org.apache.ignite.examples.datagrid.MemoryPoliciesExample; +import org.apache.ignite.examples.datagrid.DataRegionsExample; import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample; import org.apache.ignite.examples.datagrid.store.CacheLoadOnlyStoreExample; import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample; @@ -195,7 +195,7 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest { /** * @throws Exception If failed. */ - public void testMemoryPolicyExample() throws Exception { - MemoryPoliciesExample.main(EMPTY_ARGS); + public void testDataRegionExample() throws Exception { + DataRegionsExample.main(EMPTY_ARGS); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java index 94abc86..cef00ee 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicLong; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.internal.benchmarks.jmh.JmhAbstractBenchmark; import org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner; import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider; @@ -30,7 +30,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator; 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.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; @@ -210,14 +210,14 @@ public class BPlusTreeBenchmark extends JmhAbstractBenchmark { for (int i = 0; i < sizes.length; i++) sizes[i] = 1024 * MB / CPUS; - MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB); + DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(1024 * MB); PageMemory pageMem = new PageMemoryNoStoreImpl(new JavaLogger(), new UnsafeMemoryProvider(new JavaLogger()), null, PAGE_SIZE, plcCfg, - new MemoryMetricsImpl(plcCfg), + new DataRegionMetricsImpl(plcCfg), false); pageMem.start(); http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java ---------------------------------------------------------------------- diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java index f548939..655da52 100644 --- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java +++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java @@ -22,6 +22,8 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; 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; @@ -40,7 +42,11 @@ public class DummyPersistenceCompatibilityTest extends IgnitePersistenceCompatib cfg.setPeerClassLoadingEnabled(false); - cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()); + DataStorageConfiguration memCfg = new DataStorageConfiguration() + .setDefaultDataRegionConfiguration( + new DataRegionConfiguration().setPersistenceEnabled(true)); + + cfg.setDataStorageConfiguration(memCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java new file mode 100644 index 0000000..86b91f4 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java @@ -0,0 +1,119 @@ +/* + * 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; + +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.mxbean.DataRegionMetricsMXBean; + +/** + * This interface provides page memory related metrics of a specific Apache Ignite node. The overall page memory + * architecture is covered in {@link DataStorageConfiguration}. + * <p> + * Since there are can be several memory regions configured with {@link DataRegionConfiguration} on an individual + * Apache Ignite node, the metrics for every region will be collected and obtained separately. + * <p> + * There are two ways to get the metrics of an Apache Ignite node. + * <ol> + * <li> + * First, a collection of the metrics can be obtained through {@link Ignite#dataRegionMetrics()} method. Note that + * the method returns data region metrics snapshots rather than just in time memory state. + * </li> + * <li> + * Second, all {@link DataRegionMetrics} of a local Apache Ignite node are visible through JMX interface. Refer to + * {@link DataRegionMetricsMXBean} for more details. + * </li> + * </ol> + * </p> + * <p> + * Data region metrics collection is not a free operation and might affect performance of an application. This is the reason + * why the metrics are turned off by default. To enable the collection you can use both + * {@link DataRegionConfiguration#setMetricsEnabled(boolean)} configuration property or + * {@link DataRegionMetricsMXBean#enableMetrics()} method of a respective JMX bean. + */ +public interface DataRegionMetrics { + /** + * A name of a memory region the metrics are collected for. + * + * @return Name of the memory region. + */ + public String getName(); + + /** + * Gets a total number of allocated pages related to the data region. When persistence is disabled, this + * metric shows the total number of pages in memory. When persistence is enabled, this metric shows the + * total number of pages in memory and on disk. + * + * @return Total number of allocated pages. + */ + public long getTotalAllocatedPages(); + + /** + * Gets pages allocation rate of a memory region. + * + * @return Number of allocated pages per second. + */ + public float getAllocationRate(); + + /** + * Gets eviction rate of a given memory region. + * + * @return Number of evicted pages per second. + */ + public float getEvictionRate(); + + /** + * Gets percentage of pages that are fully occupied by large entries that go beyond page size. The large entities + * are split into fragments in a way so that each fragment can fit into a single page. + * + * @return Percentage of pages fully occupied by large entities. + */ + public float getLargeEntriesPagesPercentage(); + + /** + * Gets the percentage of space that is still free and can be filled in. + * + * @return The percentage of space that is still free and can be filled in. + */ + public float getPagesFillFactor(); + + /** + * Gets the number of dirty pages (pages which contents is different from the current persistent storage state). + * This metric is enabled only for Ignite nodes with enabled persistence. + * + * @return Current number of dirty pages. + */ + public long getDirtyPages(); + + /** + * Gets rate (pages per second) at which pages get replaced with other pages from persistent storage. + * The rate effectively represents the rate at which pages get 'evicted' in favor of newly needed pages. + * This metric is enabled only for Ignite nodes with enabled persistence. + * + * @return Pages per second replace rate. + */ + public float getPagesReplaceRate(); + + /** + * Gets total number of pages currently loaded to the RAM. When persistence is disabled, this metric is equal + * to {@link #getTotalAllocatedPages()}. + * + * @return Total number of pages loaded to RAM. + */ + public long getPhysicalMemoryPages(); +} http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java new file mode 100644 index 0000000..dcf2049 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java @@ -0,0 +1,106 @@ +/* +* 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; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * Converter class from {@link DataRegionMetrics} to legacy {@link MemoryMetrics}. + */ +public class DataRegionMetricsAdapter implements MemoryMetrics { + /** Delegate. */ + private final DataRegionMetrics delegate; + + /** + * @param delegate Delegate. + */ + private DataRegionMetricsAdapter(DataRegionMetrics delegate) { + this.delegate = delegate; + } + + /** + * Converts collection of {@link DataRegionMetrics} into collection of legacy {@link MemoryMetrics}. + * + * @param dataRegionMetrics Data region metrics collection. + */ + public static Collection<MemoryMetrics> collectionOf(Collection<DataRegionMetrics> dataRegionMetrics) { + if (dataRegionMetrics == null) + return null; + + Collection<MemoryMetrics> res = new ArrayList<>(); + + for (DataRegionMetrics d : dataRegionMetrics) + res.add(new DataRegionMetricsAdapter(d)); + + return res; + } + + /** + * @param delegate DataRegionMetrics. + * @return Wrapped {@link DataRegionMetrics} that implements {@link MemoryMetrics}. + * Null value is not wrapped and returned as is. + */ + public static DataRegionMetricsAdapter valueOf(DataRegionMetrics delegate) { + return delegate == null ? null : new DataRegionMetricsAdapter(delegate); + } + + /** {@inheritDoc} */ + @Override public String getName() { + return delegate.getName(); + } + + /** {@inheritDoc} */ + @Override public long getTotalAllocatedPages() { + return delegate.getTotalAllocatedPages(); + } + + /** {@inheritDoc} */ + @Override public float getAllocationRate() { + return delegate.getAllocationRate(); + } + + /** {@inheritDoc} */ + @Override public float getEvictionRate() { + return delegate.getEvictionRate(); + } + + /** {@inheritDoc} */ + @Override public float getLargeEntriesPagesPercentage() { + return delegate.getLargeEntriesPagesPercentage(); + } + + /** {@inheritDoc} */ + @Override public float getPagesFillFactor() { + return delegate.getPagesFillFactor(); + } + + /** {@inheritDoc} */ + @Override public long getDirtyPages() { + return delegate.getDirtyPages(); + } + + /** {@inheritDoc} */ + @Override public float getPagesReplaceRate() { + return delegate.getPagesReplaceRate(); + } + + /** {@inheritDoc} */ + @Override public long getPhysicalMemoryPages() { + return delegate.getPhysicalMemoryPages(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java new file mode 100644 index 0000000..87095f6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java @@ -0,0 +1,114 @@ +/* + * 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; + +import org.apache.ignite.configuration.DataStorageConfiguration; + +/** + * Data storage metrics are used to obtain statistics on persistent store and whole data storage. + */ +public interface DataStorageMetrics { + /** + * Gets the average number of WAL records per second written during the last time interval. + * <p> + * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)} + * configurartion property. + * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)} + * configuration property. + */ + public float getWalLoggingRate(); + + /** + * Gets the average number of bytes per second written during the last time interval. + * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)} + * configurartion property. + * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)} + * configuration property. + */ + public float getWalWritingRate(); + + /** + * Gets the current number of WAL segments in the WAL archive. + */ + public int getWalArchiveSegments(); + + /** + * Gets the average WAL fsync duration in microseconds over the last time interval. + * <p> + * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)} + * configurartion property. + * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)} + * configuration property. + */ + public float getWalFsyncTimeAverage(); + + /** + * Gets the duration of the last checkpoint in milliseconds. + * + * @return Total checkpoint duration in milliseconds. + */ + public long getLastCheckpointingDuration(); + + /** + * Gets the duration of last checkpoint lock wait in milliseconds. + * + * @return Checkpoint lock wait time in milliseconds. + */ + public long getLastCheckpointLockWaitDuration(); + + /** + * Gets the duration of last checkpoint mark phase in milliseconds. + * + * @return Checkpoint mark duration in milliseconds. + */ + public long getLastCheckpointMarkDuration(); + + /** + * Gets the duration of last checkpoint pages write phase in milliseconds. + * + * @return Checkpoint pages write phase in milliseconds. + */ + public long getLastCheckpointPagesWriteDuration(); + + /** + * Gets the duration of the sync phase of the last checkpoint in milliseconds. + * + * @return Checkpoint fsync time in milliseconds. + */ + public long getLastCheckpointFsyncDuration(); + + /** + * Gets the total number of pages written during the last checkpoint. + * + * @return Total number of pages written during the last checkpoint. + */ + public long getLastCheckpointTotalPagesNumber(); + + /** + * Gets the number of data pages written during the last checkpoint. + * + * @return Total number of data pages written during the last checkpoint. + */ + public long getLastCheckpointDataPagesNumber(); + + /** + * Gets the number of pages copied to a temporary checkpoint buffer during the last checkpoint. + * + * @return Total number of pages copied to a temporary checkpoint buffer during the last checkpoint. + */ + public long getLastCheckpointCopiedOnWritePagesNumber(); +} http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java new file mode 100644 index 0000000..6bb4b7e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java @@ -0,0 +1,101 @@ +/* +* 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; + +/** + * Converter class from {@link DataStorageMetrics} to legacy {@link PersistenceMetrics}. + */ +public class DataStorageMetricsAdapter implements PersistenceMetrics { + /** Delegate. */ + private final DataStorageMetrics delegate; + + /** + * @param delegate Delegate. + */ + private DataStorageMetricsAdapter(DataStorageMetrics delegate) { + this.delegate = delegate; + } + + /** + * @param delegate DataStorageMetrics. + * @return Wrapped {@link DataStorageMetrics} that implements {@link PersistenceMetrics}. + * Null value is not wrapped and returned as is. + */ + public static DataStorageMetricsAdapter valueOf(DataStorageMetrics delegate) { + return delegate == null ? null : new DataStorageMetricsAdapter(delegate); + } + + /** {@inheritDoc} */ + @Override public float getWalLoggingRate() { + return delegate.getWalLoggingRate(); + } + + /** {@inheritDoc} */ + @Override public float getWalWritingRate() { + return delegate.getWalWritingRate(); + } + + /** {@inheritDoc} */ + @Override public int getWalArchiveSegments() { + return delegate.getWalArchiveSegments(); + } + + /** {@inheritDoc} */ + @Override public float getWalFsyncTimeAverage() { + return delegate.getWalFsyncTimeAverage(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointingDuration() { + return delegate.getLastCheckpointingDuration(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointLockWaitDuration() { + return delegate.getLastCheckpointLockWaitDuration(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointMarkDuration() { + return delegate.getLastCheckpointMarkDuration(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointPagesWriteDuration() { + return delegate.getLastCheckpointPagesWriteDuration(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointFsyncDuration() { + return delegate.getLastCheckpointFsyncDuration(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointTotalPagesNumber() { + return delegate.getLastCheckpointTotalPagesNumber(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointDataPagesNumber() { + return delegate.getLastCheckpointDataPagesNumber(); + } + + /** {@inheritDoc} */ + @Override public long getLastCheckpointCopiedOnWritePagesNumber() { + return delegate.getLastCheckpointCopiedOnWritePagesNumber(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/Ignite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java index 866c313..c8de43b 100644 --- a/modules/core/src/main/java/org/apache/ignite/Ignite.java +++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java @@ -27,9 +27,9 @@ import org.apache.ignite.cluster.ClusterGroup; import org.apache.ignite.configuration.AtomicConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.CollectionConfiguration; +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.internal.util.typedef.G; import org.apache.ignite.lang.IgniteProductVersion; @@ -676,30 +676,50 @@ public interface Ignite extends AutoCloseable { public void resetLostPartitions(Collection<String> cacheNames); /** - * Returns a collection of {@link MemoryMetrics} that reflects page memory usage on this Apache Ignite node + * @return Collection of {@link MemoryMetrics} snapshots. + * @deprecated Use {@link #dataRegionMetrics()} instead. + */ + @Deprecated + public Collection<MemoryMetrics> memoryMetrics(); + + /** + * @return {@link MemoryMetrics} snapshot or {@code null} if no memory region is configured under specified name. + * @deprecated Use {@link #dataRegionMetrics(String)} instead. + */ + @Deprecated + @Nullable public MemoryMetrics memoryMetrics(String memPlcName); + + /** + * @return {@link PersistenceMetrics} snapshot. + * @deprecated Use {@link #dataStorageMetrics()} instead. + */ + @Deprecated + public PersistenceMetrics persistentStoreMetrics(); + + /** + * Returns a collection of {@link DataRegionMetrics} that reflects page memory usage on this Apache Ignite node * instance. * Returns the collection that contains the latest snapshots for each memory region - * configured with {@link MemoryPolicyConfiguration configuration} on this Ignite node instance. + * configured with {@link DataRegionConfiguration configuration} on this Ignite node instance. * - * @return Collection of {@link MemoryMetrics} snapshots. + * @return Collection of {@link DataRegionMetrics} snapshots. */ - public Collection<MemoryMetrics> memoryMetrics(); + public Collection<DataRegionMetrics> dataRegionMetrics(); /** - * Returns the latest {@link MemoryMetrics} snapshot for the memory region of the given name. + * Returns the latest {@link DataRegionMetrics} snapshot for the memory region of the given name. * * To get the metrics for the default memory region use - * {@link MemoryConfiguration#DFLT_MEM_PLC_DEFAULT_NAME} as the name + * {@link DataStorageConfiguration#DFLT_DATA_REG_DEFAULT_NAME} as the name * or a custom name if the default memory region has been renamed. * - * @param memPlcName Name of memory region configured with {@link MemoryPolicyConfiguration config}. - * @return {@link MemoryMetrics} snapshot or {@code null} if no memory region is configured under specified name. + * @param memPlcName Name of memory region configured with {@link DataRegionConfiguration config}. + * @return {@link DataRegionMetrics} snapshot or {@code null} if no memory region is configured under specified name. */ - @Nullable public MemoryMetrics memoryMetrics(String memPlcName); + @Nullable public DataRegionMetrics dataRegionMetrics(String memPlcName); /** - * - * @return {@link PersistenceMetrics} snapshot. + * @return {@link DataStorageMetrics} snapshot. */ - public PersistenceMetrics persistentStoreMetrics(); + public DataStorageMetrics dataStorageMetrics(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java index d7b4de9..d7d4443 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Properties; import javax.net.ssl.HostnameVerifier; import org.apache.ignite.cluster.ClusterGroup; -import org.apache.ignite.configuration.PersistentStoreConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.Nullable; @@ -727,7 +727,7 @@ public final class IgniteSystemProperties { */ public static final String IGNITE_WAL_LOG_TX_RECORDS = "IGNITE_WAL_LOG_TX_RECORDS"; - /** If this property is set, {@link PersistentStoreConfiguration#writeThrottlingEnabled} will be overridden to true + /** If this property is set, {@link DataStorageConfiguration#writeThrottlingEnabled} will be overridden to true * independent of initial value in configuration. */ public static final String IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED = "IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED"; http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java index c709777..e0c22ed 100644 --- a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java +++ b/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java @@ -19,7 +19,7 @@ package org.apache.ignite; import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.mxbean.MemoryMetricsMXBean; +import org.apache.ignite.mxbean.DataRegionMetricsMXBean; /** * This interface provides page memory related metrics of a specific Apache Ignite node. The overall page memory @@ -31,12 +31,12 @@ import org.apache.ignite.mxbean.MemoryMetricsMXBean; * There are two ways to get the metrics of an Apache Ignite node. * <ol> * <li> - * First, a collection of the metrics can be obtained through {@link Ignite#memoryMetrics()} method. Note that + * First, a collection of the metrics can be obtained through {@link Ignite#dataRegionMetrics()} ()} method. Note that * the method returns memory metrics snapshots rather than just in time memory state. * </li> * <li> * Second, all {@link MemoryMetrics} of a local Apache Ignite node are visible through JMX interface. Refer to - * {@link MemoryMetricsMXBean} for more details. + * {@link DataRegionMetricsMXBean} for more details. * </li> * </ol> * </p> @@ -44,8 +44,11 @@ import org.apache.ignite.mxbean.MemoryMetricsMXBean; * Memory metrics collection is not a free operation and might affect performance of an application. This is the reason * why the metrics are turned off by default. To enable the collection you can use both * {@link MemoryPolicyConfiguration#setMetricsEnabled(boolean)} configuration property or - * {@link MemoryMetricsMXBean#enableMetrics()} method of a respective JMX bean. + * {@link DataRegionMetricsMXBean#enableMetrics()} method of a respective JMX bean. + * + * @deprecated Use {@link DataRegionMetrics} instead. */ +@Deprecated public interface MemoryMetrics { /** * A name of a memory region the metrics are collected for. http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java b/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java index f3f763c..3b96b11 100644 --- a/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java +++ b/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java @@ -17,13 +17,13 @@ package org.apache.ignite; import org.apache.ignite.configuration.PersistentStoreConfiguration; -import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager; /** * Persistence metrics used to obtain statistics on persistence. * - * Use {@link IgniteCacheDatabaseSharedManager#persistentStoreMetrics()} to obtain persistent metrics. + * @deprecated Use {@link DataStorageMetrics} instead. */ +@Deprecated public interface PersistenceMetrics { /** * Gets the average number of WAL records per second written during the last time interval. http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 6c43d13..37a0677 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -187,7 +187,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** Cache group name. */ private String grpName; - /** Name of {@link MemoryPolicyConfiguration} for this cache */ + /** Name of {@link DataRegionConfiguration} for this cache */ private String memPlcName; /** Threshold for concurrent loading of keys from {@link CacheStore}. */ @@ -407,7 +407,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { loadPrevVal = cc.isLoadPreviousValue(); longQryWarnTimeout = cc.getLongQueryWarningTimeout(); maxConcurrentAsyncOps = cc.getMaxConcurrentAsyncOperations(); - memPlcName = cc.getMemoryPolicyName(); + memPlcName = cc.getDataRegionName(); name = cc.getName(); nearCfg = cc.getNearConfiguration(); nodeFilter = cc.getNodeFilter(); @@ -453,7 +453,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { * Since underlying cache is shared, the following configuration properties should be the same within group: * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode}, * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)}, - * {@link #setMemoryPolicyName(String)}. + * {@link #setDataRegionName(String)}. * * Grouping caches reduces overall overhead, since internal data structures are shared. * @@ -472,7 +472,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { * Since underlying cache is shared, the following configuration properties should be the same within group: * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode}, * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)}, - * {@link #setMemoryPolicyName(String)}. + * {@link #setDataRegionName(String)}. * * Grouping caches reduces overall overhead, since internal data structures are shared. * @@ -509,28 +509,44 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * @return {@link MemoryPolicyConfiguration} name. + * @return {@link DataRegionConfiguration} name. */ + @Nullable public String getDataRegionName() { + return memPlcName; + } + + /** + * @deprecated Use {@link #getDataRegionName()} (String)} instead. + */ + @Deprecated public String getMemoryPolicyName() { return memPlcName; } /** - * Sets a name of {@link MemoryPolicyConfiguration} for this cache. + * Sets a name of {@link DataRegionConfiguration} for this cache. * - * @param memPlcName MemoryPolicyConfiguration name. Can be null (default MemoryPolicyConfiguration will be used) + * @param dataRegionName DataRegionConfiguration name. Can be null (default DataRegionConfiguration will be used) * but should not be empty. * @return {@code this} for chaining. */ - public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) { - A.ensure(memPlcName == null || !memPlcName.isEmpty(), "Name cannot be empty."); + public CacheConfiguration<K, V> setDataRegionName(@Nullable String dataRegionName) { + A.ensure(dataRegionName == null || !dataRegionName.isEmpty(), "Name cannot be empty."); - this.memPlcName = memPlcName; + this.memPlcName = dataRegionName; return this; } /** + * @deprecated Use {@link #setDataRegionName(String)} instead. + */ + @Deprecated + public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) { + return setDataRegionName(memPlcName); + } + + /** * Gets cache eviction policy. By default, returns {@code null} * which means that evictions are disabled for cache. * http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java index f61e870..2b4ee78 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java @@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable; /** * Defines memory page eviction algorithm. A mode is set for a specific - * {@link MemoryPolicyConfiguration}. Only data pages, that store key-value entries, are eligible for eviction. The + * {@link DataRegionConfiguration}. Only data pages, that store key-value entries, are eligible for eviction. The * other types of pages, like index or meta pages, are not evictable. */ public enum DataPageEvictionMode { @@ -31,11 +31,11 @@ public enum DataPageEvictionMode { /** * Random-LRU algorithm. * <ul> - * <li>Once a memory region defined by a memory policy is configured, an off-heap array is allocated to track + * <li>Once a memory region defined by a data region is configured, an off-heap array is allocated to track * last usage timestamp for every individual data page. The size of the array is calculated this way - size = - * ({@link MemoryPolicyConfiguration#getMaxSize()} / {@link MemoryConfiguration#pageSize})</li> + * ({@link DataRegionConfiguration#getMaxSize()} / {@link DataStorageConfiguration#pageSize})</li> * <li>When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the - * tracking array is calculated this way - index = (pageAddress / {@link MemoryPolicyConfiguration#getMaxSize()}</li> + * tracking array is calculated this way - index = (pageAddress / {@link DataRegionConfiguration#getMaxSize()}</li> * <li>When it's required to evict some pages, the algorithm randomly chooses 5 indexes from the tracking array and * evicts a page with the latest timestamp. If some of the indexes point to non-data pages (index or system pages) * then the algorithm picks other pages.</li>
