You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/10/20 07:32:10 UTC
[01/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Repository: ignite
Updated Branches:
refs/heads/master 173ecef0f -> ec41370c4
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
new file mode 100644
index 0000000..9c2dca1
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
@@ -0,0 +1,255 @@
+//-
+ 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.
+
+include /app/helpers/jade/mixins
+
+-var form = 'dataStorageConfiguration'
+-var model = 'backupItem.dataStorageConfiguration'
+-var dfltRegionModel = model + '.defaultDataRegionConfiguration'
+-var dataRegionConfigurations = model + '.dataRegionConfigurations'
+
+.panel.panel-default(ng-show='$ctrl.available("2.3.0")' ng-form=form novalidate)
+ .panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
+ ignite-form-panel-chevron
+ label Data storage configuration
+ ignite-form-field-tooltip.tipLabel
+ | Page memory is a manageable off-heap based memory architecture that is split into pages of fixed size#[br]
+ | #[a(href="https://apacheignite.readme.io/docs/distributed-persistent-store" target="_blank") More info]
+ ignite-form-revert
+ .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
+ .panel-body(ng-if=`$ctrl.available("2.3.0") && ui.isPanelLoaded('${form}')`)
+ .col-sm-6
+ .settings-row
+ +number-min-max('Page size:', model + '.pageSize', '"DataStorageConfigurationPageSize"',
+ 'true', '2048', '1024', '16384', 'Every memory region is split on pages of fixed size')
+ .settings-row
+ +number('Concurrency level:', model + '.concurrencyLevel', '"DataStorageConfigurationConcurrencyLevel"',
+ 'true', 'availableProcessors', '2', 'The number of concurrent segments in Ignite internal page mapping tables')
+ .settings-row
+ +ignite-form-group
+ ignite-form-field-label
+ | System region
+ ignite-form-group-tooltip
+ | System region properties
+ .group-content
+ .details-row
+ +number('Initial size:', model + '.systemRegionInitialSize', '"DataStorageSystemRegionInitialSize"',
+ 'true', '41943040', '10485760', 'Initial size of a data region reserved for system cache')
+ .details-row
+ +number('Maximum size:', model + '.systemRegionMaxSize', '"DataStorageSystemRegionMaxSize"',
+ 'true', '104857600', '10485760', 'Maximum data region size reserved for system cache')
+ .settings-row
+ +ignite-form-group
+ ignite-form-field-label
+ | Data regions
+ ignite-form-group-tooltip
+ | Data region configurations
+ .group-content
+ .details-row
+ +ignite-form-group
+ ignite-form-field-label
+ | Default data region
+ ignite-form-group-tooltip
+ | Default data region properties
+ .group-content
+ .details-row
+ +text('Name:', dfltRegionModel + '.name', '"DfltRegionName" + $index', 'false', 'default', 'Default data region name')
+ .details-row
+ +number('Initial size:', dfltRegionModel + '.initialSize', '"DfltRegionInitialSize" + $index',
+ 'true', '268435456', '10485760', 'Default data region initial size')
+ .details-row
+ +number('Maximum size:', dfltRegionModel + '.maxSize', '"DfltRegionMaxSize" + $index',
+ 'true', '0.2 * totalMemoryAvailable', '10485760', 'Default data region maximum size')
+ .details-row
+ +text('Swap file path:', dfltRegionModel + '.swapPath', '"DfltRegionSwapFilePath" + $index', 'false',
+ 'Input swap file path', 'An optional path to a memory mapped file for default data region')
+ .details-row
+ +dropdown('Eviction mode:', dfltRegionModel + '.pageEvictionMode', '"DfltRegionPageEvictionMode"', 'true', 'DISABLED',
+ '[\
+ {value: "DISABLED", label: "DISABLED"},\
+ {value: "RANDOM_LRU", label: "RANDOM_LRU"},\
+ {value: "RANDOM_2_LRU", label: "RANDOM_2_LRU"}\
+ ]',
+ 'An algorithm for memory pages eviction\
+ <ul>\
+ <li>DISABLED - Eviction is disabled</li>\
+ <li>RANDOM_LRU - Once a memory region defined by a memory policy is configured, an off - heap array is allocated to track last usage timestamp for every individual data page</li>\
+ <li>RANDOM_2_LRU - Differs from Random - LRU only in a way that two latest access timestamps are stored for every data page</li>\
+ </ul>')
+ .details-row
+ +number-min-max-step('Eviction threshold:', dfltRegionModel + '.evictionThreshold', '"DfltRegionEvictionThreshold" + $index',
+ 'true', '0.9', '0.5', '0.999', '0.05', 'A threshold for memory pages eviction initiation')
+ .details-row
+ +number('Empty pages pool size:', dfltRegionModel + '.emptyPagesPoolSize', '"DfltRegionEmptyPagesPoolSize" + $index',
+ 'true', '100', '11', 'The minimal number of empty pages to be present in reuse lists for default data region')
+ .details-row
+ +number('Metrics sub interval count:', dfltRegionModel + '.metricsSubIntervalCount', '"DfltRegionSubIntervals" + $index',
+ 'true', '5', '1', 'A number of sub-intervals the whole rate time interval will be split into to calculate allocation and eviction rates')
+ .details-row
+ +number('Metrics rate time interval:', dfltRegionModel + '.metricsRateTimeInterval', '"DfltRegionRateTimeInterval" + $index',
+ 'true', '60000', '1000', 'Time interval for allocation rate and eviction rate monitoring purposes')
+ .details-row
+ +checkbox('Metrics enabled', dfltRegionModel + '.metricsEnabled', '"DfltRegionMetricsEnabled" + $index',
+ 'Whether memory metrics are enabled by default on node startup')
+ .details-row
+ +checkbox('Persistence enabled', dfltRegionModel + '.persistenceEnabled', '"DfltRegionPersistenceEnabled" + $index',
+ 'Enable Ignite Native Persistence')
+ .details-row(ng-init='dataRegionTbl={type: "dataRegions", model: "dataRegionConfigurations", focusId: "name", ui: "data-region-table"}')
+ +ignite-form-group()
+ ignite-form-field-label
+ | Configured data regions
+ ignite-form-group-tooltip
+ | List of configured data regions
+ ignite-form-group-add(ng-click='tableNewItem(dataRegionTbl)')
+ | Add data region configuration
+ .group-content-empty(ng-if=`!(${dataRegionConfigurations} && ${dataRegionConfigurations}.length > 0)`)
+ | Not defined
+ .group-content(ng-show=`${dataRegionConfigurations} && ${dataRegionConfigurations}.length > 0` ng-repeat=`model in ${dataRegionConfigurations} track by $index`)
+ hr(ng-if='$index != 0')
+ .settings-row
+ +text-enabled-autofocus('Name:', 'model.name', '"DataRegionName" + $index', 'true', 'false', 'default', 'Data region name')
+ +table-remove-button(dataRegionConfigurations, 'Remove memory configuration')
+ .settings-row
+ +number('Initial size:', 'model.initialSize', '"DataRegionInitialSize" + $index',
+ 'true', '268435456', '10485760', 'Initial memory region size defined by this data region')
+ .settings-row
+ +number('Maximum size:', 'model.maxSize', '"DataRegionMaxSize" + $index',
+ 'true', '0.2 * totalMemoryAvailable', '10485760', 'Maximum memory region size defined by this data region')
+ .settings-row
+ +text('Swap file path:', 'model.swapPath', '"DataRegionSwapPath" + $index', 'false',
+ 'Input swap file path', 'An optional path to a memory mapped file for this data region')
+ .settings-row
+ +dropdown('Eviction mode:', 'model.pageEvictionMode', '"DataRegionPageEvictionMode"', 'true', 'DISABLED',
+ '[\
+ {value: "DISABLED", label: "DISABLED"},\
+ {value: "RANDOM_LRU", label: "RANDOM_LRU"},\
+ {value: "RANDOM_2_LRU", label: "RANDOM_2_LRU"}\
+ ]',
+ 'An algorithm for memory pages eviction\
+ <ul>\
+ <li>DISABLED - Eviction is disabled</li>\
+ <li>RANDOM_LRU - Once a memory region defined by a memory policy is configured, an off - heap array is allocated to track last usage timestamp for every individual data page</li>\
+ <li>RANDOM_2_LRU - Differs from Random - LRU only in a way that two latest access timestamps are stored for every data page</li>\
+ </ul>')
+ .settings-row
+ +number-min-max-step('Eviction threshold:', 'model.evictionThreshold', '"DataRegionEvictionThreshold" + $index',
+ 'true', '0.9', '0.5', '0.999', '0.05', 'A threshold for memory pages eviction initiation')
+ .settings-row
+ +number('Empty pages pool size:', 'model.emptyPagesPoolSize', '"DataRegionEmptyPagesPoolSize" + $index',
+ 'true', '100', '11', 'The minimal number of empty pages to be present in reuse lists for this data region')
+ .settings-row
+ +number('Metrics sub interval count:', 'model.metricsSubIntervalCount', '"DataRegionSubIntervals" + $index',
+ 'true', '5', '1', 'A number of sub-intervals the whole rate time interval will be split into to calculate allocation and eviction rates')
+ .settings-row
+ +number('Metrics rate time interval:', 'model.metricsRateTimeInterval', '"DataRegionRateTimeInterval" + $index',
+ 'true', '60000', '1000', 'Time interval for allocation rate and eviction rate monitoring purposes')
+ .settings-row
+ +checkbox('Metrics enabled', 'model.metricsEnabled', '"DataRegionMetricsEnabled" + $index',
+ 'Whether memory metrics are enabled by default on node startup')
+ .settings-row
+ +checkbox('Persistence enabled', 'model.persistenceEnabled', '"DataRegionPersistenceEnabled" + $index',
+ 'Enable Ignite Native Persistence')
+ .settings-row
+ +text-enabled('Storage path:', `${model}.storagePath`, '"DataStoragePath"', 'true', 'false', 'db',
+ 'Directory where index and partition files are stored')
+ .settings-row
+ +number('Checkpoint frequency:', `${model}.checkpointFrequency`, '"DataStorageCheckpointFrequency"', 'true', '180000', '1',
+ 'Frequency which is a minimal interval when the dirty pages will be written to the Persistent Store')
+ .settings-row
+ +number('Checkpoint page buffer size:', `${model}.checkpointPageBufferSize`, '"DataStorageCheckpointPageBufferSize"', 'true', '268435456', '0',
+ 'Amount of memory allocated for a checkpointing temporary buffer')
+ .settings-row
+ +number('Checkpoint threads:', `${model}.checkpointThreads`, '"DataStorageCheckpointThreads"', 'true', '4', '1', 'A number of threads to use for the checkpoint purposes')
+ .settings-row
+ +dropdown('Checkpoint write order:', `${model}.checkpointWriteOrder`, '"DataStorageCheckpointWriteOrder"', 'true', 'SEQUENTIAL',
+ '[\
+ {value: "RANDOM", label: "RANDOM"},\
+ {value: "SEQUENTIAL", label: "SEQUENTIAL"}\
+ ]',
+ 'Order of writing pages to disk storage during checkpoint.\
+ <ul>\
+ <li>RANDOM - Pages are written in order provided by checkpoint pages collection iterator</li>\
+ <li>SEQUENTIAL - All checkpoint pages are collected into single list and sorted by page index</li>\
+ </ul>')
+ .settings-row
+ +dropdown('WAL mode:', `${model}.walMode`, '"DataStorageWalMode"', 'true', 'DEFAULT',
+ '[\
+ {value: "DEFAULT", label: "DEFAULT"},\
+ {value: "LOG_ONLY", label: "LOG_ONLY"},\
+ {value: "BACKGROUND", label: "BACKGROUND"},\
+ {value: "NONE", label: "NONE"}\
+ ]',
+ 'Type define behavior wal fsync.\
+ <ul>\
+ <li>DEFAULT - full-sync disk writes</li>\
+ <li>LOG_ONLY - flushes application buffers</li>\
+ <li>BACKGROUND - does not force application's buffer flush</li>\
+ <li>NONE - WAL is disabled</li>\
+ </ul>')
+ .settings-row
+ +text-enabled('WAL path:', `${model}.walPath`, '"DataStorageWalPath"', 'true', 'false', 'db/wal', 'A path to the directory where WAL is stored')
+ .settings-row
+ +text-enabled('WAL archive path:', `${model}.walArchivePath`, '"DataStorageWalArchivePath"', 'true', 'false', 'db/wal/archive', 'A path to the WAL archive directory')
+ .settings-row
+ +number('WAL segments:', `${model}.walSegments`, '"DataStorageWalSegments"', 'true', '10', '1', 'A number of WAL segments to work with')
+ .settings-row
+ +number('WAL segment size:', `${model}.walSegmentSize`, '"DataStorageWalSegmentSize"', 'true', '67108864', '0', 'Size of a WAL segment')
+ .settings-row
+ +number('WAL history size:', `${model}.walHistorySize`, '"DataStorageWalHistorySize"', 'true', '20', '1', 'A total number of checkpoints to keep in the WAL history')
+ .settings-row
+ +number('WAL flush frequency:', `${model}.walFlushFrequency`, '"DataStorageWalFlushFrequency"', 'true', '2000', '1',
+ 'How often will be fsync, in milliseconds. In background mode, exist thread which do fsync by timeout')
+ .settings-row
+ +number('WAL fsync delay:', `${model}.walFsyncDelayNanos`, '"DataStorageWalFsyncDelay"', 'true', '1000', '1', 'WAL fsync delay, in nanoseconds')
+ .settings-row
+ +number('WAL record iterator buffer size:', `${model}.walRecordIteratorBufferSize`, '"DataStorageWalRecordIteratorBufferSize"', 'true', '67108864', '1',
+ 'How many bytes iterator read from disk(for one reading), during go ahead WAL')
+ .settings-row
+ +number('Lock wait time:', `${model}.lockWaitTime`, '"DataStorageLockWaitTime"', 'true', '10000', '1',
+ 'Time out in milliseconds, while wait and try get file lock for start persist manager')
+ .settings-row
+ +number('WAL thread local buffer size:', `${model}.walThreadLocalBufferSize`, '"DataStorageWalThreadLocalBufferSize"', 'true', '131072', '1',
+ 'Define size thread local buffer. Each thread which write to WAL have thread local buffer for serialize recode before write in WAL')
+ .settings-row
+ +number('Metrics sub interval count:', `${model}.metricsSubIntervalCount`, '"DataStorageMetricsSubIntervalCount"', 'true', '5', '1',
+ 'Number of sub - intervals the whole rate time interval will be split into to calculate rate - based metrics')
+ .settings-row
+ +number('Metrics rate time interval:', `${model}.metricsRateTimeInterval`, '"DataStorageMetricsRateTimeInterval"', 'true', '60000', '1000',
+ 'The length of the time interval for rate - based metrics. This interval defines a window over which hits will be tracked')
+ .settings-row
+ +dropdown('File IO factory:', `${model}.fileIOFactory`, '"DataStorageFileIOFactory"', 'true', 'Default',
+ '[\
+ {value: "RANDOM", label: "RANDOM"},\
+ {value: "ASYNC", label: "ASYNC"},\
+ {value: null, label: "Default"},\
+ ]',
+ 'Order of writing pages to disk storage during checkpoint.\
+ <ul>\
+ <li>RANDOM - Pages are written in order provided by checkpoint pages collection iterator</li>\
+ <li>SEQUENTIAL - All checkpoint pages are collected into single list and sorted by page index</li>\
+ </ul>')
+ .settings-row
+ +number('WAL auto archive after inactivity:', `${model}.walAutoArchiveAfterInactivity`, '"DataStorageWalAutoArchiveAfterInactivity"', 'true', '-1', '-1',
+ 'Time in millis to run auto archiving segment after last record logging')
+ .settings-row
+ +checkbox-enabled('Metrics enabled', `${model}.metricsEnabled`, '"DataStorageMetricsEnabled"', 'true', 'Flag indicating whether persistence metrics collection is enabled')
+ .settings-row
+ +checkbox-enabled('Always write full pages', `${model}.alwaysWriteFullPages`, '"DataStorageAlwaysWriteFullPages"', 'true', 'Flag indicating whether always write full pages')
+ .settings-row
+ +checkbox('Write throttling enabled', `${model}.writeThrottlingEnabled`, '"DataStorageWriteThrottlingEnabled"',
+ 'Throttle threads that generate dirty pages too fast during ongoing checkpoint')
+ .col-sm-6
+ +preview-xml-java(model, 'clusterDataStorageConfiguration')
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
index e22afe2..705ba91 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
@@ -20,7 +20,7 @@ include /app/helpers/jade/mixins
-var model = 'backupItem.memoryConfiguration'
-var memoryPolicies = model + '.memoryPolicies'
-.panel.panel-default(ng-show='$ctrl.available("2.0.0")' ng-form=form novalidate)
+.panel.panel-default(ng-show='$ctrl.available(["2.0.0", "2.3.0"])' ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
ignite-form-panel-chevron
label Memory configuration
@@ -29,7 +29,7 @@ include /app/helpers/jade/mixins
| #[a(href="https://apacheignite.readme.io/docs/durable-memory" target="_blank") More info]
ignite-form-revert
.panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
- .panel-body(ng-if=`$ctrl.available("2.0.0") && ui.isPanelLoaded('${form}')`)
+ .panel-body(ng-if=`$ctrl.available(["2.0.0", "2.3.0"]) && ui.isPanelLoaded('${form}')`)
.col-sm-6
.settings-row
+number-min-max('Page size:', model + '.pageSize', '"MemoryConfigurationPageSize"',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
index 50a569b..fcc170e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
@@ -20,7 +20,7 @@ include /app/helpers/jade/mixins
-var model = 'backupItem.persistenceStoreConfiguration'
-var enabled = model + '.enabled'
-.panel.panel-default(ng-show='$ctrl.available("2.1.0")' ng-form=form novalidate)
+.panel.panel-default(ng-show='$ctrl.available(["2.1.0", "2.3.0"])' ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
ignite-form-panel-chevron
label Persistence store
@@ -29,7 +29,7 @@ include /app/helpers/jade/mixins
//- TODO IGNITE-5415 Add link to documentation.
ignite-form-revert
.panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
- .panel-body(ng-if=`$ctrl.available("2.1.0") && ui.isPanelLoaded('${form}')`)
+ .panel-body(ng-if=`$ctrl.available(["2.1.0", "2.3.0"]) && ui.isPanelLoaded('${form}')`)
.col-sm-6
.settings-row
+checkbox('Enabled', enabled, '"PersistenceEnabled"', 'Flag indicating whether to configure persistent configuration')
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/services/Clusters.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Clusters.js b/modules/web-console/frontend/app/services/Clusters.js
index 4e38a58..dd2f598 100644
--- a/modules/web-console/frontend/app/services/Clusters.js
+++ b/modules/web-console/frontend/app/services/Clusters.js
@@ -60,6 +60,12 @@ export default class Clusters {
},
swapSpaceSpi: {},
transactionConfiguration: {},
+ dataStorageConfiguration: {
+ defaultDataRegionConfiguration: {
+ name: 'default'
+ },
+ dataRegionConfigurations: []
+ },
memoryConfiguration: {
memoryPolicies: [{
name: 'default',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/services/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Version.service.js b/modules/web-console/frontend/app/services/Version.service.js
index beb27fa..8b67eb7 100644
--- a/modules/web-console/frontend/app/services/Version.service.js
+++ b/modules/web-console/frontend/app/services/Version.service.js
@@ -77,7 +77,11 @@ export default class IgniteVersion {
this.supportedVersions = [
{
- label: 'Ignite 2.x',
+ label: 'Ignite 2.3',
+ ignite: '2.3.0'
+ },
+ {
+ label: 'Ignite 2.1',
ignite: '2.2.0'
},
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index 8340b4d..2485fa6 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -176,6 +176,8 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
else if (field.type === 'memoryPolicies')
$scope.backupItem.memoryConfiguration.memoryPolicies.push({});
+ else if (field.type === 'dataRegions')
+ $scope.backupItem.dataStorageConfiguration.dataRegionConfigurations.push({});
else if (field.type === 'serviceConfigurations')
$scope.backupItem.serviceConfigurations.push({});
else if (field.type === 'executorConfigurations')
@@ -329,6 +331,9 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!cluster.memoryConfiguration)
cluster.memoryConfiguration = { memoryPolicies: [] };
+ if (!cluster.dataStorageConfiguration)
+ cluster.dataStorageConfiguration = { dataRegionConfigurations: [] };
+
if (!cluster.hadoopConfiguration)
cluster.hadoopConfiguration = { nativeLibraryNames: [] };
@@ -712,6 +717,53 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}));
}
+ function checkDataStorageConfiguration(item) {
+ const dataStorage = item.dataStorageConfiguration;
+
+ if ((dataStorage.systemRegionMaxSize || 104857600) < (dataStorage.systemRegionInitialSize || 41943040))
+ return ErrorPopover.show('DataStorageSystemRegionMaxSize', 'System data region maximum size should be greater than initial size', $scope.ui, 'dataStorageConfiguration');
+
+ const pageSize = dataStorage.pageSize;
+
+ if (pageSize > 0 && (pageSize & (pageSize - 1) !== 0)) {
+ ErrorPopover.show('DataStorageConfigurationPageSize', 'Page size must be power of 2', $scope.ui, 'dataStorageConfiguration');
+
+ return false;
+ }
+
+ return _.isNil(_.find(dataStorage.dataRegionConfigurations, (curPlc, curIx) => {
+ if (curPlc.name === 'sysMemPlc') {
+ ErrorPopover.show('DfltRegionPolicyName' + curIx, '"sysMemPlc" policy name is reserved for internal use', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (_.find(dataStorage.dataRegionConfigurations, (plc, ix) => curIx > ix && (curPlc.name || 'default') === (plc.name || 'default'))) {
+ ErrorPopover.show('DfltRegionPolicyName' + curIx, 'Data region with that name is already configured', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (curPlc.maxSize && curPlc.maxSize < (curPlc.initialSize || 268435456)) {
+ ErrorPopover.show('DfltRegionPolicyMaxSize' + curIx, 'Maximum size should be greater than initial size', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (curPlc.maxSize) {
+ const maxPoolSize = Math.floor(curPlc.maxSize / (dataStorage.pageSize || 2048) / 10);
+
+ if (maxPoolSize < (curPlc.emptyPagesPoolSize || 100)) {
+ ErrorPopover.show('DfltRegionPolicyEmptyPagesPoolSize' + curIx, 'Evicted pages pool size should be lesser than ' + maxPoolSize, $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+ }
+
+ return false;
+ }));
+ }
+
function checkODBC(item) {
if (_.get(item, 'odbc.odbcEnabled') && _.get(item, 'marshaller.kind'))
return ErrorPopover.show('odbcEnabledInput', 'ODBC can only be used with BinaryMarshaller', $scope.ui, 'odbcConfiguration');
@@ -786,7 +838,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Check cluster logical consistency.
- function validate(item) {
+ this.validate = (item) => {
ErrorPopover.hide();
if (LegacyUtils.isEmptyString(item.name))
@@ -813,13 +865,16 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!checkCommunicationConfiguration(item))
return false;
+ if (!this.available('2.3.0') && !checkDataStorageConfiguration(item))
+ return false;
+
if (!checkDiscoveryConfiguration(item))
return false;
if (!checkLoadBalancingConfiguration(item))
return false;
- if (!checkMemoryConfiguration(item))
+ if (this.available(['2.0.0', '2.3.0']) && !checkMemoryConfiguration(item))
return false;
if (!checkODBC(item))
@@ -838,7 +893,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
return false;
return true;
- }
+ };
// Save cluster in database.
function save(item) {
@@ -882,7 +937,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Save cluster.
- $scope.saveItem = function() {
+ $scope.saveItem = () => {
const item = $scope.backupItem;
const swapConfigured = item.swapSpaceSpi && item.swapSpaceSpi.kind;
@@ -890,7 +945,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!swapConfigured && _.find(clusterCaches(item), (cache) => cache.swapEnabled))
_.merge(item, {swapSpaceSpi: {kind: 'FileSwapSpaceSpi'}});
- if (validate(item))
+ if (this.validate(item))
save(item);
};
@@ -899,8 +954,8 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Clone cluster with new name.
- $scope.cloneItem = function() {
- if (validate($scope.backupItem)) {
+ $scope.cloneItem = () => {
+ if (this.validate($scope.backupItem)) {
Input.clone($scope.backupItem.name, _clusterNames()).then((newName) => {
const item = angular.copy($scope.backupItem);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/views/configuration/clusters.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/clusters.tpl.pug b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
index f0d88b7..26a1da1 100644
--- a/modules/web-console/frontend/views/configuration/clusters.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
@@ -49,6 +49,10 @@ include /app/helpers/jade/mixins
include /app/modules/states/configuration/clusters/communication
include /app/modules/states/configuration/clusters/connector
include /app/modules/states/configuration/clusters/deployment
+
+ //- Since ignite 2.3
+ include /app/modules/states/configuration/clusters/data-storage
+
include /app/modules/states/configuration/clusters/discovery
include /app/modules/states/configuration/clusters/events
include /app/modules/states/configuration/clusters/failover
@@ -58,7 +62,7 @@ include /app/helpers/jade/mixins
include /app/modules/states/configuration/clusters/logger
include /app/modules/states/configuration/clusters/marshaller
- //- Since ignite 2.0
+ //- Since ignite 2.0, deprecated in ignite 2.3
include /app/modules/states/configuration/clusters/memory
include /app/modules/states/configuration/clusters/misc
@@ -67,7 +71,7 @@ include /app/helpers/jade/mixins
//- Deprecated in ignite 2.1
include /app/modules/states/configuration/clusters/odbc
- //- Since ignite 2.1
+ //- Since ignite 2.1, deprecated in ignite 2.3
include /app/modules/states/configuration/clusters/persistence
include /app/modules/states/configuration/clusters/sql-connector
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 594fa1f..ba96b6c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -20,8 +20,8 @@ package org.apache.ignite.yardstick;
import com.beust.jcommander.Parameter;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -206,7 +206,7 @@ public class IgniteBenchmarkArguments {
/** */
@Parameter(names = {"-ps", "--pageSize"}, description = "Page size")
- private int pageSize = MemoryConfiguration.DFLT_PAGE_SIZE;
+ private int pageSize = DataStorageConfiguration.DFLT_PAGE_SIZE;
/** */
@Parameter(names = {"-sl", "--stringLength"}, description = "Test string length")
@@ -253,7 +253,7 @@ public class IgniteBenchmarkArguments {
private int streamerBufSize = IgniteDataStreamer.DFLT_PER_NODE_BUFFER_SIZE;
/**
- * @return {@code True} if need set {@link PersistentStoreConfiguration}.
+ * @return {@code True} if need set {@link DataStorageConfiguration}.
*/
public boolean persistentStoreEnabled() {
return persistentStoreEnabled;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index 35fa949..9770fa3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -156,24 +155,24 @@ public class IgniteNode implements BenchmarkServer {
c.setCommunicationSpi(commSpi);
- if (args.getPageSize() != MemoryConfiguration.DFLT_PAGE_SIZE) {
- MemoryConfiguration memCfg = c.getMemoryConfiguration();
+ if (args.getPageSize() != DataStorageConfiguration.DFLT_PAGE_SIZE) {
+ DataStorageConfiguration memCfg = c.getDataStorageConfiguration();
if (memCfg == null) {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
- c.setMemoryConfiguration(memCfg);
+ c.setDataStorageConfiguration(memCfg);
}
memCfg.setPageSize(args.getPageSize());
}
if (args.persistentStoreEnabled()) {
- PersistentStoreConfiguration pcCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pcCfg = new DataStorageConfiguration();
c.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
- c.setPersistentStoreConfiguration(pcCfg);
+ c.setDataStorageConfiguration(pcCfg);
}
ignite = IgniteSpring.start(c, appCtx);
[07/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
deleted file mode 100644
index 4e7f90a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
+++ /dev/null
@@ -1,112 +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.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-
-/**
- *
- */
-public class MemoryMetricsSnapshot implements MemoryMetrics {
- /** */
- private String name;
-
- /** */
- private long totalAllocatedPages;
-
- /** */
- private float allocationRate;
-
- /** */
- private float evictionRate;
-
- /** */
- private float largeEntriesPagesPercentage;
-
- /** */
- private float pagesFillFactor;
-
- /** */
- private long dirtyPages;
-
- /** */
- private float pageReplaceRate;
-
- /** */
- private long physicalMemoryPages;
-
- /**
- * @param metrics Metrics instance to take a copy.
- */
- public MemoryMetricsSnapshot(MemoryMetrics metrics) {
- name = metrics.getName();
- totalAllocatedPages = metrics.getTotalAllocatedPages();
- allocationRate = metrics.getAllocationRate();
- evictionRate = metrics.getEvictionRate();
- largeEntriesPagesPercentage = metrics.getLargeEntriesPagesPercentage();
- pagesFillFactor = metrics.getPagesFillFactor();
- dirtyPages = metrics.getDirtyPages();
- pageReplaceRate = metrics.getPagesReplaceRate();
- physicalMemoryPages = metrics.getPhysicalMemoryPages();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return name;
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return totalAllocatedPages;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- return allocationRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return evictionRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- return largeEntriesPagesPercentage;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- return pagesFillFactor;
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- return dirtyPages;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- return pageReplaceRate;
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- return physicalMemoryPages;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
deleted file mode 100644
index 4059c12..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
+++ /dev/null
@@ -1,84 +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.cache.persistence;
-
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
-
-/**
- * Memory policy provides access to objects configured with {@link MemoryPolicyConfiguration} configuration.
- */
-public class MemoryPolicy {
- /** */
- private final PageMemory pageMem;
-
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final MemoryPolicyConfiguration cfg;
-
- /** */
- private final PageEvictionTracker evictionTracker;
-
- /**
- * @param pageMem PageMemory instance.
- * @param memMetrics MemoryMetrics instance.
- * @param cfg Configuration of given MemoryPolicy.
- * @param evictionTracker Eviction tracker.
- */
- public MemoryPolicy(
- PageMemory pageMem,
- MemoryPolicyConfiguration cfg,
- MemoryMetricsImpl memMetrics,
- PageEvictionTracker evictionTracker
- ) {
- this.pageMem = pageMem;
- this.memMetrics = memMetrics;
- this.cfg = cfg;
- this.evictionTracker = evictionTracker;
- }
-
- /**
- *
- */
- public PageMemory pageMemory() {
- return pageMem;
- }
-
- /**
- * @return Config.
- */
- public MemoryPolicyConfiguration config() {
- return cfg;
- }
-
- /**
- * @return Memory Metrics.
- */
- public MemoryMetricsImpl memoryMetrics() {
- return memMetrics;
- }
-
- /**
- *
- */
- public PageEvictionTracker evictionTracker() {
- return evictionTracker;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
deleted file mode 100644
index 7952937..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
+++ /dev/null
@@ -1,297 +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.cache.persistence;
-
-import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.mxbean.PersistenceMetricsMXBean;
-
-/**
- *
- */
-public class PersistenceMetricsImpl implements PersistenceMetricsMXBean {
- /** */
- private volatile HitRateMetrics walLoggingRate;
-
- /** */
- private volatile HitRateMetrics walWritingRate;
-
- /** */
- private volatile HitRateMetrics walFsyncTimeDuration;
-
- /** */
- private volatile HitRateMetrics walFsyncTimeNumber;
-
- /** */
- private volatile long lastCpLockWaitDuration;
-
- /** */
- private volatile long lastCpMarkDuration;
-
- /** */
- private volatile long lastCpPagesWriteDuration;
-
- /** */
- private volatile long lastCpDuration;
-
- /** */
- private volatile long lastCpFsyncDuration;
-
- /** */
- private volatile long lastCpTotalPages;
-
- /** */
- private volatile long lastCpDataPages;
-
- /** */
- private volatile long lastCpCowPages;
-
- /** */
- private volatile long rateTimeInterval;
-
- /** */
- private volatile int subInts;
-
- /** */
- private volatile boolean metricsEnabled;
-
- /** */
- private IgniteWriteAheadLogManager wal;
-
- /**
- * @param metricsEnabled Metrics enabled flag.
- * @param rateTimeInterval Rate time interval.
- * @param subInts Number of sub-intervals.
- */
- public PersistenceMetricsImpl(
- boolean metricsEnabled,
- long rateTimeInterval,
- int subInts
- ) {
- this.metricsEnabled = metricsEnabled;
- this.rateTimeInterval = rateTimeInterval;
- this.subInts = subInts;
-
- resetRates();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalLoggingRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float)walLoggingRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalWritingRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float)walWritingRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public int getWalArchiveSegments() {
- if (!metricsEnabled)
- return 0;
-
- return wal.walArchiveSegments();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalFsyncTimeAverage() {
- if (!metricsEnabled)
- return 0;
-
- long numRate = walFsyncTimeNumber.getRate();
-
- if (numRate == 0)
- return 0;
-
- return (float)walFsyncTimeDuration.getRate() / numRate;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointLockWaitDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpLockWaitDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointMarkDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpMarkDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointPagesWriteDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpPagesWriteDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointFsyncDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpFsyncDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointTotalPagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpTotalPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointDataPagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpDataPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpCowPages;
- }
-
- /** {@inheritDoc} */
- @Override public void enableMetrics() {
- metricsEnabled = true;
- }
-
- /** {@inheritDoc} */
- @Override public void disableMetrics() {
- metricsEnabled = false;
- }
-
- /** {@inheritDoc} */
- @Override public void rateTimeInterval(long rateTimeInterval) {
- this.rateTimeInterval = rateTimeInterval;
-
- resetRates();
- }
-
- /** {@inheritDoc} */
- @Override public void subIntervals(int subInts) {
- this.subInts = subInts;
-
- resetRates();
- }
-
- /**
- * @param wal Write-ahead log manager.
- */
- public void wal(IgniteWriteAheadLogManager wal) {
- this.wal = wal;
- }
-
- /**
- * @return Metrics enabled flag.
- */
- public boolean metricsEnabled() {
- return metricsEnabled;
- }
-
- /**
- * @param lockWaitDuration Lock wait duration.
- * @param markDuration Mark duration.
- * @param pagesWriteDuration Pages write duration.
- * @param fsyncDuration Total checkpoint fsync duration.
- * @param duration Total checkpoint duration.
- * @param totalPages Total number of all pages in checkpoint.
- * @param dataPages Total number of data pages in checkpoint.
- * @param cowPages Total number of COW-ed pages in checkpoint.
- */
- public void onCheckpoint(
- long lockWaitDuration,
- long markDuration,
- long pagesWriteDuration,
- long fsyncDuration,
- long duration,
- long totalPages,
- long dataPages,
- long cowPages
- ) {
- if (metricsEnabled) {
- lastCpLockWaitDuration = lockWaitDuration;
- lastCpMarkDuration = markDuration;
- lastCpPagesWriteDuration = pagesWriteDuration;
- lastCpFsyncDuration = fsyncDuration;
- lastCpDuration = duration;
- lastCpTotalPages = totalPages;
- lastCpDataPages = dataPages;
- lastCpCowPages = cowPages;
- }
- }
-
- /**
- *
- */
- public void onWalRecordLogged() {
- walLoggingRate.onHit();
- }
-
- /**
- * @param size Size written.
- */
- public void onWalBytesWritten(int size) {
- walWritingRate.onHits(size);
- }
-
- /**
- * @param nanoTime Fsync nano time.
- */
- public void onFsync(long nanoTime) {
- long microseconds = nanoTime / 1_000;
-
- walFsyncTimeDuration.onHits(microseconds);
- walFsyncTimeNumber.onHit();
- }
-
- /**
- *
- */
- private void resetRates() {
- walLoggingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
- walWritingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
-
- walFsyncTimeDuration = new HitRateMetrics((int)rateTimeInterval, subInts);
- walFsyncTimeNumber = new HitRateMetrics((int)rateTimeInterval, subInts);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
deleted file mode 100644
index 0de9950..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
+++ /dev/null
@@ -1,144 +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.cache.persistence;
-
-import org.apache.ignite.PersistenceMetrics;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- *
- */
-public class PersistenceMetricsSnapshot implements PersistenceMetrics {
- /** */
- private float walLoggingRate;
-
- /** */
- private float walWritingRate;
-
- /** */
- private int walArchiveSegments;
-
- /** */
- private float walFsyncTimeAvg;
-
- /** */
- private long lastCpDuration;
-
- /** */
- private long lastCpLockWaitDuration;
-
- /** */
- private long lastCpMmarkDuration;
-
- /** */
- private long lastCpPagesWriteDuration;
-
- /** */
- private long lastCpFsyncDuration;
-
- /** */
- private long lastCpTotalPages;
-
- /** */
- private long lastCpDataPages;
-
- /** */
- private long lastCpCowPages;
-
- /**
- * @param metrics Metrics.
- */
- public PersistenceMetricsSnapshot(PersistenceMetrics metrics) {
- walLoggingRate = metrics.getWalLoggingRate();
- walWritingRate = metrics.getWalWritingRate();
- walArchiveSegments = metrics.getWalArchiveSegments();
- walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
- lastCpDuration = metrics.getLastCheckpointingDuration();
- lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
- lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
- lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
- lastCpFsyncDuration = metrics.getLastCheckpointFsyncDuration();
- lastCpTotalPages = metrics.getLastCheckpointTotalPagesNumber();
- lastCpDataPages = metrics.getLastCheckpointDataPagesNumber();
- lastCpCowPages = metrics.getLastCheckpointCopiedOnWritePagesNumber();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalLoggingRate() {
- return walLoggingRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalWritingRate() {
- return walWritingRate;
- }
-
- /** {@inheritDoc} */
- @Override public int getWalArchiveSegments() {
- return walArchiveSegments;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalFsyncTimeAverage() {
- return walFsyncTimeAvg;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
- return lastCpDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointLockWaitDuration() {
- return lastCpLockWaitDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointMarkDuration() {
- return lastCpMmarkDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointPagesWriteDuration() {
- return lastCpPagesWriteDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointFsyncDuration() {
- return lastCpFsyncDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointTotalPagesNumber() {
- return lastCpTotalPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointDataPagesNumber() {
- return lastCpDataPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
- return lastCpCowPages;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PersistenceMetricsSnapshot.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
index 9cc5c62..2051021 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
@@ -40,7 +40,8 @@ public class RowStore {
/** */
protected final CacheObjectContext coctx;
-
+ /** */
+ private final boolean persistenceEnabled;
/**
* @param grp Cache group.
@@ -54,7 +55,9 @@ public class RowStore {
ctx = grp.shared();
coctx = grp.cacheObjectContext();
- pageMem = grp.memoryPolicy().pageMemory();
+ pageMem = grp.dataRegion().pageMemory();
+
+ persistenceEnabled = grp.dataRegion().config().isPersistenceEnabled();
}
/**
@@ -63,13 +66,18 @@ public class RowStore {
*/
public void removeRow(long link) throws IgniteCheckedException {
assert link != 0;
- ctx.database().checkpointReadLock();
- try {
+ if (!persistenceEnabled)
freeList.removeDataRowByLink(link);
- }
- finally {
- ctx.database().checkpointReadUnlock();
+ else {
+ ctx.database().checkpointReadLock();
+
+ try {
+ freeList.removeDataRowByLink(link);
+ }
+ finally {
+ ctx.database().checkpointReadUnlock();
+ }
}
}
@@ -78,13 +86,17 @@ public class RowStore {
* @throws IgniteCheckedException If failed.
*/
public void addRow(CacheDataRow row) throws IgniteCheckedException {
- ctx.database().checkpointReadLock();
-
- try {
+ if (!persistenceEnabled)
freeList.insertDataRow(row);
- }
- finally {
- ctx.database().checkpointReadUnlock();
+ else {
+ ctx.database().checkpointReadLock();
+
+ try {
+ freeList.insertDataRow(row);
+ }
+ finally {
+ ctx.database().checkpointReadUnlock();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
index f5c7c8a..8a3d5b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache.persistence.evict;
import java.util.LinkedList;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -34,12 +34,12 @@ public class FairFifoPageEvictionTracker extends PageAbstractEvictionTracker {
/**
* @param pageMem Page memory.
- * @param plcCfg Memory policy configuration.
+ * @param plcCfg Data region configuration.
* @param sharedCtx Shared context.
*/
public FairFifoPageEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext sharedCtx) {
super(pageMem, plcCfg, sharedCtx);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
index a524d5e..5142c59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
@@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.cache.persistence.evict;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -54,12 +54,12 @@ public abstract class PageAbstractEvictionTracker implements PageEvictionTracker
/**
* @param pageMem Page memory.
- * @param plcCfg Memory policy configuration.
+ * @param plcCfg Data region configuration.
* @param sharedCtx Shared context.
*/
PageAbstractEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext sharedCtx
) {
this.pageMem = pageMem;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
index 00f1b16..4d42191 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
@@ -20,8 +20,8 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
-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.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -55,12 +55,12 @@ public class Random2LruPageEvictionTracker extends PageAbstractEvictionTracker {
*/
public Random2LruPageEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext<?, ?> sharedCtx
) {
super(pageMem, plcCfg, sharedCtx);
- MemoryConfiguration memCfg = sharedCtx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = sharedCtx.kernalContext().config().getDataStorageConfiguration();
assert plcCfg.getMaxSize() / memCfg.getPageSize() < Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
index 035a91a..ed6d2d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
@@ -21,8 +21,8 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
@@ -57,12 +57,12 @@ public class RandomLruPageEvictionTracker extends PageAbstractEvictionTracker {
*/
public RandomLruPageEvictionTracker(
PageMemory pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext<?, ?> sharedCtx
) {
super((PageMemoryNoStoreImpl)pageMem, plcCfg, sharedCtx);
- MemoryConfiguration memCfg = sharedCtx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = sharedCtx.kernalContext().config().getDataStorageConfiguration();
assert plcCfg.getMaxSize() / memCfg.getPageSize() < Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
index 0fb3052..104697e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
@@ -33,20 +33,34 @@ public class AsyncFileIOFactory implements FileIOFactory {
/** */
private static final long serialVersionUID = 0L;
+ /** Thread local channel future holder. */
+ private transient volatile ThreadLocal<AsyncFileIO.ChannelOpFuture> holder = initHolder();
+
/** {@inheritDoc} */
@Override public FileIO create(File file) throws IOException {
return create(file, CREATE, READ, WRITE);
}
- /** */
- private ThreadLocal<AsyncFileIO.ChannelOpFuture> holder = new ThreadLocal<AsyncFileIO.ChannelOpFuture>() {
- @Override protected AsyncFileIO.ChannelOpFuture initialValue() {
- return new AsyncFileIO.ChannelOpFuture();
- }
- };
-
/** {@inheritDoc} */
@Override public FileIO create(File file, OpenOption... modes) throws IOException {
+ if (holder == null) {
+ synchronized (this) {
+ if (holder == null)
+ holder = initHolder();
+ }
+ }
+
return new AsyncFileIO(file, holder, modes);
}
+
+ /**
+ * Initializes thread local channel future holder.
+ */
+ private ThreadLocal<AsyncFileIO.ChannelOpFuture> initHolder() {
+ return new ThreadLocal<AsyncFileIO.ChannelOpFuture>() {
+ @Override protected AsyncFileIO.ChannelOpFuture initialValue() {
+ return new AsyncFileIO.ChannelOpFuture();
+ }
+ };
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
index 0547dbc..408240c 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
@@ -27,7 +27,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.store.PageStore;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
@@ -60,7 +60,7 @@ public class FilePageStore implements PageStore {
private final byte type;
/** Database configuration. */
- protected final MemoryConfiguration dbCfg;
+ protected final DataStorageConfiguration dbCfg;
/** Factory to provide I/O interfaces for read/write operations with files */
private final FileIOFactory ioFactory;
@@ -92,7 +92,7 @@ public class FilePageStore implements PageStore {
/**
* @param file File.
*/
- public FilePageStore(byte type, File file, FileIOFactory factory, MemoryConfiguration cfg) {
+ public FilePageStore(byte type, File file, FileIOFactory factory, DataStorageConfiguration cfg) {
this.type = type;
cfgFile = file;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index ed82127..aadcee6 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageIdUtils;
@@ -92,7 +92,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
private final IgniteConfiguration igniteCfg;
/** */
- private PersistentStoreConfiguration pstCfg;
+ private DataStorageConfiguration dsCfg;
/** Absolute directory for file page store. Includes consistent id based folder. */
private File storeWorkDir;
@@ -109,11 +109,11 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
public FilePageStoreManager(GridKernalContext ctx) {
igniteCfg = ctx.config();
- PersistentStoreConfiguration pstCfg = igniteCfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration dsCfg = igniteCfg.getDataStorageConfiguration();
- assert pstCfg != null : "WAL should not be created if persistence is disabled.";
+ assert dsCfg != null;
- this.pstCfg = pstCfg;
+ this.dsCfg = dsCfg;
}
/** {@inheritDoc} */
@@ -352,7 +352,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
grpsWithoutIdx.add(grpDesc.groupId());
FileVersionCheckingFactory pageStoreFactory = new FileVersionCheckingFactory(
- pstCfg.getFileIOFactory(), igniteCfg.getMemoryConfiguration());
+ dsCfg.getFileIOFactory(), igniteCfg.getDataStorageConfiguration());
FilePageStore idxStore = pageStoreFactory.createPageStore(PageMemory.FLAG_IDX, idxFile);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
index 5d044ec..c2e2d36 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.cache.persistence.file;
import java.io.File;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
/**
*
@@ -35,7 +35,7 @@ public class FilePageStoreV2 extends FilePageStore {
* @param factory Factory.
* @param cfg Config.
*/
- public FilePageStoreV2(byte type, File file, FileIOFactory factory, MemoryConfiguration cfg) {
+ public FilePageStoreV2(byte type, File file, FileIOFactory factory, DataStorageConfiguration cfg) {
super(type, file, factory, cfg);
hdrSize = cfg.getPageSize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
index 40870dc..bab2cf0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
/**
* Checks version in files if it's present on the disk, creates store with latest version otherwise.
@@ -38,14 +38,14 @@ public class FileVersionCheckingFactory implements FilePageStoreFactory {
private final FileIOFactory fileIOFactory;
/** Memory configuration. */
- private final MemoryConfiguration memCfg;
+ private final DataStorageConfiguration memCfg;
/**
* @param fileIOFactory File io factory.
* @param memCfg Memory configuration.
*/
public FileVersionCheckingFactory(
- FileIOFactory fileIOFactory, MemoryConfiguration memCfg) {
+ FileIOFactory fileIOFactory, DataStorageConfiguration memCfg) {
this.fileIOFactory = fileIOFactory;
this.memCfg = memCfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
index c73a952..e7a7e63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
@@ -31,12 +31,13 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.NotNull;
@@ -157,7 +158,7 @@ public class PdsConsistentIdProcessor extends GridProcessorAdapter implements Pd
//here deprecated method is used to get compatible version of consistentId
final Serializable consistentId = ctx.discovery().consistentId();
- if (!cfg.isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(cfg))
return compatibleResolve(pstStoreBasePath, consistentId);
if (getBoolean(IGNITE_DATA_STORAGE_FOLDER_BY_CONSISTENT_ID, false))
@@ -442,12 +443,12 @@ public class PdsConsistentIdProcessor extends GridProcessorAdapter implements Pd
* @throws IgniteCheckedException if I/O failed.
*/
@Nullable private File resolvePersistentStoreBasePath() throws IgniteCheckedException {
- final PersistentStoreConfiguration pstCfg = cfg.getPersistentStoreConfiguration();
+ final DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration();
- if (pstCfg == null)
+ if (dsCfg == null)
return null;
- final String pstPath = pstCfg.getPersistentStorePath();
+ final String pstPath = dsCfg.getStoragePath();
return U.resolveWorkDirectory(
cfg.getWorkDirectory(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
index 3eb62ae..6a87d3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
@@ -31,8 +31,8 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageUpdateRecord;
import org.apache.ignite.internal.processors.cache.CacheObject;
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.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.CacheVersionIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;
@@ -81,7 +81,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
private final PageHandler<CacheDataRow, Boolean> updateRow = new UpdateRowHandler();
/** */
- private final MemoryMetricsImpl memMetrics;
+ private final DataRegionMetricsImpl memMetrics;
/** */
private final PageEvictionTracker evictionTracker;
@@ -313,7 +313,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
* @param cacheId Cache ID.
* @param name Name (for debug purpose).
* @param memMetrics Memory metrics.
- * @param memPlc Memory policy.
+ * @param memPlc Data region.
* @param reuseList Reuse list or {@code null} if this free list will be a reuse list for itself.
* @param wal Write ahead log manager.
* @param metaPageId Metadata page ID.
@@ -323,8 +323,8 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
public FreeListImpl(
int cacheId,
String name,
- MemoryMetricsImpl memMetrics,
- MemoryPolicy memPlc,
+ DataRegionMetricsImpl memMetrics,
+ DataRegion memPlc,
ReuseList reuseList,
IgniteWriteAheadLogManager wal,
long metaPageId,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
index 8a540a0..b113c62 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
@@ -180,8 +180,6 @@ public abstract class PagesList extends DataStructure {
assert nextId != pageId :
"Loop detected [next=" + U.hexLong(nextId) + ", cur=" + U.hexLong(pageId) + ']';
-
-
}
finally {
readUnlock(pageId, page, pageAddr);
@@ -354,9 +352,8 @@ public abstract class PagesList extends DataStructure {
* @param pageId Page ID.
* @param page Page absolute pointer.
* @param pageAddr Page address.
- * @throws IgniteCheckedException If failed.
*/
- private void releaseAndClose(long pageId, long page, long pageAddr) throws IgniteCheckedException {
+ private void releaseAndClose(long pageId, long page, long pageAddr) {
if (page != 0L) {
try {
// No special WAL record because we most likely changed the whole page.
@@ -924,7 +921,7 @@ public abstract class PagesList extends DataStructure {
* @param bucket Bucket index.
* @return Page for take.
*/
- private Stripe getPageForTake(int bucket) throws IgniteCheckedException {
+ private Stripe getPageForTake(int bucket) {
Stripe[] tails = getBucket(bucket);
if (tails == null || bucketsSize[bucket].get() == 0)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 95b81ad..8c64e0e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -58,7 +58,7 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.PageDeltaRecord;
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.GridCacheDatabaseSharedManager;
-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.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO;
import org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException;
@@ -235,7 +235,7 @@ public class PageMemoryImpl implements PageMemoryEx {
private long[] sizes;
/** */
- private MemoryMetricsImpl memMetrics;
+ private DataRegionMetricsImpl memMetrics;
/** */
private volatile boolean closed;
@@ -256,7 +256,7 @@ public class PageMemoryImpl implements PageMemoryEx {
GridInClosure3X<FullPageId, ByteBuffer, Integer> flushDirtyPage,
GridInClosure3X<Long, FullPageId, PageMemoryEx> changeTracker,
CheckpointLockStateChecker stateChecker,
- MemoryMetricsImpl memMetrics,
+ DataRegionMetricsImpl memMetrics,
boolean throttleEnabled
) {
assert sharedCtx != null;
@@ -1817,7 +1817,7 @@ public class PageMemoryImpl implements PageMemoryEx {
pageEvictWarned = true;
U.warn(log, "Page evictions started, this will affect storage performance (consider increasing " +
- "MemoryConfiguration#setPageCacheSize).");
+ "DataStorageConfiguration#setPageCacheSize).");
}
final ThreadLocalRandom rnd = ThreadLocalRandom.current();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 383c605..b4fc192 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -43,8 +43,8 @@ import java.util.regex.Pattern;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.events.EventType;
import org.apache.ignite.events.WalSegmentArchivedEvent;
@@ -61,7 +61,7 @@ import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.PersistenceMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataStorageMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.filename.PdsFolderSettings;
@@ -76,7 +76,6 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -146,7 +145,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private final long fsyncDelay;
/** */
- private final PersistentStoreConfiguration psCfg;
+ private final DataStorageConfiguration dsCfg;
/** Events service */
private final GridEventStorageManager evt;
@@ -155,7 +154,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private IgniteConfiguration igCfg;
/** Persistence metrics tracker. */
- private PersistenceMetricsImpl metrics;
+ private DataStorageMetricsImpl metrics;
/** */
private File walWorkDir;
@@ -209,7 +208,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* Positive (non-0) value indicates WAL can be archived even if not complete<br>
- * See {@link PersistentStoreConfiguration#setWalAutoArchiveAfterInactivity(long)}<br>
+ * See {@link DataStorageConfiguration#setWalAutoArchiveAfterInactivity(long)}<br>
*/
private final long walAutoArchiveAfterInactivity;
@@ -239,20 +238,20 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
public FileWriteAheadLogManager(@NotNull final GridKernalContext ctx) {
igCfg = ctx.config();
- PersistentStoreConfiguration psCfg = igCfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration dsCfg = igCfg.getDataStorageConfiguration();
- assert psCfg != null : "WAL should not be created if persistence is disabled.";
+ assert dsCfg != null;
- this.psCfg = psCfg;
+ this.dsCfg = dsCfg;
- maxWalSegmentSize = psCfg.getWalSegmentSize();
- mode = psCfg.getWalMode();
- tlbSize = psCfg.getTlbSize();
- flushFreq = psCfg.getWalFlushFrequency();
- fsyncDelay = psCfg.getWalFsyncDelayNanos();
- alwaysWriteFullPages = psCfg.isAlwaysWriteFullPages();
- ioFactory = psCfg.getFileIOFactory();
- walAutoArchiveAfterInactivity = psCfg.getWalAutoArchiveAfterInactivity();
+ maxWalSegmentSize = dsCfg.getWalSegmentSize();
+ mode = dsCfg.getWalMode();
+ tlbSize = dsCfg.getWalThreadLocalBufferSize();
+ flushFreq = dsCfg.getWalFlushFrequency();
+ fsyncDelay = dsCfg.getWalFsyncDelayNanos();
+ alwaysWriteFullPages = dsCfg.isAlwaysWriteFullPages();
+ ioFactory = dsCfg.getFileIOFactory();
+ walAutoArchiveAfterInactivity = dsCfg.getWalAutoArchiveAfterInactivity();
evt = ctx.event();
}
@@ -264,15 +263,15 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
checkWalConfiguration();
walWorkDir = initDirectory(
- psCfg.getWalStorePath(),
- PersistentStoreConfiguration.DFLT_WAL_STORE_PATH,
+ dsCfg.getWalPath(),
+ DataStorageConfiguration.DFLT_WAL_PATH,
resolveFolders.folderName(),
"write ahead log work directory"
);
walArchiveDir = initDirectory(
- psCfg.getWalArchivePath(),
- PersistentStoreConfiguration.DFLT_WAL_ARCHIVE_PATH,
+ dsCfg.getWalArchivePath(),
+ DataStorageConfiguration.DFLT_WAL_ARCHIVE_PATH,
resolveFolders.folderName(),
"write ahead log archive directory"
);
@@ -305,11 +304,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @throws IgniteCheckedException if WAL store path is configured and archive path isn't (or vice versa)
*/
private void checkWalConfiguration() throws IgniteCheckedException {
- if (psCfg.getWalStorePath() == null ^ psCfg.getWalArchivePath() == null) {
+ if (dsCfg.getWalPath() == null ^ dsCfg.getWalArchivePath() == null) {
throw new IgniteCheckedException(
"Properties should be either both specified or both null " +
- "[walStorePath = " + psCfg.getWalStorePath() +
- ", walArchivePath = " + psCfg.getWalArchivePath() + "]"
+ "[walStorePath = " + dsCfg.getWalPath() +
+ ", walArchivePath = " + dsCfg.getWalArchivePath() + "]"
);
}
}
@@ -575,7 +574,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
walArchiveDir,
(FileWALPointer)start,
end,
- psCfg,
+ dsCfg,
serializer,
ioFactory,
archiver,
@@ -821,7 +820,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private FileWriteHandle restoreWriteHandle(FileWALPointer lastReadPtr) throws IgniteCheckedException {
long absIdx = lastReadPtr == null ? 0 : lastReadPtr.index();
- long segNo = absIdx % psCfg.getWalSegments();
+ long segNo = absIdx % dsCfg.getWalSegments();
File curFile = new File(walWorkDir, FileDescriptor.fileName(segNo));
@@ -934,9 +933,9 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
File[] allFiles = walWorkDir.listFiles(WAL_SEGMENT_FILE_FILTER);
- if (allFiles.length != 0 && allFiles.length > psCfg.getWalSegments())
+ if (allFiles.length != 0 && allFiles.length > dsCfg.getWalSegments())
throw new IgniteCheckedException("Failed to initialize wal (work directory contains " +
- "incorrect number of segments) [cur=" + allFiles.length + ", expected=" + psCfg.getWalSegments() + ']');
+ "incorrect number of segments) [cur=" + allFiles.length + ", expected=" + dsCfg.getWalSegments() + ']');
// Allocate the first segment synchronously. All other segments will be allocated by archiver in background.
if (allFiles.length == 0) {
@@ -958,7 +957,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
log.debug("Formatting file [exists=" + file.exists() + ", file=" + file.getAbsolutePath() + ']');
try (FileIO fileIO = ioFactory.create(file, CREATE, READ, WRITE)) {
- int left = psCfg.getWalSegmentSize();
+ int left = dsCfg.getWalSegmentSize();
if (mode == WALMode.DEFAULT) {
while (left > 0) {
@@ -1017,7 +1016,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
// Signal to archiver that we are done with the segment and it can be archived.
long absNextIdx = archiver.nextAbsoluteSegmentIndex(curIdx);
- long segmentIdx = absNextIdx % psCfg.getWalSegments();
+ long segmentIdx = absNextIdx % dsCfg.getWalSegments();
return new File(walWorkDir, FileDescriptor.fileName(segmentIdx));
}
@@ -1085,7 +1084,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* File archiver operates on absolute segment indexes. For any given absolute segment index N we can calculate
- * the work WAL segment: S(N) = N % psCfg.walSegments.
+ * the work WAL segment: S(N) = N % dsCfg.walSegments.
* When a work segment is finished, it is given to the archiver. If the absolute index of last archived segment
* is denoted by A and the absolute index of next segment we want to write is denoted by W, then we can allow
* write to S(W) if W - A <= walSegments. <br>
@@ -1296,7 +1295,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
// Notify archiver thread.
notifyAll();
- while (curAbsWalIdx - lastAbsArchivedIdx > psCfg.getWalSegments() && cleanException == null)
+ while (curAbsWalIdx - lastAbsArchivedIdx > dsCfg.getWalSegments() && cleanException == null)
wait();
return curAbsWalIdx;
@@ -1366,7 +1365,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @param absIdx Absolute index to archive.
*/
private SegmentArchiveResult archiveSegment(long absIdx) throws IgniteCheckedException {
- long segIdx = absIdx % psCfg.getWalSegments();
+ long segIdx = absIdx % dsCfg.getWalSegments();
File origFile = new File(walWorkDir, FileDescriptor.fileName(segIdx));
@@ -1427,7 +1426,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
}
/**
- * Validate files depending on {@link PersistentStoreConfiguration#getWalSegments()} and create if need.
+ * Validate files depending on {@link DataStorageConfiguration#getWalSegments()} and create if need.
* Check end when exit condition return false or all files are passed.
*
* @param startWith Start with.
@@ -1436,14 +1435,14 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @throws IgniteCheckedException if validation or create file fail.
*/
private void checkFiles(int startWith, boolean create, IgnitePredicate<Integer> p) throws IgniteCheckedException {
- for (int i = startWith; i < psCfg.getWalSegments() && (p == null || (p != null && p.apply(i))); i++) {
+ for (int i = startWith; i < dsCfg.getWalSegments() && (p == null || (p != null && p.apply(i))); i++) {
File checkFile = new File(walWorkDir, FileDescriptor.fileName(i));
if (checkFile.exists()) {
if (checkFile.isDirectory())
throw new IgniteCheckedException("Failed to initialize WAL log segment (a directory with " +
"the same name already exists): " + checkFile.getAbsolutePath());
- else if (checkFile.length() != psCfg.getWalSegmentSize() && mode == WALMode.DEFAULT)
+ else if (checkFile.length() != dsCfg.getWalSegmentSize() && mode == WALMode.DEFAULT)
throw new IgniteCheckedException("Failed to initialize WAL log segment " +
"(WAL segment size change is not supported):" + checkFile.getAbsolutePath());
}
@@ -1768,7 +1767,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/** Condition activated each time writeBuffer() completes. Used to wait previously flushed write to complete */
private final Condition writeComplete = lock.newCondition();
- /** Condition for timed wait of several threads, see {@link PersistentStoreConfiguration#getWalFsyncDelayNanos()} */
+ /** Condition for timed wait of several threads, see {@link DataStorageConfiguration#getWalFsyncDelayNanos()} */
private final Condition fsync = lock.newCondition();
/**
@@ -2488,7 +2487,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private final FileArchiver archiver;
/** */
- private final PersistentStoreConfiguration psCfg;
+ private final DataStorageConfiguration psCfg;
/** Optional start pointer. */
@Nullable
@@ -2516,7 +2515,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
File walArchiveDir,
@Nullable FileWALPointer start,
@Nullable FileWALPointer end,
- PersistentStoreConfiguration psCfg,
+ DataStorageConfiguration psCfg,
@NotNull RecordSerializer serializer,
FileIOFactory ioFactory,
FileArchiver archiver,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
index 0fb8adf..962c4ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.processors.cache.persistence.wal.reader;
import java.io.File;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.pagemem.wal.WALIterator;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -84,8 +84,8 @@ public class IgniteWalIteratorFactory {
this.binaryMetadataFileStoreDir = binaryMetadataFileStoreDir;
this.marshallerMappingFileStoreDir = marshallerMappingFileStoreDir;
this.keepBinary = keepBinary;
- this.ioFactory = new PersistentStoreConfiguration().getFileIOFactory();
- new MemoryConfiguration().setPageSize(pageSize); // just for validate
+ this.ioFactory = new DataStorageConfiguration().getFileIOFactory();
+ new DataStorageConfiguration().setPageSize(pageSize); // just for validate
}
/**
@@ -122,7 +122,7 @@ public class IgniteWalIteratorFactory {
this.log = log;
this.pageSize = pageSize;
this.ioFactory = ioFactory;
- new MemoryConfiguration().setPageSize(pageSize); // just for validate
+ new DataStorageConfiguration().setPageSize(pageSize); // just for validate
}
/**
@@ -134,7 +134,7 @@ public class IgniteWalIteratorFactory {
* according its boundaries.
*/
public IgniteWalIteratorFactory(@NotNull final IgniteLogger log, int pageSize) {
- this(log, new PersistentStoreConfiguration().getFileIOFactory(), pageSize);
+ this(log, new DataStorageConfiguration().getFileIOFactory(), pageSize);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
index e234766..c0c3650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
@@ -27,8 +27,9 @@ import java.util.UUID;
import java.util.concurrent.ExecutorService;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+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.GridComponent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridKernalGateway;
@@ -177,8 +178,12 @@ public class StandaloneGridKernalContext implements GridKernalContext {
final Marshaller marshaller = new BinaryMarshaller();
cfg.setMarshaller(marshaller);
- PersistentStoreConfiguration pstCfg = new PersistentStoreConfiguration();
- cfg.setPersistentStoreConfiguration(pstCfg);
+ final DataStorageConfiguration pstCfg = new DataStorageConfiguration();
+ final DataRegionConfiguration regCfg = new DataRegionConfiguration();
+ regCfg.setPersistenceEnabled(true);
+ pstCfg.setDefaultDataRegionConfiguration(regCfg);
+
+ cfg.setDataStorageConfiguration(pstCfg);
marshaller.setContext(marshallerCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
index 824bc7a..9c096a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
*
* <p>Implementation is nonblocking and protected from hits loss.
* Maximum relative error is 1/{@link #size}.
- * 2^56 - 1 hits per interval can be accumulated without numeric overflow.
+ * 2^55 - 1 hits per interval can be accumulated without numeric overflow.
*/
public class HitRateMetrics {
/** Bits that store actual hit count. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 143e5cb..7da4898 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -648,7 +648,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
if (dhtVer == null)
dhtVer = explicitVer != null ? explicitVer : writeVersion();
- if (cctx.wal() != null && !writeEntries().isEmpty()
+ if (cacheCtx.group().persistenceEnabled() && !writeEntries().isEmpty()
&& op != NOOP && op != RELOAD && op != READ)
ptr = cctx.wal().log(new DataRecord(new DataEntry(
cacheCtx.cacheId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index 36306cb..afa3fd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -64,8 +64,8 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
) throws IgniteCheckedException {
super(name,
grp.groupId(),
- grp.memoryPolicy().pageMemory(),
- grp.shared().wal(),
+ grp.dataRegion().pageMemory(),
+ grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null,
grp.offheap().globalRemoveId(),
metaPageId,
reuseList,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
index fad3a50..a6ec6e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
@@ -55,7 +55,7 @@ public class PendingEntriesTree extends BPlusTree<PendingRow, PendingRow> {
super(name,
grp.groupId(),
pageMem,
- grp.shared().wal(),
+ grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null,
grp.offheap().globalRemoveId(),
metaPageId,
reuseList,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index ff42ff6..3cd0451 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteCallable;
@@ -142,7 +143,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
// Start first node as inactive if persistence is enabled.
- boolean activeOnStart = !ctx.config().isPersistentStoreEnabled() && ctx.config().isActiveOnStart();
+ boolean activeOnStart = !CU.isPersistenceEnabled(ctx.config()) && ctx.config().isActiveOnStart();
globalState = DiscoveryDataClusterState.createState(activeOnStart);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index e73fa6c..12765df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -65,7 +65,7 @@ import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-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.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerCacheUpdaters;
import org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor;
@@ -243,7 +243,7 @@ public class IgfsDataManager extends IgfsManager {
* @return Maximum number of bytes for IGFS data cache.
*/
public long maxSpaceSize() {
- MemoryPolicy plc = dataCachePrj.context().memoryPolicy();
+ DataRegion plc = dataCachePrj.context().dataRegion();
long size = plc != null ? plc.config().getMaxSize() : 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index e88a234..98428b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -2554,7 +2554,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private void saveCacheConfiguration(DynamicCacheDescriptor desc) {
GridCacheSharedContext cctx = ctx.cache().context();
- if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode()) {
+ if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode() &&
+ CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration())) {
CacheConfiguration cfg = desc.cacheConfiguration();
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 6fe056c..f2fd195 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -26,7 +26,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -142,7 +142,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
/** */
private boolean loadPrevVal;
- /** Name of {@link MemoryPolicyConfiguration} for this cache */
+ /** Name of {@link DataRegionConfiguration} for this cache */
private String memPlcName;
/** Maximum inline size for sql indexes. */
@@ -219,7 +219,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
evictFilter = compactClass(ccfg.getEvictionFilter());
lsnrConfigurations = compactIterable(ccfg.getCacheEntryListenerConfigurations());
loadPrevVal = ccfg.isLoadPreviousValue();
- memPlcName = ccfg.getMemoryPolicyName();
+ memPlcName = ccfg.getDataRegionName();
sqlIdxMaxInlineSize = ccfg.getSqlIndexMaxInlineSize();
nodeFilter = compactClass(ccfg.getNodeFilter());
qryDetailMetricsSz = ccfg.getQueryDetailMetricsSize();
@@ -460,7 +460,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
}
/**
- * @return {@link MemoryPolicyConfiguration} name.
+ * @return {@link DataRegionConfiguration} name.
*/
public String getMemoryPolicyName() {
return memPlcName;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
index c6cdd5c..37fed5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
@@ -20,13 +20,13 @@ package org.apache.ignite.internal.visor.cache;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * Data transfer object for {@link MemoryMetrics}
+ * Data transfer object for {@link DataRegionMetrics}
*/
public class VisorMemoryMetrics extends VisorDataTransferObject {
/** */
@@ -69,7 +69,7 @@ public class VisorMemoryMetrics extends VisorDataTransferObject {
/**
* @param m Metrics instance to create DTO.
*/
- public VisorMemoryMetrics(MemoryMetrics m) {
+ public VisorMemoryMetrics(DataRegionMetrics m) {
name = m.getName();
totalAllocatedPages = m.getTotalAllocatedPages();
allocationRate = m.getAllocationRate();
[03/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
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();
- }
- }
- }
-}
[11/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
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/master
Commit: ec41370c4da65c01e9b7c584e0706c40e4171b35
Parents: 173ecef
Author: Ivan Rakov <iv...@gmail.com>
Authored: Fri Oct 20 10:29:57 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
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>
[02/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
index dcd4ce1..880e37e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
@@ -23,12 +23,12 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
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.MetadataStorage;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.PageMemory;
@@ -156,7 +156,7 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest {
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(
@@ -165,7 +165,7 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
index 53e5daf..f22128c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
@@ -22,23 +22,23 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
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.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
- * Test verifies correct construction of swap file path {@link MemoryPolicyConfiguration#setSwapFilePath(String)}
+ * Test verifies correct construction of swap file path {@link DataRegionConfiguration#setSwapPath(String)}
* when absolute or relative paths are provided via configuration.
*/
public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
/** */
- private MemoryConfiguration memCfg;
+ private DataStorageConfiguration memCfg;
/** */
private static final String RELATIVE_SWAP_PATH = "relSwapPath";
@@ -50,7 +50,7 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
@@ -118,7 +118,7 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
private String extractDefaultPageMemoryAllocPath(GridKernalContext context) {
IgniteCacheDatabaseSharedManager dbMgr = context.cache().context().database();
- Map<String, MemoryPolicy> memPlcMap = U.field(dbMgr, "memPlcMap");
+ Map<String, DataRegion> memPlcMap = U.field(dbMgr, "dataRegionMap");
PageMemory pageMem = memPlcMap.get("default").pageMemory();
@@ -128,22 +128,22 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
}
/**
- * @param isRelativePath flag is set to {@code true} if relative path should be used for memory policy configuration.
+ * @param isRelativePath flag is set to {@code true} if relative path should be used for data region configuration.
*/
- private MemoryConfiguration createMemoryConfiguration(boolean isRelativePath) {
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ private DataStorageConfiguration createMemoryConfiguration(boolean isRelativePath) {
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setName("default");
memPlcCfg.setMaxSize(20 * 1024 * 1024);
if (isRelativePath)
- memPlcCfg.setSwapFilePath(RELATIVE_SWAP_PATH);
+ memPlcCfg.setSwapPath(RELATIVE_SWAP_PATH);
else
- memPlcCfg.setSwapFilePath(Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString());
+ memPlcCfg.setSwapPath(Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString());
- memCfg.setMemoryPolicies(memPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
return memCfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
index 1e5fcd1..a0ce285 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.igfs;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
import org.apache.ignite.IgniteAtomicSequence;
@@ -38,6 +41,7 @@ import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cache.affinity.Affinity;
@@ -584,26 +588,41 @@ public class IgfsIgniteMock implements IgniteEx {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
throwUnsupported();
return null;
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
throwUnsupported();
return null;
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
throwUnsupported();
return null;
}
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
/**
* Throw {@link UnsupportedOperationException}.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index 597efe1..0acb1d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -24,10 +24,10 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
import org.apache.ignite.igfs.IgfsInputStream;
@@ -396,14 +396,14 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
@Override public void apply(IgniteConfiguration cfg) {
String memPlcName = "igfsDataMemPlc";
- cfg.setMemoryConfiguration(new MemoryConfiguration().setMemoryPolicies(
- new MemoryPolicyConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(
+ new DataRegionConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
FileSystemConfiguration igfsCfg = cfg.getFileSystemConfiguration()[0];
- igfsCfg.getDataCacheConfiguration().setMemoryPolicyName(memPlcName);
+ igfsCfg.getDataCacheConfiguration().setDataRegionName(memPlcName);
- cfg.setCacheConfiguration(new CacheConfiguration().setName("QQQ").setMemoryPolicyName(memPlcName));
+ cfg.setCacheConfiguration(new CacheConfiguration().setName("QQQ").setDataRegionName(memPlcName));
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 779f095..c08e144 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -21,6 +21,10 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import javax.management.MBeanServer;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
@@ -469,20 +473,35 @@ public class IgniteMock implements Ignite {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
return null;
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
return null;
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
return null;
}
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
/**
* @param staticCfg Configuration.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 2f91e40..86a374a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -26,6 +26,9 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import javax.cache.CacheException;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
@@ -49,6 +52,7 @@ import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cache.affinity.Affinity;
@@ -742,21 +746,36 @@ public class IgniteProcessProxy implements IgniteEx {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
+ /** {@inheritDoc} */
@Override public void close() throws IgniteException {
if (locJvmGrid != null) {
final CountDownLatch rmtNodeStoppedLatch = new CountDownLatch(1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 5c4d7fd..7ca9467 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -54,7 +54,7 @@ import org.apache.ignite.internal.processors.database.BPlusTreeFakeReuseSelfTest
import org.apache.ignite.internal.processors.database.BPlusTreeReuseSelfTest;
import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
import org.apache.ignite.internal.processors.database.FreeListImplSelfTest;
-import org.apache.ignite.internal.processors.database.MemoryMetricsSelfTest;
+import org.apache.ignite.internal.processors.database.DataRegionMetricsSelfTest;
import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
import org.apache.ignite.internal.processors.database.SwapPathConstructionSelfTest;
import org.apache.ignite.internal.processors.odbc.OdbcConfigurationValidationSelfTest;
@@ -175,7 +175,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(BPlusTreeReuseSelfTest.class);
suite.addTestSuite(MetadataStorageSelfTest.class);
suite.addTestSuite(FreeListImplSelfTest.class);
- suite.addTestSuite(MemoryMetricsSelfTest.class);
+ suite.addTestSuite(DataRegionMetricsSelfTest.class);
suite.addTestSuite(SwapPathConstructionSelfTest.class);
suite.addTestSuite(IgniteMarshallerCacheFSRestoreTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index e8810bb..047550d 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -78,7 +78,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheStoreValueBytesSelfT
import org.apache.ignite.internal.processors.cache.GridCacheSwapPreloadSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheTtlManagerSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheTxPartitionedLocalStoreSelfTest;
-import org.apache.ignite.internal.processors.cache.GridMemoryConfigurationConsistencySelfTest;
+import org.apache.ignite.internal.processors.cache.GridDataStorageConfigurationConsistencySelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicInvokeTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalInvokeTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalWithStoreInvokeTest;
@@ -225,7 +225,7 @@ public class IgniteCacheTestSuite extends TestSuite {
// suite.addTestSuite(GridCacheP2PUndeploySelfTest.class);
suite.addTestSuite(GridCacheConfigurationValidationSelfTest.class);
suite.addTestSuite(GridCacheConfigurationConsistencySelfTest.class);
- suite.addTestSuite(GridMemoryConfigurationConsistencySelfTest.class);
+ suite.addTestSuite(GridDataStorageConfigurationConsistencySelfTest.class);
suite.addTestSuite(GridCacheJdbcBlobStoreSelfTest.class);
suite.addTestSuite(GridCacheJdbcBlobStoreMultithreadedSelfTest.class);
suite.addTestSuite(JdbcTypesDefaultTransformerTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 31ad015..6f5b710 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -29,7 +29,7 @@ import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNode
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
import org.apache.ignite.internal.processors.cache.CacheExchangeMessageDuplicatedStateTest;
import org.apache.ignite.internal.processors.cache.CacheGroupLocalConfigurationSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheMemoryPolicyConfigurationTest;
+import org.apache.ignite.internal.processors.cache.CacheDataRegionConfigurationTest;
import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterSingleServerTest;
import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterTest;
import org.apache.ignite.internal.processors.cache.CrossCacheTxNearEnabledRandomOperationsTest;
@@ -262,7 +262,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(CacheConfigurationLeakTest.class));
suite.addTest(new TestSuite(MemoryPolicyConfigValidationTest.class));
suite.addTest(new TestSuite(MemoryPolicyInitializationTest.class));
- suite.addTest(new TestSuite(CacheMemoryPolicyConfigurationTest.class));
+ suite.addTest(new TestSuite(CacheDataRegionConfigurationTest.class));
suite.addTest(new TestSuite(CacheGroupLocalConfigurationSelfTest.class));
suite.addTest(new TestSuite(CacheEnumOperationsSingleNodeTest.class));
suite.addTest(new TestSuite(CacheEnumOperationsTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index d92d848..b1e80ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -18,12 +18,12 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.persistence.IgniteDataStorageMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsExchangeDuringCheckpointTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsPageSizesTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
-import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistenceMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistentStoreDataStructuresTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionDuringPartitionClearTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsRebalancingOnNotStableTopologyTest;
@@ -53,7 +53,7 @@ public class IgnitePdsTestSuite2 extends TestSuite {
suite.addTestSuite(IgnitePdsPageSizesTest.class);
// Metrics test.
- suite.addTestSuite(IgnitePersistenceMetricsSelfTest.class);
+ suite.addTestSuite(IgniteDataStorageMetricsSelfTest.class);
suite.addTestSuite(IgnitePdsTransactionsHangTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 1a3ea4a..3c0ab5e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -110,7 +110,7 @@ public class H2TreeIndex extends GridH2IndexBase {
name,
cctx.offheap().reuseListForIndex(name),
cctx.groupId(),
- cctx.memoryPolicy().pageMemory(),
+ cctx.dataRegion().pageMemory(),
cctx.shared().wal(),
cctx.offheap().globalRemoveId(),
tbl.rowFactory(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
index 998e1e4..4a32dfd 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbSingleNodeWithIndexingPutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest extends Ignite
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
index 0a0afb4..079dcdf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
@@ -43,8 +43,9 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
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.MemoryConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.typedef.F;
@@ -136,9 +137,10 @@ public abstract class IgniteCacheDistributedPartitionQueryAbstractSelfTest exten
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration().setDefaultMemoryPolicySize(20 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(20 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
spi.setIpFinder(IP_FINDER);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 943a5c8..627b3eb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -33,8 +33,9 @@ import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
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.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -90,9 +91,10 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
- MemoryConfiguration memCfg = new MemoryConfiguration().setDefaultMemoryPolicySize(50 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
- c.setMemoryConfiguration(memCfg);
+ c.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
index b25359a..2beea8b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
@@ -31,9 +31,9 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
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.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
@@ -259,16 +259,10 @@ public abstract class DynamicColumnsAbstractTest extends GridCommonAbstractTest
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setDefaultMemoryPolicyName("default")
- .setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setName("default")
- .setMaxSize(128 * 1024 * 1024L)
- .setInitialSize(128 * 1024 * 1024L)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(128 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return optimize(cfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
index 70197f5..a39283b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
@@ -28,9 +28,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cluster.ClusterNode;
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.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.util.typedef.T2;
@@ -141,16 +141,10 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
cfg.setMarshaller(new BinaryMarshaller());
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setDefaultMemoryPolicyName("default")
- .setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setName("default")
- .setMaxSize(128 * 1024 * 1024L)
- .setInitialSize(128 * 1024 * 1024L)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(128 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return optimize(cfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
index 544eb74..ab0d520 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +44,7 @@ public class LongIndexNameTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
return super.getConfiguration(igniteInstanceName)
- .setPersistentStoreConfiguration(new PersistentStoreConfiguration())
+ .setDataStorageConfiguration(new DataStorageConfiguration())
.setCacheConfiguration(new <String, Person>CacheConfiguration("cache")
.setQueryEntities(getIndexCfg())
.setAffinity(new RendezvousAffinityFunction(false, 16)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
index 8f6afd8..54667df 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
@@ -27,8 +27,10 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.configuration.BinaryConfiguration;
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.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.F;
@@ -111,7 +113,12 @@ public class IgniteDbSingleNodeWithIndexingWalRestoreTest extends GridCommonAbst
cfg.setCacheConfiguration(indexedCacheCfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setConsistentId(gridName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
index 5bb1eb1..c37dbda 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -56,11 +56,11 @@ public class IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest extends G
cfg.setCacheConfiguration(cacheCfg(CACHE_NAME));
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setCheckpointingFrequency(1000);
+ pCfg.setCheckpointFrequency(1000);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
index a408596..1474954 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
@@ -27,8 +27,9 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
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.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.persistence.DbCheckpointListener;
@@ -71,13 +72,15 @@ public class IgnitePersistentStoreSchemaLoadTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(cacheCfg(TMPL_NAME));
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setCheckpointingFrequency(1000);
+ pCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024));
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setCheckpointFrequency(1000);
- cfg.setActiveOnStart(true);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
index 8deb61f..8283003 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
@@ -41,8 +41,8 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cache.store.CacheStoreAdapter;
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.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -141,7 +141,7 @@ public class IgniteSqlNotNullConstraintTest extends GridCommonAbstractTest {
c.setClientMode(true);
// Not allowed to have local cache on client without memory config
- c.setMemoryConfiguration(new MemoryConfiguration());
+ c.setDataStorageConfiguration(new DataStorageConfiguration());
}
return c;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
index 4a69887..41dd4f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
@@ -25,12 +25,12 @@ import java.util.Comparator;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.commons.io.Charsets;
-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;
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.testframework.junits.common.GridCommonAbstractTest;
import org.h2.result.SortOrder;
import org.h2.value.CompareMode;
@@ -181,7 +181,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private int putAndCompare(String v1, String v2, int maxSize) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log,
@@ -189,7 +189,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -279,7 +279,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
public void testStringTruncate() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -287,7 +287,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -330,7 +330,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
public void testBytes() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -338,7 +338,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -449,7 +449,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
private void testPutGet(Value v1, Value v2, Value v3) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -457,7 +457,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
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/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
index cfbe2e0..114f630 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageE
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCacheIntegrationTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsNoActualWalHistoryTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsThreadInterruptionTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRecoveryPPCTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRecoveryTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRecoveryTxLogicalRecordsTest;
@@ -52,6 +53,8 @@ public class IgnitePdsWithIndexingCoreTestSuite extends TestSuite {
suite.addTestSuite(IgnitePdsAtomicCacheRebalancingTest.class);
suite.addTestSuite(IgnitePdsTxCacheRebalancingTest.class);
+ suite.addTestSuite(IgniteWalRecoveryPPCTest.class);
+
suite.addTestSuite(IgnitePdsBinaryMetadataOnClusterRestartTest.class);
suite.addTestSuite(IgnitePdsMarshallerMappingRestoreOnNodeStartTest.class);
suite.addTestSuite(IgnitePdsThreadInterruptionTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index cde216b..73636d1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -316,7 +316,6 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(mem);
Assert.AreEqual("dfltPlc", mem.DefaultMemoryPolicyName);
- Assert.AreEqual(MemoryConfiguration.DefaultPageSize, mem.PageSize);
Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheInitialSize, mem.SystemCacheInitialSize);
Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheMaxSize, mem.SystemCacheMaxSize);
@@ -324,7 +323,6 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("dfltPlc", plc.Name);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultEmptyPagesPoolSize, plc.EmptyPagesPoolSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultEvictionThreshold, plc.EvictionThreshold);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultInitialSize, plc.InitialSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultSubIntervals, plc.SubIntervals);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultRateTimeInterval, plc.RateTimeInterval);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
index b4f89f2..00941d0 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
@@ -59,6 +60,8 @@ public class GridJettyObjectMapper extends ObjectMapper {
module.addSerializer(GridCacheSqlMetadata.class, IGNITE_SQL_METADATA_SERIALIZER);
module.addSerializer(GridCacheSqlIndexMetadata.class, IGNITE_SQL_INDEX_METADATA_SERIALIZER);
+ configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+
registerModule(module);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
index 1f80574..4cba76e 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
@@ -273,24 +273,39 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
checkIgnite();
- return g.memoryMetrics();
+ return g.dataRegionMetrics();
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
checkIgnite();
- return g.memoryMetrics(memPlcName);
+ return g.dataRegionMetrics(memPlcName);
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
checkIgnite();
- return g.persistentStoreMetrics();
+ return g.dataStorageMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
index fb2a7f4..a772492 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands.top
import org.apache.ignite.Ignition
-import org.apache.ignite.configuration.{IgniteConfiguration, MemoryConfiguration, PersistentStoreConfiguration}
+import org.apache.ignite.configuration._
import org.apache.ignite.visor.commands.top.VisorTopologyCommand._
import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
import VisorRuntimeBaseSpec._
@@ -30,11 +30,14 @@ class VisorActivationCommandSpec extends VisorRuntimeBaseSpec(2) {
override protected def config(name: String): IgniteConfiguration = {
val cfg = super.config(name)
- val memCfg = new MemoryConfiguration
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024)
+ val dfltReg = new DataRegionConfiguration
+ val dataRegCfg = new DataStorageConfiguration
- cfg.setMemoryConfiguration(memCfg)
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration)
+ dfltReg.setMaxSize(10 * 1024 * 1024)
+ dfltReg.setPersistenceEnabled(true)
+ dataRegCfg.setDefaultDataRegionConfiguration(dfltReg)
+
+ cfg.setDataStorageConfiguration(dataRegCfg)
cfg
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index a07f979..bfe1ae2 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -960,6 +960,61 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
name: String,
size: Number
}],
+ dataStorageConfiguration: {
+ systemRegionInitialSize: Number,
+ systemRegionMaxSize: Number,
+ pageSize: Number,
+ concurrencyLevel: Number,
+ defaultDataRegionConfiguration: {
+ name: String,
+ initialSize: Number,
+ maxSize: Number,
+ swapPath: String,
+ pageEvictionMode: {type: String, enum: ['DISABLED', 'RANDOM_LRU', 'RANDOM_2_LRU']},
+ evictionThreshold: Number,
+ emptyPagesPoolSize: Number,
+ metricsEnabled: Boolean,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ persistenceEnabled: Boolean
+ },
+ dataRegionConfigurations: [{
+ name: String,
+ initialSize: Number,
+ maxSize: Number,
+ swapPath: String,
+ pageEvictionMode: {type: String, enum: ['DISABLED', 'RANDOM_LRU', 'RANDOM_2_LRU']},
+ evictionThreshold: Number,
+ emptyPagesPoolSize: Number,
+ metricsEnabled: Boolean,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ persistenceEnabled: Boolean
+ }],
+ storagePath: String,
+ metricsEnabled: Boolean,
+ alwaysWriteFullPages: Boolean,
+ checkpointFrequency: Number,
+ checkpointPageBufferSize: Number,
+ checkpointThreads: Number,
+ checkpointWriteOrder: {type: String, enum: ['RANDOM', 'SEQUENTIAL']},
+ walPath: String,
+ walArchivePath: String,
+ walMode: {type: String, enum: ['DEFAULT', 'LOG_ONLY', 'BACKGROUND', 'NONE']},
+ walSegments: Number,
+ walSegmentSize: Number,
+ walHistorySize: Number,
+ walFlushFrequency: Number,
+ walFsyncDelayNanos: Number,
+ walRecordIteratorBufferSize: Number,
+ lockWaitTime: Number,
+ walThreadLocalBufferSize: Number,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ fileIOFactory: {type: String, enum: ['RANDOM', 'ASYNC']},
+ walAutoArchiveAfterInactivity: Number,
+ writeThrottlingEnabled: Boolean
+ },
memoryConfiguration: {
systemCacheInitialSize: Number,
systemCacheMaxSize: Number,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/components/page-configure-basic/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
index c0b56ac..cafdb20 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
@@ -57,7 +57,7 @@ export default class PageConfigureBasicController {
allClusterCaches: this.getAllClusterCaches(state.configureBasic),
cachesMenu: this.getCachesMenu(state.list.caches),
clustersMenu: this.getClustersMenu(state.list.clusters),
- defaultMemoryPolicy: this.getDefaultClusterMemoryPolicy(state.configureBasic.cluster),
+ defaultMemoryPolicy: this.getDefaultClusterMemoryPolicy(state.configureBasic.cluster, version),
memorySizeInputVisible: this.getMemorySizeInputVisibility(version)
}))
.do((value) => this.applyValue(value));
@@ -125,8 +125,12 @@ export default class PageConfigureBasicController {
return [...state.oldClusterCaches, ...state.newClusterCaches];
}
- getDefaultClusterMemoryPolicy(cluster) {
- return get(cluster, 'memoryConfiguration.memoryPolicies', []).find((p) => p.name === 'default');
+ getDefaultClusterMemoryPolicy(cluster, version) {
+ if (this.Version.since(version.ignite, ['2.1.0', '2.3.0']))
+ return get(cluster, 'memoryConfiguration.memoryPolicies', []).find((p) => p.name === 'default');
+
+ return get(cluster, 'dataStorageConfiguration.defaultDataRegionConfiguration') ||
+ get(cluster, 'dataStorageConfiguration.dataRegionConfigurations', []).find((p) => p.name === 'default');
}
getMemorySizeInputVisibility(version) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index a67f7b9..f6f471c 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -138,6 +138,11 @@ export default class AbstractTransformer {
return this.toSection(this.generator.clusterMemory(memoryConfiguration, available));
}
+ // Generate memory configuration group.
+ static clusterDataStorageConfiguration(dataStorageCfg, available) {
+ return this.toSection(this.generator.clusterDataStorageConfiguration(dataStorageCfg, available));
+ }
+
// Generate marshaller group.
static clusterMisc(cluster, available) {
return this.toSection(this.generator.clusterMisc(cluster, available));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 75ee47c..cd635db 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -81,6 +81,11 @@ export default class IgniteConfigurationGenerator {
this.clusterCollision(cluster.collision, cfg);
this.clusterCommunication(cluster, cfg);
this.clusterConnector(cluster.connector, cfg);
+
+ // Since ignite 2.3
+ if (available('2.3.0'))
+ this.clusterDataStorageConfiguration(cluster.dataStorageConfiguration, available, cfg);
+
this.clusterDeployment(cluster, available, cfg);
this.clusterEvents(cluster, available, cfg);
this.clusterFailover(cluster, available, cfg);
@@ -89,19 +94,23 @@ export default class IgniteConfigurationGenerator {
this.clusterLogger(cluster.logger, cfg);
this.clusterMarshaller(cluster, available, cfg);
- // Since ignite 2.0
- if (available('2.0.0'))
+ // Since ignite 2.0 and deprecated in ignite 2.3
+ if (available(['2.0.0', '2.3.0']))
this.clusterMemory(cluster.memoryConfiguration, available, cfg);
this.clusterMisc(cluster, available, cfg);
this.clusterMetrics(cluster, available, cfg);
this.clusterODBC(cluster.odbc, available, cfg);
- this.clusterPersistence(cluster.persistenceStoreConfiguration, available, cfg);
+
+ // Since ignite 2.1 deprecated in ignite 2.3
+ if (available(['2.1.0', '2.3.0']))
+ this.clusterPersistence(cluster.persistenceStoreConfiguration, available, cfg);
+
this.clusterQuery(cluster, available, cfg);
this.clusterServiceConfiguration(cluster.serviceConfigurations, cluster.caches, cfg);
this.clusterSsl(cluster, cfg);
- // Removed in ignite 2.0
+ // Deprecated in ignite 2.0
if (available(['1.0.0', '2.0.0']))
this.clusterSwap(cluster, cfg);
@@ -1333,6 +1342,95 @@ export default class IgniteConfigurationGenerator {
return cfg;
}
+ static dataRegionConfiguration(dataRegionCfg) {
+ const plcBean = new Bean('org.apache.ignite.configuration.DataRegionConfiguration', 'dataRegionCfg', dataRegionCfg, clusterDflts.dataStorageConfiguration.dataRegionConfigurations);
+
+ return plcBean.stringProperty('name')
+ .longProperty('initialSize')
+ .longProperty('maxSize')
+ .stringProperty('swapPath')
+ .enumProperty('pageEvictionMode')
+ .doubleProperty('evictionThreshold')
+ .intProperty('emptyPagesPoolSize')
+ .intProperty('metricsSubIntervalCount')
+ .longProperty('metricsRateTimeInterval')
+ .boolProperty('metricsEnabled')
+ .boolProperty('persistenceEnabled');
+ }
+
+ // Generate data storage configuration.
+ static clusterDataStorageConfiguration(dataStorageCfg, available, cfg = this.igniteConfigurationBean()) {
+ if (!available('2.3.0'))
+ return cfg;
+
+ const storageBean = new Bean('org.apache.ignite.configuration.DataStorageConfiguration', 'dataStorageCfg', dataStorageCfg, clusterDflts.dataStorageConfiguration);
+
+ storageBean.intProperty('pageSize')
+ .intProperty('concurrencyLevel')
+ .intProperty('systemRegionInitialSize')
+ .intProperty('systemRegionMaxSize');
+
+ const dfltDataRegionCfg = this.dataRegionConfiguration(_.get(dataStorageCfg, 'defaultDataRegionConfiguration'));
+
+ if (!dfltDataRegionCfg.isEmpty())
+ storageBean.beanProperty('defaultDataRegionConfiguration', dfltDataRegionCfg);
+
+ const dataRegionCfgs = [];
+
+ _.forEach(_.get(dataStorageCfg, 'dataRegionConfigurations'), (dataRegionCfg) => {
+ const plcBean = this.dataRegionConfiguration(dataRegionCfg);
+
+ if (plcBean.isEmpty())
+ return;
+
+ dataRegionCfgs.push(plcBean);
+ });
+
+ if (!_.isEmpty(dataRegionCfgs))
+ storageBean.varArgProperty('dataRegionConfigurations', 'dataRegionConfigurations', dataRegionCfgs, 'org.apache.ignite.configuration.DataRegionConfiguration');
+
+ storageBean.stringProperty('storagePath')
+ .intProperty('checkpointFrequency')
+ .longProperty('checkpointPageBufferSize')
+ .intProperty('checkpointThreads')
+ .enumProperty('walMode')
+ .stringProperty('walPath')
+ .stringProperty('walArchivePath')
+ .intProperty('walSegments')
+ .intProperty('walSegmentSize')
+ .intProperty('walHistorySize')
+ .longProperty('walFlushFrequency')
+ .longProperty('walFsyncDelayNanos')
+ .intProperty('walRecordIteratorBufferSize')
+ .longProperty('lockWaitTime')
+ .intProperty('walThreadLocalBufferSize')
+ .intProperty('metricsSubIntervalCount')
+ .intProperty('metricsRateTimeInterval')
+ .longProperty('walAutoArchiveAfterInactivity')
+ .boolProperty('metricsEnabled')
+ .boolProperty('alwaysWriteFullPages')
+ .boolProperty('writeThrottlingEnabled');
+
+ const fileIOFactory = _.get(dataStorageCfg, 'fileIOFactory');
+
+ let factoryBean;
+
+ if (fileIOFactory === 'RANDOM')
+ factoryBean = new Bean('org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory', 'rndFileIoFactory', {});
+ else if (fileIOFactory === 'ASYNC')
+ factoryBean = new Bean('org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory', 'asyncFileIoFactory', {});
+
+ if (factoryBean)
+ storageBean.beanProperty('fileIOFactory', factoryBean);
+
+ if (storageBean.isEmpty())
+ return cfg;
+
+ cfg.beanProperty('dataStorageConfiguration', storageBean);
+
+ return cfg;
+ }
+
// Generate miscellaneous configuration.
static clusterMisc(cluster, available, cfg = this.igniteConfigurationBean(cluster)) {
cfg.stringProperty('workDirectory');
@@ -1473,7 +1571,7 @@ export default class IgniteConfigurationGenerator {
// Generate cluster query group.
static clusterPersistence(persistence, available, cfg = this.igniteConfigurationBean()) {
- if (!available('2.1.0') || _.get(persistence, 'enabled') !== true)
+ if (!available(['2.1.0', '2.3.0']) || _.get(persistence, 'enabled') !== true)
return cfg;
const bean = new Bean('org.apache.ignite.configuration.PersistentStoreConfiguration', 'PersistenceCfg',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
index 1c7fc44..0e786d9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -311,6 +311,46 @@ const DFLT_CLUSTER = {
rateTimeInterval: 60000
}
},
+ dataStorageConfiguration: {
+ systemCacheInitialSize: 41943040,
+ systemCacheMaxSize: 104857600,
+ pageSize: 2048,
+ storagePath: 'db',
+ dataRegionConfigurations: {
+ name: 'default',
+ initialSize: 268435456,
+ pageEvictionMode: {
+ clsName: 'org.apache.ignite.configuration.DataPageEvictionMode',
+ value: 'DISABLED'
+ },
+ evictionThreshold: 0.9,
+ emptyPagesPoolSize: 100,
+ metricsEnabled: false,
+ metricsSubIntervalCount: 5,
+ metricsRateTimeInterval: 60000
+ },
+ metricsEnabled: false,
+ alwaysWriteFullPages: false,
+ checkpointFrequency: 180000,
+ checkpointPageBufferSize: 268435456,
+ checkpointThreads: 4,
+ walMode: {
+ clsName: 'org.apache.ignite.configuration.WALMode',
+ value: 'DEFAULT'
+ },
+ walPath: 'db/wal',
+ walArchivePath: 'db/wal/archive',
+ walSegments: 10,
+ walSegmentSize: 67108864,
+ walHistorySize: 20,
+ walFlushFrequency: 2000,
+ walFsyncDelayNanos: 1000,
+ walRecordIteratorBufferSize: 67108864,
+ lockWaitTime: 10000,
+ walThreadLocalBufferSize: 131072,
+ metricsSubIntervalCount: 5,
+ metricsRateTimeInterval: 60000
+ },
utilityCacheKeepAliveTime: 60000,
hadoopConfiguration: {
mapReducePlanner: {
[09/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
index 8f146dc..6ba68c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
@@ -27,14 +27,14 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-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.DirectMemoryRegion;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-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.io.PageIO;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -125,11 +125,11 @@ public class PageMemoryNoStoreImpl implements PageMemory {
/** Direct memory allocator. */
private final DirectMemoryProvider directMemoryProvider;
- /** Name of MemoryPolicy this PageMemory is associated with. */
- private final MemoryPolicyConfiguration memoryPolicyCfg;
+ /** Name of DataRegion this PageMemory is associated with. */
+ private final DataRegionConfiguration dataRegionCfg;
/** Object to collect memory usage metrics. */
- private final MemoryMetricsImpl memMetrics;
+ private final DataRegionMetricsImpl memMetrics;
/** */
private AtomicLong freePageListHead = new AtomicLong(INVALID_REL_PTR);
@@ -163,7 +163,7 @@ public class PageMemoryNoStoreImpl implements PageMemory {
* @param directMemoryProvider Memory allocator to use.
* @param sharedCtx Cache shared context.
* @param pageSize Page size.
- * @param memPlcCfg Memory Policy configuration.
+ * @param dataRegionCfg Data region configuration.
* @param memMetrics Memory Metrics.
* @param trackAcquiredPages If {@code true} tracks number of allocated pages (for tests purpose only).
*/
@@ -172,8 +172,8 @@ public class PageMemoryNoStoreImpl implements PageMemory {
DirectMemoryProvider directMemoryProvider,
GridCacheSharedContext<?, ?> sharedCtx,
int pageSize,
- MemoryPolicyConfiguration memPlcCfg,
- MemoryMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegionCfg,
+ DataRegionMetricsImpl memMetrics,
boolean trackAcquiredPages
) {
assert log != null || sharedCtx != null;
@@ -183,21 +183,21 @@ public class PageMemoryNoStoreImpl implements PageMemory {
this.directMemoryProvider = directMemoryProvider;
this.trackAcquiredPages = trackAcquiredPages;
this.memMetrics = memMetrics;
- memoryPolicyCfg = memPlcCfg;
+ this.dataRegionCfg = dataRegionCfg;
sysPageSize = pageSize + PAGE_OVERHEAD;
assert sysPageSize % 8 == 0 : sysPageSize;
- totalPages = (int)(memPlcCfg.getMaxSize() / sysPageSize);
+ totalPages = (int)(dataRegionCfg.getMaxSize() / sysPageSize);
rwLock = new OffheapReadWriteLock(lockConcLvl);
}
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- long startSize = memoryPolicyCfg.getInitialSize();
- long maxSize = memoryPolicyCfg.getMaxSize();
+ long startSize = dataRegionCfg.getInitialSize();
+ long maxSize = dataRegionCfg.getMaxSize();
long[] chunks = new long[SEG_CNT];
@@ -290,9 +290,9 @@ public class PageMemoryNoStoreImpl implements PageMemory {
if (relPtr == INVALID_REL_PTR)
throw new IgniteOutOfMemoryException("Not enough memory allocated " +
- "(consider increasing memory policy size or enabling evictions) " +
- "[policyName=" + memoryPolicyCfg.getName() +
- ", size=" + U.readableSize(memoryPolicyCfg.getMaxSize(), true) + "]"
+ "(consider increasing data region size or enabling evictions) " +
+ "[policyName=" + dataRegionCfg.getName() +
+ ", size=" + U.readableSize(dataRegionCfg.getMaxSize(), true) + "]"
);
assert (relPtr & ~PageIdUtils.PAGE_IDX_MASK) == 0 : U.hexLong(relPtr & ~PageIdUtils.PAGE_IDX_MASK);
@@ -615,7 +615,7 @@ public class PageMemoryNoStoreImpl implements PageMemory {
if (oldRef != null) {
if (log.isInfoEnabled())
- log.info("Allocated next memory segment [plcName=" + memoryPolicyCfg.getName() +
+ log.info("Allocated next memory segment [plcName=" + dataRegionCfg.getName() +
", chunkSize=" + U.readableSize(region.size(), true) + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index a413ade..eaaa24d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -2592,7 +2592,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param sql SQL flag.
*/
private void saveCacheConfiguration(CacheConfiguration<?, ?> cfg, boolean sql) {
- if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode()) {
+ if (cctx.pageStore() != null && cctx.database().persistenceEnabled() &&
+ CU.isPersistentCache(cfg, cctx.gridConfig().getDataStorageConfiguration()) &&
+ !cctx.kernalContext().clientNode()) {
try {
StoredCacheData data = new StoredCacheData(cfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index 5e5e02e..18acacf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -42,8 +42,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffini
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
import org.apache.ignite.internal.processors.cache.query.continuous.CounterSkipContext;
@@ -126,7 +126,7 @@ public class CacheGroupContext {
private GridCachePreloader preldr;
/** */
- private final MemoryPolicy memPlc;
+ private final DataRegion dataRegion;
/** */
private final CacheObjectContext cacheObjCtx;
@@ -150,7 +150,7 @@ public class CacheGroupContext {
* @param cacheType Cache type.
* @param ccfg Cache configuration.
* @param affNode Affinity node flag.
- * @param memPlc Memory policy.
+ * @param dataRegion data region.
* @param cacheObjCtx Cache object context.
* @param freeList Free list.
* @param reuseList Reuse list.
@@ -163,13 +163,13 @@ public class CacheGroupContext {
CacheType cacheType,
CacheConfiguration ccfg,
boolean affNode,
- MemoryPolicy memPlc,
+ DataRegion dataRegion,
CacheObjectContext cacheObjCtx,
FreeList freeList,
ReuseList reuseList,
AffinityTopologyVersion locStartVer) {
assert ccfg != null;
- assert memPlc != null || !affNode;
+ assert dataRegion != null || !affNode;
assert grpId != 0 : "Invalid group ID [cache=" + ccfg.getName() + ", grpName=" + ccfg.getGroupName() + ']';
this.grpId = grpId;
@@ -177,7 +177,7 @@ public class CacheGroupContext {
this.ctx = ctx;
this.ccfg = ccfg;
this.affNode = affNode;
- this.memPlc = memPlc;
+ this.dataRegion = dataRegion;
this.cacheObjCtx = cacheObjCtx;
this.freeList = freeList;
this.reuseList = reuseList;
@@ -188,7 +188,7 @@ public class CacheGroupContext {
depEnabled = ctx.kernalContext().deploy().enabled() && !ctx.kernalContext().cacheObjects().isBinaryEnabled(ccfg);
- storeCacheId = affNode && memPlc.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
+ storeCacheId = affNode && dataRegion.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
log = ctx.kernalContext().log(getClass());
@@ -523,10 +523,10 @@ public class CacheGroupContext {
}
/**
- * @return Memory policy.
+ * @return data region.
*/
- public MemoryPolicy memoryPolicy() {
- return memPlc;
+ public DataRegion dataRegion() {
+ return dataRegion;
}
/**
@@ -862,7 +862,7 @@ public class CacheGroupContext {
else
preldr = new GridCachePreloaderAdapter(this);
- if (ctx.kernalContext().config().getPersistentStoreConfiguration() != null) {
+ if (persistenceEnabled()) {
try {
offheapMgr = new GridCacheOffheapManager();
}
@@ -879,6 +879,13 @@ public class CacheGroupContext {
}
/**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return dataRegion != null && dataRegion.config().isPersistenceEnabled();
+ }
+
+ /**
* @param nodeId Node ID.
* @param req Request.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
index 99b7b1e..617db56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
@@ -59,14 +59,18 @@ public class CacheGroupData implements Serializable {
/** */
private long flags;
+ /** Persistence enabled flag. */
+ private final boolean persistenceEnabled;
+
/**
* @param cacheCfg Cache configuration.
* @param grpName Group name.
- * @param grpId Group ID.
+ * @param grpId Group ID.
* @param rcvdFrom Node ID cache group received from.
* @param startTopVer Start version for dynamically started group.
* @param deploymentId Deployment ID.
* @param caches Cache group caches.
+ * @param persistenceEnabled Persistence enabled flag.
*/
CacheGroupData(
CacheConfiguration cacheCfg,
@@ -76,7 +80,8 @@ public class CacheGroupData implements Serializable {
@Nullable AffinityTopologyVersion startTopVer,
IgniteUuid deploymentId,
Map<String, Integer> caches,
- long flags) {
+ long flags,
+ boolean persistenceEnabled) {
assert cacheCfg != null;
assert grpId != 0 : cacheCfg.getName();
assert deploymentId != null : cacheCfg.getName();
@@ -89,6 +94,7 @@ public class CacheGroupData implements Serializable {
this.deploymentId = deploymentId;
this.caches = caches;
this.flags = flags;
+ this.persistenceEnabled = persistenceEnabled;
}
/**
@@ -140,6 +146,13 @@ public class CacheGroupData implements Serializable {
return caches;
}
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return persistenceEnabled;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheGroupData.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
index 20301a6..86e330e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
@@ -58,14 +58,18 @@ public class CacheGroupDescriptor {
/** */
private AffinityTopologyVersion rcvdFromVer;
+ /** Persistence enabled flag. */
+ private final boolean persistenceEnabled;
+
/**
* @param cacheCfg Cache configuration.
* @param grpName Group name.
- * @param grpId Group ID.
+ * @param grpId Group ID.
* @param rcvdFrom Node ID cache group received from.
* @param startTopVer Start version for dynamically started group.
* @param deploymentId Deployment ID.
* @param caches Cache group caches.
+ * @param persistenceEnabled Persistence enabled flag.
*/
CacheGroupDescriptor(
CacheConfiguration cacheCfg,
@@ -74,7 +78,8 @@ public class CacheGroupDescriptor {
UUID rcvdFrom,
@Nullable AffinityTopologyVersion startTopVer,
IgniteUuid deploymentId,
- Map<String, Integer> caches) {
+ Map<String, Integer> caches,
+ boolean persistenceEnabled) {
assert cacheCfg != null;
assert grpId != 0;
@@ -85,6 +90,7 @@ public class CacheGroupDescriptor {
this.deploymentId = deploymentId;
this.cacheCfg = new CacheConfiguration<>(cacheCfg);
this.caches = caches;
+ this.persistenceEnabled = persistenceEnabled;
}
/**
@@ -202,7 +208,7 @@ public class CacheGroupDescriptor {
* @param otherDesc CacheGroup descriptor that must be merged with this one.
*/
void mergeWith(CacheGroupDescriptor otherDesc) {
- assert otherDesc != null && otherDesc.config() != null: otherDesc;
+ assert otherDesc != null && otherDesc.config() != null : otherDesc;
CacheConfiguration otherCfg = otherDesc.config();
@@ -221,6 +227,13 @@ public class CacheGroupDescriptor {
return startTopVer;
}
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return persistenceEnabled;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheGroupDescriptor.class, this, "cacheName", cacheCfg.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index b4cc9c5..8382821 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -912,7 +912,8 @@ class ClusterCachesInfo {
grpDesc.startTopologyVersion(),
grpDesc.deploymentId(),
grpDesc.caches(),
- 0);
+ 0,
+ grpDesc.persistenceEnabled());
cacheGrps.put(grpDesc.groupId(), grpData);
}
@@ -990,7 +991,8 @@ class ClusterCachesInfo {
grpData.receivedFrom(),
grpData.startTopologyVersion(),
grpData.deploymentId(),
- grpData.caches());
+ grpData.caches(),
+ grpData.persistenceEnabled());
if (locCacheGrps.containsKey(grpDesc.groupId())) {
CacheGroupDescriptor locGrpCfg = locCacheGrps.get(grpDesc.groupId());
@@ -1508,7 +1510,8 @@ class ClusterCachesInfo {
rcvdFrom,
curTopVer != null ? curTopVer.nextMinorVersion() : null,
deploymentId,
- caches);
+ caches,
+ CU.isPersistentCache(startedCacheCfg, ctx.config().getDataStorageConfiguration()));
CacheGroupDescriptor old = registeredCacheGrps.put(grpId, grpDesc);
@@ -1560,8 +1563,8 @@ class ClusterCachesInfo {
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "nodeFilter", "Node filter",
attr1.nodeFilterClassName(), attr2.nodeFilterClassName(), true);
- CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "memoryPolicyName", "Memory policy",
- cfg.getMemoryPolicyName(), startCfg.getMemoryPolicyName(), true);
+ CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "dataRegionName", "Data region",
+ cfg.getDataRegionName(), startCfg.getDataRegionName(), true);
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "topologyValidator", "Topology validator",
attr1.topologyValidatorClassName(), attr2.topologyValidatorClassName(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 8c5d6f2..9bdce35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -58,7 +58,6 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.cluster.ClusterGroupEmptyException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.compute.ComputeJob;
@@ -2035,7 +2034,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
GridCacheEntryEx entry = null;
try {
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
entry = entryEx(key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 120007f..34d3c97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -71,7 +71,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTran
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrManager;
import org.apache.ignite.internal.processors.cache.jta.CacheJtaManagerAdapter;
import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
-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.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager;
import org.apache.ignite.internal.processors.cache.store.CacheStoreManager;
@@ -736,10 +736,10 @@ public class GridCacheContext<K, V> implements Externalizable {
}
/**
- * @return Memory policy.
+ * @return Data region.
*/
- public MemoryPolicy memoryPolicy() {
- return grp.memoryPolicy();
+ public DataRegion dataRegion() {
+ return grp.dataRegion();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5c3fe1f..e46e4d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -48,7 +48,7 @@ import org.apache.ignite.internal.processors.cache.extras.GridCacheObsoleteEntry
import org.apache.ignite.internal.processors.cache.extras.GridCacheTtlEntryExtras;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
-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.query.continuous.CacheContinuousQueryListener;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -2543,7 +2543,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
boolean update;
- boolean walEnabled = !cctx.isNear() && cctx.shared().wal() != null;
+ boolean walEnabled = !cctx.isNear() && cctx.group().persistenceEnabled();
if (cctx.shared().database().persistenceEnabled()) {
unswap(false);
@@ -3204,7 +3204,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
assert cctx.atomic();
try {
- if (cctx.shared().wal() != null)
+ if (cctx.group().persistenceEnabled())
cctx.shared().wal().log(new DataRecord(new DataEntry(
cctx.cacheId(),
key,
@@ -3326,13 +3326,13 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/**
- * Evicts necessary number of data pages if per-page eviction is configured in current {@link MemoryPolicy}.
+ * Evicts necessary number of data pages if per-page eviction is configured in current {@link DataRegion}.
*/
private void ensureFreeSpace() throws IgniteCheckedException {
// Deadlock alert: evicting data page causes removing (and locking) all entries on the page one by one.
assert !Thread.holdsLock(this);
- cctx.shared().database().ensureFreeSpace(cctx.memoryPolicy());
+ cctx.shared().database().ensureFreeSpace(cctx.dataRegion());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index f3759e0..ad8f74a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -49,6 +49,7 @@ import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -88,7 +89,7 @@ import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
import org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-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.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
@@ -139,6 +140,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.MarshallerUtils;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.mxbean.IgniteMBeanAware;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
@@ -350,7 +352,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @return {@code true} if cache is starting on client node and this node is affinity node for the cache.
*/
private boolean storesLocallyOnClient(IgniteConfiguration c, CacheConfiguration cc) {
- if (c.isClientMode() && c.getMemoryConfiguration() == null) {
+ if (c.isClientMode() && c.getDataStorageConfiguration() == null) {
if (cc.getCacheMode() == LOCAL)
return true;
@@ -385,8 +387,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
if (storesLocallyOnClient(c, cc))
- throw new IgniteCheckedException("MemoryPolicy for client caches must be explicitly configured " +
- "on client node startup. Use MemoryConfiguration to configure MemoryPolicy.");
+ throw new IgniteCheckedException("DataRegion for client caches must be explicitly configured " +
+ "on client node startup. Use DataStorageConfiguration to configure DataRegion.");
if (cc.getCacheMode() == LOCAL && !cc.getAffinity().getClass().equals(LocalAffinityFunction.class))
U.warn(log, "AffinityFunction configuration parameter will be ignored for local cache [cacheName=" +
@@ -679,8 +681,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheType cacheType = cacheType(cacheName);
- if (cacheType != CacheType.USER && cfg.getMemoryPolicyName() == null)
- cfg.setMemoryPolicyName(sharedCtx.database().systemMemoryPolicyName());
+ if (cacheType != CacheType.USER && cfg.getDataRegionName() == null)
+ cfg.setDataRegionName(sharedCtx.database().systemDateRegionName());
if (!cacheType.userCache())
stopSeq.addLast(cacheName);
@@ -1112,12 +1114,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheCtx.onStarted();
- String memPlcName = cfg.getMemoryPolicyName();
-
- if (memPlcName == null
- && ctx.config().getMemoryConfiguration() != null)
- memPlcName = ctx.config().getMemoryConfiguration().getDefaultMemoryPolicyName();
+ String memPlcName = cfg.getDataRegionName();
+ if (memPlcName == null && ctx.config().getDataStorageConfiguration() != null)
+ memPlcName = ctx.config().getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
if (log.isInfoEnabled()) {
log.info("Started cache [name=" + cfg.getName() +
@@ -1841,9 +1841,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
throws IgniteCheckedException {
CacheConfiguration cfg = new CacheConfiguration(desc.config());
- String memPlcName = cfg.getMemoryPolicyName();
+ String memPlcName = cfg.getDataRegionName();
- MemoryPolicy memPlc = sharedCtx.database().memoryPolicy(memPlcName);
+ DataRegion memPlc = sharedCtx.database().dataRegion(memPlcName);
FreeList freeList = sharedCtx.database().freeList(memPlcName);
ReuseList reuseList = sharedCtx.database().reuseList(memPlcName);
@@ -2188,7 +2188,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
IgnitePageStoreManager pageStoreMgr = null;
IgniteWriteAheadLogManager walMgr = null;
- if (ctx.config().isPersistentStoreEnabled() && !ctx.clientNode()) {
+ if (CU.isPersistenceEnabled(ctx.config()) && !ctx.clientNode()) {
if (ctx.clientNode()) {
U.warn(log, "Persistent Store is not supported on client nodes (Persistent Store's" +
" configuration will be ignored).");
@@ -3062,15 +3062,32 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (ctx.config().isClientMode() || locNode.isDaemon() || rmt.isClient() || rmt.isDaemon())
return;
- MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
+ DataStorageConfiguration dsCfg = null;
+
+ Object dsCfgBytes = rmt.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG);
+
+ if (dsCfgBytes instanceof byte[])
+ dsCfg = new JdkMarshaller().unmarshal((byte[])dsCfgBytes, U.resolveClassLoader(ctx.config()));
+
+ if (dsCfg == null) {
+ // Try to use legacy memory configuration.
+ MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
+
+ if (memCfg != null) {
+ dsCfg = new DataStorageConfiguration();
+
+ // All properties that are used in validation should be converted here.
+ dsCfg.setPageSize(memCfg.getPageSize());
+ }
+ }
- if (memCfg != null) {
- MemoryConfiguration locMemCfg = ctx.config().getMemoryConfiguration();
+ if (dsCfg != null) {
+ DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration();
- if (memCfg.getPageSize() != locMemCfg.getPageSize()) {
+ if (dsCfg.getPageSize() != locDsCfg.getPageSize()) {
throw new IgniteCheckedException("Memory configuration mismatch (fix configuration or set -D" +
IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property) [rmtNodeId=" + rmt.id() +
- ", locPageSize = " + locMemCfg.getPageSize() + ", rmtPageSize = " + memCfg.getPageSize() + "]");
+ ", locPageSize = " + locDsCfg.getPageSize() + ", rmtPageSize = " + dsCfg.getPageSize() + "]");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 4f76875..26e2254 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -53,6 +53,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
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.TransactionConfiguration;
import org.apache.ignite.internal.GridKernalContext;
@@ -1673,4 +1675,57 @@ public class GridCacheUtils {
cfg.clearQueryEntities().setQueryEntities(normalEntities);
}
}
+
+ /**
+ * Checks if cache configuration belongs to persistent cache.
+ *
+ * @param ccfg Cache configuration.
+ * @param dsCfg Data storage config.
+ */
+ public static boolean isPersistentCache(CacheConfiguration ccfg, DataStorageConfiguration dsCfg) {
+ if (dsCfg == null)
+ return false;
+
+ String regName = ccfg.getDataRegionName();
+
+ if (regName == null || regName.equals(dsCfg.getDefaultDataRegionConfiguration().getName()))
+ return dsCfg.getDefaultDataRegionConfiguration().isPersistenceEnabled();
+
+ if (dsCfg.getDataRegionConfigurations() != null) {
+ for (DataRegionConfiguration drConf : dsCfg.getDataRegionConfigurations()) {
+ if (regName.equals(drConf.getName()))
+ return drConf.isPersistenceEnabled();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @return {@code true} if persistence is enabled for at least one data region, {@code false} if not.
+ */
+ public static boolean isPersistenceEnabled(IgniteConfiguration cfg) {
+ if (cfg.getDataStorageConfiguration() == null)
+ return false;
+
+ DataRegionConfiguration dfltReg = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration();
+
+ if (dfltReg == null)
+ return false;
+
+ if (dfltReg.isPersistenceEnabled())
+ return true;
+
+ DataRegionConfiguration[] regCfgs = cfg.getDataStorageConfiguration().getDataRegionConfigurations();
+
+ if (regCfgs == null)
+ return false;
+
+ for (DataRegionConfiguration regCfg : regCfgs) {
+ if (regCfg.isPersistenceEnabled())
+ return true;
+ }
+
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 4844686..7944c50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -148,7 +148,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
pendingEntries = new PendingEntriesTree(
grp,
name,
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
rootPage,
grp.reuseList(),
true);
@@ -794,7 +794,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
long pageId;
if (reuseList == null || (pageId = reuseList.takeRecycledPage()) == 0L)
- pageId = grp.memoryPolicy().pageMemory().allocatePage(grp.groupId(), INDEX_PARTITION, FLAG_IDX);
+ pageId = grp.dataRegion().pageMemory().allocatePage(grp.groupId(), INDEX_PARTITION, FLAG_IDX);
return pageId;
}
@@ -1435,7 +1435,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
if (row != null) {
row.key(key);
- grp.memoryPolicy().evictionTracker().touchPage(row.link());
+ grp.dataRegion().evictionTracker().touchPage(row.link());
}
return row;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
index 420cde5..19514c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryMetadata;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +63,7 @@ class BinaryMetadataFileStore {
this.ctx = ctx;
this.log = log;
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
if (binaryMetadataFileStoreDir != null)
@@ -85,7 +86,7 @@ class BinaryMetadataFileStore {
* @param binMeta Binary metadata to be written to disk.
*/
void saveMetadata(BinaryMetadata binMeta) {
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
try {
@@ -107,7 +108,7 @@ class BinaryMetadataFileStore {
* Restores metadata on startup of {@link CacheObjectBinaryProcessorImpl} but before starting discovery.
*/
void restoreMetadata() {
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
for (File file : workDir.listFiles()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index e5bcc46..7a10c10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -556,7 +556,8 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
GridCacheVersion dhtVer = cached.isNear() ? writeVersion() : null;
- if (!near() && cctx.wal() != null && op != NOOP && op != RELOAD && op != READ) {
+ if (!near() && cacheCtx.group().persistenceEnabled() &&
+ op != NOOP && op != RELOAD && op != READ) {
if (dataEntries == null)
dataEntries = new ArrayList<>(entries.size());
@@ -741,7 +742,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
}
}
- if (!near() && cctx.wal() != null)
+ if (!near() && !F.isEmpty(dataEntries) && cctx.wal() != null)
cctx.wal().log(new DataRecord(dataEntries));
if (ptr != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index c363729..cedd466 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -500,7 +500,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
* @return {@code true} if cas succeeds.
*/
private boolean casState(long state, GridDhtPartitionState toState) {
- if (ctx.database().persistenceEnabled()) {
+ if (ctx.database().persistenceEnabled() && grp.dataRegion().config().isPersistenceEnabled()) {
synchronized (this) {
boolean update = this.state.compareAndSet(state, setPartState(state, toState));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 30614a3..5095f45 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheReturn;
import org.apache.ignite.internal.processors.cache.GridCacheUpdateAtomicResult;
import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
@@ -1699,7 +1698,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ctx.shared().database().checkpointReadLock();
try {
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
// If batch store update is enabled, we need to lock all entries.
// First, need to acquire locks on cache entries, then check filter.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 1bffac4..dcb167d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -47,7 +47,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.NotNull;
/**
- * Get request. Responsible for obtaining entry from primary node. 'Near' means 'Primary' here, not 'Near Cache'.
+ * Get request. Responsible for obtaining entry from primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheDeployable,
GridCacheVersionable {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index b48693d..f736cae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -40,7 +40,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- * Near cache lock request.
+ * Near cache lock request to primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearLockRequest extends GridDistributedLockRequest {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index e73f34b..085f0b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -2682,7 +2682,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou
GridCacheEntryEx entry = cacheCtx.cache().entryEx(key, topVer);
try {
- cacheCtx.shared().database().ensureFreeSpace(cacheCtx.memoryPolicy());
+ cacheCtx.shared().database().ensureFreeSpace(cacheCtx.dataRegion());
EntryGetResult verVal = entry.versionedValue(cacheVal,
ver,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index e352c87..063eb27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -36,7 +36,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;
/**
- * Near transaction prepare request.
+ * Near transaction prepare request to primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequest {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 40d1fac..599a58c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -830,7 +830,7 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
CacheEntryPredicate[] filters = CU.filterArray(filter);
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
if (writeThrough && keys.size() > 1) {
return updateWithBatch(op,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 4d75475..0fd8323 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -98,7 +98,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
* @throws IgniteCheckedException If failed.
*/
public final void initFromLink(CacheGroupContext grp, RowData rowData) throws IgniteCheckedException {
- initFromLink(grp, grp.shared(), grp.memoryPolicy().pageMemory(), rowData);
+ initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), rowData);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
new file mode 100644
index 0000000..0b0bf2b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
+
+/**
+ * Data region provides access to objects configured with {@link DataRegionConfiguration} configuration.
+ */
+public class DataRegion {
+ /** */
+ private final PageMemory pageMem;
+
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final DataRegionConfiguration cfg;
+
+ /** */
+ private final PageEvictionTracker evictionTracker;
+
+ /**
+ * @param pageMem PageMemory instance.
+ * @param memMetrics DataRegionMetrics instance.
+ * @param cfg Configuration of given DataRegion.
+ * @param evictionTracker Eviction tracker.
+ */
+ public DataRegion(
+ PageMemory pageMem,
+ DataRegionConfiguration cfg,
+ DataRegionMetricsImpl memMetrics,
+ PageEvictionTracker evictionTracker
+ ) {
+ this.pageMem = pageMem;
+ this.memMetrics = memMetrics;
+ this.cfg = cfg;
+ this.evictionTracker = evictionTracker;
+ }
+
+ /**
+ *
+ */
+ public PageMemory pageMemory() {
+ return pageMem;
+ }
+
+ /**
+ * @return Config.
+ */
+ public DataRegionConfiguration config() {
+ return cfg;
+ }
+
+ /**
+ * @return Memory Metrics.
+ */
+ public DataRegionMetricsImpl memoryMetrics() {
+ return memMetrics;
+ }
+
+ /**
+ *
+ */
+ public PageEvictionTracker evictionTracker() {
+ return evictionTracker;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
new file mode 100644
index 0000000..1d570f9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
@@ -0,0 +1,286 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteOutClosure;
+import org.jetbrains.annotations.Nullable;
+import org.jsr166.LongAdder8;
+
+/**
+ *
+ */
+public class DataRegionMetricsImpl implements DataRegionMetrics {
+ /** */
+ private final IgniteOutClosure<Float> fillFactorProvider;
+
+ /** */
+ private final LongAdder8 totalAllocatedPages = new LongAdder8();
+
+ /**
+ * Counter for number of pages occupied by large entries (one entry is larger than one page).
+ */
+ private final LongAdder8 largeEntriesPages = new LongAdder8();
+
+ /** Counter for number of dirty pages. */
+ private LongAdder8 dirtyPages = new LongAdder8();
+
+ /** */
+ private volatile boolean metricsEnabled;
+
+ /** */
+ private boolean persistenceEnabled;
+
+ /** */
+ private volatile int subInts;
+
+ /** Allocation rate calculator. */
+ private volatile HitRateMetrics allocRate = new HitRateMetrics(60_000, 5);
+
+ /** */
+ private volatile HitRateMetrics pageReplaceRate = new HitRateMetrics(60_000, 5);
+
+ /** */
+ private final DataRegionConfiguration memPlcCfg;
+
+ /** */
+ private PageMemory pageMem;
+
+ /** Time interval (in milliseconds) when allocations/evictions are counted to calculate rate. */
+ private volatile long rateTimeInterval;
+
+ /**
+ * @param memPlcCfg DataRegionConfiguration.
+ */
+ public DataRegionMetricsImpl(DataRegionConfiguration memPlcCfg) {
+ this(memPlcCfg, null);
+ }
+
+ /**
+ * @param memPlcCfg DataRegionConfiguration.
+ */
+ public DataRegionMetricsImpl(DataRegionConfiguration memPlcCfg, @Nullable IgniteOutClosure<Float> fillFactorProvider) {
+ this.memPlcCfg = memPlcCfg;
+ this.fillFactorProvider = fillFactorProvider;
+
+ metricsEnabled = memPlcCfg.isMetricsEnabled();
+
+ rateTimeInterval = memPlcCfg.getMetricsRateTimeInterval();
+
+ subInts = memPlcCfg.getMetricsSubIntervalCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return U.maskName(memPlcCfg.getName());
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return metricsEnabled ? totalAllocatedPages.longValue() : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float) allocRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ if (!metricsEnabled)
+ return 0;
+
+ return totalAllocatedPages.longValue() != 0 ?
+ (float) largeEntriesPages.doubleValue() / totalAllocatedPages.longValue()
+ : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ if (!metricsEnabled || fillFactorProvider == null)
+ return 0;
+
+ return fillFactorProvider.apply();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ return dirtyPages.longValue();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ return ((float) pageReplaceRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ assert pageMem != null;
+
+ return pageMem.loadedPages();
+ }
+
+ /**
+ * Updates pageReplaceRate metric.
+ */
+ public void updatePageReplaceRate() {
+ if (metricsEnabled)
+ pageReplaceRate.onHit();
+ }
+
+ /**
+ * Increments dirtyPages counter.
+ */
+ public void incrementDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.increment();
+ }
+
+ /**
+ * Decrements dirtyPages counter.
+ */
+ public void decrementDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.decrement();
+ }
+
+ /**
+ * Resets dirtyPages counter to zero.
+ */
+ public void resetDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.reset();
+ }
+
+ /**
+ * Increments totalAllocatedPages counter.
+ */
+ public void incrementTotalAllocatedPages() {
+ if (metricsEnabled) {
+ totalAllocatedPages.increment();
+
+ updateAllocationRateMetrics();
+ }
+ }
+
+ /**
+ *
+ */
+ private void updateAllocationRateMetrics() {
+ allocRate.onHit();
+ }
+
+ /**
+ * @param intervalNum Interval number.
+ */
+ private long subInt(int intervalNum) {
+ return (rateTimeInterval * intervalNum) / subInts;
+ }
+
+ /**
+ *
+ */
+ public void incrementLargeEntriesPages() {
+ if (metricsEnabled)
+ largeEntriesPages.increment();
+ }
+
+ /**
+ *
+ */
+ public void decrementLargeEntriesPages() {
+ if (metricsEnabled)
+ largeEntriesPages.decrement();
+ }
+
+ /**
+ * Enable metrics.
+ */
+ public void enableMetrics() {
+ metricsEnabled = true;
+ }
+
+ /**
+ * Disable metrics.
+ */
+ public void disableMetrics() {
+ metricsEnabled = false;
+ }
+
+ /**
+ * @param persistenceEnabled Persistence enabled.
+ */
+ public void persistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+ }
+
+ /**
+ * @param pageMem Page mem.
+ */
+ public void pageMemory(PageMemory pageMem) {
+ this.pageMem = pageMem;
+ }
+
+ /**
+ * @param rateTimeInterval Time interval (in milliseconds) used to calculate allocation/eviction rate.
+ */
+ public void rateTimeInterval(long rateTimeInterval) {
+ this.rateTimeInterval = rateTimeInterval;
+
+ allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ }
+
+ /**
+ * Sets number of subintervals the whole rateTimeInterval will be split into to calculate allocation rate.
+ *
+ * @param subInts Number of subintervals.
+ */
+ public void subIntervals(int subInts) {
+ assert subInts > 0;
+
+ if (this.subInts == subInts)
+ return;
+
+ if (rateTimeInterval / subInts < 10)
+ subInts = (int) rateTimeInterval / 10;
+
+ allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
new file mode 100644
index 0000000..141d0dc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
@@ -0,0 +1,131 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+/**
+ * MBean to expose {@link DataRegionMetrics} through JMX interface.
+ */
+class DataRegionMetricsMXBeanImpl implements DataRegionMetricsMXBean {
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final DataRegionConfiguration dataRegCfg;
+
+ /**
+ * @param memMetrics DataRegionMetrics instance to expose through JMX interface.
+ * @param dataRegCfg Configuration of data region this MX Bean is created for.
+ */
+ DataRegionMetricsMXBeanImpl(DataRegionMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegCfg
+ ) {
+ this.memMetrics = memMetrics;
+ this.dataRegCfg = dataRegCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ return memMetrics.getAllocationRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return memMetrics.getEvictionRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ return memMetrics.getLargeEntriesPagesPercentage();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ return memMetrics.getPagesFillFactor();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return memMetrics.getTotalAllocatedPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ return memMetrics.getDirtyPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ return memMetrics.getPagesReplaceRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ return memMetrics.getPhysicalMemoryPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void rateTimeInterval(long rateTimeInterval) {
+ if (rateTimeInterval < 1000)
+ throw new IllegalArgumentException("rateTimeInterval property must be positive " +
+ "and greater than 1_000 milliseconds (one second)");
+
+ memMetrics.rateTimeInterval(rateTimeInterval);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void subIntervals(int subInts) {
+ if (subInts <= 1)
+ throw new IllegalArgumentException("subIntervals property must be positive " +
+ "and greater than one");
+
+ memMetrics.subIntervals(subInts);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void enableMetrics() {
+ memMetrics.enableMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void disableMetrics() {
+ memMetrics.disableMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return memMetrics.getName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getInitialSize() {
+ return (int) (dataRegCfg.getInitialSize() / (1024 * 1024));
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaxSize() {
+ return (int) (dataRegCfg.getMaxSize() / (1024 * 1024));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getSwapPath() {
+ return dataRegCfg.getSwapPath();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
new file mode 100644
index 0000000..c39fdb0d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
@@ -0,0 +1,112 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+
+/**
+ *
+ */
+public class DataRegionMetricsSnapshot implements DataRegionMetrics {
+ /** */
+ private String name;
+
+ /** */
+ private long totalAllocatedPages;
+
+ /** */
+ private float allocationRate;
+
+ /** */
+ private float evictionRate;
+
+ /** */
+ private float largeEntriesPagesPercentage;
+
+ /** */
+ private float pagesFillFactor;
+
+ /** */
+ private long dirtyPages;
+
+ /** */
+ private float pageReplaceRate;
+
+ /** */
+ private long physicalMemoryPages;
+
+ /**
+ * @param metrics Metrics instance to take a copy.
+ */
+ public DataRegionMetricsSnapshot(DataRegionMetrics metrics) {
+ name = metrics.getName();
+ totalAllocatedPages = metrics.getTotalAllocatedPages();
+ allocationRate = metrics.getAllocationRate();
+ evictionRate = metrics.getEvictionRate();
+ largeEntriesPagesPercentage = metrics.getLargeEntriesPagesPercentage();
+ pagesFillFactor = metrics.getPagesFillFactor();
+ dirtyPages = metrics.getDirtyPages();
+ pageReplaceRate = metrics.getPagesReplaceRate();
+ physicalMemoryPages = metrics.getPhysicalMemoryPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return name;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return totalAllocatedPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ return allocationRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return evictionRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ return largeEntriesPagesPercentage;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ return pagesFillFactor;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ return dirtyPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ return pageReplaceRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ return physicalMemoryPages;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
new file mode 100644
index 0000000..16707aa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
@@ -0,0 +1,297 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.mxbean.DataStorageMetricsMXBean;
+
+/**
+ *
+ */
+public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
+ /** */
+ private volatile HitRateMetrics walLoggingRate;
+
+ /** */
+ private volatile HitRateMetrics walWritingRate;
+
+ /** */
+ private volatile HitRateMetrics walFsyncTimeDuration;
+
+ /** */
+ private volatile HitRateMetrics walFsyncTimeNumber;
+
+ /** */
+ private volatile long lastCpLockWaitDuration;
+
+ /** */
+ private volatile long lastCpMarkDuration;
+
+ /** */
+ private volatile long lastCpPagesWriteDuration;
+
+ /** */
+ private volatile long lastCpDuration;
+
+ /** */
+ private volatile long lastCpFsyncDuration;
+
+ /** */
+ private volatile long lastCpTotalPages;
+
+ /** */
+ private volatile long lastCpDataPages;
+
+ /** */
+ private volatile long lastCpCowPages;
+
+ /** */
+ private volatile long rateTimeInterval;
+
+ /** */
+ private volatile int subInts;
+
+ /** */
+ private volatile boolean metricsEnabled;
+
+ /** */
+ private IgniteWriteAheadLogManager wal;
+
+ /**
+ * @param metricsEnabled Metrics enabled flag.
+ * @param rateTimeInterval Rate time interval.
+ * @param subInts Number of sub-intervals.
+ */
+ public DataStorageMetricsImpl(
+ boolean metricsEnabled,
+ long rateTimeInterval,
+ int subInts
+ ) {
+ this.metricsEnabled = metricsEnabled;
+ this.rateTimeInterval = rateTimeInterval;
+ this.subInts = subInts;
+
+ resetRates();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalLoggingRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float)walLoggingRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalWritingRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float)walWritingRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getWalArchiveSegments() {
+ if (!metricsEnabled)
+ return 0;
+
+ return wal.walArchiveSegments();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalFsyncTimeAverage() {
+ if (!metricsEnabled)
+ return 0;
+
+ long numRate = walFsyncTimeNumber.getRate();
+
+ if (numRate == 0)
+ return 0;
+
+ return (float)walFsyncTimeDuration.getRate() / numRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointingDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointLockWaitDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpLockWaitDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointMarkDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpMarkDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointPagesWriteDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpPagesWriteDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointFsyncDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpFsyncDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointTotalPagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpTotalPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointDataPagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpDataPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpCowPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void enableMetrics() {
+ metricsEnabled = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void disableMetrics() {
+ metricsEnabled = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void rateTimeInterval(long rateTimeInterval) {
+ this.rateTimeInterval = rateTimeInterval;
+
+ resetRates();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void subIntervals(int subInts) {
+ this.subInts = subInts;
+
+ resetRates();
+ }
+
+ /**
+ * @param wal Write-ahead log manager.
+ */
+ public void wal(IgniteWriteAheadLogManager wal) {
+ this.wal = wal;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean metricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @param lockWaitDuration Lock wait duration.
+ * @param markDuration Mark duration.
+ * @param pagesWriteDuration Pages write duration.
+ * @param fsyncDuration Total checkpoint fsync duration.
+ * @param duration Total checkpoint duration.
+ * @param totalPages Total number of all pages in checkpoint.
+ * @param dataPages Total number of data pages in checkpoint.
+ * @param cowPages Total number of COW-ed pages in checkpoint.
+ */
+ public void onCheckpoint(
+ long lockWaitDuration,
+ long markDuration,
+ long pagesWriteDuration,
+ long fsyncDuration,
+ long duration,
+ long totalPages,
+ long dataPages,
+ long cowPages
+ ) {
+ if (metricsEnabled) {
+ lastCpLockWaitDuration = lockWaitDuration;
+ lastCpMarkDuration = markDuration;
+ lastCpPagesWriteDuration = pagesWriteDuration;
+ lastCpFsyncDuration = fsyncDuration;
+ lastCpDuration = duration;
+ lastCpTotalPages = totalPages;
+ lastCpDataPages = dataPages;
+ lastCpCowPages = cowPages;
+ }
+ }
+
+ /**
+ *
+ */
+ public void onWalRecordLogged() {
+ walLoggingRate.onHit();
+ }
+
+ /**
+ * @param size Size written.
+ */
+ public void onWalBytesWritten(int size) {
+ walWritingRate.onHits(size);
+ }
+
+ /**
+ * @param nanoTime Fsync nano time.
+ */
+ public void onFsync(long nanoTime) {
+ long microseconds = nanoTime / 1_000;
+
+ walFsyncTimeDuration.onHits(microseconds);
+ walFsyncTimeNumber.onHit();
+ }
+
+ /**
+ *
+ */
+ private void resetRates() {
+ walLoggingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+ walWritingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+
+ walFsyncTimeDuration = new HitRateMetrics((int)rateTimeInterval, subInts);
+ walFsyncTimeNumber = new HitRateMetrics((int)rateTimeInterval, subInts);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
new file mode 100644
index 0000000..4841387
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
@@ -0,0 +1,144 @@
+/*
+ * 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.cache.persistence;
+
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ *
+ */
+public class DataStorageMetricsSnapshot implements DataStorageMetrics {
+ /** */
+ private float walLoggingRate;
+
+ /** */
+ private float walWritingRate;
+
+ /** */
+ private int walArchiveSegments;
+
+ /** */
+ private float walFsyncTimeAvg;
+
+ /** */
+ private long lastCpDuration;
+
+ /** */
+ private long lastCpLockWaitDuration;
+
+ /** */
+ private long lastCpMmarkDuration;
+
+ /** */
+ private long lastCpPagesWriteDuration;
+
+ /** */
+ private long lastCpFsyncDuration;
+
+ /** */
+ private long lastCpTotalPages;
+
+ /** */
+ private long lastCpDataPages;
+
+ /** */
+ private long lastCpCowPages;
+
+ /**
+ * @param metrics Metrics.
+ */
+ public DataStorageMetricsSnapshot(DataStorageMetrics metrics) {
+ walLoggingRate = metrics.getWalLoggingRate();
+ walWritingRate = metrics.getWalWritingRate();
+ walArchiveSegments = metrics.getWalArchiveSegments();
+ walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
+ lastCpDuration = metrics.getLastCheckpointingDuration();
+ lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
+ lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
+ lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
+ lastCpFsyncDuration = metrics.getLastCheckpointFsyncDuration();
+ lastCpTotalPages = metrics.getLastCheckpointTotalPagesNumber();
+ lastCpDataPages = metrics.getLastCheckpointDataPagesNumber();
+ lastCpCowPages = metrics.getLastCheckpointCopiedOnWritePagesNumber();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalLoggingRate() {
+ return walLoggingRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalWritingRate() {
+ return walWritingRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getWalArchiveSegments() {
+ return walArchiveSegments;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalFsyncTimeAverage() {
+ return walFsyncTimeAvg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointingDuration() {
+ return lastCpDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointLockWaitDuration() {
+ return lastCpLockWaitDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointMarkDuration() {
+ return lastCpMmarkDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointPagesWriteDuration() {
+ return lastCpPagesWriteDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointFsyncDuration() {
+ return lastCpFsyncDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointTotalPagesNumber() {
+ return lastCpTotalPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointDataPagesNumber() {
+ return lastCpDataPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
+ return lastCpCowPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DataStorageMetricsSnapshot.class, this);
+ }
+}
[05/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
deleted file mode 100644
index bc71e33..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
+++ /dev/null
@@ -1,79 +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.cache;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Tests a check of memory configuration consistency.
- */
-public class GridMemoryConfigurationConsistencySelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
- discoSpi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(discoSpi);
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- // Nodes will have different page size.
- memCfg.setPageSize(MemoryConfiguration.DFLT_PAGE_SIZE * (1 + getTestIgniteInstanceIndex(gridName)));
-
- cfg.setMemoryConfiguration(memCfg);
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMemoryConfigurationConsistency() throws Exception {
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- /** {@inheritDoc} */
- @Override public Void call() throws Exception {
- startGrids(2);
-
- return null;
- }
- }, IgniteCheckedException.class, null);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index 4c9ad27..1827c65 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -29,9 +29,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
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.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -67,6 +67,9 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
/** */
static final String CACHE_NAME_PREFIX = "cache-";
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/** */
boolean client;
@@ -116,19 +119,21 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
ccfgs = null;
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024);
+ memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(persistenceEnabled()));
- cfg.setMemoryConfiguration(memCfg);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- if (persistenceEnabled()) {
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ if (persistenceEnabled())
+ memCfg.setWalMode(WALMode.LOG_ONLY);
- pCfg.setWalMode(WALMode.LOG_ONLY);
-
- cfg.setPersistentStoreConfiguration(pCfg);
- }
+ cfg.setDataStorageConfiguration(memCfg);
if (testSpi) {
TestRecordingCommunicationSpi spi = new TestRecordingCommunicationSpi();
@@ -1236,12 +1241,15 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
* @return Cache configurations.
*/
final CacheConfiguration[] cacheConfigurations2() {
- CacheConfiguration[] ccfgs = new CacheConfiguration[4];
+ CacheConfiguration[] ccfgs = new CacheConfiguration[5];
ccfgs[0] = cacheConfiguration(CACHE_NAME_PREFIX + 0, ATOMIC);
ccfgs[1] = cacheConfiguration(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
ccfgs[2] = cacheConfiguration(CACHE_NAME_PREFIX + 2, ATOMIC);
ccfgs[3] = cacheConfiguration(CACHE_NAME_PREFIX + 3, TRANSACTIONAL);
+ ccfgs[4] = cacheConfiguration(CACHE_NAME_PREFIX + 4, TRANSACTIONAL);
+
+ ccfgs[4].setDataRegionName(NO_PERSISTENCE_REGION);
return ccfgs;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
index 4a19aa8..6245952 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
@@ -23,6 +23,9 @@ import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.testframework.GridTestUtils;
/**
@@ -73,7 +76,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
* @throws Exception If failed.
*/
public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception {
- activateCachesRestore(5, false);
+ activateCachesRestore(5, true);
}
/**
@@ -120,8 +123,9 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
}
- for (CacheConfiguration ccfg : cacheConfigurations1())
- checkCacheData(cacheData, ccfg.getName());
+ DataStorageConfiguration dsCfg = srv.configuration().getDataStorageConfiguration();
+
+ checkCachesData(cacheData, dsCfg);
checkCaches(srvs, CACHES);
@@ -152,8 +156,24 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
}
- for (CacheConfiguration ccfg : cacheConfigurations1())
- checkCacheData(cacheData, ccfg.getName());
+ checkCachesData(cacheData, dsCfg);
+ }
+
+ /**
+ * Checks that persistent caches are present with actual data and volatile caches are missing.
+ *
+ * @param cacheData Cache data.
+ * @param dsCfg DataStorageConfiguration.
+ */
+ private void checkCachesData(Map<Integer, Integer> cacheData, DataStorageConfiguration dsCfg) {
+ for (CacheConfiguration ccfg : cacheConfigurations1()) {
+ if (CU.isPersistentCache(ccfg, dsCfg))
+ checkCacheData(cacheData, ccfg.getName());
+ else {
+ for (Ignite node : G.allGrids())
+ assertTrue(node.cache(ccfg.getName()) == null || node.cache(ccfg.getName()).size() == 0);
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
index 1d8174b..d0130cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
@@ -187,7 +187,7 @@ public class MemoryPolicyConfigValidationTest extends GridCommonAbstractTest {
private MemoryPolicyConfiguration[] createPlcWithReservedNameMisuseCfg() {
MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1];
- res[0] = createMemoryPolicy("sysMemPlc", 1024 * 1024, 1024 * 1024);
+ res[0] = createMemoryPolicy("sysMemPlc", 10 * 1024 * 1024, 10 * 1024 * 1024);
return res;
}
@@ -354,36 +354,34 @@ public class MemoryPolicyConfigValidationTest extends GridCommonAbstractTest {
*/
private enum ValidationViolationType {
/** */
- NAMES_CONFLICT("Two MemoryPolicies have the same name: "),
+ NAMES_CONFLICT("have the same name"),
/** */
- SYSTEM_MEMORY_POLICY_NAME_MISUSE("'sysMemPlc' policy name is reserved for internal use."),
+ SYSTEM_MEMORY_POLICY_NAME_MISUSE("name is reserved for internal use"),
/** */
- TOO_SMALL_MEMORY_SIZE("MemoryPolicy must have size more than 10MB "),
+ TOO_SMALL_MEMORY_SIZE("must have size more than 10MB"),
/** */
- NULL_NAME_ON_USER_DEFINED_POLICY("User-defined MemoryPolicyConfiguration must have non-null and non-empty name."),
+ NULL_NAME_ON_USER_DEFINED_POLICY("must have non-null and non-empty name"),
/** */
- MISSING_USER_DEFINED_DEFAULT("User-defined default MemoryPolicy name must be presented among configured MemoryPolices: "),
+ MISSING_USER_DEFINED_DEFAULT("name must be presented among configured"),
/** */
- DEFAULT_SIZE_IS_DEFINED_TWICE("User-defined MemoryPolicy configuration and defaultMemoryPolicySize properties are set at the same time."),
+ DEFAULT_SIZE_IS_DEFINED_TWICE("properties are set at the same time."),
/** */
- TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE("User-defined default MemoryPolicy size is less than 1MB."),
+ TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE("must have size more than 10MB"),
/** */
- MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE("MemoryPolicy maxSize must not be smaller than initialSize"),
+ MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE("must not be smaller than initialSize"),
/** Case when rateTimeInterval property of MemoryPolicyConfiguration is less than or equals zero. */
- LTE_ZERO_RATE_TIME_INTERVAL("Rate time interval must be greater than zero " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval)"),
+ LTE_ZERO_RATE_TIME_INTERVAL("Rate time interval must be greater than zero"),
/** Case when subIntervals property of MemoryPolicyConfiguration is less than or equals zero. */
- LTE_ZERO_SUB_INTERVALS("Sub intervals must be greater than zero " +
- "(use MemoryPolicyConfiguration.subIntervals property to adjust the sub intervals)");
+ LTE_ZERO_SUB_INTERVALS("Sub intervals must be greater than zero");
/**
* @param violationMsg Violation message.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
index d065941..0f50efc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
@@ -23,8 +23,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
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.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -59,15 +59,10 @@ public class NonAffinityCoordinatorDynamicStartStopTest extends GridCommonAbstra
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024));
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setMaxSize(200 * 1000 * 1000);
-
- memPlcCfg.setName("dfltMemPlc");
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ cfg.setDataStorageConfiguration(memCfg);
if (gridName.contains(DUMMY_GRID_NAME))
cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE, false));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
index fe139ba..7d9df26 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
@@ -19,8 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed;
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.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -43,8 +45,14 @@ public class Cache64kPartitionsTest extends GridCommonAbstractTest {
cfg.setActiveOnStart(false);
- if (persistenceEnabled)
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ if (persistenceEnabled) {
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ 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/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 7f2a5d0..ab07611 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -48,8 +48,9 @@ import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
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.MemoryConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridNodeOrderComparator;
@@ -182,11 +183,11 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
discoSpi.setJoinTimeout(30_000);
}
- MemoryConfiguration cfg1 = new MemoryConfiguration();
+ DataStorageConfiguration cfg1 = new DataStorageConfiguration();
- cfg1.setDefaultMemoryPolicySize(150 * 1024 * 1024L);
+ cfg1.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(150 * 1024 * 1024L));
- cfg.setMemoryConfiguration(cfg1);
+ cfg.setDataStorageConfiguration(cfg1);
cfg.setClientMode(client);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
index 88df607..44d8b44 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
@@ -32,8 +32,9 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
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.MemoryConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -96,11 +97,11 @@ public class CacheStartOnJoinTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(testSpi);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(50 * 1024 * 1024);
+ memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setClientMode(client);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
index bda7940..072ca7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
@@ -22,9 +22,9 @@ 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.DataPageEvictionMode;
+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.configuration.NearCacheConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -63,10 +63,14 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
* @return Configuration with given eviction mode set.
*/
static IgniteConfiguration setEvictionMode(DataPageEvictionMode mode, IgniteConfiguration configuration) {
- MemoryPolicyConfiguration[] policies = configuration.getMemoryConfiguration().getMemoryPolicies();
+ DataRegionConfiguration[] policies = configuration.getDataStorageConfiguration().getDataRegionConfigurations();
- for (MemoryPolicyConfiguration plcCfg : policies)
- plcCfg.setPageEvictionMode(mode);
+ if (policies != null) {
+ for (DataRegionConfiguration plcCfg : policies)
+ plcCfg.setPageEvictionMode(mode);
+ }
+
+ configuration.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setPageEvictionMode(mode);
return configuration;
}
@@ -84,9 +88,9 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
+ DataRegionConfiguration plc = new DataRegionConfiguration();
// This will test additional segment allocation.
plc.setInitialSize(SIZE / 2);
@@ -95,11 +99,10 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
plc.setEvictionThreshold(EVICTION_THRESHOLD);
plc.setName(DEFAULT_POLICY_NAME);
- dbCfg.setMemoryPolicies(plc);
+ dbCfg.setDefaultDataRegionConfiguration(plc);
dbCfg.setPageSize(PAGE_SIZE);
- dbCfg.setDefaultMemoryPolicyName(DEFAULT_POLICY_NAME);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
return cfg;
}
@@ -124,7 +127,7 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
.setAffinity(new RendezvousAffinityFunction(false, 32))
.setCacheMode(cacheMode)
.setAtomicityMode(atomicityMode)
- .setMemoryPolicyName(memoryPlcName)
+ .setDataRegionName(memoryPlcName)
.setWriteSynchronizationMode(writeSynchronizationMode);
if (cacheMode == CacheMode.PARTITIONED)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
index 71d809a..7e0b1d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
@@ -27,7 +27,7 @@ import javax.cache.expiry.TouchedExpiryPolicy;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -51,10 +51,10 @@ public class IgniteCacheLargeValueExpireTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
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/IgniteDataStorageMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
new file mode 100644
index 0000000..93fa24e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
@@ -0,0 +1,237 @@
+/*
+ * 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.cache.persistence;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.BinaryConfiguration;
+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.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.PAX;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String GROUP1 = "grp1";
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setConsistentId(gridName);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setMetricsEnabled(true)
+ .setName("dflt-plc"))
+ .setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(false)
+ .setMetricsEnabled(true)
+ .setName("no-persistence"))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024)
+ .setMetricsEnabled(true);
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ cfg.setCacheConfiguration(cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1, null),
+ cacheConfiguration(null, "cache-np", PARTITIONED, ATOMIC, 1, "no-persistence"));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ GridTestUtils.deleteDbFiles();
+
+ super.afterTest();
+ }
+
+ /**
+ * @param grpName Cache group name.
+ * @param name Cache name.
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Atomicity mode.
+ * @param backups Backups number.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration cacheConfiguration(
+ String grpName,
+ String name,
+ CacheMode cacheMode,
+ CacheAtomicityMode atomicityMode,
+ int backups,
+ String dataRegName
+ ) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(name);
+ ccfg.setGroupName(grpName);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setBackups(backups);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setDataRegionName(dataRegName);
+
+ return ccfg;
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testPersistenceMetrics() throws Exception {
+ final IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ try {
+ IgniteCache<Object, Object> cache = ig.cache("cache");
+
+ for (int i = 0; i < 10; i++)
+ cache.put(i, new Person("first-" + i, "last-" + i));
+
+ IgniteCache<Object, Object> cacheNp = ig.cache("cache-np");
+
+ for (int i = 0; i < 10; i++)
+ cacheNp.put(i, new Person("first-" + i, "last-" + i));
+
+ DataRegionMetrics memMetrics = ig.dataRegionMetrics("dflt-plc");
+
+ assertNotNull(memMetrics);
+ assertTrue(memMetrics.getDirtyPages() > 0);
+ assertTrue(memMetrics.getPagesFillFactor() > 0);
+
+ memMetrics = ig.dataRegionMetrics("no-persistence");
+
+ assertNotNull(memMetrics);
+ assertTrue(memMetrics.getTotalAllocatedPages() > 0);
+ assertTrue(memMetrics.getPagesFillFactor() > 0);
+
+ ig.context().cache().context().database().waitForCheckpoint("test");
+
+ assertTrue(GridTestUtils.waitForCondition(new PAX() {
+ @Override public boolean applyx() {
+ DataStorageMetrics pMetrics = ig.dataStorageMetrics();
+
+ assertNotNull(pMetrics);
+
+ return pMetrics.getLastCheckpointTotalPagesNumber() != 0 &&
+ pMetrics.getLastCheckpointDataPagesNumber() != 0;
+ }
+ }, 10_000));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ static class Person implements Serializable {
+ /** */
+ @GridToStringInclude
+ @QuerySqlField(index = true, groups = "full_name")
+ private String fName;
+
+ /** */
+ @GridToStringInclude
+ @QuerySqlField(index = true, groups = "full_name")
+ private String lName;
+
+ /**
+ * @param fName First name.
+ * @param lName Last name.
+ */
+ public Person(String fName, String lName) {
+ this.fName = fName;
+ this.lName = lName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(Person.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person person = (Person)o;
+
+ return Objects.equals(fName, person.fName) &&
+ Objects.equals(lName, person.lName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return Objects.hash(fName, lName);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
index cc3820b..50d7e7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
@@ -31,8 +31,9 @@ import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.BinaryConfiguration;
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.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -63,9 +64,12 @@ public class IgnitePdsBinaryMetadataOnClusterRestartTest extends GridCommonAbstr
cfg.setClientMode(clientMode);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024))
);
BinaryConfiguration bCfg = new BinaryConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
index 705156f..8e43e93 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
@@ -37,10 +37,9 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
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.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.IgniteInternalFuture;
@@ -113,27 +112,23 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends GridCommonAb
cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
memCfg.setPageSize(1024);
+ memCfg.setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setMaxSize(150 * 1024 * 1024);
memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setSwapFilePath("work/swap");
+ memPlcCfg.setSwapPath("work/swap");
+ memPlcCfg.setPersistenceEnabled(true);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
index 2c15416..130a91c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.processors.cache.persistence;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbClientNearCachePutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsClientNearCachePutGetTest extends IgniteDbClientNearCacheP
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
index a363e8c..27b1950 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
@@ -32,10 +32,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.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.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -80,18 +79,13 @@ public class IgnitePdsContinuousRestartTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(400 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(checkpointDelay);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setMaxSize(400 * 1024 * 1024);
- memPlcCfg.setInitialSize(400 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -103,12 +97,6 @@ public class IgnitePdsContinuousRestartTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- .setCheckpointingFrequency(checkpointDelay)
- );
-
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/IgnitePdsDynamicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
index 0325e12..7e0cf82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
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.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.processors.database.IgniteDbDynamicCacheSelfTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -46,24 +45,13 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
@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).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setPageSize(1024);
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
if ("client".equals(gridName))
cfg.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
index 94b8f53..2586a1f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
@@ -19,10 +19,9 @@ package org.apache.ignite.internal.processors.cache.persistence;
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.util.typedef.internal.U;
@@ -40,6 +39,9 @@ public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTes
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/**
*
*/
@@ -88,31 +90,28 @@ public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTes
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(1000 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(800 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointThreads(1)
+ .setCheckpointFrequency(1);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- memCfg.setMemoryPolicies(memPlcCfg);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(200 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
- ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
-
- cfg.setCacheConfiguration(ccfg);
+ CacheConfiguration ccfgNp = new CacheConfiguration("nonPersistentCache");
+ ccfgNp.setDataRegionName(NO_PERSISTENCE_REGION);
- PersistentStoreConfiguration psiCfg = new PersistentStoreConfiguration()
- .setCheckpointingThreads(1)
- .setCheckpointingFrequency(1)
- .setWalMode(WALMode.LOG_ONLY);
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
- cfg.setPersistentStoreConfiguration(psiCfg);
+ cfg.setCacheConfiguration(ccfg, ccfgNp);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
index 517b9ea..0429d6b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
@@ -23,8 +23,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -41,8 +41,8 @@ public class IgnitePdsMarshallerMappingRestoreOnNodeStartTest extends GridCommon
cfg.setWorkDirectory(Paths.get(tmpDir, "srv" + gridIndex).toString());
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
);
cfg.setCacheConfiguration(new CacheConfiguration()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
index 0437251..6a2c9b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
@@ -30,10 +30,10 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -72,18 +72,12 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- memCfg.setMemoryPolicies(memPlcCfg);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration();
@@ -97,8 +91,6 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
index 1d6ba4b..d2ec33a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
@@ -23,10 +23,9 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCache;
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.util.typedef.internal.U;
@@ -49,25 +48,13 @@ public class IgnitePdsPageSizesTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(pageSize);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- memCfg.setPageSize(pageSize);
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setCacheConfiguration(
new CacheConfiguration(cacheName)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
index 6e2752d..9369443 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
@@ -26,10 +26,10 @@ import org.apache.ignite.IgniteCheckedException;
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.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.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
@@ -69,7 +69,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
private final String cacheName = "cache";
/** Policy name. */
- private final String policyName = "dfltMemPlc";
+ private final String policyName = "dfltDataRegion";
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -82,24 +82,17 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(1024 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setName(policyName))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(500)
+ .setAlwaysWriteFullPages(true);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName(policyName);
- memPlcCfg.setInitialSize(1024 * 1024 * 1024);
- memPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName(policyName);
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(500)
- .setAlwaysWriteFullPages(true)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
@@ -147,7 +140,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
// Disable integrated checkpoint thread.
psMgr.enableCheckpoints(false).get();
- PageMemory mem = sharedCtx.database().memoryPolicy(policyName).pageMemory();
+ PageMemory mem = sharedCtx.database().dataRegion(policyName).pageMemory();
int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
@@ -212,7 +205,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
dbMgr.enableCheckpoints(false).get();
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
for (FullPageId fullId : pages) {
long page = mem.acquirePage(fullId.groupId(), fullId.pageId());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
index 78da14d..d2c157b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
@@ -25,10 +25,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
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.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.IgniteInternalFuture;
@@ -61,27 +60,17 @@ public class IgnitePdsRemoveDuringRebalancingTest extends GridCommonAbstractTest
.setRebalanceMode(CacheRebalanceMode.SYNC)
);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- dbCfg.setPageSize(1024);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
- memPlcCfg.setSwapFilePath(DFLT_STORE_DIR);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setSwapPath(DFLT_STORE_DIR))
.setWalMode(WALMode.LOG_ONLY)
- );
+ .setPageSize(1024)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
index 4add384..18e31fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.processors.cache.persistence;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbSingleNodePutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsSingleNodePutGetPersistenceTest extends IgniteDbSingleNode
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
deleted file mode 100644
index cfa1706..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
+++ /dev/null
@@ -1,225 +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.cache.persistence;
-
-import java.io.Serializable;
-import java.util.Objects;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.PersistenceMetrics;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.BinaryConfiguration;
-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.PersistentStoreConfiguration;
-import org.apache.ignite.configuration.WALMode;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.PAX;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class IgnitePersistenceMetricsSelfTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final String GROUP1 = "grp1";
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- GridTestUtils.deleteDbFiles();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- GridTestUtils.deleteDbFiles();
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setConsistentId(gridName);
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
-
- memCfg.setDefaultMemoryPolicyName("dflt-plc");
-
- MemoryPolicyConfiguration memPlc = new MemoryPolicyConfiguration();
- memPlc.setName("dflt-plc");
- memPlc.setMaxSize(10 * 1024 * 1024);
- memPlc.setMetricsEnabled(true);
-
- memCfg.setMemoryPolicies(memPlc);
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()
- .setMetricsEnabled(true).setWalMode(WALMode.LOG_ONLY));
-
- cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
-
- cfg.setCacheConfiguration(cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1));
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- GridTestUtils.deleteDbFiles();
-
- super.afterTest();
- }
-
- /**
- * @param grpName Cache group name.
- * @param name Cache name.
- * @param cacheMode Cache mode.
- * @param atomicityMode Atomicity mode.
- * @param backups Backups number.
- * @return Cache configuration.
- */
- private CacheConfiguration cacheConfiguration(
- String grpName,
- String name,
- CacheMode cacheMode,
- CacheAtomicityMode atomicityMode,
- int backups
- ) {
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setName(name);
- ccfg.setGroupName(grpName);
- ccfg.setAtomicityMode(atomicityMode);
- ccfg.setBackups(backups);
- ccfg.setCacheMode(cacheMode);
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
- return ccfg;
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testPersistenceMetrics() throws Exception {
- final IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- try {
- IgniteCache<Object, Object> cache = ig.cache("cache");
-
- for (int i = 0; i < 10; i++)
- cache.put(i, new Person("first-" + i, "last-" + i));
-
- {
- MemoryMetrics memMetrics = ig.memoryMetrics("dflt-plc");
-
- assertNotNull(memMetrics);
- assertTrue(memMetrics.getDirtyPages() > 0);
- }
-
- ig.context().cache().context().database().waitForCheckpoint("test");
-
- GridTestUtils.waitForCondition(new PAX() {
- @Override public boolean applyx() {
- PersistenceMetrics pMetrics = ig.persistentStoreMetrics();
-
- assertNotNull(pMetrics);
-
- return pMetrics.getLastCheckpointTotalPagesNumber() != 0 &&
- pMetrics.getLastCheckpointDataPagesNumber() != 0;
- }
- }, 5_000);
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
- *
- */
- static class Person implements Serializable {
- /** */
- @GridToStringInclude
- @QuerySqlField(index = true, groups = "full_name")
- private String fName;
-
- /** */
- @GridToStringInclude
- @QuerySqlField(index = true, groups = "full_name")
- private String lName;
-
- /**
- * @param fName First name.
- * @param lName Last name.
- */
- public Person(String fName, String lName) {
- this.fName = fName;
- this.lName = lName;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(Person.class, this);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- Person person = (Person)o;
-
- return Objects.equals(fName, person.fName) &&
- Objects.equals(lName, person.lName);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(fName, lName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
index 9295000..814ee57 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
@@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.cache.persistence;
import org.apache.ignite.configuration.CheckpointWriteOrder;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
/**
@@ -29,9 +29,9 @@ public class IgnitePersistenceSequentialCheckpointTest extends IgnitePersistentS
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
- .setCheckpointingThreads(4)
+ .setCheckpointThreads(4)
.setCheckpointWriteOrder(CheckpointWriteOrder.SEQUENTIAL));
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/IgnitePersistentStoreCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
index dc65177..1e7ad1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
@@ -33,9 +33,9 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicy;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -85,13 +85,13 @@ public class IgnitePersistentStoreCacheGroupsTest extends GridCommonAbstractTest
cfg.setConsistentId(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(100 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(1024)
+ .setWalMode(WALMode.LOG_ONLY);
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY));
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
index fed8766..e9828f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
@@ -26,10 +26,9 @@ import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteSet;
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.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -50,20 +49,12 @@ public class IgnitePersistentStoreDataStructuresTest extends GridCommonAbstractT
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY));
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
[06/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
new file mode 100644
index 0000000..394e294
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
@@ -0,0 +1,225 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for data region configuration.
+ */
+public class VisorDataRegionConfiguration extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Unique name of DataRegion. */
+ private String name;
+
+ /** Initial memory region size defined by this memory policy. */
+ private long initSize;
+
+ /** Maximum memory region size defined by this memory policy. */
+ private long maxSize;
+
+ /** Path for memory mapped file. */
+ private String swapPath;
+
+ /** An algorithm for memory pages eviction. */
+ private DataPageEvictionMode pageEvictionMode;
+
+ /** A threshold for memory pages eviction initiation. */
+ private double evictionThreshold;
+
+ /** Minimum number of empty pages in reuse lists. */
+ private int emptyPagesPoolSize;
+
+ /** Enable memory metrics collection for this data region. */
+ private boolean metricsEnabled;
+
+ /** Number of sub-intervals. */
+ private int metricsSubIntervalCount;
+
+ /** Time interval over which allocation rate is calculated. */
+ private long metricsRateTimeInterval;
+
+ /** Enable Ignite Native Persistence. */
+ private boolean persistenceEnabled;
+
+ /**
+ * Default constructor.
+ */
+ public VisorDataRegionConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param plc Data region configuration.
+ */
+ public VisorDataRegionConfiguration(DataRegionConfiguration plc) {
+ assert plc != null;
+
+ name = plc.getName();
+ initSize = plc.getInitialSize();
+ maxSize = plc.getMaxSize();
+ swapPath = plc.getSwapPath();
+ pageEvictionMode = plc.getPageEvictionMode();
+ evictionThreshold = plc.getEvictionThreshold();
+ emptyPagesPoolSize = plc.getEmptyPagesPoolSize();
+ metricsEnabled = plc.isMetricsEnabled();
+ metricsSubIntervalCount = plc.getMetricsSubIntervalCount();
+ metricsRateTimeInterval = plc.getMetricsRateTimeInterval();
+ persistenceEnabled = plc.isPersistenceEnabled();
+ }
+
+ /**
+ * @param regCfgs Array of data region configurations.
+ * @return Collection of DTO objects.
+ */
+ public static List<VisorDataRegionConfiguration> from(DataRegionConfiguration[] regCfgs) {
+ List<VisorDataRegionConfiguration> res = new ArrayList<>();
+
+ if (regCfgs != null) {
+ for (DataRegionConfiguration plc: regCfgs)
+ res.add(new VisorDataRegionConfiguration(plc));
+ }
+
+ return res;
+ }
+
+ /**
+ * @return Unique name of DataRegion.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Maximum memory region size defined by this memory policy.
+ */
+ public long getMaxSize() {
+ return maxSize;
+ }
+
+ /**
+ * @return Initial memory region size defined by this memory policy.
+ */
+ public long getInitialSize() {
+ return initSize;
+ }
+
+ /**
+ * @return Path for memory mapped file.
+ */
+ public String getSwapPath() {
+ return swapPath;
+ }
+
+ /**
+ * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default.
+ */
+ public DataPageEvictionMode getPageEvictionMode() {
+ return pageEvictionMode;
+ }
+
+ /**
+ * @return Memory pages eviction threshold.
+ */
+ public double getEvictionThreshold() {
+ return evictionThreshold;
+ }
+
+ /**
+ * @return Minimum number of empty pages in reuse list.
+ */
+ public int getEmptyPagesPoolSize() {
+ return emptyPagesPoolSize;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @return Number of sub intervals.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * @return Time interval over which allocation rate is calculated.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ out.writeLong(initSize);
+ out.writeLong(maxSize);
+ U.writeString(out, swapPath);
+ U.writeEnum(out, pageEvictionMode);
+ out.writeDouble(evictionThreshold);
+ out.writeInt(emptyPagesPoolSize);
+ out.writeBoolean(metricsEnabled);
+ out.writeInt(metricsSubIntervalCount);
+ out.writeLong(metricsRateTimeInterval);
+ out.writeBoolean(persistenceEnabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ initSize = in.readLong();
+ maxSize = in.readLong();
+ swapPath = U.readString(in);
+ pageEvictionMode = DataPageEvictionMode.fromOrdinal(in.readByte());
+ evictionThreshold = in.readDouble();
+ emptyPagesPoolSize = in.readInt();
+ metricsEnabled = in.readBoolean();
+ metricsSubIntervalCount = in.readInt();
+ metricsRateTimeInterval = in.readLong();
+ persistenceEnabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorDataRegionConfiguration.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
new file mode 100644
index 0000000..78bf1c5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
@@ -0,0 +1,453 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.configuration.CheckpointWriteOrder;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
+
+/**
+ * Data transfer object for data store configuration.
+ */
+public class VisorDataStorageConfiguration extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Size of a memory chunk reserved for system cache initially. */
+ private long sysRegionInitSize;
+
+ /** Size of memory for system cache. */
+ private long sysRegionMaxSize;
+
+ /** Page size. */
+ private int pageSize;
+
+ /** Concurrency level. */
+ private int concLvl;
+
+ /** Configuration of default data region. */
+ private VisorDataRegionConfiguration dfltDataRegCfg;
+
+ /** Memory policies. */
+ private List<VisorDataRegionConfiguration> dataRegCfgs;
+
+ /** */
+ private String storagePath;
+
+ /** Checkpointing frequency. */
+ private long checkpointFreq;
+
+ /** Lock wait time. */
+ private long lockWaitTime;
+
+ /** */
+ private long checkpointPageBufSize;
+
+ /** */
+ private int checkpointThreads;
+
+ /** Checkpoint write order. */
+ private CheckpointWriteOrder checkpointWriteOrder;
+
+ /** */
+ private int walHistSize;
+
+ /** Number of work WAL segments. */
+ private int walSegments;
+
+ /** Number of WAL segments to keep. */
+ private int walSegmentSize;
+
+ /** WAL persistence path. */
+ private String walPath;
+
+ /** WAL archive path. */
+ private String walArchivePath;
+
+ /** Metrics enabled flag. */
+ private boolean metricsEnabled;
+
+ /** Wal mode. */
+ private WALMode walMode;
+
+ /** WAl thread local buffer size. */
+ private int walTlbSize;
+
+ /** Wal flush frequency. */
+ private long walFlushFreq;
+
+ /** Wal fsync delay in nanoseconds. */
+ private long walFsyncDelay;
+
+ /** Wal record iterator buffer size. */
+ private int walRecordIterBuffSize;
+
+ /** Always write full pages. */
+ private boolean alwaysWriteFullPages;
+
+ /** Factory to provide I/O interface for files */
+ private String fileIOFactory;
+
+ /** Number of sub-intervals. */
+ private int metricsSubIntervalCount;
+
+ /** Time interval (in milliseconds) for rate-based metrics. */
+ private long metricsRateTimeInterval;
+
+ /** Time interval (in milliseconds) for running auto archiving for incompletely WAL segment */
+ private long walAutoArchiveAfterInactivity;
+
+ /** If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled. */
+ private boolean writeThrottlingEnabled;
+
+ /**
+ * Default constructor.
+ */
+ public VisorDataStorageConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cfg Data storage configuration.
+ */
+ public VisorDataStorageConfiguration(DataStorageConfiguration cfg) {
+ assert cfg != null;
+
+ sysRegionInitSize = cfg.getSystemRegionInitialSize();
+ sysRegionMaxSize = cfg.getSystemRegionMaxSize();
+ pageSize = cfg.getPageSize();
+ concLvl = cfg.getConcurrencyLevel();
+
+ DataRegionConfiguration dfltRegion = cfg.getDefaultDataRegionConfiguration();
+
+ if (dfltRegion != null)
+ dfltDataRegCfg = new VisorDataRegionConfiguration(dfltRegion);
+
+ dataRegCfgs = VisorDataRegionConfiguration.from(cfg.getDataRegionConfigurations());
+
+ storagePath = cfg.getStoragePath();
+ checkpointFreq = cfg.getCheckpointFrequency();
+ lockWaitTime = cfg.getLockWaitTime();
+ checkpointPageBufSize = cfg.getCheckpointPageBufferSize();
+ checkpointThreads = cfg.getCheckpointThreads();
+ checkpointWriteOrder = cfg.getCheckpointWriteOrder();
+ walHistSize = cfg.getWalHistorySize();
+ walSegments = cfg.getWalSegments();
+ walSegmentSize = cfg.getWalSegmentSize();
+ walPath = cfg.getWalPath();
+ walArchivePath = cfg.getWalArchivePath();
+ metricsEnabled = cfg.isMetricsEnabled();
+ walMode = cfg.getWalMode();
+ walTlbSize = cfg.getWalThreadLocalBufferSize();
+ walFlushFreq = cfg.getWalFlushFrequency();
+ walFsyncDelay = cfg.getWalFsyncDelayNanos();
+ walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize();
+ alwaysWriteFullPages = cfg.isAlwaysWriteFullPages();
+ fileIOFactory = compactClass(cfg.getFileIOFactory());
+ metricsSubIntervalCount = cfg.getMetricsSubIntervalCount();
+ metricsRateTimeInterval = cfg.getMetricsRateTimeInterval();
+ walAutoArchiveAfterInactivity = cfg.getWalAutoArchiveAfterInactivity();
+ writeThrottlingEnabled = cfg.isWriteThrottlingEnabled();
+ }
+
+ /**
+ * @return Initial size in bytes.
+ */
+ public long getSystemRegionInitialSize() {
+ return sysRegionInitSize;
+ }
+
+ /**
+ * @return Maximum in bytes.
+ */
+ public long getSystemRegionMaxSize() {
+ return sysRegionMaxSize;
+ }
+
+ /**
+ * @return Page size in bytes.
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @return Mapping table concurrency level.
+ */
+ public int getConcurrencyLevel() {
+ return concLvl;
+ }
+
+ /**
+ * @return Configuration of default data region.
+ */
+ public VisorDataRegionConfiguration getDefaultDataRegionConfiguration() {
+ return dfltDataRegCfg;
+ }
+
+ /**
+ * @return Array of configured data regions.
+ */
+ public List<VisorDataRegionConfiguration> getDataRegionConfigurations() {
+ return dataRegCfgs;
+ }
+
+ /**
+ * @return Path the root directory where the Persistent Store will persist data and indexes.
+ */
+ public String getStoragePath() {
+ return storagePath;
+ }
+
+ /**
+ * @return Checkpointing frequency in milliseconds.
+ */
+ public long getCheckpointFrequency() {
+ return checkpointFreq;
+ }
+
+ /**
+ * @return Checkpointing page buffer size in bytes.
+ */
+ public long getCheckpointPageBufferSize() {
+ return checkpointPageBufSize;
+ }
+
+ /**
+ * @return Number of checkpointing threads.
+ */
+ public int getCheckpointThreads() {
+ return checkpointThreads;
+ }
+
+ /**
+ * @return Checkpoint write order.
+ */
+ public CheckpointWriteOrder getCheckpointWriteOrder() {
+ return checkpointWriteOrder;
+ }
+
+ /**
+ * @return Time for wait.
+ */
+ public long getLockWaitTime() {
+ return lockWaitTime;
+ }
+
+ /**
+ * @return Number of WAL segments to keep after a checkpoint is finished.
+ */
+ public int getWalHistorySize() {
+ return walHistSize;
+ }
+
+ /**
+ * @return Number of work WAL segments.
+ */
+ public int getWalSegments() {
+ return walSegments;
+ }
+
+ /**
+ * @return WAL segment size.
+ */
+ public int getWalSegmentSize() {
+ return walSegmentSize;
+ }
+
+ /**
+ * @return WAL persistence path, absolute or relative to Ignite work directory.
+ */
+ public String getWalPath() {
+ return walPath;
+ }
+
+ /**
+ * @return WAL archive directory.
+ */
+ public String getWalArchivePath() {
+ return walArchivePath;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @return Time interval in milliseconds.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * @return The number of sub-intervals for history tracking.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * @return WAL mode.
+ */
+ public WALMode getWalMode() {
+ return walMode;
+ }
+
+ /**
+ * @return Thread local buffer size.
+ */
+ public int getWalThreadLocalBufferSize() {
+ return walTlbSize;
+ }
+
+ /**
+ * @return Flush frequency.
+ */
+ public long getWalFlushFrequency() {
+ return walFlushFreq;
+ }
+
+ /**
+ * @return Gets the fsync delay, in nanoseconds.
+ */
+ public long getWalFsyncDelayNanos() {
+ return walFsyncDelay;
+ }
+
+ /**
+ * @return Record iterator buffer size.
+ */
+ public int getWalRecordIteratorBufferSize() {
+ return walRecordIterBuffSize;
+ }
+
+ /**
+ * @return Flag indicating whether full pages should be always written.
+ */
+ public boolean isAlwaysWriteFullPages() {
+ return alwaysWriteFullPages;
+ }
+
+ /**
+ * @return File I/O factory class name.
+ */
+ public String getFileIOFactory() {
+ return fileIOFactory;
+ }
+
+ /**
+ * @return Time in millis.
+ */
+ public long getWalAutoArchiveAfterInactivity() {
+ return walAutoArchiveAfterInactivity;
+ }
+
+ /**
+ * @return Flag indicating whether write throttling is enabled.
+ */
+ public boolean isWriteThrottlingEnabled() {
+ return writeThrottlingEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(sysRegionInitSize);
+ out.writeLong(sysRegionMaxSize);
+ out.writeInt(pageSize);
+ out.writeInt(concLvl);
+ out.writeObject(dfltDataRegCfg);
+ U.writeCollection(out, dataRegCfgs);
+ U.writeString(out, storagePath);
+ out.writeLong(checkpointFreq);
+ out.writeLong(lockWaitTime);
+ out.writeLong(checkpointPageBufSize);
+ out.writeInt(checkpointThreads);
+ U.writeEnum(out, checkpointWriteOrder);
+ out.writeInt(walHistSize);
+ out.writeInt(walSegments);
+ out.writeInt(walSegmentSize);
+ U.writeString(out, walPath);
+ U.writeString(out, walArchivePath);
+ out.writeBoolean(metricsEnabled);
+ U.writeEnum(out, walMode);
+ out.writeInt(walTlbSize);
+ out.writeLong(walFlushFreq);
+ out.writeLong(walFsyncDelay);
+ out.writeInt(walRecordIterBuffSize);
+ out.writeBoolean(alwaysWriteFullPages);
+ U.writeString(out, fileIOFactory);
+ out.writeInt(metricsSubIntervalCount);
+ out.writeLong(metricsRateTimeInterval);
+ out.writeLong(walAutoArchiveAfterInactivity);
+ out.writeBoolean(writeThrottlingEnabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ sysRegionInitSize = in.readLong();
+ sysRegionMaxSize = in.readLong();
+ pageSize = in.readInt();
+ concLvl = in.readInt();
+ dfltDataRegCfg = (VisorDataRegionConfiguration)in.readObject();
+ dataRegCfgs = U.readList(in);
+ storagePath = U.readString(in);
+ checkpointFreq = in.readLong();
+ lockWaitTime = in.readLong();
+ checkpointPageBufSize = in.readLong();
+ checkpointThreads = in.readInt();
+ checkpointWriteOrder = CheckpointWriteOrder.fromOrdinal(in.readByte());
+ walHistSize = in.readInt();
+ walSegments = in.readInt();
+ walSegmentSize = in.readInt();
+ walPath = U.readString(in);
+ walArchivePath = U.readString(in);
+ metricsEnabled = in.readBoolean();
+ walMode = WALMode.fromOrdinal(in.readByte());
+ walTlbSize = in.readInt();
+ walFlushFreq = in.readLong();
+ walFsyncDelay = in.readLong();
+ walRecordIterBuffSize = in.readInt();
+ alwaysWriteFullPages = in.readBoolean();
+ fileIOFactory = U.readString(in);
+ metricsSubIntervalCount = in.readInt();
+ metricsRateTimeInterval = in.readLong();
+ walAutoArchiveAfterInactivity = in.readLong();
+ writeThrottlingEnabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorDataStorageConfiguration.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index a716a76..99cce40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -119,6 +119,9 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
/** List of service configurations. */
private List<VisorServiceConfiguration> srvcCfgs;
+ /** Configuration of data storage. */
+ private VisorDataStorageConfiguration dataStorage;
+
/**
* Default constructor.
*/
@@ -153,11 +156,11 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
atomic = new VisorAtomicConfiguration(c.getAtomicConfiguration());
txCfg = new VisorTransactionConfiguration(c.getTransactionConfiguration());
- if (c.getMemoryConfiguration() != null)
- memCfg = new VisorMemoryConfiguration(c.getMemoryConfiguration());
+ if (c.getDataStorageConfiguration() != null)
+ memCfg = null;
- if (c.getPersistentStoreConfiguration() != null)
- psCfg = new VisorPersistentStoreConfiguration(c.getPersistentStoreConfiguration());
+ if (c.getDataStorageConfiguration() != null)
+ psCfg = null;
storeSesLsnrs = compactArray(c.getCacheStoreSessionListenerFactories());
warmupClos = compactClass(c.getWarmupClosure());
@@ -180,6 +183,8 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
sqlConnCfg = new VisorSqlConnectorConfiguration(scc);
srvcCfgs = VisorServiceConfiguration.list(c.getServiceConfiguration());
+
+ dataStorage = new VisorDataStorageConfiguration(c.getDataStorageConfiguration());
}
/**
@@ -357,6 +362,18 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
return srvcCfgs;
}
+ /**
+ * @return Configuration of data storage.
+ */
+ public VisorDataStorageConfiguration getDataStorageConfiguration() {
+ return dataStorage;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte getProtocolVersion() {
+ return V2;
+ }
+
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
out.writeObject(basic);
@@ -384,6 +401,7 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
out.writeObject(hadoopCfg);
out.writeObject(sqlConnCfg);
U.writeCollection(out, srvcCfgs);
+ out.writeObject(dataStorage);
}
/** {@inheritDoc} */
@@ -413,6 +431,9 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
hadoopCfg = (VisorHadoopConfiguration)in.readObject();
sqlConnCfg = (VisorSqlConnectorConfiguration) in.readObject();
srvcCfgs = U.readList(in);
+
+ if (protoVer == V2)
+ dataStorage = (VisorDataStorageConfiguration)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
index ccb23ac..6708f9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
@@ -22,8 +22,8 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
-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.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -48,10 +48,10 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
/** Concurrency level. */
private int concLvl;
- /** Name of MemoryPolicy to be used as default. */
+ /** Name of DataRegion to be used as default. */
private String dfltMemPlcName;
- /** Size of memory (in bytes) to use for default MemoryPolicy. */
+ /** Size of memory (in bytes) to use for default DataRegion. */
private long dfltMemPlcSize;
/** Memory policies. */
@@ -69,22 +69,22 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
*
* @param memCfg Memory configuration.
*/
- public VisorMemoryConfiguration(MemoryConfiguration memCfg) {
+ public VisorMemoryConfiguration(DataStorageConfiguration memCfg) {
assert memCfg != null;
- sysCacheInitSize = memCfg.getSystemCacheInitialSize();
- sysCacheMaxSize = memCfg.getSystemCacheMaxSize();
+ sysCacheInitSize = memCfg.getSystemRegionInitialSize();
+ sysCacheMaxSize = memCfg.getSystemRegionMaxSize();
pageSize = memCfg.getPageSize();
concLvl = memCfg.getConcurrencyLevel();
- dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
- dfltMemPlcSize = memCfg.getDefaultMemoryPolicySize();
+// dfltMemPlcName = memCfg.getDefaultDataRegionName();
+ //dfltMemPlcSize = memCfg.getDefaultDataRegionSize();
- MemoryPolicyConfiguration[] plcs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] plcs = memCfg.getDataRegionConfigurations();
if (!F.isEmpty(plcs)) {
memPlcs = new ArrayList<>(plcs.length);
- for (MemoryPolicyConfiguration plc : plcs)
+ for (DataRegionConfiguration plc : plcs)
memPlcs.add(new VisorMemoryPolicyConfiguration(plc));
}
}
@@ -118,7 +118,7 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
}
/**
- * @return Name of MemoryPolicy to be used as default.
+ * @return Name of DataRegion to be used as default.
*/
public String getDefaultMemoryPolicyName() {
return dfltMemPlcName;
@@ -132,7 +132,7 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
}
/**
- * @return Collection of MemoryPolicyConfiguration objects.
+ * @return Collection of DataRegionConfiguration objects.
*/
public List<VisorMemoryPolicyConfiguration> getMemoryPolicies() {
return memPlcs;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
index bed4c4b..92159a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.configuration.DataPageEvictionMode;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
@@ -33,7 +33,7 @@ public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Unique name of MemoryPolicy. */
+ /** Unique name of DataRegion. */
private String name;
/** Maximum memory region size defined by this memory policy. */
@@ -69,20 +69,20 @@ public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject {
*
* @param plc Memory policy configuration.
*/
- public VisorMemoryPolicyConfiguration(MemoryPolicyConfiguration plc) {
+ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) {
assert plc != null;
name = plc.getName();
maxSize = plc.getMaxSize();
initSize = plc.getInitialSize();
- swapFilePath = plc.getSwapFilePath();
+ swapFilePath = plc.getSwapPath();
pageEvictionMode = plc.getPageEvictionMode();
evictionThreshold = plc.getEvictionThreshold();
emptyPagesPoolSize = plc.getEmptyPagesPoolSize();
}
/**
- * Unique name of MemoryPolicy.
+ * Unique name of DataRegion.
*/
public String getName() {
return name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 3fd7b0d..99d1132 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -21,7 +21,7 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteFileSystem;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -157,7 +157,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
try {
List<VisorMemoryMetrics> memoryMetrics = res.getMemoryMetrics();
- for (MemoryMetrics m : ignite.memoryMetrics())
+ for (DataRegionMetrics m : ignite.dataRegionMetrics())
memoryMetrics.add(new VisorMemoryMetrics(m));
}
catch (Exception e) {
@@ -257,7 +257,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
*/
protected void persistenceMetrics(VisorNodeDataCollectorJobResult res) {
try {
- res.setPersistenceMetrics(new VisorPersistenceMetrics(ignite.persistentStoreMetrics()));
+ res.setPersistenceMetrics(new VisorPersistenceMetrics(ignite.dataStorageMetrics()));
}
catch (Exception e) {
res.setPersistenceMetricsEx(new VisorExceptionWrapper(e));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
index 90ecf6e..0612c5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
@@ -54,7 +54,7 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
/** Exception while collecting node events. */
private VisorExceptionWrapper evtsEx;
- /** Node memory metrics. */
+ /** Node data region metrics. */
private List<VisorMemoryMetrics> memoryMetrics = new ArrayList<>();
/** Exception while collecting memory metrics. */
@@ -161,7 +161,7 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
}
/**
- * @return Collected memory metrics.
+ * @return Collected data region metrics.
*/
public List<VisorMemoryMetrics> getMemoryMetrics() {
return memoryMetrics;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 6e10b84..ace964c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -67,7 +67,7 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
/** Exceptions caught during collecting events from nodes. */
private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
- /** All memory metrics collected from nodes. */
+ /** All data region metrics collected from nodes. */
private Map<UUID, Collection<VisorMemoryMetrics>> memoryMetrics = new HashMap<>();
/** Exceptions caught during collecting memory metrics from nodes. */
@@ -188,7 +188,7 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
}
/**
- * @return All memory metrics collected from nodes.
+ * @return All data region metrics collected from nodes.
*/
public Map<UUID, Collection<VisorMemoryMetrics>> getMemoryMetrics() {
return memoryMetrics;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
index c838161..165855c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal.visor.node;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.PersistenceMetrics;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * DTO object for {@link PersistenceMetrics}.
+ * DTO object for {@link DataStorageMetrics}.
*/
public class VisorPersistenceMetrics extends VisorDataTransferObject {
/** */
@@ -76,7 +76,7 @@ public class VisorPersistenceMetrics extends VisorDataTransferObject {
/**
* @param metrics Persistence metrics.
*/
- public VisorPersistenceMetrics(PersistenceMetrics metrics) {
+ public VisorPersistenceMetrics(DataStorageMetrics metrics) {
walLoggingRate = metrics.getWalLoggingRate();
walWritingRate = metrics.getWalWritingRate();
walArchiveSegments = metrics.getWalArchiveSegments();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
index 128f43a..f9d7a64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
@@ -19,14 +19,14 @@ package org.apache.ignite.internal.visor.node;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * DTO object for {@link PersistentStoreConfiguration}.
+ * DTO object for {@link DataStorageConfiguration}.
*/
public class VisorPersistentStoreConfiguration extends VisorDataTransferObject {
/** */
@@ -99,26 +99,26 @@ public class VisorPersistentStoreConfiguration extends VisorDataTransferObject {
/**
* @param cfg Persistent store configuration.
*/
- public VisorPersistentStoreConfiguration(PersistentStoreConfiguration cfg) {
- persistenceStorePath = cfg.getPersistentStorePath();
- checkpointingFreq = cfg.getCheckpointingFrequency();
+ public VisorPersistentStoreConfiguration(DataStorageConfiguration cfg) {
+ persistenceStorePath = cfg.getStoragePath();
+ checkpointingFreq = cfg.getCheckpointFrequency();
lockWaitTime = cfg.getLockWaitTime();
- checkpointingPageBufSize = cfg.getCheckpointingPageBufferSize();
- checkpointingThreads = cfg.getCheckpointingThreads();
+ checkpointingPageBufSize = cfg.getCheckpointPageBufferSize();
+ checkpointingThreads = cfg.getCheckpointThreads();
walHistSize = cfg.getWalHistorySize();
walSegments = cfg.getWalSegments();
walSegmentSize = cfg.getWalSegmentSize();
- walStorePath = cfg.getWalStorePath();
+ walStorePath = cfg.getWalPath();
walArchivePath = cfg.getWalArchivePath();
metricsEnabled = cfg.isMetricsEnabled();
walMode = cfg.getWalMode();
- tlbSize = cfg.getTlbSize();
+ tlbSize = cfg.getWalThreadLocalBufferSize();
walFlushFreq = cfg.getWalFlushFrequency();
walFsyncDelay = cfg.getWalFsyncDelayNanos();
walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize();
alwaysWriteFullPages = cfg.isAlwaysWriteFullPages();
- subIntervals = cfg.getSubIntervals();
- rateTimeInterval = cfg.getRateTimeInterval();
+ subIntervals = cfg.getMetricsSubIntervalCount();
+ rateTimeInterval = cfg.getMetricsRateTimeInterval();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
new file mode 100644
index 0000000..eeed496
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
@@ -0,0 +1,139 @@
+/*
+ * 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.mxbean;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+
+/**
+ * This interface defines a JMX view on {@link DataRegionMetrics}.
+ */
+@MXBeanDescription("MBean that provides access to DataRegionMetrics of a local Apache Ignite node.")
+public interface DataRegionMetricsMXBean extends DataRegionMetrics {
+ /** {@inheritDoc} */
+ @MXBeanDescription("A name of a memory region the metrics are collected for.")
+ @Override public String getName();
+
+ /**
+ * Gets initial memory region size defined by its {@link DataRegionConfiguration}.
+ *
+ * @return Initial size in MB.
+ */
+ @MXBeanDescription("Initial memory region size defined by its data region.")
+ public int getInitialSize();
+
+ /**
+ * Maximum memory region size defined by its {@link DataRegionConfiguration}.
+ *
+ * @return Maximum size in MB.
+ */
+ @MXBeanDescription("Maximum memory region size defined by its data region.")
+ public int getMaxSize();
+
+ /**
+ * A path to the memory-mapped files the memory region defined by {@link DataRegionConfiguration} will be
+ * mapped to.
+ *
+ * @return Path to the memory-mapped files.
+ */
+ @MXBeanDescription("Path to the memory-mapped files.")
+ public String getSwapPath();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of allocated pages.")
+ @Override public long getTotalAllocatedPages();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Allocation rate (pages per second) averaged across rateTimeInternal.")
+ @Override public float getAllocationRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Eviction rate (pages per second).")
+ @Override public float getEvictionRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of pages that are fully occupied by large entries that go beyond page size.")
+ @Override public float getLargeEntriesPagesPercentage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of space that is still free and can be filled in.")
+ @Override public float getPagesFillFactor();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages in memory not yet synchronized with persistent storage.")
+ @Override public long getDirtyPages();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Rate at which pages in memory are replaced with pages from persistent storage (pages per second).")
+ @Override public float getPagesReplaceRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages residing in physical RAM.")
+ @Override public long getPhysicalMemoryPages();
+
+ /**
+ * Enables memory metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Enables memory metrics collection on an Apache Ignite node.")
+ public void enableMetrics();
+
+ /**
+ * Disables memory metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Disables memory metrics collection on an Apache Ignite node.")
+ public void disableMetrics();
+
+ /**
+ * Sets time interval for {@link #getAllocationRate()} and {@link #getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60 seconds, subsequent calls to {@link #getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @param rateTimeInterval Time interval (in milliseconds) used for allocation and eviction rates calculations.
+ */
+ @MXBeanDescription(
+ "Sets time interval for pages allocation and eviction monitoring purposes."
+ )
+ @MXBeanParametersNames(
+ "rateTimeInterval"
+ )
+ @MXBeanParametersDescriptions(
+ "Time interval (in milliseconds) to set."
+ )
+ public void rateTimeInterval(long rateTimeInterval);
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #rateTimeInterval(long)} will be split into to calculate
+ * {@link #getAllocationRate()} and {@link #getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link #getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @param subInts A number of sub-intervals.
+ */
+ @MXBeanDescription(
+ "Sets a number of sub-intervals to calculate allocation and eviction rates metrics."
+ )
+ @MXBeanParametersNames(
+ "subInts"
+ )
+ @MXBeanParametersDescriptions(
+ "Number of subintervals to set."
+ )
+ public void subIntervals(int subInts);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
new file mode 100644
index 0000000..f0fb631
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
@@ -0,0 +1,121 @@
+/*
+ * 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.mxbean;
+
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+
+/**
+ * An MX bean allowing to monitor and tune persistence metrics.
+ */
+public interface DataStorageMetricsMXBean extends DataStorageMetrics {
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of WAL records per second written during the last time interval.")
+ @Override float getWalLoggingRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of bytes per second written during the last time interval.")
+ @Override float getWalWritingRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current number of WAL segments in the WAL archive.")
+ @Override int getWalArchiveSegments();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average WAL fsync duration in microseconds over the last time interval.")
+ @Override float getWalFsyncTimeAverage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the last checkpoint in milliseconds.")
+ @Override long getLastCheckpointingDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint lock wait in milliseconds.")
+ @Override long getLastCheckpointLockWaitDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint mark in milliseconds.")
+ @Override long getLastCheckpointMarkDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint pages write in milliseconds.")
+ @Override long getLastCheckpointPagesWriteDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the sync phase of the last checkpoint in milliseconds.")
+ @Override long getLastCheckpointFsyncDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of pages written during the last checkpoint.")
+ @Override long getLastCheckpointTotalPagesNumber();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of data pages written during the last checkpoint.")
+ @Override long getLastCheckpointDataPagesNumber();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages copied to a temporary checkpoint buffer during the last checkpoint.")
+ @Override long getLastCheckpointCopiedOnWritePagesNumber();
+
+ /**
+ * Enables persistence metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Enables persistence metrics collection on an Apache Ignite node.")
+ public void enableMetrics();
+
+ /**
+ * Disables persistence metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Disables persistence metrics collection on an Apache Ignite node.")
+ public void disableMetrics();
+
+ /**
+ * Sets time interval for rate-based metrics. Identical to setting
+ * {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)} configuration property.
+ *
+ * @param rateTimeInterval Time interval (in milliseconds) used for allocation and eviction rates calculations.
+ */
+ @MXBeanDescription(
+ "Sets time interval for pages allocation and eviction monitoring purposes."
+ )
+ @MXBeanParametersNames(
+ "rateTimeInterval"
+ )
+ @MXBeanParametersDescriptions(
+ "Time interval (in milliseconds) to set."
+ )
+ public void rateTimeInterval(long rateTimeInterval);
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #rateTimeInterval(long)} will be split into to calculate
+ * rate-based metrics. Identical to setting {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)} configuration
+ * property.
+ *
+ * @param subInts A number of sub-intervals.
+ */
+ @MXBeanDescription(
+ "Sets a number of sub-intervals to calculate allocation and eviction rates metrics."
+ )
+ @MXBeanParametersNames(
+ "subInts"
+ )
+ @MXBeanParametersDescriptions(
+ "Number of subintervals to set."
+ )
+ public void subIntervals(int subInts);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
index 4d6c96a..e547536 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
@@ -21,8 +21,10 @@ import org.apache.ignite.configuration.MemoryPolicyConfiguration;
/**
* This interface defines a JMX view on {@link MemoryMetrics}.
+ * @deprecated Part of old API. Metrics are accessible through {@link DataRegionMetricsMXBean}.
*/
@MXBeanDescription("MBean that provides access to MemoryMetrics of a local Apache Ignite node.")
+@Deprecated
public interface MemoryMetricsMXBean extends MemoryMetrics {
/** {@inheritDoc} */
@MXBeanDescription("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/mxbean/PersistenceMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
index 40c2235..0c16640 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
@@ -22,7 +22,9 @@ import org.apache.ignite.configuration.PersistentStoreConfiguration;
/**
* An MX bean allowing to monitor and tune persistence metrics.
+ * @deprecated Part of old API. Metrics are accessible through {@link DataStorageMetricsMXBean}.
*/
+@Deprecated
public interface PersistenceMetricsMXBean extends PersistenceMetrics {
/** {@inheritDoc} */
@MXBeanDescription("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/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 2f795df..f3fc074 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -137,10 +137,10 @@ org.apache.ignite.configuration.CollectionConfiguration
org.apache.ignite.configuration.DataPageEvictionMode
org.apache.ignite.configuration.DeploymentMode
org.apache.ignite.configuration.IgniteReflectionFactory
-org.apache.ignite.configuration.MemoryConfiguration
-org.apache.ignite.configuration.MemoryPolicyConfiguration
+org.apache.ignite.configuration.DataStorageConfiguration
+org.apache.ignite.configuration.DataRegionConfiguration
org.apache.ignite.configuration.NearCacheConfiguration
-org.apache.ignite.configuration.PersistentStoreConfiguration
+org.apache.ignite.configuration.DataStorageConfiguration
org.apache.ignite.configuration.TopologyValidator
org.apache.ignite.configuration.TransactionConfiguration
org.apache.ignite.configuration.WALMode
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/config/examples.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/examples.properties b/modules/core/src/test/config/examples.properties
index ea0d8ed..2144533 100644
--- a/modules/core/src/test/config/examples.properties
+++ b/modules/core/src/test/config/examples.properties
@@ -22,4 +22,4 @@ ScalarCacheExample=examples/config/example-ignite.xml
ScalarCacheQueryExample=examples/config/example-ignite.xml
ScalarCountGraphTrianglesExample=examples/config/example-ignite.xml
ScalarPopularNumbersRealTimeExample=examples/config/example-ignite.xml
-MemoryPolicyExample=examples/config/example-memory-policies.xml
\ No newline at end of file
+DataRegionExample=examples/config/example-data-regions.xml
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
index be92761..008da71 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
@@ -25,8 +25,8 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
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.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -71,11 +71,11 @@ public class LargeEntryUpdateTest extends GridCommonAbstractTest {
cfg.setPublicThreadPoolSize(THREAD_COUNT);
- MemoryConfiguration mem = new MemoryConfiguration();
+ DataStorageConfiguration mem = new DataStorageConfiguration();
mem.setPageSize(PAGE_SIZE);
- cfg.setMemoryConfiguration(mem);
+ cfg.setDataStorageConfiguration(mem);
CacheConfiguration[] ccfgs = new CacheConfiguration[CACHE_COUNT];
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
index f842440..1352c37 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.lang.IgnitePredicate;
@@ -111,7 +111,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
final IgniteCache cache = ignite.getOrCreateCache(CACHE_NAME);
- MemoryMetricsImpl memMetrics = getDefaultMemoryPolicyMetrics(ignite);
+ DataRegionMetricsImpl memMetrics = getDefaultMemoryPolicyMetrics(ignite);
memMetrics.enableMetrics();
@@ -128,8 +128,8 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
/**
* @param ignite Ignite instance.
*/
- private MemoryMetricsImpl getDefaultMemoryPolicyMetrics(IgniteEx ignite) throws IgniteCheckedException {
- return ignite.context().cache().context().database().memoryPolicy(null).memoryMetrics();
+ private DataRegionMetricsImpl getDefaultMemoryPolicyMetrics(IgniteEx ignite) throws IgniteCheckedException {
+ return ignite.context().cache().context().database().dataRegion(null).memoryMetrics();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
index 3d6f116..9a923f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
@@ -25,7 +25,7 @@ import org.apache.ignite.IgniteState;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -81,10 +81,10 @@ public class IgniteSlowClientDetectionSelfTest extends GridCommonAbstractTest {
cfg.setCommunicationSpi(commSpi);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(16 * 1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
index 5bef372..3b9e393 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
@@ -23,7 +23,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
-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.file.MappedFileMemoryProvider;
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
-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.io.PageIO;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -309,7 +309,7 @@ public class PageMemoryNoLoadSelfTest extends GridCommonAbstractTest {
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
@@ -320,7 +320,7 @@ public class PageMemoryNoLoadSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
index 3a418f0..8703791 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
@@ -31,8 +31,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
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.NearCacheConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteBiInClosure;
@@ -75,7 +75,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest {
cfg.setClientMode(client);
if (client)
- cfg.setMemoryConfiguration(new MemoryConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration());
CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
index bf94d16..6b03867 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
@@ -21,9 +21,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
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.lang.IgniteInClosure;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -43,17 +43,16 @@ public class CacheConfigurationLeakTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
+ DataRegionConfiguration plc = new DataRegionConfiguration();
plc.setName("dfltPlc");
- plc.setMaxSize(MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE * 10);
+ plc.setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE * 10);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
+ memCfg.setDefaultDataRegionConfiguration(plc);
- 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/CacheDataRegionConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
new file mode 100644
index 0000000..775aaa8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+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.internal.IgniteEx;
+import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheDataRegionConfigurationTest extends GridCommonAbstractTest {
+ /** */
+ private volatile CacheConfiguration ccfg;
+
+ /** */
+ private volatile DataStorageConfiguration memCfg;
+
+ /** */
+ private static final long DFLT_MEM_PLC_SIZE = 10 * 1024 * 1024;
+
+ /** */
+ private static final long BIG_MEM_PLC_SIZE = 1024 * 1024 * 1024;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (memCfg != null)
+ cfg.setDataStorageConfiguration(memCfg);
+
+ if (ccfg != null)
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * Verifies that proper exception is thrown when DataRegion is misconfigured for cache.
+ */
+ public void testMissingDataRegion() throws Exception {
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setDataRegionName("nonExistingMemPlc");
+
+ try {
+ startGrid(0);
+ }
+ catch (IgniteCheckedException e) {
+ String msg = e.getMessage();
+
+ assertTrue("Not expected exception was thrown: " + e, msg.contains("Requested DataRegion is not configured"));
+
+ return;
+ }
+
+ fail("Expected exception was not thrown: missing DataRegion");
+ }
+
+ /**
+ * Verifies that {@link IgniteOutOfMemoryException} is thrown when cache is configured with too small DataRegion.
+ */
+ public void testTooSmallDataRegion() throws Exception {
+ memCfg = new DataStorageConfiguration();
+
+ DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
+ dfltPlcCfg.setName("dfltPlc");
+ dfltPlcCfg.setInitialSize(10 * 1024 * 1024);
+ dfltPlcCfg.setMaxSize(10 * 1024 * 1024);
+
+ DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
+ bigPlcCfg.setName("bigPlc");
+ bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
+
+ memCfg.setDataRegionConfigurations(bigPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
+
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ IgniteEx ignite0 = startGrid(0);
+
+ IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
+ boolean oomeThrown = false;
+
+ try {
+ for (int i = 0; i < 500_000; i++)
+ cache.put(i, "abc");
+ }
+ catch (Exception e) {
+ Throwable cause = e;
+
+ do {
+ if (cause instanceof IgniteOutOfMemoryException) {
+ oomeThrown = true;
+ break;
+ }
+
+ if (cause == null)
+ break;
+
+ if (cause.getSuppressed() == null || cause.getSuppressed().length == 0)
+ cause = cause.getCause();
+ else
+ cause = cause.getSuppressed()[0];
+ }
+ while (true);
+ }
+
+ if (!oomeThrown)
+ fail("OutOfMemoryException hasn't been thrown");
+ }
+
+ /**
+ * Verifies that with enough memory allocated adding values to cache doesn't cause any exceptions.
+ */
+ public void testProperlySizedMemoryPolicy() throws Exception {
+ memCfg = new DataStorageConfiguration();
+
+ DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
+ dfltPlcCfg.setName("dfltPlc");
+ dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
+ dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
+
+ DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
+ bigPlcCfg.setName("bigPlc");
+ bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
+
+ memCfg.setDataRegionConfigurations(bigPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
+
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+ ccfg.setDataRegionName("bigPlc");
+
+ IgniteEx ignite0 = startGrid(0);
+
+ IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
+ try {
+ for (int i = 0; i < 500_000; i++)
+ cache.put(i, "abc");
+ }
+ catch (Exception e) {
+ fail("With properly sized DataRegion no exceptions are expected to be thrown.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
deleted file mode 100644
index 0fb9c08..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
+++ /dev/null
@@ -1,172 +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.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-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.internal.IgniteEx;
-import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
- /** */
- private volatile CacheConfiguration ccfg;
-
- /** */
- private volatile MemoryConfiguration memCfg;
-
- /** */
- private static final long DFLT_MEM_PLC_SIZE = 10 * 1024 * 1024;
-
- /** */
- private static final long BIG_MEM_PLC_SIZE = 1024 * 1024 * 1024;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- if (memCfg != null)
- cfg.setMemoryConfiguration(memCfg);
-
- if (ccfg != null)
- cfg.setCacheConfiguration(ccfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * Verifies that proper exception is thrown when MemoryPolicy is misconfigured for cache.
- */
- public void testMissingMemoryPolicy() throws Exception {
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
-
- ccfg.setMemoryPolicyName("nonExistingMemPlc");
-
- try {
- startGrid(0);
- }
- catch (IgniteCheckedException e) {
- String msg = e.getMessage();
-
- assertTrue("Not expected exception was thrown: " + e, msg.contains("Requested MemoryPolicy is not configured"));
-
- return;
- }
-
- fail("Expected exception was not thrown: missing MemoryPolicy");
- }
-
- /**
- * Verifies that {@link IgniteOutOfMemoryException} is thrown when cache is configured with too small MemoryPolicy.
- */
- public void testTooSmallMemoryPolicy() throws Exception {
- memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration dfltPlcCfg = new MemoryPolicyConfiguration();
- dfltPlcCfg.setName("dfltPlc");
- dfltPlcCfg.setInitialSize(10 * 1024 * 1024);
- dfltPlcCfg.setMaxSize(10 * 1024 * 1024);
-
- MemoryPolicyConfiguration bigPlcCfg = new MemoryPolicyConfiguration();
- bigPlcCfg.setName("bigPlc");
- bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
-
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
-
- IgniteEx ignite0 = startGrid(0);
-
- IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
-
- boolean oomeThrown = false;
-
- try {
- for (int i = 0; i < 500_000; i++)
- cache.put(i, "abc");
- }
- catch (Exception e) {
- Throwable cause = e;
-
- do {
- if (cause instanceof IgniteOutOfMemoryException) {
- oomeThrown = true;
- break;
- }
-
- if (cause == null)
- break;
-
- if (cause.getSuppressed() == null || cause.getSuppressed().length == 0)
- cause = cause.getCause();
- else
- cause = cause.getSuppressed()[0];
- }
- while (true);
- }
-
- if (!oomeThrown)
- fail("OutOfMemoryException hasn't been thrown");
- }
-
- /**
- * Verifies that with enough memory allocated adding values to cache doesn't cause any exceptions.
- */
- public void testProperlySizedMemoryPolicy() throws Exception {
- memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration dfltPlcCfg = new MemoryPolicyConfiguration();
- dfltPlcCfg.setName("dfltPlc");
- dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
- dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
-
- MemoryPolicyConfiguration bigPlcCfg = new MemoryPolicyConfiguration();
- bigPlcCfg.setName("bigPlc");
- bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
-
- memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
-
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
- ccfg.setMemoryPolicyName("bigPlc");
-
- IgniteEx ignite0 = startGrid(0);
-
- IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
-
- try {
- for (int i = 0; i < 500_000; i++)
- cache.put(i, "abc");
- }
- catch (Exception e) {
- fail("With properly sized MemoryPolicy no exceptions are expected to be thrown.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
index c53bc4b..5eb8292 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
@@ -27,8 +27,8 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
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.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
@@ -72,7 +72,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
private static String CACHE_NAME_LOC = "cache_local";
/** Memory configuration to be used on client nodes with local caches. */
- private static MemoryConfiguration memCfg;
+ private static DataStorageConfiguration memCfg;
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
@@ -97,7 +97,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
if (getTestIgniteInstanceName(2).equals(igniteInstanceName)) {
iCfg.setClientMode(true);
- iCfg.setMemoryConfiguration(memCfg);
+ iCfg.setDataStorageConfiguration(memCfg);
}
((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setIpFinder(ipFinder);
@@ -670,7 +670,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalClose() throws Exception {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
@@ -721,7 +721,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalCloseWithTry() throws Exception {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
new file mode 100644
index 0000000..3c728f7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
@@ -0,0 +1,79 @@
+/*
+* 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.cache;
+
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests a check of memory configuration consistency.
+ */
+public class GridDataStorageConfigurationConsistencySelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
+
+ // Nodes will have different page size.
+ memCfg.setPageSize(DataStorageConfiguration.DFLT_PAGE_SIZE * (1 + getTestIgniteInstanceIndex(gridName)));
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMemoryConfigurationConsistency() throws Exception {
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ /** {@inheritDoc} */
+ @Override public Void call() throws Exception {
+ startGrids(2);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+}
[04/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
index 842f618..fb1574d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
@@ -73,7 +73,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteEx ignite = startGrid(0);
- Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
+ Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
assertTrue(allMemPlcs.size() == 2);
@@ -89,7 +89,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteEx ignite = startGrid(0);
- Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
+ Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
assertTrue(allMemPlcs.size() == 3);
@@ -110,13 +110,13 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
- Collection<MemoryPolicy> allMemPlcs = dbMgr.memoryPolicies();
+ Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
assertTrue(allMemPlcs.size() == 2);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
- MemoryPolicy dfltMemPlc = U.field(dbMgr, "dfltMemPlc");
+ DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion");
assertTrue(dfltMemPlc.config().getMaxSize() == USER_DEFAULT_MEM_PLC_SIZE);
}
@@ -134,13 +134,13 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
- Collection<MemoryPolicy> allMemPlcs = dbMgr.memoryPolicies();
+ Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
assertTrue(allMemPlcs.size() == 3);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
- MemoryPolicy dfltMemPlc = U.field(dbMgr, "dfltMemPlc");
+ DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion");
assertTrue(dfltMemPlc.config().getMaxSize() == USER_CUSTOM_MEM_PLC_SIZE);
}
@@ -220,7 +220,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
private void verifyCacheMemoryPolicy(IgniteCache cache, String plcName) {
GridCacheContext ctx = ((IgniteCacheProxy) cache).context();
- assertEquals(plcName, ctx.memoryPolicy().config().getName());
+ assertEquals(plcName, ctx.dataRegion().config().getName());
}
/**
@@ -278,12 +278,12 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
/**
* @param allMemPlcs Collection of all memory policies.
*/
- private void verifyDefaultAndSystemMemoryPolicies(Collection<MemoryPolicy> allMemPlcs) {
+ private void verifyDefaultAndSystemMemoryPolicies(Collection<DataRegion> allMemPlcs) {
assertTrue("Default memory policy is not presented",
isMemoryPolicyPresented(allMemPlcs, DFLT_MEM_PLC_DEFAULT_NAME));
assertTrue("System memory policy is not presented",
- isMemoryPolicyPresented(allMemPlcs, IgniteCacheDatabaseSharedManager.SYSTEM_MEMORY_POLICY_NAME));
+ isMemoryPolicyPresented(allMemPlcs, IgniteCacheDatabaseSharedManager.SYSTEM_DATA_REGION_NAME));
}
/**
@@ -303,8 +303,8 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
* @param memPlcs Collection of memory policies.
* @param nameToVerify Excepted name of memory policy.
*/
- private boolean isMemoryPolicyPresented(Collection<MemoryPolicy> memPlcs, String nameToVerify) {
- for (MemoryPolicy memPlc : memPlcs) {
+ private boolean isMemoryPolicyPresented(Collection<DataRegion> memPlcs, String nameToVerify) {
+ for (DataRegion memPlc : memPlcs) {
if (nameToVerify.equals(memPlc.config().getName()))
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
index 25626f4..577cf9a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
@@ -21,9 +21,9 @@ import java.util.Arrays;
import java.util.List;
import org.apache.ignite.IgniteCache;
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.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -40,6 +40,9 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/** */
private CacheConfiguration[] ccfgs;
@@ -55,17 +58,18 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
ccfgs = null;
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024);
-
- cfg.setMemoryConfiguration(memCfg);
-
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(10 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(1024)
+ .setWalMode(WALMode.LOG_ONLY);
- pCfg.setWalMode(WALMode.LOG_ONLY);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
@@ -137,14 +141,22 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
IgniteCache<Object, Object> cache2 = ignite(2).cache("c2");
+ IgniteCache<Object, Object> cache3 = ignite(2).cache("c3");
+
for (Integer key : keys) {
assertEquals(key, cache1.get(key));
assertNull(cache2.get(key));
+ assertNull(cache3.get(key));
+
cache2.put(key, key);
assertEquals(key, cache2.get(key));
+
+ cache3.put(key, key);
+
+ assertEquals(key, cache3.get(key));
}
List<Integer> nearKeys = nearKeys(cache1, 10, 0);
@@ -152,6 +164,10 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
for (Integer key : nearKeys) {
assertNull(cache1.get(key));
assertNull(cache2.get(key));
+ assertNull(cache3.get(key));
+
+ cache3.put(key, key);
+ assertEquals(key, cache3.get(key));
cache2.put(key, key);
assertEquals(key, cache2.get(key));
@@ -165,6 +181,8 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
awaitPartitionMapExchange();
for (Integer key : nearKeys) {
+ assertEquals(key, cache3.get(key));
+
assertEquals(key, cache2.get(key));
assertEquals(key, cache1.get(key));
@@ -186,10 +204,13 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
* @return Configurations set 1.
*/
private CacheConfiguration[] configurations2() {
- CacheConfiguration[] ccfgs = new CacheConfiguration[2];
+ CacheConfiguration[] ccfgs = new CacheConfiguration[3];
ccfgs[0] = cacheConfiguration("c1");
ccfgs[1] = cacheConfiguration("c2");
+ ccfgs[2] = cacheConfiguration("c3");
+
+ ccfgs[2].setDataRegionName(NO_PERSISTENCE_REGION);
return ccfgs;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
index b8db802..615e108 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
@@ -30,9 +30,10 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -40,7 +41,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.configuration.MemoryConfiguration;
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
@@ -61,18 +61,12 @@ public class IgnitePdsMultiNodePutGetRestartTest 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(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- dbCfg.setMemoryPolicies(memPlcCfg);
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
@@ -86,7 +80,6 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
cfg.setMarshaller(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
index c1bec35..3dfdc57 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
@@ -25,10 +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.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.IgniteInternalFuture;
@@ -60,26 +59,12 @@ public class IgnitePdsPageEvictionDuringPartitionClearTest extends GridCommonAbs
cfg.setCacheConfiguration(ccfg);
// Intentionally set small page cache size.
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(70 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setInitialSize(70 * 1024 * 1024);
- memPlcCfg.setMaxSize(70 * 1024 * 1024);
-
- memPlcCfg.setName("dfltMemPlc");
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- memCfg.setMemoryPolicies(memPlcCfg);
-
- memCfg.setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ 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/persistence/db/IgnitePdsPageEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
index 13cd8b4..47d0cb2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
@@ -27,10 +27,10 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-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.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -58,22 +58,14 @@ public class IgnitePdsPageEvictionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-
- memCfg.setPageSize(1024);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(50 * 1024 * 1024);
- memPlcCfg.setMaxSize(50 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration<DbKey, DbValue> ccfg = new CacheConfiguration<>(CACHE_NAME);
@@ -84,8 +76,6 @@ public class IgnitePdsPageEvictionTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
.setIpFinder(IP_FINDER)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
index 546a87a..893ecb5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
@@ -28,10 +28,10 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.PartitionLossPolicy;
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.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
@@ -167,23 +167,13 @@ public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstr
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(CHECKPOINT_FREQUENCY);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- 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/persistence/db/IgnitePdsTransactionsHangTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
index 7e8cfac..f3aee08 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
@@ -32,10 +32,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.BinaryConfiguration;
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.TransactionConfiguration;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -123,26 +122,21 @@ public class IgnitePdsTransactionsHangTest extends GridCommonAbstractTest {
cfg.setTransactionConfiguration(txCfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalHistorySize(1)
- .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
- );
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setInitialSize(PAGE_CACHE_SIZE * 1024 * 1024);
memPlcCfg.setMaxSize(PAGE_CACHE_SIZE * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setWalHistorySize(1);
+ memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
memCfg.setPageSize(PAGE_SIZE * 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/persistence/db/IgnitePdsWholeClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
index df5bfdf..91380f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
@@ -28,10 +28,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.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.checkpoint.noop.NoopCheckpointSpi;
@@ -56,18 +55,12 @@ public class IgnitePdsWholeClusterRestartTest 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(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -85,11 +78,6 @@ public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
-
cfg.setConsistentId(gridName);
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/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
index e577886..9e01f7b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
@@ -23,10 +23,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.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.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -58,20 +57,20 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(IP_FINDER);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
if (set2kPageSize)
memCfg.setPageSize(2048);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setMaxSize(100 * 1000 * 1000);
+ memPlcCfg.setName("dfltDataRegion");
+ memPlcCfg.setPersistenceEnabled(true);
- memPlcCfg.setName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setCheckpointFrequency(3_000);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -82,8 +81,6 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setCheckpointingFrequency(3_000));
-
cfg.setConsistentId(gridName);
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/db/file/IgnitePdsCacheIntegrationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
index d36894f..7d51b46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
@@ -31,10 +31,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
@@ -65,25 +64,13 @@ public class IgnitePdsCacheIntegrationTest 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(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
index b4c32d8..5ae8969 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
@@ -37,9 +37,9 @@ import java.nio.ByteOrder;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheRebalanceMode;
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.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -106,15 +106,12 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(500)
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
+ .setCheckpointFrequency(500)
.setWalMode(WALMode.LOG_ONLY)
.setAlwaysWriteFullPages(true)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))
);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
@@ -163,7 +160,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Otherwise we will violate page store integrity rules.
ig.cache(cacheName).put(0, 0);
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> res;
@@ -192,7 +189,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
dbMgr.enableCheckpoints(false).get();
- mem = shared.database().memoryPolicy(null).pageMemory();
+ mem = shared.database().dataRegion(null).pageMemory();
verifyReads(res.get1(), mem, res.get2(), shared.wal());
}
@@ -214,7 +211,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Disable integrated checkpoint thread.
dbMgr.enableCheckpoints(false);
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
IgniteWriteAheadLogManager wal = shared.wal();
@@ -415,7 +412,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- PageMemory pageMem = sharedCtx.database().memoryPolicy(null).pageMemory();
+ PageMemory pageMem = sharedCtx.database().dataRegion(null).pageMemory();
IgniteWriteAheadLogManager wal = sharedCtx.wal();
db.enableCheckpoints(false).get();
@@ -520,7 +517,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Disable integrated checkpoint thread.
dbMgr.enableCheckpoints(false);
- PageMemoryEx mem = (PageMemoryEx) dbMgr.memoryPolicy(null).pageMemory();
+ PageMemoryEx mem = (PageMemoryEx) dbMgr.dataRegion(null).pageMemory();
ig.context().cache().context().database().checkpointReadLock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
index a9b0892..47a4b7b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
@@ -24,10 +24,10 @@ import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataPageEvictionMode;
+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.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -69,9 +69,7 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
- cfg.setMemoryConfiguration(createDbConfig());
+ cfg.setDataStorageConfiguration(createDbConfig());
cfg.setCacheConfiguration(new CacheConfiguration<>(cacheName));
@@ -81,19 +79,20 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
/**
* @return DB config.
*/
- private MemoryConfiguration createDbConfig() {
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ private DataStorageConfiguration createDbConfig() {
+ final DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setInitialSize(MEMORY_LIMIT);
memPlcCfg.setMaxSize(MEMORY_LIMIT);
memPlcCfg.setPageEvictionMode(DataPageEvictionMode.RANDOM_LRU);
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
+ memPlcCfg.setPersistenceEnabled(true);
memCfg.setPageSize(PAGE_SIZE);
memCfg.setConcurrencyLevel(NUMBER_OF_SEGMENTS);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setWalMode(WALMode.LOG_ONLY);
return memCfg;
}
@@ -290,7 +289,7 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
final IgniteCacheDatabaseSharedManager db = sharedCtx.database();
- return db.memoryPolicy(null).pageMemory();
+ return db.dataRegion(null).pageMemory();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
index 1779fce..61f92c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
@@ -27,9 +27,9 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -59,19 +59,19 @@ public class IgnitePdsNoActualWalHistoryTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(4 * 1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalSegmentSize(4 * 1024 * 1024)
- .setWalHistorySize(2)
- .setWalSegments(10)
- .setWalMode(WALMode.LOG_ONLY)
- );
+ dbCfg.setWalSegmentSize(4 * 1024 * 1024)
+ .setWalHistorySize(2)
+ .setWalSegments(10)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true));
cfg.setMarshaller(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
index 2a00768..4b55aed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
@@ -17,22 +17,20 @@
package org.apache.ignite.internal.processors.cache.persistence.db.file;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
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.processors.cache.persistence.file.AsyncFileIOFactory;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.ThreadLocalRandom8;
-import java.util.concurrent.atomic.AtomicReference;
-
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
/**
@@ -59,9 +57,7 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(storeConfiguration());
-
- cfg.setMemoryConfiguration(memoryConfiguration());
+ cfg.setDataStorageConfiguration(memoryConfiguration());
cfg.setCacheConfiguration(new CacheConfiguration<>(cacheName));
@@ -69,36 +65,19 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest {
}
/**
- * @return Store config.
- */
- private PersistentStoreConfiguration storeConfiguration() {
- PersistentStoreConfiguration cfg = new PersistentStoreConfiguration();
-
- cfg.setWalMode(WALMode.LOG_ONLY);
-
- cfg.setWalFsyncDelayNanos(0);
-
- cfg.setFileIOFactory(new AsyncFileIOFactory());
-
- return cfg;
- }
-
- /**
* @return Memory config.
*/
- private MemoryConfiguration memoryConfiguration() {
- final MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- // memPlcCfg.setPageEvictionMode(RANDOM_LRU); TODO Fix NPE on start.
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setPageSize(PAGE_SIZE);
- memCfg.setConcurrencyLevel(1);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- return memCfg;
+ private DataStorageConfiguration memoryConfiguration() {
+ return new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setName("dfltMemPlc")
+ .setPersistenceEnabled(true)
+ /*.setPageEvictionMode(DataPageEvictionMode.RANDOM_LRU) TODO: fix NPE on start */)
+ .setPageSize(PAGE_SIZE)
+ .setConcurrencyLevel(1)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setWalFsyncDelayNanos(0)
+ .setFileIOFactory(new AsyncFileIOFactory());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
index fe7e4df..1f322de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
@@ -27,10 +27,9 @@ import java.util.regex.Pattern;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+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.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridStringLogger;
@@ -129,7 +128,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
if (configuredConsistentId != null)
cfg.setConsistentId(configuredConsistentId);
- final PersistentStoreConfiguration psCfg = new PersistentStoreConfiguration();
+ final DataStorageConfiguration dsCfg = new DataStorageConfiguration();
if (placeStorageInTemp) {
final File tempDir = new File(System.getProperty("java.io.tmpdir"));
@@ -138,19 +137,16 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
pstWalStoreCustomPath = new File(tempDir, "WalStore");
pstWalArchCustomPath = new File(tempDir, "WalArchive");
- psCfg.setPersistentStorePath(pstStoreCustomPath.getAbsolutePath());
- psCfg.setWalStorePath(pstWalStoreCustomPath.getAbsolutePath());
- psCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
+ dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath());
+ dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath());
+ dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
}
- cfg.setPersistentStoreConfiguration(psCfg);
+ dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(32 * 1024 * 1024)
+ .setPersistenceEnabled(true));
- final MemoryConfiguration memCfg = new MemoryConfiguration();
- final MemoryPolicyConfiguration memPolCfg = new MemoryPolicyConfiguration();
-
- memPolCfg.setMaxSize(32 * 1024 * 1024); // we don't need much memory for this test
- memCfg.setMemoryPolicies(memPolCfg);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(dsCfg);
if (strLog != null)
cfg.setGridLogger(strLog);
@@ -665,8 +661,8 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
*/
private void assertPdsDirsDefaultExist(String subDirName) throws IgniteCheckedException {
assertDirectoryExist("binary_meta", subDirName);
- assertDirectoryExist(PersistentStoreConfiguration.DFLT_WAL_STORE_PATH, subDirName);
- assertDirectoryExist(PersistentStoreConfiguration.DFLT_WAL_ARCHIVE_PATH, subDirName);
+ assertDirectoryExist(DataStorageConfiguration.DFLT_WAL_PATH, subDirName);
+ assertDirectoryExist(DataStorageConfiguration.DFLT_WAL_ARCHIVE_PATH, subDirName);
assertDirectoryExist(PdsConsistentIdProcessor.DB_DEFAULT_FOLDER, subDirName);
}
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/IgnitePdsWalTlbTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
index a06d587..5700eb3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
@@ -21,9 +21,9 @@ import javax.cache.CacheException;
import org.apache.ignite.IgniteDataStreamer;
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.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -52,24 +52,14 @@ public class IgnitePdsWalTlbTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointPageBufferSize(DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE + 1)
+ .setWalThreadLocalBufferSize(640000000);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingPageBufferSize(DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE + 1)
- .setTlbSize(640000000)
- );
+ cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
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/IgniteWalFlushFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
index 12ec6ef..af8f679 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
@@ -24,10 +24,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
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.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.GridKernalState;
import org.apache.ignite.internal.IgniteEx;
@@ -83,23 +82,15 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(cacheCfg);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration()
- .setName("dfltMemPlc")
- .setInitialSize(2 * 1024L * 1024L * 1024L);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(2048L * 1024 * 1024).setPersistenceEnabled(true))
+ .setFileIOFactory(new FailingFileIOFactory())
+ .setWalMode(WALMode.BACKGROUND)
+ // Setting WAL Segment size to high values forces flushing by timeout.
+ .setWalSegmentSize(flushByTimeout ? 500_000 : 50_000);
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setMemoryPolicies(memPlcCfg)
- .setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- cfg.setMemoryConfiguration(memCfg);
-
- PersistentStoreConfiguration storeCfg = new PersistentStoreConfiguration()
- .setFileIOFactory(new FailingFileIOFactory())
- .setWalMode(WALMode.BACKGROUND)
- // Setting WAL Segment size to high values forces flushing by timeout.
- .setWalSegmentSize(flushByTimeout ? 500_000 : 50_000);
-
- cfg.setPersistentStoreConfiguration(storeCfg);
+ 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/persistence/db/wal/IgniteWalHistoryReservationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
index 5d5458e..35d85d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
@@ -27,10 +27,10 @@ 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.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.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -57,20 +57,12 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
cfg.setClientMode(client);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- long memSize = 200L * 1024L * 1024L;
-
- memCfg.setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setInitialSize(memSize)
- .setMaxSize(memSize)
- .setName("dfltMemPlc")
- );
-
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -82,8 +74,6 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
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/db/wal/IgniteWalRecoveryPPCTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java
new file mode 100644
index 0000000..f3c2c99
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java
@@ -0,0 +1,321 @@
+/*
+ * 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.cache.persistence.db.wal;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.BinaryConfiguration;
+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.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgniteWalRecoveryPPCTest extends GridCommonAbstractTest {
+ /** */
+ private boolean fork;
+
+ /** */
+ public static final String CACHE_NAME_1 = "cache_1";
+
+ /** */
+ public static final String CACHE_NAME_2 = "cache_2";
+
+ /** */
+ public static final String MEM_PLC_NO_PDS = "mem_plc_2";
+
+ /** */
+ private int walSegmentSize;
+
+ /** Logger only. */
+ private boolean logOnly;
+
+ /** {@inheritDoc} */
+ @Override protected boolean isMultiJvm() {
+ return fork;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME_1);
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+ cfg.setCacheConfiguration(ccfg);
+
+ CacheConfiguration<Integer, IndexedObject> ccfg2 = new CacheConfiguration<>(CACHE_NAME_2);
+
+ ccfg2.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
+ ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
+ ccfg2.setDataRegionName(MEM_PLC_NO_PDS);
+
+ cfg.setCacheConfiguration(ccfg, ccfg2);
+
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
+ dbCfg.setPageSize(4 * 1024);
+
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
+ memPlcCfg.setInitialSize(1024 * 1024 * 1024);
+ memPlcCfg.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
+
+ dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+
+ DataRegionConfiguration memPlcCfg2 = new DataRegionConfiguration();
+ memPlcCfg2.setName(MEM_PLC_NO_PDS);
+ memPlcCfg2.setInitialSize(1024 * 1024 * 1024);
+ memPlcCfg2.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg2.setPersistenceEnabled(false);
+
+ dbCfg.setDataRegionConfigurations(memPlcCfg2);
+
+ dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);
+
+ dbCfg.setWalHistorySize(2);
+
+ dbCfg.setWalMode(WALMode.LOG_ONLY);
+
+ if (walSegmentSize != 0)
+ dbCfg.setWalSegmentSize(walSegmentSize);
+
+ cfg.setDataStorageConfiguration(dbCfg);
+
+ cfg.setMarshaller(null);
+
+ BinaryConfiguration binCfg = new BinaryConfiguration();
+
+ binCfg.setCompactFooter(false);
+
+ cfg.setBinaryConfiguration(binCfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testWalSimple() throws Exception {
+ try {
+ IgniteEx ignite = startGrid(1);
+
+ ignite.active(true);
+
+ IgniteCache<Object, Object> cache1 = ignite.cache(CACHE_NAME_1);
+ IgniteCache<Object, Object> cache2 = ignite.cache(CACHE_NAME_2);
+
+ info(" --> step1");
+
+ for (int i = 0; i < 10_000; i += 2) {
+ cache1.put(i, new IndexedObject(i));
+ cache2.put(i, new IndexedObject(i + 1));
+ }
+
+ info(" --> step2");
+
+ for (int i = 0; i < 10_000; i += 3) {
+ cache1.put(i, new IndexedObject(i * 2));
+ cache2.put(i, new IndexedObject(i * 2 + 1));
+ }
+
+ info(" --> step3");
+
+ for (int i = 0; i < 10_000; i += 7) {
+ cache1.put(i, new IndexedObject(i * 3));
+ cache2.put(i, new IndexedObject(i * 3 + 1));
+ }
+
+ info(" --> check1");
+
+ // Check.
+ for (int i = 0; i < 10_000; i++) {
+ IndexedObject o;
+ IndexedObject o1;
+
+ if (i % 7 == 0) {
+ o = new IndexedObject(i * 3);
+ o1 = new IndexedObject(i * 3 + 1);
+ }
+ else if (i % 3 == 0) {
+ o = new IndexedObject(i * 2);
+ o1 = new IndexedObject(i * 2 + 1);
+ }
+ else if (i % 2 == 0) {
+ o = new IndexedObject(i);
+ o1 = new IndexedObject(i + 1);
+ }
+ else {
+ o = null;
+ o1 = null;
+ }
+
+ assertEquals(o, cache1.get(i));
+ assertEquals(o1, cache2.get(i));
+ }
+
+ stopGrid(1);
+
+ ignite = startGrid(1);
+
+ ignite.active(true);
+
+ cache1 = ignite.cache(CACHE_NAME_1);
+ cache2 = ignite.cache(CACHE_NAME_2);
+
+ info(" --> check2");
+
+ // Check.
+ for (int i = 0; i < 10_000; i++) {
+ IndexedObject o;
+
+ if (i % 7 == 0)
+ o = new IndexedObject(i * 3);
+ else if (i % 3 == 0)
+ o = new IndexedObject(i * 2);
+ else if (i % 2 == 0)
+ o = new IndexedObject(i);
+ else
+ o = null;
+
+ assertEquals(o, cache1.get(i));
+ assertEquals(null, cache2.get(i));
+ }
+
+ info(" --> ok");
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ public void testDynamicallyStartedNonPersistentCache() throws Exception {
+ try {
+ IgniteEx ignite = startGrid(1);
+
+ ignite.active(true);
+
+ IgniteCache<Integer, Object> dynamicPersistent = ignite.getOrCreateCache(
+ new CacheConfiguration<Integer, Object>()
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setRebalanceMode(CacheRebalanceMode.SYNC)
+ .setName("dynamicPersistent")
+ .setAffinity(new RendezvousAffinityFunction(false, 32)));
+
+ IgniteCache<Integer, Object> dynamicVolatile = ignite.getOrCreateCache(
+ new CacheConfiguration<Integer, Object>()
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setRebalanceMode(CacheRebalanceMode.SYNC)
+ .setDataRegionName(MEM_PLC_NO_PDS)
+ .setName("dynamicVolatile")
+ .setAffinity(new RendezvousAffinityFunction(false, 32)));
+
+ for (int i = 0; i < 10_000; i++) {
+ dynamicPersistent.put(i, new IndexedObject(i));
+ dynamicVolatile.put(i, new IndexedObject(i + 1));
+ }
+
+ stopGrid(1);
+
+ ignite = startGrid(1);
+
+ ignite.active(true);
+
+ dynamicPersistent = ignite.cache("dynamicPersistent");
+ dynamicVolatile = ignite.cache("dynamicVolatile");
+
+ for (int i = 0; i < 10_000; i++)
+ assertEquals(new IndexedObject(i), dynamicPersistent.get(i));
+
+ assertNull(dynamicVolatile);
+
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ private static class IndexedObject {
+ /** */
+ @QuerySqlField(index = true)
+ private int iVal;
+
+ /**
+ * @param iVal Integer value.
+ */
+ private IndexedObject(int iVal) {
+ this.iVal = iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof IndexedObject))
+ return false;
+
+ IndexedObject that = (IndexedObject)o;
+
+ return iVal == that.iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IndexedObject.class, this);
+ }
+ }
+}
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/IgniteWalRecoverySeveralRestartsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
index 9497dc6..699fe81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.util.typedef.internal.S;
@@ -80,25 +79,13 @@ public class IgniteWalRecoverySeveralRestartsTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(500 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(PAGE_SIZE);
- dbCfg.setPageSize(PAGE_SIZE);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(500 * 1024 * 1024);
- memPlcCfg.setMaxSize(500 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setMarshaller(null);
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/IgniteWalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
index bf8cd85..b357877 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
@@ -48,10 +48,9 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.BinaryConfiguration;
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.IgniteInternalFuture;
@@ -136,34 +135,30 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(4 * 1024);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setInitialSize(1024 * 1024 * 1024);
memPlcCfg.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);
- cfg.setMemoryConfiguration(dbCfg);
+ dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
- pCfg.setWalRecordIteratorBufferSize(1024 * 1024);
-
- pCfg.setWalHistorySize(2);
+ dbCfg.setWalHistorySize(2);
if (logOnly)
- pCfg.setWalMode(WALMode.LOG_ONLY);
+ dbCfg.setWalMode(WALMode.LOG_ONLY);
if (walSegmentSize != 0)
- pCfg.setWalSegmentSize(walSegmentSize);
+ dbCfg.setWalSegmentSize(walSegmentSize);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
cfg.setMarshaller(null);
@@ -976,7 +971,7 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
delta.applyDelta(sharedCtx
.database()
- .memoryPolicy(null)
+ .dataRegion(null)
.pageMemory(),
((DirectBuffer)buf1).address());
@@ -990,7 +985,7 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
info("Done apply...");
- PageMemoryEx pageMem = (PageMemoryEx)db.memoryPolicy(null).pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)db.dataRegion(null).pageMemory();
for (Map.Entry<FullPageId, byte[]> entry : rolledPages.entrySet()) {
FullPageId fullId = entry.getKey();
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/IgniteWalSerializerVersionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
index ddf74c8..7500fdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
@@ -22,8 +22,9 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
import org.apache.ignite.internal.pagemem.wal.WALIterator;
@@ -63,7 +64,10 @@ public class IgniteWalSerializerVersionTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024)));
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/db/wal/WalRecoveryTxLogicalRecordsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
index f5d46e2..10b6110 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
@@ -38,9 +38,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
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.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.store.PageStore;
@@ -107,20 +107,20 @@ public class WalRecoveryTxLogicalRecordsTest extends GridCommonAbstractTest {
else
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(pageSize);
- cfg.setMemoryConfiguration(dbCfg);
+ dbCfg.setWalHistorySize(WAL_HIST_SIZE);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
- pCfg.setWalHistorySize(WAL_HIST_SIZE);
+ dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true));
if (checkpointFreq != null)
- pCfg.setCheckpointingFrequency(checkpointFreq);
+ dbCfg.setCheckpointFrequency(checkpointFreq);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
cfg.setMarshaller(null);
[08/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 9a2e028..de3b60a 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -57,18 +57,17 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.management.ObjectName;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CheckpointWriteOrder;
import org.apache.ignite.configuration.DataPageEvictionMode;
+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.events.DiscoveryEvent;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridKernalContext;
@@ -139,7 +138,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteOutClosure;
-import org.apache.ignite.mxbean.PersistenceMetricsMXBean;
+import org.apache.ignite.mxbean.DataStorageMetricsMXBean;
import org.apache.ignite.thread.IgniteThread;
import org.apache.ignite.thread.IgniteThreadPoolExecutor;
import org.jetbrains.annotations.NotNull;
@@ -229,7 +228,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
};
/** */
- private static final String MBEAN_NAME = "PersistenceMetrics";
+ private static final String MBEAN_NAME = "DataStorageMetrics";
/** */
private static final String MBEAN_GROUP = "Persistent Store";
@@ -262,7 +261,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
private volatile boolean printCheckpointStats = true;
/** Database configuration. */
- private final PersistentStoreConfiguration persistenceCfg;
+ private final DataStorageConfiguration persistenceCfg;
/** */
private final Collection<DbCheckpointListener> lsnrs = new CopyOnWriteArrayList<>();
@@ -301,7 +300,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
private IgniteCacheSnapshotManager snapshotMgr;
/** */
- private PersistenceMetricsImpl persStoreMetrics;
+ private DataStorageMetricsImpl persStoreMetrics;
/** */
private ObjectName persistenceMetricsMbeanName;
@@ -318,18 +317,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
public GridCacheDatabaseSharedManager(GridKernalContext ctx) {
IgniteConfiguration cfg = ctx.config();
- persistenceCfg = cfg.getPersistentStoreConfiguration();
+ persistenceCfg = cfg.getDataStorageConfiguration();
- assert persistenceCfg != null : "PageStore should not be created if persistence is disabled.";
+ assert persistenceCfg != null;
- checkpointFreq = persistenceCfg.getCheckpointingFrequency();
+ checkpointFreq = persistenceCfg.getCheckpointFrequency();
lockWaitTime = persistenceCfg.getLockWaitTime();
- persStoreMetrics = new PersistenceMetricsImpl(
+ persStoreMetrics = new DataStorageMetricsImpl(
persistenceCfg.isMetricsEnabled(),
- persistenceCfg.getRateTimeInterval(),
- persistenceCfg.getSubIntervals()
+ persistenceCfg.getMetricsRateTimeInterval(),
+ persistenceCfg.getMetricsSubIntervalCount()
);
}
@@ -400,12 +399,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*
*/
private void initDataBase() {
- if (persistenceCfg.getCheckpointingThreads() > 1)
+ if (persistenceCfg.getCheckpointThreads() > 1)
asyncRunner = new IgniteThreadPoolExecutor(
"checkpoint-runner",
cctx.igniteInstanceName(),
- persistenceCfg.getCheckpointingThreads(),
- persistenceCfg.getCheckpointingThreads(),
+ persistenceCfg.getCheckpointThreads(),
+ persistenceCfg.getCheckpointThreads(),
30_000,
new LinkedBlockingQueue<Runnable>()
);
@@ -420,26 +419,26 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @return Checkpoint buffer size.
*/
public static long checkpointBufferSize(IgniteConfiguration cfg) {
- PersistentStoreConfiguration persistenceCfg = cfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration persistenceCfg = cfg.getDataStorageConfiguration();
if (persistenceCfg == null)
return 0L;
- long res = persistenceCfg.getCheckpointingPageBufferSize();
+ long res = persistenceCfg.getCheckpointPageBufferSize();
if (res == 0L) {
res = DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE;
- MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration();
assert memCfg != null;
- long totalSize = memCfg.getSystemCacheMaxSize();
+ long totalSize = memCfg.getSystemRegionMaxSize();
- if (memCfg.getMemoryPolicies() == null)
- totalSize += MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE;
+ if (memCfg.getDataRegionConfigurations() == null)
+ totalSize += DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE;
else {
- for (MemoryPolicyConfiguration memPlc : memCfg.getMemoryPolicies()) {
+ for (DataRegionConfiguration memPlc : memCfg.getDataRegionConfigurations()) {
if (Long.MAX_VALUE - memPlc.getMaxSize() > totalSize)
totalSize += memPlc.getMaxSize();
else {
@@ -465,11 +464,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
@Override public void onActivate(GridKernalContext ctx) throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Activate database manager [id=" + cctx.localNodeId() +
@@ -522,7 +516,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
MBEAN_GROUP,
MBEAN_NAME,
persStoreMetrics,
- PersistenceMetricsMXBean.class);
+ DataStorageMetricsMXBean.class);
}
catch (Throwable e) {
throw new IgniteCheckedException("Failed to register " + MBEAN_NAME + " MBean.", e);
@@ -549,14 +543,19 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected IgniteOutClosure<Float> fillFactorProvider(final String memPlcName) {
+ @Override protected IgniteOutClosure<Float> fillFactorProvider(final DataRegionConfiguration dataRegCfg) {
+ if (!dataRegCfg.isPersistenceEnabled())
+ return super.fillFactorProvider(dataRegCfg);
+
+ final String dataRegName = dataRegCfg.getName();
+
return new IgniteOutClosure<Float>() {
@Override public Float apply() {
long loadSize = 0L;
long totalSize = 0L;
for (CacheGroupContext grpCtx : cctx.cache().cacheGroups()) {
- if (!grpCtx.memoryPolicy().config().getName().equals(memPlcName))
+ if (!grpCtx.dataRegion().config().getName().equals(dataRegName))
continue;
assert grpCtx.offheap() instanceof GridCacheOffheapManager;
@@ -678,10 +677,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** {@inheritDoc} */
@Override protected PageMemory createPageMemory(
DirectMemoryProvider memProvider,
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration plcCfg,
- MemoryMetricsImpl memMetrics
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration plcCfg,
+ DataRegionMetricsImpl memMetrics
) {
+ if (!plcCfg.isPersistenceEnabled())
+ return super.createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
+
memMetrics.persistenceEnabled(true);
long cacheSize = plcCfg.getMaxSize();
@@ -741,15 +743,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)
+ @Override protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg)
throws IgniteCheckedException {
- if (plcCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED)
- U.warn(log, "Page eviction mode for [" + plcCfg.getName() + "] memory region is ignored " +
+ if (!regCfg.isPersistenceEnabled())
+ super.checkRegionEvictionProperties(regCfg, dbCfg);
+
+ if (regCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED)
+ U.warn(log, "Page eviction mode for [" + regCfg.getName() + "] memory region is ignored " +
"because Ignite Native Persistence is enabled");
}
/** {@inheritDoc} */
- @Override protected void checkPageSize(MemoryConfiguration memCfg) {
+ @Override protected void checkPageSize(DataStorageConfiguration memCfg) {
if (memCfg.getPageSize() == 0) {
try {
assert cctx.pageStore() instanceof FilePageStoreManager :
@@ -767,10 +772,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
catch (IgniteCheckedException | IOException | IllegalArgumentException e) {
U.quietAndWarn(log, "Attempt to resolve pageSize from store files failed: " + e.getMessage());
- U.quietAndWarn(log, "Default page size will be used: " + MemoryConfiguration.DFLT_PAGE_SIZE + " bytes");
+ U.quietAndWarn(log, "Default page size will be used: " + DataStorageConfiguration.DFLT_PAGE_SIZE + " bytes");
}
- memCfg.setPageSize(MemoryConfiguration.DFLT_PAGE_SIZE);
+ memCfg.setPageSize(DataStorageConfiguration.DFLT_PAGE_SIZE);
}
}
@@ -800,7 +805,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
int pageSize = hdr.getInt();
if (pageSize == 2048) {
- U.quietAndWarn(log, "You are currently using persistent store with 2K pages (MemoryConfiguration#" +
+ U.quietAndWarn(log, "You are currently using persistent store with 2K pages (DataStorageConfiguration#" +
"pageSize). If you use SSD disk, consider migrating to 4K pages for better IO performance.");
}
@@ -923,9 +928,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
for (IgniteBiTuple<CacheGroupContext, Boolean> tup : stoppedGrps) {
CacheGroupContext gctx = tup.get1();
+ if (!gctx.persistenceEnabled())
+ continue;
+
snapshotMgr.onCacheGroupStop(gctx);
- PageMemoryEx pageMem = (PageMemoryEx)gctx.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)gctx.dataRegion().pageMemory();
Collection<Integer> grpIds = destroyed.get(pageMem);
@@ -1024,12 +1032,15 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @return {@code true} if all PageMemory instances are safe to update.
*/
private boolean safeToUpdatePageMemories() {
- Collection<MemoryPolicy> memPlcs = context().database().memoryPolicies();
+ Collection<DataRegion> memPlcs = context().database().dataRegions();
if (memPlcs == null)
return true;
- for (MemoryPolicy memPlc : memPlcs) {
+ for (DataRegion memPlc : memPlcs) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
PageMemoryEx pageMemEx = (PageMemoryEx)memPlc.pageMemory();
if (!pageMemEx.safeToUpdate())
@@ -1049,11 +1060,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
checkpointLock.readLock().unlock();
if (checkpointer != null) {
- Collection<MemoryPolicy> memPlcs = context().database().memoryPolicies();
+ Collection<DataRegion> dataRegs = context().database().dataRegions();
+
+ if (dataRegs != null) {
+ for (DataRegion dataReg : dataRegs) {
+ if (!dataReg.config().isPersistenceEnabled())
+ continue;
- if (memPlcs != null) {
- for (MemoryPolicy memPlc : memPlcs) {
- PageMemoryEx mem = (PageMemoryEx)memPlc.pageMemory();
+ PageMemoryEx mem = (PageMemoryEx)dataReg.pageMemory();
if (mem != null && !mem.safeToUpdate()) {
checkpointer.wakeupForCheckpoint(0, "too many dirty pages");
@@ -1595,7 +1609,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*
* @param grpId Cache group id.
* @return PageMemoryEx instance.
- * @throws IgniteCheckedException if no MemoryPolicy is configured for a name obtained from cache descriptor.
+ * @throws IgniteCheckedException if no DataRegion is configured for a name obtained from cache descriptor.
*/
private PageMemoryEx getPageMemoryForCacheGroup(int grpId) throws IgniteCheckedException {
// TODO IGNITE-5075: cache descriptor can be removed.
@@ -1606,9 +1620,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
if (desc == null)
throw new IgniteCheckedException("Failed to find cache group descriptor [grpId=" + grpId + ']');
- String memPlcName = desc.config().getMemoryPolicyName();
+ String memPlcName = desc.config().getDataRegionName();
- return (PageMemoryEx)sharedCtx.database().memoryPolicy(memPlcName).pageMemory();
+ return (PageMemoryEx)sharedCtx.database().dataRegion(memPlcName).pageMemory();
}
/**
@@ -1687,9 +1701,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
continue;
}
+ if (!grp.dataRegion().config().isPersistenceEnabled())
+ continue;
+
int grpId = grp.groupId();
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
for (int i = 0; i < grp.affinity().partitions(); i++) {
if (storeMgr.exists(grpId, i)) {
@@ -1822,14 +1839,17 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
long start = System.currentTimeMillis();
- Collection<MemoryPolicy> memPolicies = context().database().memoryPolicies();
+ Collection<DataRegion> memPolicies = context().database().dataRegions();
List<IgniteBiTuple<PageMemory, Collection<FullPageId>>> cpEntities = new ArrayList<>(memPolicies.size());
- for (MemoryPolicy memPlc : memPolicies) {
- PageMemoryEx pageMem = (PageMemoryEx)memPlc.pageMemory();
- cpEntities.add(new IgniteBiTuple<PageMemory, Collection<FullPageId>>(pageMem,
- (pageMem).beginCheckpoint()));
+ for (DataRegion memPlc : memPolicies) {
+ if (memPlc.config().isPersistenceEnabled()) {
+ PageMemoryEx pageMem = (PageMemoryEx)memPlc.pageMemory();
+
+ cpEntities.add(new IgniteBiTuple<PageMemory, Collection<FullPageId>>(
+ pageMem, (pageMem).beginCheckpoint()));
+ }
}
tmpWriteBuf.order(ByteOrder.nativeOrder());
@@ -2426,11 +2446,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* pages.
*/
private IgniteBiTuple<Collection<GridMultiCollectionWrapper<FullPageId>>, Integer> beginAllCheckpoints() {
- Collection<GridMultiCollectionWrapper<FullPageId>> res = new ArrayList(memoryPolicies().size());
+ Collection<GridMultiCollectionWrapper<FullPageId>> res = new ArrayList(dataRegions().size());
int pagesNum = 0;
- for (MemoryPolicy memPlc : memoryPolicies()) {
+ for (DataRegion memPlc : dataRegions()) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
GridMultiCollectionWrapper<FullPageId> nextCpPagesCol = ((PageMemoryEx)memPlc.pageMemory()).beginCheckpoint();
pagesNum += nextCpPagesCol.size();
@@ -2446,8 +2469,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*/
private void markCheckpointEnd(Checkpoint chp) throws IgniteCheckedException {
synchronized (this) {
- for (MemoryPolicy memPlc : memoryPolicies())
+ for (DataRegion memPlc : dataRegions()) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
((PageMemoryEx)memPlc.pageMemory()).finishCheckpoint();
+ }
if (chp.hasDelta())
writeCheckpointEntry(
@@ -2495,8 +2522,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/**
* Reorders list of checkpoint pages and splits them into needed number of sublists according to
- * {@link PersistentStoreConfiguration#getCheckpointingThreads()} and
- * {@link PersistentStoreConfiguration#getCheckpointWriteOrder()}.
+ * {@link DataStorageConfiguration#getCheckpointThreads()} and
+ * {@link DataStorageConfiguration#getCheckpointWriteOrder()}.
*
* @param cpPagesTuple Checkpoint pages tuple.
*/
@@ -2523,7 +2550,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
});
}
- int cpThreads = persistenceCfg.getCheckpointingThreads();
+ int cpThreads = persistenceCfg.getCheckpointThreads();
int pagesSubLists = cpThreads == 1 ? 1 : cpThreads * 4;
// Splitting pages to (threads * 4) subtasks. If any thread will be faster, it will help slower threads.
@@ -2606,7 +2633,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
if (grp == null)
continue;
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ if (!grp.dataRegion().config().isPersistenceEnabled())
+ continue;
+
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
Integer tag = pageMem.getForCheckpoint(
fullId, tmpWriteBuf, persStoreMetrics.metricsEnabled() ? tracker : null);
@@ -3313,14 +3343,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
- return new PersistenceMetricsSnapshot(persStoreMetrics);
+ @Override public DataStorageMetrics persistentStoreMetrics() {
+ return new DataStorageMetricsSnapshot(persStoreMetrics);
}
/**
*
*/
- public PersistenceMetricsImpl persistentStoreMetricsImpl() {
+ public DataStorageMetricsImpl persistentStoreMetricsImpl() {
return persStoreMetrics;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index 5c91a4f..6ed62f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -93,14 +93,14 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
reuseList = new ReuseListImpl(grp.groupId(),
grp.cacheOrGroupName(),
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
ctx.wal(),
reuseListRoot.pageId().pageId(),
reuseListRoot.isAllocated());
RootPage metastoreRoot = metas.treeRoot;
- metaStore = new MetadataStorage(grp.memoryPolicy().pageMemory(),
+ metaStore = new MetadataStorage(grp.dataRegion().pageMemory(),
ctx.wal(),
globalRemoveId(),
grp.groupId(),
@@ -126,7 +126,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
pendingEntries = new PendingEntriesTree(
grp,
name,
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
pendingRootPage.pageId().pageId(),
reuseList,
pendingRootPage.isAllocated()
@@ -148,7 +148,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
/** {@inheritDoc} */
@Override public void onCheckpointBegin(Context ctx) throws IgniteCheckedException {
- assert grp.memoryPolicy().pageMemory() instanceof PageMemoryEx;
+ assert grp.dataRegion().pageMemory() instanceof PageMemoryEx;
reuseList.saveMetadata();
@@ -185,7 +185,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
int size = store.fullSize();
long rmvId = globalRemoveId().get();
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = this.ctx.wal();
if (size > 0 || updCntr > 0) {
@@ -437,7 +437,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
saveStoreMetadata(store, null, false, true);
- PageMemoryEx pageMemory = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMemory = (PageMemoryEx)grp.dataRegion().pageMemory();
int tag = pageMemory.invalidate(grp.groupId(), p);
@@ -511,7 +511,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
* @throws IgniteCheckedException If failed.
*/
private Metas getOrAllocateCacheMetas() throws IgniteCheckedException {
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = ctx.wal();
int grpId = grp.groupId();
@@ -915,8 +915,8 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
freeList = new FreeListImpl(
grp.groupId(),
grp.cacheOrGroupName() + "-" + partId,
- grp.memoryPolicy().memoryMetrics(),
- grp.memoryPolicy(),
+ grp.dataRegion().memoryMetrics(),
+ grp.dataRegion(),
null,
ctx.wal(),
reuseRoot.pageId().pageId(),
@@ -942,7 +942,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
}
};
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
delegate0 = new CacheDataStoreImpl(partId, name, rowStore, dataTree);
@@ -1036,7 +1036,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
* @return Partition metas.
*/
private Metas getOrAllocatePartitionMetas() throws IgniteCheckedException {
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = ctx.wal();
int grpId = grp.groupId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index d7682f0..da598d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -25,14 +25,14 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.configuration.DataPageEvictionMode;
+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.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
@@ -57,24 +57,24 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseL
import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteOutClosure;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_INITIAL_SIZE;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_PAGE_SIZE;
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE;
/**
*
*/
public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdapter
implements IgniteChangeGlobalStateSupport, CheckpointLockStateChecker {
- /** MemoryPolicyConfiguration name reserved for internal caches. */
- static final String SYSTEM_MEMORY_POLICY_NAME = "sysMemPlc";
+ /** DataRegionConfiguration name reserved for internal caches. */
+ static final String SYSTEM_DATA_REGION_NAME = "sysMemPlc";
/** Minimum size of memory chunk */
private static final long MIN_PAGE_MEMORY_SIZE = 10 * 1024 * 1024;
@@ -83,16 +83,16 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
private static final long MAX_PAGE_MEMORY_INIT_SIZE_32_BIT = 2L * 1024 * 1024 * 1024;
/** */
- protected Map<String, MemoryPolicy> memPlcMap;
+ protected Map<String, DataRegion> dataRegionMap;
/** */
- protected Map<String, MemoryMetrics> memMetricsMap;
+ protected Map<String, DataRegionMetrics> memMetricsMap;
/** */
- protected MemoryPolicy dfltMemPlc;
+ protected DataRegion dfltDataRegion;
/** */
- private Map<String, FreeListImpl> freeListMap;
+ protected Map<String, FreeListImpl> freeListMap;
/** */
private FreeListImpl dfltFreeList;
@@ -102,10 +102,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override protected void start0() throws IgniteCheckedException {
- if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
+ if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null)
return;
- MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
assert memCfg != null;
@@ -115,7 +115,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * Registers MBeans for all MemoryMetrics configured in this instance.
+ * Registers MBeans for all DataRegionMetrics configured in this instance.
*/
private void registerMetricsMBeans() {
if(U.IGNITE_MBEANS_DISABLED)
@@ -123,21 +123,21 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
IgniteConfiguration cfg = cctx.gridConfig();
- for (MemoryMetrics memMetrics : memMetricsMap.values()) {
- MemoryPolicyConfiguration memPlcCfg = memPlcMap.get(memMetrics.getName()).config();
+ for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
+ DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
- registerMetricsMBean((MemoryMetricsImpl)memMetrics, memPlcCfg, cfg);
+ registerMetricsMBean((DataRegionMetricsImpl)memMetrics, memPlcCfg, cfg);
}
}
/**
* @param memMetrics Memory metrics.
- * @param memPlcCfg Memory policy configuration.
+ * @param dataRegionCfg Data region configuration.
* @param cfg Ignite configuration.
*/
private void registerMetricsMBean(
- MemoryMetricsImpl memMetrics,
- MemoryPolicyConfiguration memPlcCfg,
+ DataRegionMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegionCfg,
IgniteConfiguration cfg
) {
assert !U.IGNITE_MBEANS_DISABLED;
@@ -146,13 +146,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
U.registerMBean(
cfg.getMBeanServer(),
cfg.getIgniteInstanceName(),
- "MemoryMetrics",
- memPlcCfg.getName(),
- new MemoryMetricsMXBeanImpl(memMetrics, memPlcCfg),
- MemoryMetricsMXBean.class);
+ "DataRegionMetrics",
+ dataRegionCfg.getName(),
+ new DataRegionMetricsMXBeanImpl(memMetrics, dataRegionCfg),
+ DataRegionMetricsMXBean.class);
}
catch (Throwable e) {
- U.error(log, "Failed to register MBean for MemoryMetrics with name: '" + memMetrics.getName() + "'", e);
+ U.error(log, "Failed to register MBean for DataRegionMetrics with name: '" + memMetrics.getName() + "'", e);
}
}
@@ -160,22 +160,24 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param dbCfg Database config.
* @throws IgniteCheckedException If failed.
*/
- protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
- freeListMap = U.newHashMap(memPlcMap.size());
+ protected void initPageMemoryDataStructures(DataStorageConfiguration dbCfg) throws IgniteCheckedException {
+ freeListMap = U.newHashMap(dataRegionMap.size());
- String dfltMemPlcName = dbCfg.getDefaultMemoryPolicyName();
+ String dfltMemPlcName = dbCfg.getDefaultDataRegionConfiguration().getName();
- for (MemoryPolicy memPlc : memPlcMap.values()) {
- MemoryPolicyConfiguration memPlcCfg = memPlc.config();
+ for (DataRegion memPlc : dataRegionMap.values()) {
+ DataRegionConfiguration memPlcCfg = memPlc.config();
- MemoryMetricsImpl memMetrics = (MemoryMetricsImpl) memMetricsMap.get(memPlcCfg.getName());
+ DataRegionMetricsImpl memMetrics = (DataRegionMetricsImpl) memMetricsMap.get(memPlcCfg.getName());
+
+ boolean persistenceEnabled = memPlcCfg.isPersistenceEnabled();
FreeListImpl freeList = new FreeListImpl(0,
cctx.igniteInstanceName(),
memMetrics,
memPlc,
null,
- cctx.wal(),
+ persistenceEnabled ? cctx.wal() : null,
0L,
true);
@@ -196,7 +198,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
*/
private void startMemoryPolicies() {
- for (MemoryPolicy memPlc : memPlcMap.values()) {
+ for (DataRegion memPlc : dataRegionMap.values()) {
memPlc.pageMemory().start();
memPlc.evictionTracker().start();
@@ -207,102 +209,81 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param memCfg Database config.
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- protected void initPageMemoryPolicies(MemoryConfiguration memCfg) throws IgniteCheckedException {
- MemoryPolicyConfiguration[] memPlcsCfgs = memCfg.getMemoryPolicies();
-
- if (memPlcsCfgs == null) {
- //reserve place for default and system memory policies
- memPlcMap = U.newHashMap(2);
- memMetricsMap = U.newHashMap(2);
-
- addMemoryPolicy(
- memCfg,
- memCfg.createDefaultPolicyConfig(),
- DFLT_MEM_PLC_DEFAULT_NAME
- );
-
- U.warn(log, "No user-defined default MemoryPolicy found; system default of 1GB size will be used.");
- }
- else {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
-
- if (DFLT_MEM_PLC_DEFAULT_NAME.equals(dfltMemPlcName) && !hasCustomDefaultMemoryPolicy(memPlcsCfgs)) {
- //reserve additional place for default and system memory policies
- memPlcMap = U.newHashMap(memPlcsCfgs.length + 2);
- memMetricsMap = U.newHashMap(memPlcsCfgs.length + 2);
+ protected void initDataRegions(DataStorageConfiguration memCfg) throws IgniteCheckedException {
+ DataRegionConfiguration[] dataRegionCfgs = memCfg.getDataRegionConfigurations();
- addMemoryPolicy(
- memCfg,
- memCfg.createDefaultPolicyConfig(),
- DFLT_MEM_PLC_DEFAULT_NAME
- );
+ int dataRegions = dataRegionCfgs == null ? 0 : dataRegionCfgs.length;
- U.warn(log, "No user-defined default MemoryPolicy found; system default of 1GB size will be used.");
- }
- else {
- //reserve additional space for system memory policy only
- memPlcMap = U.newHashMap(memPlcsCfgs.length + 1);
- memMetricsMap = U.newHashMap(memPlcsCfgs.length + 1);
- }
+ dataRegionMap = U.newHashMap(2 + dataRegions);
+ memMetricsMap = U.newHashMap(2 + dataRegions);
- for (MemoryPolicyConfiguration memPlcCfg : memPlcsCfgs)
- addMemoryPolicy(memCfg, memPlcCfg, memPlcCfg.getName());
+ if (dataRegionCfgs != null) {
+ for (DataRegionConfiguration dataRegionCfg : dataRegionCfgs)
+ addDataRegion(memCfg, dataRegionCfg, dataRegionCfg.getName());
}
- addMemoryPolicy(
+ addDataRegion(
+ memCfg,
+ memCfg.getDefaultDataRegionConfiguration(),
+ memCfg.getDefaultDataRegionConfiguration().getName()
+ );
+
+ addDataRegion(
memCfg,
- createSystemMemoryPolicy(
- memCfg.getSystemCacheInitialSize(),
- memCfg.getSystemCacheMaxSize()
+ createSystemDataRegion(
+ memCfg.getSystemRegionInitialSize(),
+ memCfg.getSystemRegionMaxSize()
),
- SYSTEM_MEMORY_POLICY_NAME
+ SYSTEM_DATA_REGION_NAME
);
}
/**
- * @param memCfg Database config.
- * @param memPlcCfg Memory policy config.
- * @param memPlcName Memory policy name.
+ * @param dataStorageCfg Database config.
+ * @param dataRegionCfg Data region config.
+ * @param dataRegionName Data region name.
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- private void addMemoryPolicy(
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration memPlcCfg,
- String memPlcName
+ private void addDataRegion(
+ DataStorageConfiguration dataStorageCfg,
+ DataRegionConfiguration dataRegionCfg,
+ String dataRegionName
) throws IgniteCheckedException {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
+ String dfltMemPlcName = dataStorageCfg.getDefaultDataRegionConfiguration().getName();
if (dfltMemPlcName == null)
- dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME;
+ dfltMemPlcName = DFLT_DATA_REG_DEFAULT_NAME;
- MemoryMetricsImpl memMetrics = new MemoryMetricsImpl(memPlcCfg, fillFactorProvider(memPlcName));
+ DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(dataRegionCfg, fillFactorProvider(dataRegionCfg));
- MemoryPolicy memPlc = initMemory(memCfg, memPlcCfg, memMetrics);
+ DataRegion memPlc = initMemory(dataStorageCfg, dataRegionCfg, memMetrics);
- memPlcMap.put(memPlcName, memPlc);
+ dataRegionMap.put(dataRegionName, memPlc);
- memMetricsMap.put(memPlcName, memMetrics);
+ memMetricsMap.put(dataRegionName, memMetrics);
- if (memPlcName.equals(dfltMemPlcName))
- dfltMemPlc = memPlc;
- else if (memPlcName.equals(DFLT_MEM_PLC_DEFAULT_NAME))
- U.warn(log, "Memory Policy with name 'default' isn't used as a default. " +
+ if (dataRegionName.equals(dfltMemPlcName))
+ dfltDataRegion = memPlc;
+ else if (dataRegionName.equals(DFLT_DATA_REG_DEFAULT_NAME))
+ U.warn(log, "Data Region with name 'default' isn't used as a default. " +
"Please check Memory Policies configuration.");
}
/**
- * Closure that can be used to compute fill factor for provided memory policy.
+ * Closure that can be used to compute fill factor for provided data region.
*
- * @param memPlcName Memory policy name.
+ * @param dataRegCfg Data region configuration.
* @return Closure.
*/
- protected IgniteOutClosure<Float> fillFactorProvider(final String memPlcName) {
+ protected IgniteOutClosure<Float> fillFactorProvider(final DataRegionConfiguration dataRegCfg) {
+ final String dataRegName = dataRegCfg.getName();
+
return new IgniteOutClosure<Float>() {
private FreeListImpl freeList;
@Override public Float apply() {
if (freeList == null) {
- FreeListImpl freeList0 = freeListMap.get(memPlcName);
+ FreeListImpl freeList0 = freeListMap.get(dataRegName);
if (freeList0 == null)
return (float) 0;
@@ -321,11 +302,11 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcsCfgs User-defined memory policy configurations.
+ * @param memPlcsCfgs User-defined data region configurations.
*/
- private boolean hasCustomDefaultMemoryPolicy(MemoryPolicyConfiguration[] memPlcsCfgs) {
- for (MemoryPolicyConfiguration memPlcsCfg : memPlcsCfgs) {
- if (DFLT_MEM_PLC_DEFAULT_NAME.equals(memPlcsCfg.getName()))
+ private boolean hasCustomDefaultDataRegion(DataRegionConfiguration[] memPlcsCfgs) {
+ for (DataRegionConfiguration memPlcsCfg : memPlcsCfgs) {
+ if (DFLT_DATA_REG_DEFAULT_NAME.equals(memPlcsCfg.getName()))
return true;
}
@@ -336,12 +317,12 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param sysCacheInitSize Initial size of PageMemory to be created for system cache.
* @param sysCacheMaxSize Maximum size of PageMemory to be created for system cache.
*
- * @return {@link MemoryPolicyConfiguration configuration} of MemoryPolicy for system cache.
+ * @return {@link DataRegionConfiguration configuration} of DataRegion for system cache.
*/
- private MemoryPolicyConfiguration createSystemMemoryPolicy(long sysCacheInitSize, long sysCacheMaxSize) {
- MemoryPolicyConfiguration res = new MemoryPolicyConfiguration();
+ private DataRegionConfiguration createSystemDataRegion(long sysCacheInitSize, long sysCacheMaxSize) {
+ DataRegionConfiguration res = new DataRegionConfiguration();
- res.setName(SYSTEM_MEMORY_POLICY_NAME);
+ res.setName(SYSTEM_DATA_REGION_NAME);
res.setInitialSize(sysCacheInitSize);
res.setMaxSize(sysCacheMaxSize);
@@ -351,71 +332,76 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param memCfg configuration to validate.
*/
- private void validateConfiguration(MemoryConfiguration memCfg) throws IgniteCheckedException {
+ private void validateConfiguration(DataStorageConfiguration memCfg) throws IgniteCheckedException {
checkPageSize(memCfg);
- MemoryPolicyConfiguration[] plcCfgs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] regCfgs = memCfg.getDataRegionConfigurations();
- Set<String> plcNames = (plcCfgs != null) ? U.<String>newHashSet(plcCfgs.length) : new HashSet<String>(0);
+ Set<String> regNames = (regCfgs != null) ? U.<String>newHashSet(regCfgs.length) : new HashSet<String>(0);
- checkSystemMemoryPolicySizeConfiguration(
- memCfg.getSystemCacheInitialSize(),
- memCfg.getSystemCacheMaxSize()
+ checkSystemDataRegionSizeConfiguration(
+ memCfg.getSystemRegionInitialSize(),
+ memCfg.getSystemRegionMaxSize()
);
- if (plcCfgs != null) {
- for (MemoryPolicyConfiguration plcCfg : plcCfgs) {
- assert plcCfg != null;
+ if (regCfgs != null) {
+ for (DataRegionConfiguration regCfg : regCfgs)
+ checkDataRegionConfiguration(memCfg, regNames, regCfg);
+ }
+
+ checkDataRegionConfiguration(memCfg, regNames, memCfg.getDefaultDataRegionConfiguration());
+ }
- checkPolicyName(plcCfg.getName(), plcNames);
+ /**
+ * @param memCfg Mem config.
+ * @param regNames Region names.
+ * @param regCfg Reg config.
+ */
+ private void checkDataRegionConfiguration(DataStorageConfiguration memCfg, Set<String> regNames,
+ DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ assert regCfg != null;
- checkPolicySize(plcCfg);
+ checkDataRegionName(regCfg.getName(), regNames);
- checkMetricsProperties(plcCfg);
+ checkDataRegionSize(regCfg);
- checkPolicyEvictionProperties(plcCfg, memCfg);
- }
- }
+ checkMetricsProperties(regCfg);
- checkDefaultPolicyConfiguration(
- memCfg.getDefaultMemoryPolicyName(),
- memCfg.getDefaultMemoryPolicySize(),
- plcNames
- );
+ checkRegionEvictionProperties(regCfg, memCfg);
}
/**
* @param memCfg Memory config.
*/
- protected void checkPageSize(MemoryConfiguration memCfg) {
+ protected void checkPageSize(DataStorageConfiguration memCfg) {
if (memCfg.getPageSize() == 0)
memCfg.setPageSize(DFLT_PAGE_SIZE);
}
/**
- * @param plcCfg Memory policy config.
+ * @param regCfg data region config.
*
* @throws IgniteCheckedException if validation of memory metrics properties fails.
*/
- private static void checkMetricsProperties(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException {
- if (plcCfg.getRateTimeInterval() <= 0)
+ private static void checkMetricsProperties(DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ if (regCfg.getMetricsRateTimeInterval() <= 0)
throw new IgniteCheckedException("Rate time interval must be greater than zero " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval) " +
- "[name=" + plcCfg.getName() +
- ", rateTimeInterval=" + plcCfg.getRateTimeInterval() + "]"
+ "(use DataRegionConfiguration.rateTimeInterval property to adjust the interval) " +
+ "[name=" + regCfg.getName() +
+ ", rateTimeInterval=" + regCfg.getMetricsRateTimeInterval() + "]"
);
- if (plcCfg.getSubIntervals() <= 0)
+ if (regCfg.getMetricsSubIntervalCount() <= 0)
throw new IgniteCheckedException("Sub intervals must be greater than zero " +
- "(use MemoryPolicyConfiguration.subIntervals property to adjust the sub intervals) " +
- "[name=" + plcCfg.getName() +
- ", subIntervals=" + plcCfg.getSubIntervals() + "]"
+ "(use DataRegionConfiguration.subIntervals property to adjust the sub intervals) " +
+ "[name=" + regCfg.getName() +
+ ", subIntervals=" + regCfg.getMetricsSubIntervalCount() + "]"
);
- if (plcCfg.getRateTimeInterval() < 1_000)
+ if (regCfg.getMetricsRateTimeInterval() < 1_000)
throw new IgniteCheckedException("Rate time interval must be longer that 1 second (1_000 milliseconds) " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval) " +
- "[name=" + plcCfg.getName() +
- ", rateTimeInterval=" + plcCfg.getRateTimeInterval() + "]");
+ "(use DataRegionConfiguration.rateTimeInterval property to adjust the interval) " +
+ "[name=" + regCfg.getName() +
+ ", rateTimeInterval=" + regCfg.getMetricsRateTimeInterval() + "]");
}
/**
@@ -424,19 +410,19 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
* @throws IgniteCheckedException In case of validation violation.
*/
- private static void checkSystemMemoryPolicySizeConfiguration(
+ private static void checkSystemDataRegionSizeConfiguration(
long sysCacheInitSize,
long sysCacheMaxSize
) throws IgniteCheckedException {
if (sysCacheInitSize < MIN_PAGE_MEMORY_SIZE)
throw new IgniteCheckedException("Initial size for system cache must have size more than 10MB (use " +
- "MemoryConfiguration.systemCacheInitialSize property to set correct size in bytes) " +
+ "DataStorageConfiguration.systemCacheInitialSize property to set correct size in bytes) " +
"[size=" + U.readableSize(sysCacheInitSize, true) + ']'
);
if (U.jvm32Bit() && sysCacheInitSize > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
throw new IgniteCheckedException("Initial size for system cache exceeds 2GB on 32-bit JVM (use " +
- "MemoryPolicyConfiguration.systemCacheInitialSize property to set correct size in bytes " +
+ "DataRegionConfiguration.systemCacheInitialSize property to set correct size in bytes " +
"or use 64-bit JVM) [size=" + U.readableSize(sysCacheInitSize, true) + ']'
);
@@ -444,138 +430,90 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
throw new IgniteCheckedException("MaxSize of system cache must not be smaller than " +
"initialSize [initSize=" + U.readableSize(sysCacheInitSize, true) +
", maxSize=" + U.readableSize(sysCacheMaxSize, true) + "]. " +
- "Use MemoryConfiguration.systemCacheInitialSize/MemoryConfiguration.systemCacheMaxSize " +
+ "Use DataStorageConfiguration.systemCacheInitialSize/DataStorageConfiguration.systemCacheMaxSize " +
"properties to set correct sizes in bytes."
);
}
/**
- * @param dfltPlcName Default MemoryPolicy name.
- * @param dfltPlcSize Default size of MemoryPolicy overridden by user (equals to -1 if wasn't specified by user).
- * @param plcNames All MemoryPolicy names.
- * @throws IgniteCheckedException In case of validation violation.
- */
- private static void checkDefaultPolicyConfiguration(
- String dfltPlcName,
- long dfltPlcSize,
- Collection<String> plcNames
- ) throws IgniteCheckedException {
- if (dfltPlcSize != MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE) {
- if (!F.eq(dfltPlcName, MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME))
- throw new IgniteCheckedException("User-defined MemoryPolicy configuration " +
- "and defaultMemoryPolicySize properties are set at the same time. " +
- "Delete either MemoryConfiguration.defaultMemoryPolicySize property " +
- "or user-defined default MemoryPolicy configuration");
-
- if (dfltPlcSize < MIN_PAGE_MEMORY_SIZE)
- throw new IgniteCheckedException("User-defined default MemoryPolicy size is less than 1MB. " +
- "Use MemoryConfiguration.defaultMemoryPolicySize property to set correct size.");
-
- if (U.jvm32Bit() && dfltPlcSize > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
- throw new IgniteCheckedException("User-defined default MemoryPolicy size exceeds 2GB on 32-bit JVM " +
- "(use MemoryConfiguration.defaultMemoryPolicySize property to set correct size in bytes " +
- "or use 64-bit JVM) [size=" + U.readableSize(dfltPlcSize, true) + ']'
- );
- }
-
- if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(dfltPlcName)) {
- if (dfltPlcName.isEmpty())
- throw new IgniteCheckedException("User-defined default MemoryPolicy name must be non-empty");
-
- if (!plcNames.contains(dfltPlcName))
- throw new IgniteCheckedException("User-defined default MemoryPolicy name " +
- "must be presented among configured MemoryPolices: " + dfltPlcName);
- }
- }
-
- /**
- * @param plcCfg MemoryPolicyConfiguration to validate.
+ * @param regCfg DataRegionConfiguration to validate.
* @throws IgniteCheckedException If config is invalid.
*/
- private void checkPolicySize(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException {
- boolean dfltInitSize = false;
-
- if (plcCfg.getInitialSize() == 0) {
- plcCfg.setInitialSize(DFLT_MEMORY_POLICY_INITIAL_SIZE);
-
- dfltInitSize = true;
- }
-
- if (plcCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE)
- throw new IgniteCheckedException("MemoryPolicy must have size more than 10MB (use " +
- "MemoryPolicyConfiguration.initialSize property to set correct size in bytes) " +
- "[name=" + plcCfg.getName() + ", size=" + U.readableSize(plcCfg.getInitialSize(), true) + "]"
+ private void checkDataRegionSize(DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ if (regCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE || regCfg.getMaxSize() < MIN_PAGE_MEMORY_SIZE)
+ throw new IgniteCheckedException("DataRegion must have size more than 10MB (use " +
+ "DataRegionConfiguration.initialSize and .maxSize properties to set correct size in bytes) " +
+ "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) +
+ ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]"
);
- if (plcCfg.getMaxSize() < plcCfg.getInitialSize()) {
- // If initial size was not set, use the max size.
- if (dfltInitSize) {
- plcCfg.setInitialSize(plcCfg.getMaxSize());
-
- LT.warn(log, "MemoryPolicy maxSize=" + U.readableSize(plcCfg.getMaxSize(), true) +
- " is smaller than defaultInitialSize=" +
- U.readableSize(MemoryConfiguration.DFLT_MEMORY_POLICY_INITIAL_SIZE, true) +
- ", setting initialSize to " + U.readableSize(plcCfg.getMaxSize(), true));
- }
- else {
- throw new IgniteCheckedException("MemoryPolicy maxSize must not be smaller than " +
- "initialSize [name=" + plcCfg.getName() +
- ", initSize=" + U.readableSize(plcCfg.getInitialSize(), true) +
- ", maxSize=" + U.readableSize(plcCfg.getMaxSize(), true) + ']');
+ if (regCfg.getMaxSize() < regCfg.getInitialSize()) {
+ if (regCfg.getInitialSize() != Math.min(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE,
+ DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)) {
+ throw new IgniteCheckedException("DataRegion maxSize must not be smaller than initialSize" +
+ "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) +
+ ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]");
}
+
+ regCfg.setInitialSize(regCfg.getMaxSize());
+
+ LT.warn(log, "DataRegion maxSize=" + U.readableSize(regCfg.getMaxSize(), true) +
+ " is smaller than defaultInitialSize=" +
+ U.readableSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE, true) +
+ ", setting initialSize to " + U.readableSize(regCfg.getMaxSize(), true));
}
- if (U.jvm32Bit() && plcCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
- throw new IgniteCheckedException("MemoryPolicy initialSize exceeds 2GB on 32-bit JVM (use " +
- "MemoryPolicyConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " +
- "[name=" + plcCfg.getName() +
- ", size=" + U.readableSize(plcCfg.getInitialSize(), true) + "]");
+ if (U.jvm32Bit() && regCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
+ throw new IgniteCheckedException("DataRegion initialSize exceeds 2GB on 32-bit JVM (use " +
+ "DataRegionConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " +
+ "[name=" + regCfg.getName() +
+ ", size=" + U.readableSize(regCfg.getInitialSize(), true) + "]");
}
/**
- * @param plcCfg MemoryPolicyConfiguration to validate.
+ * @param regCfg DataRegionConfiguration to validate.
* @param dbCfg Memory configuration.
* @throws IgniteCheckedException If config is invalid.
*/
- protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)
+ protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg)
throws IgniteCheckedException {
- if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
+ if (regCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
return;
- if (plcCfg.getEvictionThreshold() < 0.5 || plcCfg.getEvictionThreshold() > 0.999) {
+ if (regCfg.getEvictionThreshold() < 0.5 || regCfg.getEvictionThreshold() > 0.999) {
throw new IgniteCheckedException("Page eviction threshold must be between 0.5 and 0.999: " +
- plcCfg.getName());
+ regCfg.getName());
}
- if (plcCfg.getEmptyPagesPoolSize() <= 10)
- throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + plcCfg.getName());
+ if (regCfg.getEmptyPagesPoolSize() <= 10)
+ throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + regCfg.getName());
- long maxPoolSize = plcCfg.getMaxSize() / dbCfg.getPageSize() / 10;
+ long maxPoolSize = regCfg.getMaxSize() / dbCfg.getPageSize() / 10;
- if (plcCfg.getEmptyPagesPoolSize() >= maxPoolSize) {
+ if (regCfg.getEmptyPagesPoolSize() >= maxPoolSize) {
throw new IgniteCheckedException("Evicted pages pool size should be lesser than " + maxPoolSize +
- ": " + plcCfg.getName());
+ ": " + regCfg.getName());
}
}
/**
- * @param plcName MemoryPolicy name to validate.
+ * @param regName DataRegion name to validate.
* @param observedNames Names of MemoryPolicies observed before.
* @throws IgniteCheckedException If config is invalid.
*/
- private static void checkPolicyName(String plcName, Collection<String> observedNames)
+ private static void checkDataRegionName(String regName, Collection<String> observedNames)
throws IgniteCheckedException {
- if (plcName == null || plcName.isEmpty())
- throw new IgniteCheckedException("User-defined MemoryPolicyConfiguration must have non-null and " +
+ if (regName == null || regName.isEmpty())
+ throw new IgniteCheckedException("User-defined DataRegionConfiguration must have non-null and " +
"non-empty name.");
- if (observedNames.contains(plcName))
- throw new IgniteCheckedException("Two MemoryPolicies have the same name: " + plcName);
+ if (observedNames.contains(regName))
+ throw new IgniteCheckedException("Two MemoryPolicies have the same name: " + regName);
- if (SYSTEM_MEMORY_POLICY_NAME.equals(plcName))
- throw new IgniteCheckedException("'sysMemPlc' policy name is reserved for internal use.");
+ if (SYSTEM_DATA_REGION_NAME.equals(regName))
+ throw new IgniteCheckedException("'" + SYSTEM_DATA_REGION_NAME + "' policy name is reserved for internal use.");
- observedNames.add(plcName);
+ observedNames.add(regName);
}
/**
@@ -589,22 +527,22 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return collection of all configured {@link MemoryPolicy policies}.
+ * @return collection of all configured {@link DataRegion policies}.
*/
- public Collection<MemoryPolicy> memoryPolicies() {
- return memPlcMap != null ? memPlcMap.values() : null;
+ public Collection<DataRegion> dataRegions() {
+ return dataRegionMap != null ? dataRegionMap.values() : null;
}
/**
- * @return MemoryMetrics for all MemoryPolicies configured in Ignite instance.
+ * @return DataRegionMetrics for all MemoryPolicies configured in Ignite instance.
*/
- public Collection<MemoryMetrics> memoryMetrics() {
+ public Collection<DataRegionMetrics> memoryMetrics() {
if (!F.isEmpty(memMetricsMap)) {
// Intentionally return a collection copy to make it explicitly serializable.
- Collection<MemoryMetrics> res = new ArrayList<>(memMetricsMap.size());
+ Collection<DataRegionMetrics> res = new ArrayList<>(memMetricsMap.size());
- for (MemoryMetrics metrics : memMetricsMap.values())
- res.add(new MemoryMetricsSnapshot(metrics));
+ for (DataRegionMetrics metrics : memMetricsMap.values())
+ res.add(new DataRegionMetricsSnapshot(metrics));
return res;
}
@@ -613,9 +551,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return PersistenceMetrics if persistence is enabled or {@code null} otherwise.
+ * @return DataStorageMetrics if persistence is enabled or {@code null} otherwise.
*/
- public PersistenceMetrics persistentStoreMetrics() {
+ public DataStorageMetrics persistentStoreMetrics() {
return null;
}
@@ -628,46 +566,46 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcName Name of {@link MemoryPolicy} to obtain {@link MemoryMetrics} for.
- * @return {@link MemoryMetrics} snapshot for specified {@link MemoryPolicy} or {@code null} if
- * no {@link MemoryPolicy} is configured for specified name.
+ * @param memPlcName Name of {@link DataRegion} to obtain {@link DataRegionMetrics} for.
+ * @return {@link DataRegionMetrics} snapshot for specified {@link DataRegion} or {@code null} if
+ * no {@link DataRegion} is configured for specified name.
*/
- @Nullable public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable public DataRegionMetrics memoryMetrics(String memPlcName) {
if (!F.isEmpty(memMetricsMap)) {
- MemoryMetrics memMetrics = memMetricsMap.get(memPlcName);
+ DataRegionMetrics memMetrics = memMetricsMap.get(memPlcName);
if (memMetrics == null)
return null;
else
- return new MemoryMetricsSnapshot(memMetrics);
+ return new DataRegionMetricsSnapshot(memMetrics);
}
else
return null;
}
/**
- * @param memPlcName Memory policy name.
- * @return {@link MemoryPolicy} instance associated with a given {@link MemoryPolicyConfiguration}.
- * @throws IgniteCheckedException in case of request for unknown MemoryPolicy.
+ * @param memPlcName data region name.
+ * @return {@link DataRegion} instance associated with a given {@link DataRegionConfiguration}.
+ * @throws IgniteCheckedException in case of request for unknown DataRegion.
*/
- public MemoryPolicy memoryPolicy(String memPlcName) throws IgniteCheckedException {
+ public DataRegion dataRegion(String memPlcName) throws IgniteCheckedException {
if (memPlcName == null)
- return dfltMemPlc;
+ return dfltDataRegion;
- if (memPlcMap == null)
+ if (dataRegionMap == null)
return null;
- MemoryPolicy plc;
+ DataRegion plc;
- if ((plc = memPlcMap.get(memPlcName)) == null)
- throw new IgniteCheckedException("Requested MemoryPolicy is not configured: " + memPlcName);
+ if ((plc = dataRegionMap.get(memPlcName)) == null)
+ throw new IgniteCheckedException("Requested DataRegion is not configured: " + memPlcName);
return plc;
}
/**
- * @param memPlcName MemoryPolicyConfiguration name.
- * @return {@link FreeList} instance associated with a given {@link MemoryPolicyConfiguration}.
+ * @param memPlcName DataRegionConfiguration name.
+ * @return {@link FreeList} instance associated with a given {@link DataRegionConfiguration}.
*/
public FreeList freeList(String memPlcName) {
if (memPlcName == null)
@@ -677,8 +615,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcName MemoryPolicyConfiguration name.
- * @return {@link ReuseList} instance associated with a given {@link MemoryPolicyConfiguration}.
+ * @param memPlcName DataRegionConfiguration name.
+ * @return {@link ReuseList} instance associated with a given {@link DataRegionConfiguration}.
*/
public ReuseList reuseList(String memPlcName) {
if (memPlcName == null)
@@ -689,8 +627,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override protected void stop0(boolean cancel) {
- if (memPlcMap != null) {
- for (MemoryPolicy memPlc : memPlcMap.values()) {
+ if (dataRegionMap != null) {
+ for (DataRegion memPlc : dataRegionMap.values()) {
memPlc.pageMemory().stop();
memPlc.evictionTracker().stop();
@@ -698,9 +636,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
unregisterMBean(memPlc.memoryMetrics().getName());
}
- memPlcMap.clear();
+ dataRegionMap.clear();
- memPlcMap = null;
+ dataRegionMap = null;
}
}
@@ -718,7 +656,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
cfg.getMBeanServer().unregisterMBean(
U.makeMBeanName(
cfg.getIgniteInstanceName(),
- "MemoryMetrics", name
+ "DataRegionMetrics", name
));
}
catch (Throwable e) {
@@ -848,13 +786,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* See {@link GridCacheMapEntry#ensureFreeSpace()}
*
- * @param memPlc Memory policy.
+ * @param memPlc data region.
*/
- public void ensureFreeSpace(MemoryPolicy memPlc) throws IgniteCheckedException {
+ public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException {
if (memPlc == null)
return;
- MemoryPolicyConfiguration plcCfg = memPlc.config();
+ DataRegionConfiguration plcCfg = memPlc.config();
if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
return;
@@ -884,16 +822,16 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param memCfg memory configuration with common parameters.
- * @param plcCfg memory policy with PageMemory specific parameters.
- * @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
- * @return Memory policy instance.
+ * @param plcCfg data region with PageMemory specific parameters.
+ * @param memMetrics {@link DataRegionMetrics} object to collect memory usage metrics.
+ * @return data region instance.
*
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- private MemoryPolicy initMemory(
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration plcCfg,
- MemoryMetricsImpl memMetrics
+ private DataRegion initMemory(
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration plcCfg,
+ DataRegionMetricsImpl memMetrics
) throws IgniteCheckedException {
File allocPath = buildAllocPath(plcCfg);
@@ -905,15 +843,15 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
- return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
+ return new DataRegion(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
/**
- * @param plc Memory Policy Configuration.
+ * @param plc data region Configuration.
* @param pageMem Page memory.
*/
- private PageEvictionTracker createPageEvictionTracker(MemoryPolicyConfiguration plc, PageMemory pageMem) {
- if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED || cctx.gridConfig().isPersistentStoreEnabled())
+ private PageEvictionTracker createPageEvictionTracker(DataRegionConfiguration plc, PageMemory pageMem) {
+ if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED || CU.isPersistenceEnabled(cctx.gridConfig()))
return new NoOpPageEvictionTracker();
assert pageMem instanceof PageMemoryNoStoreImpl : pageMem.getClass();
@@ -936,12 +874,12 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* Builds allocation path for memory mapped file to be used with PageMemory.
*
- * @param plc MemoryPolicyConfiguration.
+ * @param plc DataRegionConfiguration.
*
* @throws IgniteCheckedException If resolving swap directory fails.
*/
- @Nullable private File buildAllocPath(MemoryPolicyConfiguration plc) throws IgniteCheckedException {
- String path = plc.getSwapFilePath();
+ @Nullable private File buildAllocPath(DataRegionConfiguration plc) throws IgniteCheckedException {
+ String path = plc.getSwapPath();
if (path == null)
return null;
@@ -962,15 +900,15 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
* @param memProvider Memory provider.
* @param memCfg Memory configuartion.
- * @param memPlcCfg Memory policy configuration.
- * @param memMetrics MemoryMetrics to collect memory usage metrics.
+ * @param memPlcCfg data region configuration.
+ * @param memMetrics DataRegionMetrics to collect memory usage metrics.
* @return PageMemory instance.
*/
protected PageMemory createPageMemory(
DirectMemoryProvider memProvider,
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration memPlcCfg,
- MemoryMetricsImpl memMetrics
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration memPlcCfg,
+ DataRegionMetricsImpl memMetrics
) {
memMetrics.persistenceEnabled(false);
@@ -1003,14 +941,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
- if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
+ if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null)
return;
- MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
assert memCfg != null;
- initPageMemoryPolicies(memCfg);
+ initDataRegions(memCfg);
registerMetricsMBeans();
@@ -1025,10 +963,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return Name of MemoryPolicyConfiguration for internal caches.
+ * @return Name of DataRegionConfiguration for internal caches.
*/
- public String systemMemoryPolicyName() {
- return SYSTEM_MEMORY_POLICY_NAME;
+ public String systemDateRegionName() {
+ return SYSTEM_DATA_REGION_NAME;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
deleted file mode 100644
index 3261874..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
+++ /dev/null
@@ -1,286 +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.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteOutClosure;
-import org.jetbrains.annotations.Nullable;
-import org.jsr166.LongAdder8;
-
-/**
- *
- */
-public class MemoryMetricsImpl implements MemoryMetrics {
- /** */
- private final IgniteOutClosure<Float> fillFactorProvider;
-
- /** */
- private final LongAdder8 totalAllocatedPages = new LongAdder8();
-
- /**
- * Counter for number of pages occupied by large entries (one entry is larger than one page).
- */
- private final LongAdder8 largeEntriesPages = new LongAdder8();
-
- /** Counter for number of dirty pages. */
- private LongAdder8 dirtyPages = new LongAdder8();
-
- /** */
- private volatile boolean metricsEnabled;
-
- /** */
- private boolean persistenceEnabled;
-
- /** */
- private volatile int subInts;
-
- /** Allocation rate calculator. */
- private volatile HitRateMetrics allocRate = new HitRateMetrics(60_000, 5);
-
- /** */
- private volatile HitRateMetrics pageReplaceRate = new HitRateMetrics(60_000, 5);
-
- /** */
- private final MemoryPolicyConfiguration memPlcCfg;
-
- /** */
- private PageMemory pageMem;
-
- /** Time interval (in milliseconds) when allocations/evictions are counted to calculate rate. */
- private volatile long rateTimeInterval;
-
- /**
- * @param memPlcCfg MemoryPolicyConfiguration.
- */
- public MemoryMetricsImpl(MemoryPolicyConfiguration memPlcCfg) {
- this(memPlcCfg, null);
- }
-
- /**
- * @param memPlcCfg MemoryPolicyConfiguration.
- */
- public MemoryMetricsImpl(MemoryPolicyConfiguration memPlcCfg, @Nullable IgniteOutClosure<Float> fillFactorProvider) {
- this.memPlcCfg = memPlcCfg;
- this.fillFactorProvider = fillFactorProvider;
-
- metricsEnabled = memPlcCfg.isMetricsEnabled();
-
- rateTimeInterval = memPlcCfg.getRateTimeInterval();
-
- subInts = memPlcCfg.getSubIntervals();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return U.maskName(memPlcCfg.getName());
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return metricsEnabled ? totalAllocatedPages.longValue() : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float) allocRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- if (!metricsEnabled)
- return 0;
-
- return totalAllocatedPages.longValue() != 0 ?
- (float) largeEntriesPages.doubleValue() / totalAllocatedPages.longValue()
- : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- if (!metricsEnabled || fillFactorProvider == null)
- return 0;
-
- return fillFactorProvider.apply();
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- return dirtyPages.longValue();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- return ((float) pageReplaceRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- assert pageMem != null;
-
- return pageMem.loadedPages();
- }
-
- /**
- * Updates pageReplaceRate metric.
- */
- public void updatePageReplaceRate() {
- if (metricsEnabled)
- pageReplaceRate.onHit();
- }
-
- /**
- * Increments dirtyPages counter.
- */
- public void incrementDirtyPages() {
- if (metricsEnabled)
- dirtyPages.increment();
- }
-
- /**
- * Decrements dirtyPages counter.
- */
- public void decrementDirtyPages() {
- if (metricsEnabled)
- dirtyPages.decrement();
- }
-
- /**
- * Resets dirtyPages counter to zero.
- */
- public void resetDirtyPages() {
- if (metricsEnabled)
- dirtyPages.reset();
- }
-
- /**
- * Increments totalAllocatedPages counter.
- */
- public void incrementTotalAllocatedPages() {
- if (metricsEnabled) {
- totalAllocatedPages.increment();
-
- updateAllocationRateMetrics();
- }
- }
-
- /**
- *
- */
- private void updateAllocationRateMetrics() {
- allocRate.onHit();
- }
-
- /**
- * @param intervalNum Interval number.
- */
- private long subInt(int intervalNum) {
- return (rateTimeInterval * intervalNum) / subInts;
- }
-
- /**
- *
- */
- public void incrementLargeEntriesPages() {
- if (metricsEnabled)
- largeEntriesPages.increment();
- }
-
- /**
- *
- */
- public void decrementLargeEntriesPages() {
- if (metricsEnabled)
- largeEntriesPages.decrement();
- }
-
- /**
- * Enable metrics.
- */
- public void enableMetrics() {
- metricsEnabled = true;
- }
-
- /**
- * Disable metrics.
- */
- public void disableMetrics() {
- metricsEnabled = false;
- }
-
- /**
- * @param persistenceEnabled Persistence enabled.
- */
- public void persistenceEnabled(boolean persistenceEnabled) {
- this.persistenceEnabled = persistenceEnabled;
- }
-
- /**
- * @param pageMem Page mem.
- */
- public void pageMemory(PageMemory pageMem) {
- this.pageMem = pageMem;
- }
-
- /**
- * @param rateTimeInterval Time interval (in milliseconds) used to calculate allocation/eviction rate.
- */
- public void rateTimeInterval(long rateTimeInterval) {
- this.rateTimeInterval = rateTimeInterval;
-
- allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- }
-
- /**
- * Sets number of subintervals the whole rateTimeInterval will be split into to calculate allocation rate.
- *
- * @param subInts Number of subintervals.
- */
- public void subIntervals(int subInts) {
- assert subInts > 0;
-
- if (this.subInts == subInts)
- return;
-
- if (rateTimeInterval / subInts < 10)
- subInts = (int) rateTimeInterval / 10;
-
- allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
deleted file mode 100644
index 392f83f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
+++ /dev/null
@@ -1,131 +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.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
-
-/**
- * MBean to expose {@link MemoryMetrics} through JMX interface.
- */
-class MemoryMetricsMXBeanImpl implements MemoryMetricsMXBean {
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final MemoryPolicyConfiguration memPlcCfg;
-
- /**
- * @param memMetrics MemoryMetrics instance to expose through JMX interface.
- * @param memPlcCfg configuration of memory policy this MX Bean is created for.
- */
- MemoryMetricsMXBeanImpl(MemoryMetricsImpl memMetrics,
- MemoryPolicyConfiguration memPlcCfg
- ) {
- this.memMetrics = memMetrics;
- this.memPlcCfg = memPlcCfg;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- return memMetrics.getAllocationRate();
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return memMetrics.getEvictionRate();
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- return memMetrics.getLargeEntriesPagesPercentage();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- return memMetrics.getPagesFillFactor();
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return memMetrics.getTotalAllocatedPages();
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- return memMetrics.getDirtyPages();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- return memMetrics.getPagesReplaceRate();
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- return memMetrics.getPhysicalMemoryPages();
- }
-
- /** {@inheritDoc} */
- @Override public void rateTimeInterval(long rateTimeInterval) {
- if (rateTimeInterval < 1000)
- throw new IllegalArgumentException("rateTimeInterval property must be positive " +
- "and greater than 1_000 milliseconds (one second)");
-
- memMetrics.rateTimeInterval(rateTimeInterval);
- }
-
- /** {@inheritDoc} */
- @Override public void subIntervals(int subInts) {
- if (subInts <= 1)
- throw new IllegalArgumentException("subIntervals property must be positive " +
- "and greater than one");
-
- memMetrics.subIntervals(subInts);
- }
-
- /** {@inheritDoc} */
- @Override public void enableMetrics() {
- memMetrics.enableMetrics();
- }
-
- /** {@inheritDoc} */
- @Override public void disableMetrics() {
- memMetrics.disableMetrics();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return memMetrics.getName();
- }
-
- /** {@inheritDoc} */
- @Override public int getInitialSize() {
- return (int) (memPlcCfg.getInitialSize() / (1024 * 1024));
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxSize() {
- return (int) (memPlcCfg.getMaxSize() / (1024 * 1024));
- }
-
- /** {@inheritDoc} */
- @Override public String getSwapFilePath() {
- return memPlcCfg.getSwapFilePath();
- }
-}
[10/11] ignite git commit: IGNITE-6030 Allow enabling persistence per
data region
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
new file mode 100644
index 0000000..50edf5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
@@ -0,0 +1,406 @@
+/*
+ * 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.configuration;
+
+import java.io.Serializable;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
+
+/**
+ * This class allows defining custom data regions' configurations with various parameters for Apache Ignite
+ * page memory (see {@link DataStorageConfiguration}. For each configured data region Apache Ignite instantiates
+ * respective memory regions with different parameters like maximum size, eviction policy, swapping options,
+ * persistent mode flag, etc.
+ * An Apache Ignite cache can be mapped to a particular region using
+ * {@link CacheConfiguration#setDataRegionName(String)} method.
+ * <p>Sample configuration below shows how to configure several data regions:</p>
+ * <pre>
+ * {@code
+ * <property name="memoryConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ * <property name="defaultRegionConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="Default_Region"/>
+ * <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ * <property name="maxSize" value="#{5 * 1024 * 102 * 1024}"/>
+ * </bean>
+ * </property>
+ *
+ * <property name="pageSize" value="4096"/>
+ *
+ * <property name="dataRegions">
+ * <list>
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="20MB_Region_Eviction"/>
+ * <property name="initialSize" value="#{20 * 1024 * 1024}"/>
+ * <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
+ * </bean>
+ *
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="25MB_Region_Swapping"/>
+ * <property name="initialSize" value="#{25 * 1024 * 1024}"/>
+ * <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ * <property name="swapPath" value="db/swap"/>
+ * </bean>
+ * </list>
+ * </property>
+ * }
+ * </pre>
+ */
+public final class DataRegionConfiguration implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Default metrics enabled flag. */
+ public static final boolean DFLT_METRICS_ENABLED = false;
+
+ /** Default amount of sub intervals to calculate {@link DataRegionMetrics#getAllocationRate()} metric. */
+ public static final int DFLT_SUB_INTERVALS = 5;
+
+ /** Default length of interval over which {@link DataRegionMetrics#getAllocationRate()} metric is calculated. */
+ public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+ /** Data region name. */
+ private String name = DFLT_DATA_REG_DEFAULT_NAME;
+
+ /** Data region maximum size in memory. */
+ private long maxSize = DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE;
+
+ /** Data region start size. */
+ private long initSize = Math.min(
+ DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE, DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE);
+
+ /** An optional path to a memory mapped files directory for this data region. */
+ private String swapPath;
+
+ /** An algorithm for memory pages eviction. */
+ private DataPageEvictionMode pageEvictionMode = DataPageEvictionMode.DISABLED;
+
+ /**
+ * A threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page
+ * memory will start the eviction only after 90% data region is occupied.
+ */
+ private double evictionThreshold = 0.9;
+
+ /** Minimum number of empty pages in reuse lists. */
+ private int emptyPagesPoolSize = 100;
+
+ /**
+ * Flag to enable the memory metrics collection for this data region.
+ */
+ private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+ /** Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead. */
+ private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+ /**
+ * Time interval (in milliseconds) for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60_000 milliseconds, subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ */
+ private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+ /**
+ * Flag to enable Ignite Native Persistence.
+ */
+ private boolean persistenceEnabled = false;
+
+ /**
+ * Gets data region name.
+ *
+ * @return Data region name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets data region name. The name must be non empty and must not be equal to the reserved 'sysMemPlc' one.
+ *
+ * If not specified, {@link DataStorageConfiguration#DFLT_DATA_REG_DEFAULT_NAME} value is used.
+ *
+ * @param name Data region name.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setName(String name) {
+ this.name = name;
+
+ return this;
+ }
+
+ /**
+ * Maximum memory region size defined by this data region. If the whole data can not fit into the memory region
+ * an out of memory exception will be thrown.
+ *
+ * @return Size in bytes.
+ */
+ public long getMaxSize() {
+ return maxSize;
+ }
+
+ /**
+ * Sets maximum memory region size defined by this data region. The total size should not be less than 10 MB
+ * due to the internal data structures overhead.
+ *
+ * @param maxSize Maximum data region size in bytes.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMaxSize(long maxSize) {
+ this.maxSize = maxSize;
+
+ return this;
+ }
+
+ /**
+ * Gets initial memory region size defined by this data region. When the used memory size exceeds this value,
+ * new chunks of memory will be allocated.
+ *
+ * @return Data region start size.
+ */
+ public long getInitialSize() {
+ return initSize;
+ }
+
+ /**
+ * Sets initial memory region size defined by this data region. When the used memory size exceeds this value,
+ * new chunks of memory will be allocated.
+ *
+ * @param initSize Data region initial size.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setInitialSize(long initSize) {
+ this.initSize = initSize;
+
+ return this;
+ }
+
+ /**
+ * A path to the memory-mapped files the memory region defined by this data region will be mapped to. Having
+ * the path set, allows relying on swapping capabilities of an underlying operating system for the memory region.
+ *
+ * @return A path to the memory-mapped files or {@code null} if this feature is not used for the memory region
+ * defined by this data region.
+ */
+ public String getSwapPath() {
+ return swapPath;
+ }
+
+ /**
+ * Sets a path to the memory-mapped files.
+ *
+ * @param swapFilePath A Path to the memory mapped file.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setSwapPath(String swapFilePath) {
+ this.swapPath = swapFilePath;
+
+ return this;
+ }
+
+ /**
+ * Gets memory pages eviction mode. If {@link DataPageEvictionMode#DISABLED} is used (default) then an out of
+ * memory exception will be thrown if the memory region usage, defined by this data region, goes beyond its
+ * capacity which is {@link #getMaxSize()}.
+ *
+ * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default.
+ */
+ public DataPageEvictionMode getPageEvictionMode() {
+ return pageEvictionMode;
+ }
+
+ /**
+ * Sets memory pages eviction mode.
+ *
+ * @param evictionMode Eviction mode.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode) {
+ pageEvictionMode = evictionMode;
+
+ return this;
+ }
+
+ /**
+ * Gets a threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the
+ * page memory will start the eviction only after 90% of the data region is occupied.
+ *
+ * @return Memory pages eviction threshold.
+ */
+ public double getEvictionThreshold() {
+ return evictionThreshold;
+ }
+
+ /**
+ * Sets memory pages eviction threshold.
+ *
+ * @param evictionThreshold Eviction threshold.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setEvictionThreshold(double evictionThreshold) {
+ this.evictionThreshold = evictionThreshold;
+
+ return this;
+ }
+
+ /**
+ * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+ * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+ * (key, value) pair is slightly larger than page size / 2.
+ * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+ * to contain largest cache entry).
+ * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+ *
+ * @return Minimum number of empty pages in reuse list.
+ */
+ public int getEmptyPagesPoolSize() {
+ return emptyPagesPoolSize;
+ }
+
+ /**
+ * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+ * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+ * (key, value) pair is slightly larger than page size / 2.
+ * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+ * to contain largest cache entry).
+ * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+ *
+ * @param emptyPagesPoolSize Empty pages pool size.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize) {
+ this.emptyPagesPoolSize = emptyPagesPoolSize;
+
+ return this;
+ }
+
+ /**
+ * Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
+ * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+ *
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
+ * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+ *
+ * @param metricsEnabled Metrics enabled flag.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsEnabled(boolean metricsEnabled) {
+ this.metricsEnabled = metricsEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets whether persistence is enabled for this data region. All caches residing in this region will be persistent.
+ *
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /**
+ * Sets persistence enabled flag.
+ *
+ * @param persistenceEnabled Persistence enabled flag.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setPersistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets time interval for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60_000 milliseconds,
+ * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @return Time interval over which allocation rate is calculated.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * Sets time interval for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60 seconds,
+ * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @param metricsRateTimeInterval Time interval used for allocation and eviction rates calculations.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+ this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+ return this;
+ }
+
+ /**
+ * Gets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)}
+ * will be split into to calculate {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @return number of sub intervals.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @param metricsSubIntervalCnt A number of sub-intervals.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+ this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
new file mode 100644
index 0000000..bd314ab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
@@ -0,0 +1,882 @@
+/*
+ * 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.configuration;
+
+import java.io.Serializable;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * A durable memory configuration for an Apache Ignite node. The durable memory is a manageable off-heap based memory
+ * architecture that divides all expandable data regions into pages of fixed size
+ * (see {@link DataStorageConfiguration#getPageSize()}). An individual page can store one or many cache key-value entries
+ * that allows reusing the memory in the most efficient way and avoid memory fragmentation issues.
+ * <p>
+ * By default, the durable memory allocates a single expandable data region with default settings. All the caches that
+ * will be configured in an application will be mapped to this data region by default, thus, all the cache data will
+ * reside in that data region. Parameters of default data region can be changed by setting
+ * {@link DataStorageConfiguration#setDefaultDataRegionConfiguration(DataRegionConfiguration)}.
+ * Other data regions (except default) can be configured with
+ * {@link DataStorageConfiguration#setDataRegionConfigurations(DataRegionConfiguration...)}.
+ * <p>
+ * Data region can be used in memory-only mode, or in persistent mode, when memory is used as a caching layer for disk.
+ * Persistence for data region can be turned on with {@link DataRegionConfiguration#setPersistenceEnabled(boolean)}
+ * flag. To learn more about data regions refer to {@link DataRegionConfiguration} documentation.
+ * <p>Sample configuration below shows how to make 5 GB data regions the default one for Apache Ignite:</p>
+ * <pre>
+ * {@code
+ *
+ * <property name="dataStorageConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ * <property name="systemCacheInitialSize" value="#{100 * 1024 * 1024}"/>
+ *
+ * <property name="defaultDataRegionConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="default_data_region"/>
+ * <property name="initialSize" value="#{5 * 1024 * 1024 * 1024}"/>
+ * </bean>
+ * </property>
+ * </bean>
+ * </property>
+ * }
+ * </pre>
+ */
+public class DataStorageConfiguration implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Default data region start size (256 MB). */
+ @SuppressWarnings("UnnecessaryBoxing")
+ public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256L * 1024 * 1024;
+
+ /** Fraction of available memory to allocate for default DataRegion. */
+ private static final double DFLT_DATA_REGION_FRACTION = 0.2;
+
+ /** Default data region's size is 20% of physical memory available on current machine. */
+ public static final long DFLT_DATA_REGION_MAX_SIZE = Math.max(
+ (long)(DFLT_DATA_REGION_FRACTION * U.getTotalMemoryAvailable()),
+ DFLT_DATA_REGION_INITIAL_SIZE);
+
+ /** Default initial size of a memory chunk for the system cache (40 MB). */
+ private static final long DFLT_SYS_CACHE_INIT_SIZE = 40 * 1024 * 1024;
+
+ /** Default max size of a memory chunk for the system cache (100 MB). */
+ private static final long DFLT_SYS_CACHE_MAX_SIZE = 100 * 1024 * 1024;
+
+ /** Default memory page size. */
+ public static final int DFLT_PAGE_SIZE = 4 * 1024;
+
+ /** This name is assigned to default Dataregion if no user-defined default MemPlc is specified */
+ public static final String DFLT_DATA_REG_DEFAULT_NAME = "default";
+
+ /** */
+ public static final int DFLT_CHECKPOINT_FREQ = 180000;
+
+ /** Lock default wait time, 10 sec. */
+ public static final int DFLT_LOCK_WAIT_TIME = 10 * 1000;
+
+ /** */
+ public static final boolean DFLT_METRICS_ENABLED = false;
+
+ /** Default amount of sub intervals to calculate rate-based metric. */
+ public static final int DFLT_SUB_INTERVALS = 5;
+
+ /** Default length of interval over which rate-based metric is calculated. */
+ public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+ /** Default number of checkpoint threads. */
+ public static final int DFLT_CHECKPOINT_THREADS = 4;
+
+ /** Default checkpoint write order. */
+ public static final CheckpointWriteOrder DFLT_CHECKPOINT_WRITE_ORDER = CheckpointWriteOrder.SEQUENTIAL;
+
+ /** Default number of checkpoints to be kept in WAL after checkpoint is finished */
+ public static final int DFLT_WAL_HISTORY_SIZE = 20;
+
+ /** */
+ public static final int DFLT_WAL_SEGMENTS = 10;
+
+ /** Default WAL file segment size, 64MBytes */
+ public static final int DFLT_WAL_SEGMENT_SIZE = 64 * 1024 * 1024;
+
+ /** Default wal mode. */
+ public static final WALMode DFLT_WAL_MODE = WALMode.DEFAULT;
+
+ /** Default thread local buffer size. */
+ public static final int DFLT_TLB_SIZE = 128 * 1024;
+
+ /** Default Wal flush frequency. */
+ public static final int DFLT_WAL_FLUSH_FREQ = 2000;
+
+ /** Default wal fsync delay. */
+ public static final int DFLT_WAL_FSYNC_DELAY = 1000;
+
+ /** Default wal record iterator buffer size. */
+ public static final int DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE = 64 * 1024 * 1024;
+
+ /** Default wal always write full pages. */
+ public static final boolean DFLT_WAL_ALWAYS_WRITE_FULL_PAGES = false;
+
+ /** Default wal directory. */
+ public static final String DFLT_WAL_PATH = "db/wal";
+
+ /** Default wal archive directory. */
+ public static final String DFLT_WAL_ARCHIVE_PATH = "db/wal/archive";
+
+ /** Default write throttling enabled. */
+ public static final boolean DFLT_WRITE_THROTTLING_ENABLED = false;
+
+ /** Size of a memory chunk reserved for system cache initially. */
+ private long sysRegionInitSize = DFLT_SYS_CACHE_INIT_SIZE;
+
+ /** Maximum size of system cache. */
+ private long sysCacheMaxSize = DFLT_SYS_CACHE_MAX_SIZE;
+
+ /** Memory page size. */
+ private int pageSize;
+
+ /** Concurrency level. */
+ private int concLvl;
+
+ /** Configuration of default data region. */
+ private DataRegionConfiguration dfltDataRegConf = new DataRegionConfiguration();
+
+ /** Data regions. */
+ private DataRegionConfiguration[] dataRegions;
+
+ /** Directory where index and partition files are stored. */
+ private String storagePath;
+
+ /** Checkpoint frequency. */
+ private long checkpointFreq = DFLT_CHECKPOINT_FREQ;
+
+ /** Lock wait time, in milliseconds. */
+ private long lockWaitTime = DFLT_LOCK_WAIT_TIME;
+
+ /** */
+ private long checkpointPageBufSize;
+
+ /** */
+ private int checkpointThreads = DFLT_CHECKPOINT_THREADS;
+
+ /** Checkpoint write order. */
+ private CheckpointWriteOrder checkpointWriteOrder = DFLT_CHECKPOINT_WRITE_ORDER;
+
+ /** Number of checkpoints to keep */
+ private int walHistSize = DFLT_WAL_HISTORY_SIZE;
+
+ /** Number of work WAL segments. */
+ private int walSegments = DFLT_WAL_SEGMENTS;
+
+ /** Size of one WAL segment in bytes. 64 Mb is used by default. Maximum value is 2Gb */
+ private int walSegmentSize = DFLT_WAL_SEGMENT_SIZE;
+
+ /** Directory where WAL is stored (work directory) */
+ private String walPath = DFLT_WAL_PATH;
+
+ /** WAL archive path. */
+ private String walArchivePath = DFLT_WAL_ARCHIVE_PATH;
+
+ /** Metrics enabled flag. */
+ private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+ /** Wal mode. */
+ private WALMode walMode = DFLT_WAL_MODE;
+
+ /** WAl thread local buffer size. */
+ private int walTlbSize = DFLT_TLB_SIZE;
+
+ /** Wal flush frequency in milliseconds. */
+ private long walFlushFreq = DFLT_WAL_FLUSH_FREQ;
+
+ /** Wal fsync delay. */
+ private long walFsyncDelay = DFLT_WAL_FSYNC_DELAY;
+
+ /** Wal record iterator buffer size. */
+ private int walRecordIterBuffSize = DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE;
+
+ /** Always write full pages. */
+ private boolean alwaysWriteFullPages = DFLT_WAL_ALWAYS_WRITE_FULL_PAGES;
+
+ /** Factory to provide I/O interface for files */
+ private FileIOFactory fileIOFactory =
+ IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
+ new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+
+ /**
+ * Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * rate-based metrics.
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * rate-based metrics when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ */
+ private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+ /** Time interval (in milliseconds) for rate-based metrics. */
+ private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+ /**
+ * Time interval (in milliseconds) for running auto archiving for incompletely WAL segment
+ */
+ private long walAutoArchiveAfterInactivity = -1;
+
+ /**
+ * If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled.
+ */
+ private boolean writeThrottlingEnabled = DFLT_WRITE_THROTTLING_ENABLED;
+
+ /**
+ * Initial size of a data region reserved for system cache.
+ *
+ * @return Size in bytes.
+ */
+ public long getSystemRegionInitialSize() {
+ return sysRegionInitSize;
+ }
+
+ /**
+ * Sets initial size of a data region reserved for system cache.
+ *
+ * Default value is {@link #DFLT_SYS_CACHE_INIT_SIZE}
+ *
+ * @param sysRegionInitSize Size in bytes.
+ *
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setSystemRegionInitialSize(long sysRegionInitSize) {
+ A.ensure(sysCacheMaxSize > 0, "System region initial size can not be less zero.");
+
+ this.sysRegionInitSize = sysRegionInitSize;
+
+ return this;
+ }
+
+ /**
+ * Maximum data region size reserved for system cache.
+ *
+ * @return Size in bytes.
+ */
+ public long getSystemRegionMaxSize() {
+ return sysCacheMaxSize;
+ }
+
+ /**
+ * Sets maximum data region size reserved for system cache. The total size should not be less than 10 MB
+ * due to internal data structures overhead.
+ *
+ * @param sysCacheMaxSize Maximum size in bytes for system cache data region.
+ *
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setSystemRegionMaxSize(long sysCacheMaxSize) {
+ A.ensure(sysCacheMaxSize > 0, "System cache max size can not be less zero.");
+
+ this.sysCacheMaxSize = sysCacheMaxSize;
+
+ return this;
+ }
+
+ /**
+ * The page memory consists of one or more expandable data regions defined by {@link DataRegionConfiguration}.
+ * Every data region is split on pages of fixed size that store actual cache entries.
+ *
+ * @return Page size in bytes.
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * Changes the page size.
+ *
+ * @param pageSize Page size in bytes. If value is not set (or zero), {@link #DFLT_PAGE_SIZE} will be used.
+ */
+ public DataStorageConfiguration setPageSize(int pageSize) {
+ if (pageSize != 0) {
+ A.ensure(pageSize >= 1024 && pageSize <= 16 * 1024, "Page size must be between 1kB and 16kB.");
+ A.ensure(U.isPow2(pageSize), "Page size must be a power of 2.");
+ }
+
+ this.pageSize = pageSize;
+
+ return this;
+ }
+
+ /**
+ * Gets an array of all data regions configured. Apache Ignite will instantiate a dedicated data region per
+ * region. An Apache Ignite cache can be mapped to a specific region with
+ * {@link CacheConfiguration#setDataRegionName(String)} method.
+ *
+ * @return Array of configured data regions.
+ */
+ public DataRegionConfiguration[] getDataRegionConfigurations() {
+ return dataRegions;
+ }
+
+ /**
+ * Sets data regions configurations.
+ *
+ * @param dataRegionConfigurations Data regions configurations.
+ */
+ public DataStorageConfiguration setDataRegionConfigurations(DataRegionConfiguration... dataRegionConfigurations) {
+ this.dataRegions = dataRegionConfigurations;
+
+ return this;
+ }
+
+ /**
+ * Returns the number of concurrent segments in Ignite internal page mapping tables. By default equals
+ * to the number of available CPUs.
+ *
+ * @return Mapping table concurrency level.
+ */
+ public int getConcurrencyLevel() {
+ return concLvl;
+ }
+
+ /**
+ * Sets the number of concurrent segments in Ignite internal page mapping tables.
+ *
+ * @param concLvl Mapping table concurrency level.
+ */
+ public DataStorageConfiguration setConcurrencyLevel(int concLvl) {
+ this.concLvl = concLvl;
+
+ return this;
+ }
+
+ /**
+ * @return Configuration of default data region. All cache groups will reside in this data region by default.
+ * For assigning a custom data region to cache group, use {@link CacheConfiguration#setDataRegionName(String)}.
+ */
+ public DataRegionConfiguration getDefaultDataRegionConfiguration() {
+ return dfltDataRegConf;
+ }
+
+ /**
+ * Overrides configuration of default data region which is created automatically.
+ * @param dfltDataRegConf Default data region configuration.
+ */
+ public DataStorageConfiguration setDefaultDataRegionConfiguration(DataRegionConfiguration dfltDataRegConf) {
+ this.dfltDataRegConf = dfltDataRegConf;
+
+ return this;
+ }
+
+ /**
+ * Returns a path the root directory where the Persistent Store will persist data and indexes.
+ */
+ public String getStoragePath() {
+ return storagePath;
+ }
+
+ /**
+ * Sets a path to the root directory where the Persistent Store will persist data and indexes.
+ * By default the Persistent Store's files are located under Ignite work directory.
+ *
+ * @param persistenceStorePath Persistence store path.
+ */
+ public DataStorageConfiguration setStoragePath(String persistenceStorePath) {
+ this.storagePath = persistenceStorePath;
+
+ return this;
+ }
+
+ /**
+ * Gets checkpoint frequency.
+ *
+ * @return checkpoint frequency in milliseconds.
+ */
+ public long getCheckpointFrequency() {
+ return checkpointFreq <= 0 ? DFLT_CHECKPOINT_FREQ : checkpointFreq;
+ }
+
+ /**
+ * Sets the checkpoint frequency which is a minimal interval when the dirty pages will be written
+ * to the Persistent Store. If the rate is high, checkpoint will be triggered more frequently.
+ *
+ * @param checkpointFreq checkpoint frequency in milliseconds.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointFrequency(long checkpointFreq) {
+ this.checkpointFreq = checkpointFreq;
+
+ return this;
+ }
+
+ /**
+ * Gets amount of memory allocated for a checkpoint temporary buffer.
+ *
+ * @return Checkpoint page buffer size in bytes or {@code 0} for Ignite
+ * to choose the buffer size automatically.
+ */
+ public long getCheckpointPageBufferSize() {
+ return checkpointPageBufSize;
+ }
+
+ /**
+ * Sets amount of memory allocated for the checkpoint temporary buffer. The buffer is used to create temporary
+ * copies of pages that are being written to disk and being update in parallel while the checkpoint is in
+ * progress.
+ *
+ * @param checkpointPageBufSize Checkpoint page buffer size in bytes or {@code 0} for Ignite to
+ * choose the buffer size automatically.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointPageBufferSize(long checkpointPageBufSize) {
+ this.checkpointPageBufSize = checkpointPageBufSize;
+
+ return this;
+ }
+
+
+ /**
+ * Gets a number of threads to use for the checkpoint purposes.
+ *
+ * @return Number of checkpoint threads.
+ */
+ public int getCheckpointThreads() {
+ return checkpointThreads;
+ }
+
+ /**
+ * Sets a number of threads to use for the checkpoint purposes.
+ *
+ * @param checkpointThreads Number of checkpoint threads. Four threads are used by default.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointThreads(int checkpointThreads) {
+ this.checkpointThreads = checkpointThreads;
+
+ return this;
+ }
+
+ /**
+ * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+ *
+ * @return Lock wait time in milliseconds.
+ */
+ public long getLockWaitTime() {
+ return lockWaitTime;
+ }
+
+ /**
+ * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+ *
+ * @param lockWaitTime Lock wait time in milliseconds.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setLockWaitTime(long lockWaitTime) {
+ this.lockWaitTime = lockWaitTime;
+
+ return this;
+ }
+
+ /**
+ * Gets a total number of checkpoints to keep in the WAL history.
+ *
+ * @return Number of checkpoints to keep in WAL after a checkpoint is finished.
+ */
+ public int getWalHistorySize() {
+ return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize;
+ }
+
+ /**
+ * Sets a total number of checkpoints to keep in the WAL history.
+ *
+ * @param walHistSize Number of checkpoints to keep after a checkpoint is finished.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalHistorySize(int walHistSize) {
+ this.walHistSize = walHistSize;
+
+ return this;
+ }
+
+ /**
+ * Gets a number of WAL segments to work with.
+ *
+ * @return Number of work WAL segments.
+ */
+ public int getWalSegments() {
+ return walSegments <= 0 ? DFLT_WAL_SEGMENTS : walSegments;
+ }
+
+ /**
+ * Sets a number of WAL segments to work with. For performance reasons,
+ * the whole WAL is split into files of fixed length called segments.
+ *
+ * @param walSegments Number of WAL segments.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalSegments(int walSegments) {
+ this.walSegments = walSegments;
+
+ return this;
+ }
+
+ /**
+ * Gets size of a WAL segment in bytes.
+ *
+ * @return WAL segment size.
+ */
+ public int getWalSegmentSize() {
+ return walSegmentSize <= 0 ? DFLT_WAL_SEGMENT_SIZE : walSegmentSize;
+ }
+
+ /**
+ * Sets size of a WAL segment.
+ *
+ * @param walSegmentSize WAL segment size. 64 MB is used by default. Maximum value is 2Gb
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) {
+ this.walSegmentSize = walSegmentSize;
+
+ return this;
+ }
+
+ /**
+ * Gets a path to the directory where WAL is stored.
+ *
+ * @return WAL persistence path, absolute or relative to Ignite work directory.
+ */
+ public String getWalPath() {
+ return walPath;
+ }
+
+ /**
+ * Sets a path to the directory where WAL is stored. If this path is relative, it will be resolved
+ * relatively to Ignite work directory.
+ *
+ * @param walStorePath WAL persistence path, absolute or relative to Ignite work directory.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalPath(String walStorePath) {
+ this.walPath = walStorePath;
+
+ return this;
+ }
+
+ /**
+ * Gets a path to the WAL archive directory.
+ *
+ * @return WAL archive directory.
+ */
+ public String getWalArchivePath() {
+ return walArchivePath;
+ }
+
+ /**
+ * Sets a path for the WAL archive directory. Every WAL segment will be fully copied to this directory before
+ * it can be reused for WAL purposes.
+ *
+ * @param walArchivePath WAL archive directory.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalArchivePath(String walArchivePath) {
+ this.walArchivePath = walArchivePath;
+
+ return this;
+ }
+
+ /**
+ * Gets flag indicating whether persistence metrics collection is enabled.
+ * Default value is {@link #DFLT_METRICS_ENABLED}.
+ *
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * Sets flag indicating whether persistence metrics collection is enabled.
+ *
+ * @param metricsEnabled Metrics enabled flag.
+ */
+ public DataStorageConfiguration setMetricsEnabled(boolean metricsEnabled) {
+ this.metricsEnabled = metricsEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets flag indicating whether write throttling is enabled.
+ */
+ public boolean isWriteThrottlingEnabled() {
+ return writeThrottlingEnabled;
+ }
+
+ /**
+ * Sets flag indicating whether write throttling is enabled.
+ *
+ * @param writeThrottlingEnabled Write throttling enabled flag.
+ */
+ public DataStorageConfiguration setWriteThrottlingEnabled(boolean writeThrottlingEnabled) {
+ this.writeThrottlingEnabled = writeThrottlingEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets the length of the time interval for rate-based metrics. This interval defines a window over which
+ * hits will be tracked. Default value is {@link #DFLT_RATE_TIME_INTERVAL_MILLIS}.
+ *
+ * @return Time interval in milliseconds.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * Sets the length of the time interval for rate-based metrics. This interval defines a window over which
+ * hits will be tracked.
+ *
+ * @param metricsRateTimeInterval Time interval in milliseconds.
+ */
+ public DataStorageConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+ this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+ return this;
+ }
+
+ /**
+ * Gets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+ * Default value is {@link #DFLT_SUB_INTERVALS}.
+ *
+ * @return The number of sub-intervals for history tracking.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * Sets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+ *
+ * @param metricsSubIntervalCnt The number of sub-intervals for history tracking.
+ */
+ public DataStorageConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+ this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+ return this;
+ }
+
+ /**
+ * Property that defines behavior of wal fsync.
+ * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+ *
+ * @return WAL mode.
+ */
+ public WALMode getWalMode() {
+ return walMode == null ? DFLT_WAL_MODE : walMode;
+ }
+
+ /**
+ * Sets property that defines behavior of wal fsync.
+ * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+ *
+ * @param walMode Wal mode.
+ */
+ public DataStorageConfiguration setWalMode(WALMode walMode) {
+ this.walMode = walMode;
+
+ return this;
+ }
+
+ /**
+ * Property for size of thread local buffer.
+ * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+ *
+ * @return Thread local buffer size (in bytes).
+ */
+ public int getWalThreadLocalBufferSize() {
+ return walTlbSize <= 0 ? DFLT_TLB_SIZE : walTlbSize;
+ }
+
+ /**
+ * Sets size of thread local buffer.
+ * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+ *
+ * @param walTlbSize Thread local buffer size (in bytes).
+ */
+ public DataStorageConfiguration setWalThreadLocalBufferSize(int walTlbSize) {
+ this.walTlbSize = walTlbSize;
+
+ return this;
+ }
+
+ /**
+ * This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+ * all other WAL modes.
+ *
+ * @return WAL flush frequency, in milliseconds.
+ */
+ public long getWalFlushFrequency() {
+ return walFlushFreq;
+ }
+
+ /**
+ * This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+ * all other WAL modes.
+ *
+ * @param walFlushFreq WAL flush frequency, in milliseconds.
+ */
+ public DataStorageConfiguration setWalFlushFrequency(long walFlushFreq) {
+ this.walFlushFreq = walFlushFreq;
+
+ return this;
+ }
+
+ /**
+ * Property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+ * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+ * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+ * Total throughput should increase under load as total WAL fsync rate will be limited.
+ */
+ public long getWalFsyncDelayNanos() {
+ return walFsyncDelay <= 0 ? DFLT_WAL_FSYNC_DELAY : walFsyncDelay;
+ }
+
+ /**
+ * Sets property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+ * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+ * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+ * Total throughput should increase under load as total WAL fsync rate will be limited.
+ *
+ * @param walFsyncDelayNanos Wal fsync delay, in nanoseconds.
+ */
+ public DataStorageConfiguration setWalFsyncDelayNanos(long walFsyncDelayNanos) {
+ walFsyncDelay = walFsyncDelayNanos;
+
+ return this;
+ }
+
+ /**
+ * Property define how many bytes iterator read from
+ * disk (for one reading), during go ahead wal.
+ *
+ * @return Record iterator buffer size.
+ */
+ public int getWalRecordIteratorBufferSize() {
+ return walRecordIterBuffSize <= 0 ? DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE : walRecordIterBuffSize;
+ }
+
+ /**
+ * Sets property defining how many bytes iterator read from
+ * disk (for one reading), during go ahead wal.
+ *
+ * @param walRecordIterBuffSize Wal record iterator buffer size.
+ */
+ public DataStorageConfiguration setWalRecordIteratorBufferSize(int walRecordIterBuffSize) {
+ this.walRecordIterBuffSize = walRecordIterBuffSize;
+
+ return this;
+ }
+
+ /**
+ * Gets flag that enforces writing full page to WAL on every change (instead of delta record).
+ * Can be used for debugging purposes: every version of page will be present in WAL.
+ * Note that WAL will take several times more space in this mode.
+ */
+ public boolean isAlwaysWriteFullPages() {
+ return alwaysWriteFullPages;
+ }
+
+ /**
+ * Sets flag that enforces writing full page to WAL on every change (instead of delta record).
+ * Can be used for debugging purposes: every version of page will be present in WAL.
+ * Note that WAL will take several times more space in this mode.
+ *
+ * @param alwaysWriteFullPages Always write full pages flag.
+ */
+ public DataStorageConfiguration setAlwaysWriteFullPages(boolean alwaysWriteFullPages) {
+ this.alwaysWriteFullPages = alwaysWriteFullPages;
+
+ return this;
+ }
+
+ /**
+ * Factory to provide implementation of FileIO interface
+ * which is used for any file read/write operations
+ *
+ * @return File I/O factory
+ */
+ public FileIOFactory getFileIOFactory() {
+ return fileIOFactory;
+ }
+
+ /**
+ * Sets factory to provide implementation of FileIO interface
+ * which is used for any file read/write operations
+ *
+ * @param fileIOFactory File I/O factory
+ */
+ public DataStorageConfiguration setFileIOFactory(FileIOFactory fileIOFactory) {
+ this.fileIOFactory = fileIOFactory;
+
+ return this;
+ }
+
+ /**
+ * <b>Note:</b> setting this value with {@link WALMode#DEFAULT} may generate file size overhead for WAL segments in case
+ * grid is used rarely.
+ *
+ * @param walAutoArchiveAfterInactivity time in millis to run auto archiving segment (even if incomplete) after last
+ * record logging. <br> Positive value enables incomplete segment archiving after timeout (inactivity). <br> Zero or
+ * negative value disables auto archiving.
+ * @return current configuration instance for chaining
+ */
+ public DataStorageConfiguration setWalAutoArchiveAfterInactivity(long walAutoArchiveAfterInactivity) {
+ this.walAutoArchiveAfterInactivity = walAutoArchiveAfterInactivity;
+
+ return this;
+ }
+
+ /**
+ * @return time in millis to run auto archiving WAL segment (even if incomplete) after last record log
+ */
+ public long getWalAutoArchiveAfterInactivity() {
+ return walAutoArchiveAfterInactivity;
+ }
+
+ /**
+ * This property defines order of writing pages to disk storage during checkpoint.
+ *
+ * @return Checkpoint write order.
+ */
+ public CheckpointWriteOrder getCheckpointWriteOrder() {
+ return checkpointWriteOrder;
+ }
+
+ /**
+ * This property defines order of writing pages to disk storage during checkpoint.
+ *
+ * @param checkpointWriteOrder Checkpoint write order.
+ */
+ public DataStorageConfiguration setCheckpointWriteOrder(CheckpointWriteOrder checkpointWriteOrder) {
+ this.checkpointWriteOrder = checkpointWriteOrder;
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index a79d436..fc1fb6b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -457,11 +457,16 @@ public class IgniteConfiguration {
private ExecutorConfiguration[] execCfgs;
/** Page memory configuration. */
+ @Deprecated
private MemoryConfiguration memCfg;
/** Persistence store configuration. */
+ @Deprecated
private PersistentStoreConfiguration pstCfg;
+ /** Page memory configuration. */
+ private DataStorageConfiguration dsCfg;
+
/** Active on start flag. */
private boolean activeOnStart = DFLT_ACTIVE_ON_START;
@@ -510,6 +515,7 @@ public class IgniteConfiguration {
allResolversPassReq = cfg.isAllSegmentationResolversPassRequired();
atomicCfg = cfg.getAtomicConfiguration();
binaryCfg = cfg.getBinaryConfiguration();
+ dsCfg = cfg.getDataStorageConfiguration();
memCfg = cfg.getMemoryConfiguration();
pstCfg = cfg.getPersistentStoreConfiguration();
cacheCfg = cfg.getCacheConfiguration();
@@ -2157,6 +2163,29 @@ public class IgniteConfiguration {
*
* @return Memory configuration.
*/
+ public DataStorageConfiguration getDataStorageConfiguration() {
+ return dsCfg;
+ }
+
+ /**
+ * Sets durable memory configuration.
+ *
+ * @param dsCfg Data storage configuration.
+ * @return {@code this} for chaining.
+ */
+ public IgniteConfiguration setDataStorageConfiguration(DataStorageConfiguration dsCfg) {
+ this.dsCfg = dsCfg;
+
+ return this;
+ }
+
+ /**
+ * Gets page memory configuration.
+ *
+ * @return Memory configuration.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
+ */
+ @Deprecated
public MemoryConfiguration getMemoryConfiguration() {
return memCfg;
}
@@ -2166,7 +2195,9 @@ public class IgniteConfiguration {
*
* @param memCfg Memory configuration.
* @return {@code this} for chaining.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+ @Deprecated
public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration memCfg) {
this.memCfg = memCfg;
@@ -2177,14 +2208,20 @@ public class IgniteConfiguration {
* Gets persistence configuration used by Apache Ignite Persistent Store.
*
* @return Persistence configuration.
+ *
+ * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
*/
+ @Deprecated
public PersistentStoreConfiguration getPersistentStoreConfiguration() {
return pstCfg;
}
/**
- * @return Flag {@code true} if persistent enable, {@code false} if disable.
+ * @return Flag {@code true} if persistence is enabled, {@code false} if disabled.
+ *
+ * @deprecated Part of legacy configuration API. Doesn't work if new configuration API is used.
*/
+ @Deprecated
public boolean isPersistentStoreEnabled() {
return pstCfg != null;
}
@@ -2194,7 +2231,10 @@ public class IgniteConfiguration {
*
* @param pstCfg Persistence configuration.
* @return {@code this} for chaining.
+ *
+ * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
*/
+ @Deprecated
public IgniteConfiguration setPersistentStoreConfiguration(PersistentStoreConfiguration pstCfg) {
this.pstCfg = pstCfg;
@@ -2208,7 +2248,7 @@ public class IgniteConfiguration {
* <p>
* Default value is {@link #DFLT_ACTIVE_ON_START}.
* <p>
- * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+ * This flag is ignored when {@link DataStorageConfiguration} is present:
* cluster is always inactive on start when Ignite Persistence is enabled.
*
* @return Active on start flag value.
@@ -2221,7 +2261,7 @@ public class IgniteConfiguration {
* Sets flag indicating whether the cluster will be active on start. This value should be the same on all
* nodes in the cluster.
* <p>
- * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+ * This flag is ignored when {@link DataStorageConfiguration} is present:
* cluster is always inactive on start when Ignite Persistence is enabled.
*
* @param activeOnStart Active on start flag value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
index 9ba26c8..c3d4e74 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
@@ -57,7 +57,10 @@ import org.apache.ignite.internal.util.typedef.internal.U;
* </property>
* }
* </pre>
+ *
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+@Deprecated
public class MemoryConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -66,7 +69,7 @@ public class MemoryConfiguration implements Serializable {
@SuppressWarnings("UnnecessaryBoxing")
public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024;
- /** Fraction of available memory to allocate for default MemoryPolicy. */
+ /** Fraction of available memory to allocate for default DataRegion. */
private static final double DFLT_MEMORY_POLICY_FRACTION = 0.2;
/** Default memory policy's size is 20% of physical memory available on current machine. */
@@ -83,7 +86,7 @@ public class MemoryConfiguration implements Serializable {
/** Default memory page size. */
public static final int DFLT_PAGE_SIZE = 4 * 1024;
- /** This name is assigned to default MemoryPolicy if no user-defined default MemPlc is specified */
+ /** This name is assigned to default DataRegion if no user-defined default MemPlc is specified */
public static final String DFLT_MEM_PLC_DEFAULT_NAME = "default";
/** Size of a memory chunk reserved for system cache initially. */
@@ -101,7 +104,7 @@ public class MemoryConfiguration implements Serializable {
/** A name of the memory policy that defines the default memory region. */
private String dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME;
- /** Size of memory (in bytes) to use for default MemoryPolicy. */
+ /** Size of memory (in bytes) to use for default DataRegion. */
private long dfltMemPlcSize = DFLT_MEMORY_POLICY_MAX_SIZE;
/** Memory policies. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
index dff8b2b..efe7ae2 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.ignite.configuration;
import java.io.Serializable;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
@@ -60,7 +60,10 @@ import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_D
* </property>
* }
* </pre>
+ *
+ * @deprecated Use {@link DataRegionConfiguration} instead.
*/
+@Deprecated
public final class MemoryPolicyConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -121,6 +124,11 @@ public final class MemoryPolicyConfiguration implements Serializable {
private long rateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
/**
+ * Flag to enable Ignite Native Persistence.
+ */
+ private boolean persistenceEnabled = true;
+
+ /**
* Gets memory policy name.
*
* @return Memory policy name.
@@ -290,7 +298,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
/**
* Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
- * at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+ * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
*
* @return Metrics enabled flag.
*/
@@ -300,7 +308,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
/**
* Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
- * Memory metrics can be enabled and disabled at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+ * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
*
* @param metricsEnabled Metrics enabled flag.
* @return {@code this} for chaining.
@@ -312,6 +320,24 @@ public final class MemoryPolicyConfiguration implements Serializable {
}
/**
+ * Gets whether Ignite Native Persistence is enabled for this memory policy.
+ *
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /**
+ * Sets persistence enabled flag.
+ *
+ * @param persistenceEnabled Persistence enabled flag.
+ */
+ public void setPersistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+ }
+
+ /**
* Gets time interval for {@link MemoryMetrics#getAllocationRate()}
* and {@link MemoryMetrics#getEvictionRate()} monitoring purposes.
* <p>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
index c44e92d..c41721a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
@@ -25,7 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Configures Apache Ignite Persistent store.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+@Deprecated
public class PersistentStoreConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -144,7 +146,7 @@ public class PersistentStoreConfiguration implements Serializable {
/** Factory to provide I/O interface for files */
private FileIOFactory fileIOFactory =
IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
- new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+ new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
/**
* Number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
index 7bd27fe..794a262 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
@@ -17,6 +17,8 @@
package org.apache.ignite.igfs;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+
/**
* {@code IGFS} metrics snapshot for the file system. Note, that some metrics are global and
* some are local (i.e. per each node).
@@ -33,7 +35,7 @@ public interface IgfsMetrics {
/**
* Gets maximum amount of data that can be stored on local node. This metrics is related to
- * to the {@link org.apache.ignite.configuration.MemoryPolicyConfiguration#getMaxSize()} of the IGFS data cache.
+ * to the {@link DataRegionConfiguration#getMaxSize()} of the IGFS data cache.
*
* @return Maximum IGFS local space size.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 759bf64..8a71e1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -49,6 +49,10 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.cache.CacheException;
import javax.management.JMException;
import javax.management.ObjectName;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
import org.apache.ignite.IgniteAtomicSequence;
@@ -85,6 +89,7 @@ import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
@@ -114,7 +119,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
-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.filename.PdsConsistentIdProcessor;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
@@ -176,6 +181,7 @@ import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.StripedExecutorMXBean;
@@ -214,6 +220,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CLIENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CONSISTENCY_CHECK_SKIPPED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DAEMON;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STREAMER_POOL_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
@@ -231,10 +238,10 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_US
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MEMORY_CONFIG;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SPI_CLASS;
@@ -1245,10 +1252,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
int loadedPages = 0;
- Collection<MemoryPolicy> policies = ctx.cache().context().database().memoryPolicies();
+ Collection<DataRegion> policies = ctx.cache().context().database().dataRegions();
if (!F.isEmpty(policies)) {
- for (MemoryPolicy memPlc : policies)
+ for (DataRegion memPlc : policies)
loadedPages += memPlc.pageMemory().loadedPages();
}
@@ -1424,7 +1431,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (total > safeToUse) {
U.quietAndWarn(log, "Nodes started on local machine require more than 80% of physical RAM what can " +
- "lead to significant slowdown due to swapping (please decrease JVM heap size, memory policy " +
+ "lead to significant slowdown due to swapping (please decrease JVM heap size, data region " +
"size or checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" +
(ram >> 20) + "MB]");
}
@@ -1604,8 +1611,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (cfg.getConnectorConfiguration() != null)
add(ATTR_REST_PORT_RANGE, cfg.getConnectorConfiguration().getPortRange());
- // Save database configuration.
- add(ATTR_MEMORY_CONFIG, cfg.getMemoryConfiguration());
+ // Save data storage configuration.
+ addDataStorageConfigurationAttributes();
// Save transactions configuration.
add(ATTR_TX_CONFIG, cfg.getTransactionConfiguration());
@@ -1633,6 +1640,25 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/**
+ *
+ */
+ private void addDataStorageConfigurationAttributes() throws IgniteCheckedException {
+ MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+
+ // Save legacy memory configuration if it's present.
+ if (memCfg != null) {
+ // Page size initialization is suspended, see IgniteCacheDatabaseSharedManager#checkPageSize.
+ // We should copy initialized value from new configuration.
+ memCfg.setPageSize(cfg.getDataStorageConfiguration().getPageSize());
+
+ add(ATTR_MEMORY_CONFIG, memCfg);
+ }
+
+ // Save data storage configuration.
+ add(ATTR_DATA_STORAGE_CONFIG, new JdkMarshaller().marshal(cfg.getDataStorageConfiguration()));
+ }
+
+ /**
* Add SPI version and class attributes into node attributes.
*
* @param spiList Collection of SPIs to get attributes from.
@@ -2509,14 +2535,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
*
*/
private void ackMemoryConfiguration() {
- MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration();
if (memCfg == null)
return;
- U.log(log, "System cache's MemoryPolicy size is configured to " +
- (memCfg.getSystemCacheInitialSize() / (1024 * 1024)) + " MB. " +
- "Use MemoryConfiguration.systemCacheMemorySize property to change the setting.");
+ U.log(log, "System cache's DataRegion size is configured to " +
+ (memCfg.getSystemRegionInitialSize() / (1024 * 1024)) + " MB. " +
+ "Use DataStorageConfiguration.systemCacheMemorySize property to change the setting.");
}
/**
@@ -2535,12 +2561,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
for (CacheConfiguration c : cacheCfgs) {
String cacheName = U.maskName(c.getName());
- String memPlcName = c.getMemoryPolicyName();
+ String memPlcName = c.getDataRegionName();
if (CU.isSystemCache(cacheName))
memPlcName = "sysMemPlc";
- else if (memPlcName == null && cfg.getMemoryConfiguration() != null)
- memPlcName = cfg.getMemoryConfiguration().getDefaultMemoryPolicyName();
+ else if (memPlcName == null && cfg.getDataStorageConfiguration() != null)
+ memPlcName = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
if (!memPlcNamesMapping.containsKey(memPlcName))
memPlcNamesMapping.put(memPlcName, new ArrayList<String>());
@@ -2551,7 +2577,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
for (Map.Entry<String, ArrayList<String>> e : memPlcNamesMapping.entrySet()) {
- sb.a("in '").a(e.getKey()).a("' memoryPolicy: [");
+ sb.a("in '").a(e.getKey()).a("' dataRegion: [");
for (String s : e.getValue())
sb.a("'").a(s).a("', ");
@@ -3509,7 +3535,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
guard();
try {
@@ -3521,7 +3547,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
guard();
try {
@@ -3533,7 +3559,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
guard();
try {
@@ -3545,6 +3571,21 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) {
return atomicSequence(name, null, initVal, create);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 024f339..277ed79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -184,8 +184,12 @@ public final class IgniteNodeAttributes {
public static final String ATTR_DATA_STREAMER_POOL_SIZE = ATTR_PREFIX + ".data.streamer.pool.size";
/** Memory configuration. */
+ @Deprecated
public static final String ATTR_MEMORY_CONFIG = ATTR_PREFIX + ".memory";
+ /** Data storage configuration. */
+ public static final String ATTR_DATA_STORAGE_CONFIG = ATTR_PREFIX + ".data.storage.config";
+
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 07a5c43..36257e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -57,11 +57,15 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.ExecutorConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
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.TransactionConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
@@ -123,6 +127,8 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
import static org.apache.ignite.internal.IgniteComponentType.SPRING;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.RESTART_JVM;
@@ -2183,15 +2189,27 @@ public class IgnitionEx {
myCfg.setExecutorConfiguration(clone);
}
- if (!myCfg.isClientMode() && myCfg.getMemoryConfiguration() == null) {
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ initializeDataStorageConfiguration(myCfg);
- memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+ return myCfg;
+ }
- myCfg.setMemoryConfiguration(memCfg);
+ /**
+ * @param cfg Ignite configuration.
+ */
+ private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
+ if (cfg.getDataStorageConfiguration() != null &&
+ (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)) {
+ throw new IgniteCheckedException("Data storage can be configured with either legacy " +
+ "(MemoryConfiguration, PersistentStoreConfiguration) or new (DataStorageConfiguration) classes, " +
+ "but not both.");
}
- return myCfg;
+ if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)
+ convertLegacyDataStorageConfigurationToNew(cfg);
+
+ if (!cfg.isClientMode() && cfg.getDataStorageConfiguration() == null)
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration());
}
/**
@@ -2755,4 +2773,108 @@ public class IgnitionEx {
}
}
}
+
+ /**
+ * @param cfg Ignite Configuration with legacy data storage configuration.
+ */
+ private static void convertLegacyDataStorageConfigurationToNew(
+ IgniteConfiguration cfg) throws IgniteCheckedException {
+ boolean persistenceEnabled = cfg.getPersistentStoreConfiguration() != null;
+
+ DataStorageConfiguration dsCfg = new DataStorageConfiguration();
+
+ MemoryConfiguration memCfg = cfg.getMemoryConfiguration() != null ?
+ cfg.getMemoryConfiguration() : new MemoryConfiguration();
+
+ dsCfg.setConcurrencyLevel(memCfg.getConcurrencyLevel());
+ dsCfg.setPageSize(memCfg.getPageSize());
+ dsCfg.setSystemRegionInitialSize(memCfg.getSystemCacheInitialSize());
+ dsCfg.setSystemRegionMaxSize(memCfg.getSystemCacheMaxSize());
+
+ List<DataRegionConfiguration> optionalDataRegions = new ArrayList<>();
+
+ boolean customDfltPlc = false;
+
+ if (memCfg.getMemoryPolicies() != null) {
+ for (MemoryPolicyConfiguration mpc : memCfg.getMemoryPolicies()) {
+ DataRegionConfiguration region = new DataRegionConfiguration();
+
+ region.setPersistenceEnabled(persistenceEnabled);
+
+ if (mpc.getInitialSize() != 0L)
+ region.setInitialSize(mpc.getInitialSize());
+
+ region.setEmptyPagesPoolSize(mpc.getEmptyPagesPoolSize());
+ region.setEvictionThreshold(mpc.getEvictionThreshold());
+ region.setMaxSize(mpc.getMaxSize());
+ region.setName(mpc.getName());
+ region.setPageEvictionMode(mpc.getPageEvictionMode());
+ region.setMetricsRateTimeInterval(mpc.getRateTimeInterval());
+ region.setMetricsSubIntervalCount(mpc.getSubIntervals());
+ region.setSwapPath(mpc.getSwapFilePath());
+ region.setMetricsEnabled(mpc.isMetricsEnabled());
+
+ if (mpc.getName() == null) {
+ throw new IgniteCheckedException(new IllegalArgumentException(
+ "User-defined MemoryPolicyConfiguration must have non-null and non-empty name."));
+ }
+
+ if (mpc.getName().equals(memCfg.getDefaultMemoryPolicyName())) {
+ customDfltPlc = true;
+
+ dsCfg.setDefaultDataRegionConfiguration(region);
+ } else
+ optionalDataRegions.add(region);
+ }
+ }
+
+ if (!optionalDataRegions.isEmpty())
+ dsCfg.setDataRegionConfigurations(optionalDataRegions.toArray(new DataRegionConfiguration[optionalDataRegions.size()]));
+
+ if (!customDfltPlc) {
+ if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(memCfg.getDefaultMemoryPolicyName())) {
+ throw new IgniteCheckedException(new IllegalArgumentException("User-defined default MemoryPolicy " +
+ "name must be presented among configured MemoryPolices: " + memCfg.getDefaultMemoryPolicyName()));
+ }
+
+ dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(memCfg.getDefaultMemoryPolicySize())
+ .setName(memCfg.getDefaultMemoryPolicyName())
+ .setPersistenceEnabled(persistenceEnabled));
+ } else {
+ if (memCfg.getDefaultMemoryPolicySize() != DFLT_MEMORY_POLICY_MAX_SIZE)
+ throw new IgniteCheckedException(new IllegalArgumentException("User-defined MemoryPolicy " +
+ "configuration and defaultMemoryPolicySize properties are set at the same time."));
+ }
+
+ if (persistenceEnabled) {
+ PersistentStoreConfiguration psCfg = cfg.getPersistentStoreConfiguration();
+
+ dsCfg.setCheckpointFrequency(psCfg.getCheckpointingFrequency());
+ dsCfg.setCheckpointPageBufferSize(psCfg.getCheckpointingPageBufferSize());
+ dsCfg.setCheckpointThreads(psCfg.getCheckpointingThreads());
+ dsCfg.setCheckpointWriteOrder(psCfg.getCheckpointWriteOrder());
+ dsCfg.setFileIOFactory(psCfg.getFileIOFactory());
+ dsCfg.setLockWaitTime(psCfg.getLockWaitTime());
+ dsCfg.setStoragePath(psCfg.getPersistentStorePath());
+ dsCfg.setMetricsRateTimeInterval(psCfg.getRateTimeInterval());
+ dsCfg.setMetricsSubIntervalCount(psCfg.getSubIntervals());
+ dsCfg.setWalThreadLocalBufferSize(psCfg.getTlbSize());
+ dsCfg.setWalArchivePath(psCfg.getWalArchivePath());
+ dsCfg.setWalAutoArchiveAfterInactivity(psCfg.getWalAutoArchiveAfterInactivity());
+ dsCfg.setWalFlushFrequency(psCfg.getWalFlushFrequency());
+ dsCfg.setWalFsyncDelayNanos(psCfg.getWalFsyncDelayNanos());
+ dsCfg.setWalHistorySize(psCfg.getWalHistorySize());
+ dsCfg.setWalMode(psCfg.getWalMode());
+ dsCfg.setWalRecordIteratorBufferSize(psCfg.getWalRecordIteratorBufferSize());
+ dsCfg.setWalSegments(psCfg.getWalSegments());
+ dsCfg.setWalSegmentSize(psCfg.getWalSegmentSize());
+ dsCfg.setWalPath(psCfg.getWalStorePath());
+ dsCfg.setAlwaysWriteFullPages(psCfg.isAlwaysWriteFullPages());
+ dsCfg.setMetricsEnabled(psCfg.isMetricsEnabled());
+ dsCfg.setWriteThrottlingEnabled(psCfg.isWriteThrottlingEnabled());
+ }
+
+ cfg.setDataStorageConfiguration(dsCfg);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index f57bda7..1e5c370 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.plugin.PluginProvider;
@@ -506,7 +507,7 @@ public class MarshallerContextImpl implements MarshallerContext {
closProc = ctx.closure();
clientNode = ctx.clientNode();
- if (ctx.config().isPersistentStoreEnabled())
+ if (CU.isPersistenceEnabled(ctx.config()))
fileStore.restoreMappings(this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 14485d2..a3b157d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -53,8 +53,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
-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.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
@@ -1533,32 +1533,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
if(ctx.config().isClientMode())
return 0;
- MemoryConfiguration memCfg = ctx.config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
assert memCfg != null;
- long res = memCfg.getSystemCacheMaxSize();
+ long res = memCfg.getSystemRegionMaxSize();
// Add memory policies.
- MemoryPolicyConfiguration[] memPlcCfgs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
- if (memPlcCfgs != null) {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
-
- boolean customDflt = false;
-
- for (MemoryPolicyConfiguration memPlcCfg : memPlcCfgs) {
- if(F.eq(dfltMemPlcName, memPlcCfg.getName()))
- customDflt = true;
-
- res += memPlcCfg.getMaxSize();
- }
-
- if(!customDflt)
- res += memCfg.getDefaultMemoryPolicySize();
+ if (dataRegions != null) {
+ for (DataRegionConfiguration dataReg : dataRegions)
+ res += dataReg.getMaxSize();
}
- else
- res += memCfg.getDefaultMemoryPolicySize();
+
+ res += memCfg.getDefaultDataRegionConfiguration().getMaxSize();
// Add persistence (if any).
res += GridCacheDatabaseSharedManager.checkpointBufferSize(ctx.config());