http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/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 8bc74a9..39ebced 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js @@ -20,18 +20,22 @@ import DFLT_DIALECTS from 'app/data/dialects.json'; import { EmptyBean, Bean } from './Beans'; import IgniteClusterDefaults from './defaults/Cluster.service'; +import IgniteEventGroups from './defaults/Event-groups.service'; import IgniteCacheDefaults from './defaults/Cache.service'; import IgniteIGFSDefaults from './defaults/IGFS.service'; import JavaTypes from '../../../services/JavaTypes.service'; +import VersionService from 'app/modules/configuration/Version.service'; const clusterDflts = new IgniteClusterDefaults(); const cacheDflts = new IgniteCacheDefaults(); const igfsDflts = new IgniteIGFSDefaults(); - const javaTypes = new JavaTypes(clusterDflts, cacheDflts, igfsDflts); +const versionService = new VersionService(); export default class IgniteConfigurationGenerator { + static eventGrps = new IgniteEventGroups(); + static igniteConfigurationBean(cluster) { return new Bean('org.apache.ignite.configuration.IgniteConfiguration', 'cfg', cluster, clusterDflts); } @@ -60,13 +64,16 @@ export default class IgniteConfigurationGenerator { * Function to generate ignite configuration. * * @param {Object} cluster Cluster to process. - * @param {Boolean} client + * @param {String} version Target version of configuration. + * @param {Boolean} client Is client configuration. * @return {Bean} Generated ignite configuration. */ - static igniteConfiguration(cluster, client) { + static igniteConfiguration(cluster, version, client) { + const available = versionService.since.bind(versionService, version); + const cfg = this.igniteConfigurationBean(cluster); - this.clusterGeneral(cluster, cfg, client); + this.clusterGeneral(cluster, available, cfg, client); this.clusterAtomics(cluster.atomicConfiguration, cfg); this.clusterBinary(cluster.binaryConfiguration, cfg); this.clusterCacheKeyConfiguration(cluster.cacheKeyConfiguration, cfg); @@ -74,24 +81,37 @@ export default class IgniteConfigurationGenerator { this.clusterCollision(cluster.collision, cfg); this.clusterCommunication(cluster, cfg); this.clusterConnector(cluster.connector, cfg); - this.clusterDeployment(cluster, cfg); - this.clusterEvents(cluster, cfg); - this.clusterFailover(cluster, cfg); + this.clusterDeployment(cluster, available, cfg); + this.clusterEvents(cluster, available, cfg); + this.clusterFailover(cluster, available, cfg); + this.clusterHadoop(cluster.hadoopConfiguration, cfg); this.clusterLoadBalancing(cluster, cfg); this.clusterLogger(cluster.logger, cfg); + this.clusterMarshaller(cluster, available, cfg); + + // Since ignite 2.0 + if (available('2.0.0')) + this.clusterMemory(cluster.memoryConfiguration, cfg); + + this.clusterMisc(cluster, available, cfg); + this.clusterMetrics(cluster, available, cfg); this.clusterODBC(cluster.odbc, cfg); - this.clusterMarshaller(cluster, cfg); - this.clusterMetrics(cluster, cfg); - this.clusterTime(cluster, cfg); - this.clusterPools(cluster, cfg); - this.clusterTransactions(cluster.transactionConfiguration, cfg); + this.clusterServiceConfiguration(cluster.serviceConfigurations, cluster.caches, cfg); this.clusterSsl(cluster, cfg); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + this.clusterSwap(cluster, cfg); + + this.clusterPools(cluster, available, cfg); + this.clusterTime(cluster, available, cfg); + this.clusterTransactions(cluster.transactionConfiguration, cfg); this.clusterUserAttributes(cluster, cfg); - this.clusterCaches(cluster, cluster.caches, cluster.igfss, client, cfg); + this.clusterCaches(cluster, cluster.caches, cluster.igfss, available, client, cfg); if (!client) - this.clusterIgfss(cluster.igfss, cfg); + this.clusterIgfss(cluster.igfss, available, cfg); return cfg; } @@ -154,12 +174,16 @@ export default class IgniteConfigurationGenerator { } // Generate general section. - static clusterGeneral(cluster, cfg = this.igniteConfigurationBean(cluster), client = false) { + static clusterGeneral(cluster, available, cfg = this.igniteConfigurationBean(cluster), client = false) { if (client) cfg.prop('boolean', 'clientMode', true); - cfg.stringProperty('name', 'igniteInstanceName') - .stringProperty('localHost'); + if (available('2.0.0')) + cfg.stringProperty('name', 'igniteInstanceName'); + else + cfg.stringProperty('name', 'gridName'); + + cfg.stringProperty('localHost'); if (_.isNil(cluster.discovery)) return cfg; @@ -338,12 +362,12 @@ export default class IgniteConfigurationGenerator { if (ipFinder) discovery.beanProperty('ipFinder', ipFinder); - this.clusterDiscovery(cluster.discovery, cfg, discovery); + this.clusterDiscovery(cluster.discovery, available, cfg, discovery); return cfg; } - static igfsDataCache(igfs) { + static igfsDataCache(igfs, available) { return this.cacheConfiguration({ name: igfs.name + '-data', cacheMode: 'PARTITIONED', @@ -351,25 +375,25 @@ export default class IgniteConfigurationGenerator { writeSynchronizationMode: 'FULL_SYNC', backups: 0, igfsAffinnityGroupSize: igfs.affinnityGroupSize || 512 - }); + }, available); } - static igfsMetaCache(igfs) { + static igfsMetaCache(igfs, available) { return this.cacheConfiguration({ name: igfs.name + '-meta', cacheMode: 'REPLICATED', atomicityMode: 'TRANSACTIONAL', writeSynchronizationMode: 'FULL_SYNC' - }); + }, available); } - static clusterCaches(cluster, caches, igfss, client, cfg = this.igniteConfigurationBean(cluster)) { - const ccfgs = _.map(caches, (cache) => this.cacheConfiguration(cache)); + static clusterCaches(cluster, caches, igfss, available, client, cfg = this.igniteConfigurationBean(cluster)) { + const ccfgs = _.map(caches, (cache) => this.cacheConfiguration(cache, available)); if (!client) { _.forEach(igfss, (igfs) => { - ccfgs.push(this.igfsDataCache(igfs)); - ccfgs.push(this.igfsMetaCache(igfs)); + ccfgs.push(this.igfsDataCache(igfs, available)); + ccfgs.push(this.igfsMetaCache(igfs, available)); }); } @@ -850,7 +874,7 @@ export default class IgniteConfigurationGenerator { } // Generate deployment group. - static clusterDeployment(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterDeployment(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { cfg.enumProperty('deploymentMode') .boolProperty('peerClassLoadingEnabled'); @@ -861,6 +885,10 @@ export default class IgniteConfigurationGenerator { cluster.peerClassLoadingLocalClassPathExclude); } + // Since ignite 2.0 + if (available('2.0.0')) + cfg.emptyBeanProperty('classLoader'); + let deploymentBean = null; switch (_.get(cluster, 'deploymentSpi.kind')) { @@ -905,9 +933,7 @@ export default class IgniteConfigurationGenerator { } // Generate discovery group. - static clusterDiscovery(discovery, cfg = this.igniteConfigurationBean(), discoSpi = this.discoveryConfigurationBean(discovery)) { - // TODO IGNITE-4988 cfg.intProperty('metricsUpdateFrequency') - + static clusterDiscovery(discovery, available, cfg = this.igniteConfigurationBean(), discoSpi = this.discoveryConfigurationBean(discovery)) { discoSpi.stringProperty('localAddress') .intProperty('localPort') .intProperty('localPortRange') @@ -917,8 +943,16 @@ export default class IgniteConfigurationGenerator { .intProperty('maxAckTimeout') .intProperty('networkTimeout') .intProperty('joinTimeout') - .intProperty('threadPriority') - .intProperty('topHistorySize') + .intProperty('threadPriority'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) { + discoSpi.intProperty('heartbeatFrequency') + .intProperty('maxMissedHeartbeats') + .intProperty('maxMissedClientHeartbeats'); + } + + discoSpi.intProperty('topHistorySize') .emptyBeanProperty('listener') .emptyBeanProperty('dataExchange') .emptyBeanProperty('metricsProvider') @@ -936,7 +970,7 @@ export default class IgniteConfigurationGenerator { } // Generate events group. - static clusterEvents(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterEvents(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { const eventStorage = cluster.eventStorage; let eventStorageBean = null; @@ -963,19 +997,56 @@ export default class IgniteConfigurationGenerator { // No-op. } - if (eventStorageBean && eventStorageBean.nonEmpty()) - cfg.beanProperty('eventStorageSpi', eventStorageBean); + if (eventStorageBean) { + if (!eventStorageBean.isEmpty() || !available(['1.0.0', '2.0.0'])) + cfg.beanProperty('eventStorageSpi', eventStorageBean); + + if (_.nonEmpty(cluster.includeEventTypes)) { + const eventGrps = _.filter(this.eventGrps, ({value}) => _.includes(cluster.includeEventTypes, value)); + + if (available('2.0.0')) { + const events = _.reduce(eventGrps, (acc, eventGrp) => { + switch (eventGrp.value) { + case 'EVTS_SWAPSPACE': + // Removed. + + break; + case 'EVTS_CACHE': + const eventGrpX2 = _.cloneDeep(eventGrp); + + eventGrpX2.events = _.filter(eventGrpX2.events, (ev) => + !_.includes(['EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED'], ev)); + + acc.push(eventGrpX2); - if (_.nonEmpty(cluster.includeEventTypes)) - cfg.eventTypes('evts', 'includeEventTypes', cluster.includeEventTypes); + break; + default: + acc.push(eventGrp); + } + + return acc; + }, []); + + cfg.eventTypes('evts', 'includeEventTypes', events); + } + else + cfg.eventTypes('evts', 'includeEventTypes', eventGrps); + } + } return cfg; } // Generate failover group. - static clusterFailover(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterFailover(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { const spis = []; + // Since ignite 2.0 + if (available('2.0.0')) { + cfg.intProperty('failureDetectionTimeout') + .intProperty('clientFailureDetectionTimeout'); + } + _.forEach(cluster.failoverSpi, (spi) => { let failoverSpi; @@ -1020,6 +1091,51 @@ export default class IgniteConfigurationGenerator { return cfg; } + // Generate failover group. + static clusterHadoop(hadoop, cfg = this.igniteConfigurationBean()) { + const hadoopBean = new Bean('org.apache.ignite.configuration.HadoopConfiguration', 'hadoop', hadoop, clusterDflts.hadoopConfiguration); + + let plannerBean; + + switch (_.get(hadoop, 'mapReducePlanner.kind')) { + case 'Weighted': + plannerBean = new Bean('org.apache.ignite.hadoop.mapreduce.IgniteHadoopWeightedMapReducePlanner', 'planner', + _.get(hadoop, 'mapReducePlanner.Weighted'), clusterDflts.hadoopConfiguration.mapReducePlanner.Weighted); + + plannerBean.intProperty('localMapperWeight') + .intProperty('remoteMapperWeight') + .intProperty('localReducerWeight') + .intProperty('remoteReducerWeight') + .intProperty('preferLocalReducerThresholdWeight'); + + break; + + case 'Custom': + const clsName = _.get(hadoop, 'mapReducePlanner.Custom.className'); + + if (clsName) + plannerBean = new EmptyBean(clsName); + + break; + + default: + // No-op. + } + + if (plannerBean) + hadoopBean.beanProperty('mapReducePlanner', plannerBean); + + hadoopBean.intProperty('finishedJobInfoTtl') + .intProperty('maxParallelTasks') + .intProperty('maxTaskQueueSize') + .arrayProperty('nativeLibraryNames', 'nativeLibraryNames', _.get(hadoop, 'nativeLibraryNames')); + + if (!hadoopBean.isEmpty()) + cfg.beanProperty('hadoopConfiguration', hadoopBean); + + return cfg; + } + // Generate load balancing configuration group. static clusterLoadBalancing(cluster, cfg = this.igniteConfigurationBean(cluster)) { const spis = []; @@ -1161,15 +1277,78 @@ export default class IgniteConfigurationGenerator { return cfg; } + // Generate logger group. + static clusterMemory(memoryConfiguration, cfg = this.igniteConfigurationBean()) { + const memoryBean = new Bean('org.apache.ignite.configuration.MemoryConfiguration', 'memoryConfiguration', memoryConfiguration, clusterDflts.memoryConfiguration); + + memoryBean.intProperty('pageSize') + .intProperty('concurrencyLevel') + .intProperty('systemCacheInitialSize') + .intProperty('systemCacheMaxSize') + .stringProperty('defaultMemoryPolicyName'); + + if (memoryBean.valueOf('defaultMemoryPolicyName') === 'default') + memoryBean.intProperty('defaultMemoryPolicySize'); + + const policies = []; + + _.forEach(_.get(memoryConfiguration, 'memoryPolicies'), (plc) => { + const plcBean = new Bean('org.apache.ignite.configuration.MemoryPolicyConfiguration', 'policy', plc, clusterDflts.memoryConfiguration.memoryPolicies); + + plcBean.stringProperty('name') + .intProperty('initialSize') + .intProperty('maxSize') + .stringProperty('swapFilePath') + .enumProperty('pageEvictionMode') + .intProperty('evictionThreshold') + .intProperty('emptyPagesPoolSize') + .boolProperty('metricsEnabled'); + + policies.push(plcBean); + }); + + if (!_.isEmpty(policies)) + memoryBean.arrayProperty('memoryPolicies', 'memoryPolicies', policies, 'org.apache.ignite.configuration.MemoryPolicyConfiguration'); + + if (memoryBean.isEmpty()) + return cfg; + + cfg.beanProperty('memoryConfiguration', memoryBean); + + return cfg; + } + + // Generate miscellaneous configuration. + static clusterMisc(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { + cfg.stringProperty('workDirectory'); + + // Since Ignite 2.0 + if (available('2.0.0')) { + cfg.stringProperty('consistentId') + .emptyBeanProperty('warmupClosure') + .boolProperty('activeOnStart') + .boolProperty('cacheSanityCheckEnabled'); + } + + cfg.boolProperty('lateAffinityAssignment'); + + return cfg; + } + // Generate IGFSs configs. - static clusterIgfss(igfss, cfg = this.igniteConfigurationBean()) { + static clusterIgfss(igfss, available, cfg = this.igniteConfigurationBean()) { const igfsCfgs = _.map(igfss, (igfs) => { - const igfsCfg = this.igfsGeneral(igfs); + const igfsCfg = this.igfsGeneral(igfs, available); this.igfsIPC(igfs, igfsCfg); this.igfsFragmentizer(igfs, igfsCfg); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + this.igfsDualMode(igfs, igfsCfg); + this.igfsSecondFS(igfs, igfsCfg); - this.igfsMisc(igfs, igfsCfg); + this.igfsMisc(igfs, available, igfsCfg); return igfsCfg; }); @@ -1180,7 +1359,7 @@ export default class IgniteConfigurationGenerator { } // Generate marshaller group. - static clusterMarshaller(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterMarshaller(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { const kind = _.get(cluster.marshaller, 'kind'); const settings = _.get(cluster.marshaller, kind); @@ -1188,7 +1367,7 @@ export default class IgniteConfigurationGenerator { switch (kind) { case 'OptimizedMarshaller': - bean = new Bean('org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller', 'marshaller', settings) + bean = new Bean('org.apache.ignite.marshaller.optimized.OptimizedMarshaller', 'marshaller', settings) .intProperty('poolSize') .intProperty('requireSerializable'); @@ -1208,15 +1387,24 @@ export default class IgniteConfigurationGenerator { cfg.intProperty('marshalLocalJobs'); + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) { + cfg.intProperty('marshallerCacheKeepAliveTime') + .intProperty('marshallerCacheThreadPoolSize', 'marshallerCachePoolSize'); + } + return cfg; } // Generate metrics group. - static clusterMetrics(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterMetrics(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { cfg.intProperty('metricsExpireTime') .intProperty('metricsHistorySize') - .intProperty('metricsLogFrequency') - .intProperty('metricsUpdateFrequency'); + .intProperty('metricsLogFrequency'); + + // Since ignite 2.0 + if (available('2.0.0')) + cfg.intProperty('metricsUpdateFrequency'); return cfg; } @@ -1237,20 +1425,43 @@ export default class IgniteConfigurationGenerator { return cfg; } + // Java code generator for cluster's service configurations. + static clusterServiceConfiguration(srvs, caches, cfg = this.igniteConfigurationBean()) { + const srvBeans = []; + + _.forEach(srvs, (srv) => { + const bean = new Bean('org.apache.ignite.services.ServiceConfiguration', 'service', srv, clusterDflts.serviceConfigurations); + + bean.stringProperty('name') + .emptyBeanProperty('service') + .intProperty('maxPerNodeCount') + .intProperty('totalCount') + .stringProperty('cache', 'cacheName', (_id) => _id ? _.find(caches, {_id}).name : null) + .stringProperty('affinityKey'); + + srvBeans.push(bean); + }); + + if (!_.isEmpty(srvBeans)) + cfg.arrayProperty('services', 'serviceConfiguration', srvBeans, 'org.apache.ignite.services.ServiceConfiguration'); + + return cfg; + } + // Java code generator for cluster's SSL configuration. static clusterSsl(cluster, cfg = this.igniteConfigurationBean(cluster)) { if (cluster.sslEnabled && _.nonNil(cluster.sslContextFactory)) { const bean = new Bean('org.apache.ignite.ssl.SslContextFactory', 'sslCtxFactory', cluster.sslContextFactory); - bean.stringProperty('keyAlgorithm') + bean.intProperty('keyAlgorithm') .pathProperty('keyStoreFilePath'); if (_.nonEmpty(bean.valueOf('keyStoreFilePath'))) bean.propertyChar('keyStorePassword', 'ssl.key.storage.password', 'YOUR_SSL_KEY_STORAGE_PASSWORD'); - bean.stringProperty('keyStoreType') - .stringProperty('protocol'); + bean.intProperty('keyStoreType') + .intProperty('protocol'); if (_.nonEmpty(cluster.sslContextFactory.trustManagers)) { bean.arrayProperty('trustManagers', 'trustManagers', @@ -1263,7 +1474,7 @@ export default class IgniteConfigurationGenerator { if (_.nonEmpty(bean.valueOf('trustStoreFilePath'))) bean.propertyChar('trustStorePassword', 'ssl.trust.storage.password', 'YOUR_SSL_TRUST_STORAGE_PASSWORD'); - bean.stringProperty('trustStoreType'); + bean.intProperty('trustStoreType'); } cfg.beanProperty('sslContextFactory', bean); @@ -1272,8 +1483,31 @@ export default class IgniteConfigurationGenerator { return cfg; } + // Generate swap group. + static clusterSwap(cluster, cfg = this.igniteConfigurationBean(cluster)) { + if (_.get(cluster.swapSpaceSpi, 'kind') === 'FileSwapSpaceSpi') { + const bean = new Bean('org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi', 'swapSpaceSpi', + cluster.swapSpaceSpi.FileSwapSpaceSpi); + + bean.pathProperty('baseDirectory') + .intProperty('readStripesNumber') + .floatProperty('maximumSparsity') + .intProperty('maxWriteQueueSize') + .intProperty('writeBufferSize'); + + cfg.beanProperty('swapSpaceSpi', bean); + } + + return cfg; + } + // Generate time group. - static clusterTime(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterTime(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { + if (available(['1.0.0', '2.0.0'])) { + cfg.intProperty('clockSyncSamples') + .intProperty('clockSyncFrequency'); + } + cfg.intProperty('timeServerPortBase') .intProperty('timeServerPortRange'); @@ -1281,12 +1515,38 @@ export default class IgniteConfigurationGenerator { } // Generate thread pools group. - static clusterPools(cluster, cfg = this.igniteConfigurationBean(cluster)) { + static clusterPools(cluster, available, cfg = this.igniteConfigurationBean(cluster)) { cfg.intProperty('publicThreadPoolSize') .intProperty('systemThreadPoolSize') + .intProperty('serviceThreadPoolSize') .intProperty('managementThreadPoolSize') .intProperty('igfsThreadPoolSize') - .intProperty('rebalanceThreadPoolSize'); + .intProperty('rebalanceThreadPoolSize') + .intProperty('utilityCacheThreadPoolSize', 'utilityCachePoolSize') + .intProperty('utilityCacheKeepAliveTime') + .intProperty('asyncCallbackPoolSize') + .intProperty('stripedPoolSize'); + + // Since ignite 2.0 + if (available('2.0.0')) { + cfg.intProperty('dataStreamerThreadPoolSize') + .intProperty('queryThreadPoolSize'); + + const executors = []; + + _.forEach(cluster.executorConfiguration, (exec) => { + const execBean = new Bean('org.apache.ignite.configuration.ExecutorConfiguration', 'executor', exec); + + execBean.stringProperty('name') + .intProperty('size'); + + if (!execBean.isEmpty()) + executors.push(execBean); + }); + + if (!_.isEmpty(executors)) + cfg.arrayProperty('executors', 'executorConfiguration', executors, 'org.apache.ignite.configuration.ExecutorConfiguration'); + } return cfg; } @@ -1427,7 +1687,7 @@ export default class IgniteConfigurationGenerator { } // Generate cache general group. - static cacheGeneral(cache, ccfg = this.cacheConfigurationBean(cache)) { + static cacheGeneral(cache, available, ccfg = this.cacheConfigurationBean(cache)) { ccfg.stringProperty('name') .enumProperty('cacheMode') .enumProperty('atomicityMode'); @@ -1437,7 +1697,9 @@ export default class IgniteConfigurationGenerator { .intProperty('readFromBackup'); } - ccfg.enumProperty('partitionLossPolicy'); + // Since ignite 2.0 + if (available('2.0.0')) + ccfg.enumProperty('partitionLossPolicy'); ccfg.intProperty('copyOnRead'); @@ -1459,7 +1721,7 @@ export default class IgniteConfigurationGenerator { } // Generate cache memory group. - static cacheAffinity(cache, ccfg = this.cacheConfigurationBean(cache)) { + static cacheAffinity(cache, available, ccfg = this.cacheConfigurationBean(cache)) { switch (_.get(cache, 'affinity.kind')) { case 'Rendezvous': ccfg.beanProperty('affinity', this.cacheAffinityFunction('org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction', cache.affinity.Rendezvous)); @@ -1479,18 +1741,46 @@ export default class IgniteConfigurationGenerator { ccfg.emptyBeanProperty('affinityMapper'); + // Since ignite 2.0 + if (available('2.0.0')) + ccfg.emptyBeanProperty('topologyValidator'); + return ccfg; } // Generate cache memory group. - static cacheMemory(cache, ccfg = this.cacheConfigurationBean(cache)) { + static cacheMemory(cache, available, ccfg = this.cacheConfigurationBean(cache)) { + // Since ignite 2.0 + if (available('2.0.0')) + ccfg.stringProperty('memoryPolicyName'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) { + ccfg.enumProperty('memoryMode'); + + if (ccfg.valueOf('memoryMode') !== 'OFFHEAP_VALUES') + ccfg.intProperty('offHeapMaxMemory'); + } + + // Since ignite 2.0 + if (available('2.0.0')) { + ccfg.boolProperty('onheapCacheEnabled') + .emptyBeanProperty('evictionFilter'); + } + this._evictionPolicy(ccfg, 'evictionPolicy', cache.evictionPolicy, cacheDflts.evictionPolicy); + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) { + ccfg.intProperty('startSize') + .boolProperty('swapEnabled'); + } + return ccfg; } // Generate cache queries & Indexing group. - static cacheQuery(cache, domains, ccfg = this.cacheConfigurationBean(cache)) { + static cacheQuery(cache, domains, available, ccfg = this.cacheConfigurationBean(cache)) { const indexedTypes = _.reduce(domains, (acc, domain) => { if (domain.queryMetadata === 'Annotations') acc.push(domain.keyType, domain.valueType); @@ -1498,19 +1788,34 @@ export default class IgniteConfigurationGenerator { return acc; }, []); - ccfg.stringProperty('sqlSchema') - .intProperty('longQueryWarningTimeout') + ccfg.stringProperty('sqlSchema'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + ccfg.intProperty('sqlOnheapRowCacheSize'); + + ccfg.intProperty('longQueryWarningTimeout') .arrayProperty('indexedTypes', 'indexedTypes', indexedTypes, 'java.lang.Class') .intProperty('queryDetailMetricsSize') - .intProperty('queryParallelism') - .arrayProperty('sqlFunctionClasses', 'sqlFunctionClasses', cache.sqlFunctionClasses, 'java.lang.Class') - .intProperty('sqlEscapeAll'); + .arrayProperty('sqlFunctionClasses', 'sqlFunctionClasses', cache.sqlFunctionClasses, 'java.lang.Class'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + ccfg.intProperty('snapshotableIndex'); + + ccfg.intProperty('sqlEscapeAll'); + + // Since ignite 2.0 + if (available('2.0.0')) { + ccfg.intProperty('queryParallelism') + .intProperty('sqlIndexMaxInlineSize'); + } return ccfg; } // Generate cache store group. - static cacheStore(cache, domains, ccfg = this.cacheConfigurationBean(cache)) { + static cacheStore(cache, domains, available, ccfg = this.cacheConfigurationBean(cache)) { const kind = _.get(cache, 'cacheStoreFactory.kind'); if (kind && cache.cacheStoreFactory[kind]) { @@ -1611,52 +1916,66 @@ export default class IgniteConfigurationGenerator { .intProperty('writeBehindFlushSize') .intProperty('writeBehindFlushFrequency') .intProperty('writeBehindFlushThreadCount'); + + // Since ignite 2.0 + if (available('2.0.0')) + ccfg.boolProperty('writeBehindCoalescing'); } return ccfg; } // Generate cache concurrency control group. - static cacheConcurrency(cache, ccfg = this.cacheConfigurationBean(cache)) { + static cacheConcurrency(cache, available, ccfg = this.cacheConfigurationBean(cache)) { ccfg.intProperty('maxConcurrentAsyncOperations') - .intProperty('defaultLockTimeout') - .enumProperty('writeSynchronizationMode'); + .intProperty('defaultLockTimeout'); - return ccfg; - } + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + ccfg.enumProperty('atomicWriteOrderMode'); - // Generate cache node filter group. - static cacheNodeFilter(cache, igfss, ccfg = this.cacheConfigurationBean(cache)) { - const kind = _.get(cache, 'nodeFilter.kind'); + ccfg.enumProperty('writeSynchronizationMode'); - const settings = _.get(cache.nodeFilter, kind); + return ccfg; + } - if (_.isNil(settings)) - return ccfg; + static nodeFilter(filter, igfss) { + const kind = _.get(filter, 'kind'); - let bean = null; + const settings = _.get(filter, kind); - switch (kind) { - case 'IGFS': - const foundIgfs = _.find(igfss, {_id: settings.igfs}); + if (!_.isNil(settings)) { + switch (kind) { + case 'IGFS': + const foundIgfs = _.find(igfss, {_id: settings.igfs}); - if (foundIgfs) { - bean = new Bean('org.apache.ignite.internal.processors.igfs.IgfsNodePredicate', 'nodeFilter', foundIgfs) - .stringConstructorArgument('name'); - } + if (foundIgfs) { + return new Bean('org.apache.ignite.internal.processors.igfs.IgfsNodePredicate', 'nodeFilter', foundIgfs) + .stringConstructorArgument('name'); + } - break; - case 'Custom': - if (_.nonEmpty(settings.className)) - bean = new EmptyBean(settings.className); + break; + case 'Custom': + if (_.nonEmpty(settings.className)) + return new EmptyBean(settings.className); - break; - default: + break; + default: // No-op. + } } - if (bean) - ccfg.beanProperty('nodeFilter', bean); + return null; + } + + // Generate cache node filter group. + static cacheNodeFilter(cache, igfss, ccfg = this.cacheConfigurationBean(cache)) { + const filter = _.get(cache, 'nodeFilter'); + + const filterBean = this.nodeFilter(filter, igfss); + + if (filterBean) + ccfg.beanProperty('nodeFilter', filterBean); return ccfg; } @@ -1744,16 +2063,16 @@ export default class IgniteConfigurationGenerator { ccfg.collectionProperty('qryEntities', 'queryEntities', qryEntities, 'org.apache.ignite.cache.QueryEntity'); } - static cacheConfiguration(cache, ccfg = this.cacheConfigurationBean(cache)) { - this.cacheGeneral(cache, ccfg); - this.cacheAffinity(cache, ccfg); - this.cacheMemory(cache, ccfg); - this.cacheQuery(cache, cache.domains, ccfg); - this.cacheStore(cache, cache.domains, ccfg); + static cacheConfiguration(cache, available, ccfg = this.cacheConfigurationBean(cache)) { + this.cacheGeneral(cache, available, ccfg); + this.cacheAffinity(cache, available, ccfg); + this.cacheMemory(cache, available, ccfg); + this.cacheQuery(cache, cache.domains, available, ccfg); + this.cacheStore(cache, cache.domains, available, ccfg); const igfs = _.get(cache, 'nodeFilter.IGFS.instance'); this.cacheNodeFilter(cache, igfs ? [igfs] : [], ccfg); - this.cacheConcurrency(cache, ccfg); + this.cacheConcurrency(cache, available, ccfg); this.cacheRebalance(cache, ccfg); this.cacheNearServer(cache, ccfg); this.cacheStatistics(cache, ccfg); @@ -1763,12 +2082,19 @@ export default class IgniteConfigurationGenerator { } // Generate IGFS general group. - static igfsGeneral(igfs, cfg = this.igfsConfigurationBean(igfs)) { + static igfsGeneral(igfs, available, cfg = this.igfsConfigurationBean(igfs)) { if (_.isEmpty(igfs.name)) return cfg; - cfg.stringProperty('name') - .enumProperty('defaultMode'); + cfg.stringProperty('name'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) { + cfg.stringProperty('name', 'dataCacheName', (name) => name + '-data') + .stringProperty('name', 'metaCacheName', (name) => name + '-meta'); + } + + cfg.enumProperty('defaultMode'); return cfg; } @@ -1830,20 +2156,50 @@ export default class IgniteConfigurationGenerator { return cfg; } + // Generate IGFS Dual mode group. + static igfsDualMode(igfs, cfg = this.igfsConfigurationBean(igfs)) { + cfg.intProperty('dualModeMaxPendingPutsSize') + .emptyBeanProperty('dualModePutExecutorService') + .intProperty('dualModePutExecutorServiceShutdown'); + + return cfg; + } + // Generate IGFS miscellaneous group. - static igfsMisc(igfs, cfg = this.igfsConfigurationBean(igfs)) { - cfg.intProperty('blockSize') - .intProperty('bufferSize') - .intProperty('maximumTaskRangeLength') + static igfsMisc(igfs, available, cfg = this.igfsConfigurationBean(igfs)) { + cfg.intProperty('blockSize'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + cfg.intProperty('streamBufferSize'); + + // Since ignite 2.0 + if (available('2.0.0')) + cfg.intProperty('streamBufferSize', 'bufferSize'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + cfg.intProperty('maxSpaceSize'); + + cfg.intProperty('maximumTaskRangeLength') .intProperty('managementPort') .intProperty('perNodeBatchSize') .intProperty('perNodeParallelBatchCount') .intProperty('prefetchBlocks') - .intProperty('sequentialReadsBeforePrefetch') - .intProperty('colocateMetadata') + .intProperty('sequentialReadsBeforePrefetch'); + + // Removed in ignite 2.0 + if (available(['1.0.0', '2.0.0'])) + cfg.intProperty('trashPurgeTimeout'); + + cfg.intProperty('colocateMetadata') .intProperty('relaxedConsistency') .mapProperty('pathModes', 'pathModes'); + // Since ignite 2.0 + if (available('2.0.0')) + cfg.boolProperty('updateFileLengthOnFlush'); + return cfg; } }
http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js index bcfa2e2..91457e8 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js @@ -23,13 +23,13 @@ export default class IgniteDockerGenerator { * Generate from section. * * @param {Object} cluster Cluster. - * @param {String} ver Ignite version. + * @param {Object} targetVer Target version. * @returns {String} */ - from(cluster, ver) { + from(cluster, targetVer) { return [ '# Start from Apache Ignite image.', - `FROM apacheignite/ignite:${ver}` + `FROM apacheignite/ignite:${targetVer.ignite}` ].join('\n'); } @@ -37,11 +37,11 @@ export default class IgniteDockerGenerator { * Generate Docker file for cluster. * * @param {Object} cluster Cluster. - * @param {String} ver Ignite version. + * @param {Object} targetVer Target version. */ - generate(cluster, ver) { + generate(cluster, targetVer) { return [ - this.from(cluster, ver), + this.from(cluster, targetVer), '', '# Set config uri for node.', `ENV CONFIG_URI config/${cluster.name}-server.xml`, http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js index df10b23..bf1a667 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js @@ -568,12 +568,17 @@ export default class IgniteJavaTransformer extends AbstractTransformer { break; case 'EVENT_TYPES': - if (prop.eventTypes.length === 1) - this._setProperty(sb, id, prop.name, _.head(prop.eventTypes)); + if (prop.eventTypes.length === 1) { + const evtGrp = _.head(prop.eventTypes); + + this._setProperty(sb, id, prop.name, evtGrp.label); + } else { - sb.append(`int[] ${prop.id} = new int[${_.head(prop.eventTypes)}.length`); + const evtGrp = _.map(prop.eventTypes, 'label'); - _.forEach(_.tail(prop.eventTypes), (evtGrp) => { + sb.append(`int[] ${prop.id} = new int[${_.head(evtGrp)}.length`); + + _.forEach(_.tail(evtGrp), (evtGrp) => { sb.append(` + ${evtGrp}.length`); }); @@ -583,12 +588,12 @@ export default class IgniteJavaTransformer extends AbstractTransformer { sb.append('int k = 0;'); - _.forEach(prop.eventTypes, (evtGrp, evtIdx) => { + _.forEach(evtGrp, (evtGrp, evtIdx) => { sb.emptyLine(); sb.append(`System.arraycopy(${evtGrp}, 0, ${prop.id}, k, ${evtGrp}.length);`); - if (evtIdx < prop.eventTypes.length - 1) + if (evtIdx < evtGrp.length - 1) sb.append(`k += ${evtGrp}.length;`); }); @@ -810,7 +815,7 @@ export default class IgniteJavaTransformer extends AbstractTransformer { } static _prepareImports(imports) { - return _.sortedUniq(_.sortBy(_.filter(imports, (cls) => !cls.startsWith('java.lang.') && _.includes(cls, '.')))); + return _.sortedUniq(_.sortBy(_.filter(imports, (cls) => !_.startsWith(cls, 'java.lang.') && _.includes(cls, '.')))); } /** @@ -823,10 +828,8 @@ export default class IgniteJavaTransformer extends AbstractTransformer { _.forEach(bean.properties, (prop) => { switch (prop.clsName) { case 'EVENT_TYPES': - _.forEach(prop.eventTypes, (value) => { - const evtGrp = _.find(this.eventGroups, {value}); - - imports.push(`${evtGrp.class}.${evtGrp.value}`); + _.forEach(prop.eventTypes, (grp) => { + imports.push(`${grp.class}.${grp.value}`); }); break; @@ -1035,10 +1038,11 @@ export default class IgniteJavaTransformer extends AbstractTransformer { return sb; } - static cluster(cluster, pkg, clsName, client) { - const cfg = this.generator.igniteConfiguration(cluster, client); + static cluster(cluster, targetVer, pkg, clsName, client) { + const cfg = this.generator.igniteConfiguration(cluster, targetVer, client); - const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : []; + const clientNearCaches = client ? _.filter(cluster.caches, (cache) => + cache.mode === 'PARTITIONED' && _.get(cache, 'clientNearConfiguration.enabled')) : []; return this.igniteConfiguration(cfg, pkg, clsName, clientNearCaches); } http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js index 23a9c4e..f6f6a80 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js @@ -16,7 +16,6 @@ */ import StringBuilder from './StringBuilder'; -import IgniteVersion from 'app/modules/configuration/Version.service'; // Java built-in class names. import POM_DEPENDENCIES from 'app/data/pom-dependencies.json'; @@ -142,11 +141,11 @@ export default class IgniteMavenGenerator { /** * Generate pom.xml. * - * @param cluster Cluster to take info about dependencies. - * @param version Version for Ignite dependencies. - * @returns {string} Generated content. + * @param {Object} cluster Cluster to take info about dependencies. + * @param {Object} targetVer Target version for dependencies. + * @returns {String} Generated content. */ - generate(cluster, version = IgniteVersion.ignite) { + generate(cluster, targetVer) { const caches = cluster.caches; const deps = []; const storeDeps = []; @@ -154,12 +153,14 @@ export default class IgniteMavenGenerator { const blobStoreFactory = {cacheStoreFactory: {kind: 'CacheHibernateBlobStoreFactory'}}; + const igniteVer = targetVer.ignite; + _.forEach(caches, (cache) => { if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) this.storeFactoryDependency(storeDeps, cache.cacheStoreFactory[cache.cacheStoreFactory.kind]); if (_.get(cache, 'nodeFilter.kind') === 'Exclude') - this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', version); + this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', igniteVer); }); const sb = new StringBuilder(); @@ -178,21 +179,21 @@ export default class IgniteMavenGenerator { sb.emptyLine(); - this.artifact(sb, cluster, version); + this.artifact(sb, cluster, igniteVer); - this.addDependency(deps, 'org.apache.ignite', 'ignite-core', version); + this.addDependency(deps, 'org.apache.ignite', 'ignite-core', igniteVer); - this.addDependency(deps, 'org.apache.ignite', 'ignite-spring', version); - this.addDependency(deps, 'org.apache.ignite', 'ignite-indexing', version); - this.addDependency(deps, 'org.apache.ignite', 'ignite-rest-http', version); + this.addDependency(deps, 'org.apache.ignite', 'ignite-spring', igniteVer); + this.addDependency(deps, 'org.apache.ignite', 'ignite-indexing', igniteVer); + this.addDependency(deps, 'org.apache.ignite', 'ignite-rest-http', igniteVer); if (_.get(cluster, 'deploymentSpi.kind') === 'URI') - this.addDependency(deps, 'org.apache.ignite', 'ignite-urideploy', version); + this.addDependency(deps, 'org.apache.ignite', 'ignite-urideploy', igniteVer); let dep = POM_DEPENDENCIES[cluster.discovery.kind]; if (dep) - this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version); + this.addDependency(deps, 'org.apache.ignite', dep.artifactId, igniteVer); if (cluster.discovery.kind === 'Jdbc') { const store = cluster.discovery.Jdbc; @@ -206,23 +207,24 @@ export default class IgniteMavenGenerator { dep = POM_DEPENDENCIES.S3; if (dep) - this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version); + this.addDependency(deps, 'org.apache.ignite', dep.artifactId, igniteVer); } else if (spi.kind === 'JDBC') this.storeFactoryDependency(storeDeps, spi.JDBC); }); - if (_.find(cluster.igfss, (igfs) => igfs.secondaryFileSystemEnabled)) - this.addDependency(deps, 'org.apache.ignite', 'ignite-hadoop', version); + if (_.get(cluster, 'hadoopConfiguration.mapReducePlanner.kind') === 'Weighted' || + _.find(cluster.igfss, (igfs) => igfs.secondaryFileSystemEnabled)) + this.addDependency(deps, 'org.apache.ignite', 'ignite-hadoop', igniteVer); if (_.find(caches, blobStoreFactory)) - this.addDependency(deps, 'org.apache.ignite', 'ignite-hibernate', version); + this.addDependency(deps, 'org.apache.ignite', 'ignite-hibernate', igniteVer); if (cluster.logger && cluster.logger.kind) { dep = POM_DEPENDENCIES[cluster.logger.kind]; if (dep) - this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version); + this.addDependency(deps, 'org.apache.ignite', dep.artifactId, igniteVer); } this.dependencies(sb, cluster, deps.concat(storeDeps)); http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js index d1a9092..b076193 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js @@ -184,8 +184,6 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo // Generate discovery group. static clusterDiscovery(discovery, cfg = this.igniteConfigurationBean()) { if (discovery) { - // TODO IGNITE-4988 cfg.intProperty('metricsUpdateFrequency') - let discoveryCfg = cfg.findProperty('discovery'); if (_.isNil(discoveryCfg)) { @@ -202,6 +200,9 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo .intProperty('networkTimeout') .intProperty('joinTimeout') .intProperty('threadPriority') + .intProperty('heartbeatFrequency') + .intProperty('maxMissedHeartbeats') + .intProperty('maxMissedClientHeartbeats') .intProperty('topHistorySize') .intProperty('reconnectCount') .intProperty('statisticsPrintFrequency') @@ -281,8 +282,6 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo .intProperty('readFromBackup'); } - ccfg.enumProperty('partitionLossPolicy'); - ccfg.intProperty('copyOnRead'); if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && ccfg.valueOf('atomicityMode') === 'TRANSACTIONAL') @@ -293,14 +292,23 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo // Generate cache memory group. static cacheMemory(cache, ccfg = this.cacheConfigurationBean(cache)) { + ccfg.enumProperty('memoryMode'); + + if (ccfg.valueOf('memoryMode') !== 'OFFHEAP_VALUES') + ccfg.intProperty('offHeapMaxMemory'); + // this._evictionPolicy(ccfg, 'evictionPolicy', cache.evictionPolicy, cacheDflts.evictionPolicy); + ccfg.intProperty('startSize') + .boolProperty('swapEnabled', 'EnableSwap'); + return ccfg; } // Generate cache queries & Indexing group. static cacheQuery(cache, domains, ccfg = this.cacheConfigurationBean(cache)) { - ccfg.intProperty('longQueryWarningTimeout'); + ccfg.intProperty('sqlOnheapRowCacheSize') + .intProperty('longQueryWarningTimeout'); return ccfg; } @@ -406,6 +414,7 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo static cacheConcurrency(cache, ccfg = this.cacheConfigurationBean(cache)) { ccfg.intProperty('maxConcurrentAsyncOperations') .intProperty('defaultLockTimeout') + .enumProperty('atomicWriteOrderMode') .enumProperty('writeSynchronizationMode'); return ccfg; http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js index b234575..41aea0a 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js @@ -183,24 +183,20 @@ export default class IgniteSpringTransformer extends AbstractTransformer { sb.startBlock(`<property name="${prop.name}">`); if (prop.eventTypes.length === 1) { - const evtGrp = _.find(this.eventGroups, {value: _.head(prop.eventTypes)}); + const evtGrp = _.head(prop.eventTypes); - evtGrp && sb.append(`<util:constant static-field="${evtGrp.class}.${evtGrp.value}"/>`); + sb.append(`<util:constant static-field="${evtGrp.class}.${evtGrp.label}"/>`); } else { sb.startBlock('<list>'); - _.forEach(prop.eventTypes, (item, ix) => { + _.forEach(prop.eventTypes, (evtGrp, ix) => { ix > 0 && sb.emptyLine(); - const evtGrp = _.find(this.eventGroups, {value: item}); + sb.append(`<!-- EventType.${evtGrp.label} -->`); - if (evtGrp) { - sb.append(`<!-- EventType.${item} -->`); - - _.forEach(evtGrp.events, (event) => - sb.append(`<util:constant static-field="${evtGrp.class}.${event}"/>`)); - } + _.forEach(evtGrp.events, (event) => + sb.append(`<util:constant static-field="${evtGrp.class}.${event}"/>`)); }); sb.endBlock('</list>'); @@ -320,10 +316,11 @@ export default class IgniteSpringTransformer extends AbstractTransformer { return sb; } - static cluster(cluster, client) { - const cfg = this.generator.igniteConfiguration(cluster, client); + static cluster(cluster, targetVer, client) { + const cfg = this.generator.igniteConfiguration(cluster, targetVer, client); - const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : []; + const clientNearCaches = client ? _.filter(cluster.caches, (cache) => + cache.mode === 'PARTITIONED' && _.get(cache, 'clientNearConfiguration.enabled')) : []; return this.igniteConfiguration(cfg, clientNearCaches); } http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js index c9720cd..eeac3a0 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js @@ -28,6 +28,15 @@ const DFLT_CACHE = { clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheAtomicityMode', mapper: enumValueMapper }, + memoryMode: { + clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMemoryMode', + value: 'ONHEAP_TIERED', + mapper: enumValueMapper + }, + atomicWriteOrderMode: { + clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode', + mapper: enumValueMapper + }, writeSynchronizationMode: { clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode', value: 'PRIMARY_SYNC', http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js index 390233b..ad5b88a 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js @@ -19,14 +19,24 @@ const DFLT_CACHE = { cacheMode: { clsName: 'org.apache.ignite.cache.CacheMode' }, - atomicityMode: { - clsName: 'org.apache.ignite.cache.CacheAtomicityMode' - }, partitionLossPolicy: { clsName: 'org.apache.ignite.cache.PartitionLossPolicy', value: 'IGNORE' }, + atomicityMode: { + clsName: 'org.apache.ignite.cache.CacheAtomicityMode' + }, + memoryMode: { + clsName: 'org.apache.ignite.cache.CacheMemoryMode', + value: 'ONHEAP_TIERED' + }, + onheapCacheEnabled: false, + offHeapMaxMemory: -1, + startSize: 1500000, + swapEnabled: false, + sqlOnheapRowCacheSize: 10240, longQueryWarningTimeout: 3000, + snapshotableIndex: false, sqlEscapeAll: false, storeKeepBinary: false, loadPreviousValue: false, @@ -45,8 +55,12 @@ const DFLT_CACHE = { writeBehindFlushSize: 10240, writeBehindFlushFrequency: 5000, writeBehindFlushThreadCount: 1, + writeBehindCoalescing: true, maxConcurrentAsyncOperations: 500, defaultLockTimeout: 0, + atomicWriteOrderMode: { + clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode' + }, writeSynchronizationMode: { clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode', value: 'PRIMARY_SYNC' @@ -115,7 +129,8 @@ const DFLT_CACHE = { databaseFieldType: { clsName: 'java.sql.Types' } - } + }, + memoryPolicyName: 'default' }; export default class IgniteCacheDefaults { http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/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 5ed90c5..2c86667 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 @@ -17,6 +17,8 @@ const DFLT_CLUSTER = { localHost: '0.0.0.0', + activeOnStart: true, + cacheSanityCheckEnabled: true, discovery: { localPort: 47500, localPortRange: 100, @@ -26,7 +28,9 @@ const DFLT_CLUSTER = { networkTimeout: 5000, joinTimeout: 0, threadPriority: 10, - metricsUpdateFrequency: 2000, + heartbeatFrequency: 2000, + maxMissedHeartbeats: 1, + maxMissedClientHeartbeats: 5, topHistorySize: 1000, reconnectCount: 10, statisticsPrintFrequency: 0, @@ -168,6 +172,8 @@ const DFLT_CLUSTER = { maximumFailoverAttempts: 5 } }, + failureDetectionTimeout: 10000, + clientFailureDetectionTimeout: 30000, logger: { Log4j: { level: { @@ -181,9 +187,12 @@ const DFLT_CLUSTER = { } }, marshalLocalJobs: false, + marshallerCacheKeepAliveTime: 10000, metricsHistorySize: 10000, metricsLogFrequency: 60000, metricsUpdateFrequency: 2000, + clockSyncSamples: 8, + clockSyncFrequency: 120000, timeServerPortBase: 31100, timeServerPortRange: 100, transactionConfiguration: { @@ -280,6 +289,41 @@ const DFLT_CLUSTER = { nodeWeight: 10, useWeights: false } + }, + memoryConfiguration: { + systemCacheInitialSize: 41943040, + systemCacheMaxSize: 104857600, + pageSize: 2048, + defaultMemoryPolicyName: 'default', + memoryPolicies: { + name: 'default', + initialSize: 268435456, + pageEvictionMode: { + clsName: 'org.apache.ignite.configuration.DataPageEvictionMode', + value: 'DISABLED' + }, + evictionThreshold: 0.9, + emptyPagesPoolSize: 100, + metricsEnabled: false + } + }, + utilityCacheKeepAliveTime: 60000, + hadoopConfiguration: { + mapReducePlanner: { + Weighted: { + localMapperWeight: 100, + remoteMapperWeight: 100, + localReducerWeight: 100, + remoteReducerWeight: 100, + preferLocalReducerThresholdWeight: 200 + } + }, + finishedJobInfoTtl: 30000, + maxTaskQueueSize: 8192 + }, + serviceConfigurations: { + maxPerNodeCount: 0, + totalCount: 0 } }; http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js index 49699bc..ff72d50 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js @@ -35,14 +35,18 @@ const DFLT_IGFS = { fragmentizerConcurrentFiles: 0, fragmentizerThrottlingBlockLength: 16777216, fragmentizerThrottlingDelay: 200, + dualModeMaxPendingPutsSize: 0, + dualModePutExecutorServiceShutdown: false, blockSize: 65536, - bufferSize: 65536, + streamBufferSize: 65536, + maxSpaceSize: 0, maximumTaskRangeLength: 0, managementPort: 11400, perNodeBatchSize: 100, perNodeParallelBatchCount: 8, prefetchBlocks: 0, sequentialReadsBeforePrefetch: 0, + trashPurgeTimeout: 1000, colocateMetadata: true, relaxedConsistency: true, pathModes: { @@ -50,7 +54,8 @@ const DFLT_IGFS = { keyField: 'path', valClsName: 'org.apache.ignite.igfs.IgfsMode', valField: 'mode' - } + }, + updateFileLengthOnFlush: false }; export default class IgniteIGFSDefaults { http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/sql/sql.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js index cf9f917..c8fcf8f 100644 --- a/modules/web-console/frontend/app/modules/sql/sql.controller.js +++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js @@ -1348,7 +1348,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', const _tryStartRefresh = function(paragraph) { _tryStopRefresh(paragraph); - if (paragraph.rate && paragraph.rate.installed && paragraph.queryArgs) { + if (_.get(paragraph, 'rate.installed') && paragraph.queryExecuted()) { $scope.chartAcceptKeyColumn(paragraph, TIME_LINE); _executeRefresh(paragraph); @@ -1377,7 +1377,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', const cache = _.find($scope.caches, {name: paragraph.cacheName}); if (cache) - return !!_.find(cache.nodes, (node) => Version.includes(node.version, ...ENFORCE_JOIN_VERS)); + return !!_.find(cache.nodes, (node) => Version.since(node.version, ...ENFORCE_JOIN_VERS)); return false; }; @@ -1663,7 +1663,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', paragraph.rate.unit = unit; paragraph.rate.installed = true; - if (paragraph.queryExecuted()) + if (paragraph.queryExecuted() && !paragraph.scanExplain()) _tryStartRefresh(paragraph); }; http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/states/configuration.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration.state.js b/modules/web-console/frontend/app/modules/states/configuration.state.js index 624cf5f..03a312f 100644 --- a/modules/web-console/frontend/app/modules/states/configuration.state.js +++ b/modules/web-console/frontend/app/modules/states/configuration.state.js @@ -34,6 +34,11 @@ import igfsTpl from 'views/configuration/igfs.tpl.pug'; import summaryTpl from 'views/configuration/summary.tpl.pug'; import summaryTabsTemplateUrl from 'views/configuration/summary-tabs.pug'; +import clustersCtrl from 'Controllers/clusters-controller'; +import domainsCtrl from 'Controllers/domains-controller'; +import cachesCtrl from 'Controllers/caches-controller'; +import igfsCtrl from 'Controllers/igfs-controller'; + angular.module('ignite-console.states.configuration', ['ui.router']) .directive(...previewPanel) // Summary screen @@ -62,7 +67,9 @@ angular.module('ignite-console.states.configuration', ['ui.router']) onEnter: AclRoute.checkAccess('configuration'), metaTags: { title: 'Configure Clusters' - } + }, + controller: clustersCtrl, + controllerAs: '$ctrl' }) .state('base.configuration.caches', { url: '/caches', @@ -70,7 +77,9 @@ angular.module('ignite-console.states.configuration', ['ui.router']) onEnter: AclRoute.checkAccess('configuration'), metaTags: { title: 'Configure Caches' - } + }, + controller: cachesCtrl, + controllerAs: '$ctrl' }) .state('base.configuration.domains', { url: '/domains', @@ -78,7 +87,9 @@ angular.module('ignite-console.states.configuration', ['ui.router']) onEnter: AclRoute.checkAccess('configuration'), metaTags: { title: 'Configure Domain Model' - } + }, + controller: domainsCtrl, + controllerAs: '$ctrl' }) .state('base.configuration.igfs', { url: '/igfs', @@ -86,7 +97,9 @@ angular.module('ignite-console.states.configuration', ['ui.router']) onEnter: AclRoute.checkAccess('configuration'), metaTags: { title: 'Configure IGFS' - } + }, + controller: igfsCtrl, + controllerAs: '$ctrl' }) .state('base.configuration.summary', { url: '/summary', http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug index 14857fc..cb333ac 100644 --- a/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug +++ b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug @@ -38,14 +38,8 @@ include /app/helpers/jade/mixins .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`) .panel-body(ng-if=`ui.isPanelLoaded('${form}')`) .col-sm-6 - .settings-row - +dropdown('Function:', `${affModel}.kind`, '"AffinityKind"', 'true', 'Default', - '[\ - {value: "Rendezvous", label: "Rendezvous"},\ - {value: "Fair", label: "Fair"},\ - {value: "Custom", label: "Custom"},\ - {value: undefined, label: "Default"}\ - ]', + .settings-row(ng-if='$ctrl.available(["1.0.0", "2.0.0"])') + +dropdown('Function:', `${affModel}.kind`, '"AffinityKind"', 'true', 'Default', 'affinityFunction', 'Key topology resolver to provide mapping from keys to nodes\ <ul>\ <li>Rendezvous - Based on Highest Random Weight algorithm<br/></li>\ @@ -53,6 +47,14 @@ include /app/helpers/jade/mixins <li>Custom - Custom implementation of key affinity fynction<br/></li>\ <li>Default - By default rendezvous affinity function with 1024 partitions is used<br/></li>\ </ul>') + .settings-row(ng-if='$ctrl.available("2.0.0")') + +dropdown('Function:', `${affModel}.kind`, '"AffinityKind"', 'true', 'Default', 'affinityFunction', + 'Key topology resolver to provide mapping from keys to nodes\ + <ul>\ + <li>Rendezvous - Based on Highest Random Weight algorithm<br/></li>\ + <li>Custom - Custom implementation of key affinity fynction<br/></li>\ + <li>Default - By default rendezvous affinity function with 1024 partitions is used<br/></li>\ + </ul>') .panel-details(ng-if=rendezvousAff) .details-row +number-required('Partitions', `${affModel}.Rendezvous.partitions`, '"RendPartitions"', 'true', rendPartitionsRequired, '1024', '1', 'Number of partitions') @@ -78,5 +80,10 @@ include /app/helpers/jade/mixins .settings-row +java-class('Mapper:', model + '.affinityMapper', '"AffMapCustomClassName"', 'true', 'false', 'Provide custom affinity key for any given key') + + //- Since ignite 2.0 + .settings-row(ng-if='$ctrl.available("2.0.0")') + +java-class('Topology validator:', model + '.topologyValidator', '"topologyValidator"', 'true', 'false', 'Topology validator') + .col-sm-6 +preview-xml-java(model, 'cacheAffinity') http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug index 92bc8ab..b24bf47 100644 --- a/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug +++ b/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug @@ -37,6 +37,20 @@ include /app/helpers/jade/mixins +number('Default lock timeout:', `${model}.defaultLockTimeout`, '"defaultLockTimeout"', 'true', '0', '0', 'Default lock acquisition timeout in milliseconds<br/>\ If <b>0</b> then lock acquisition will never timeout') + + //- Removed in ignite 2.0 + .settings-row(ng-if='$ctrl.available(["1.0.0", "2.0.0"])' ng-hide=`${model}.atomicityMode === 'TRANSACTIONAL'`) + +dropdown('Entry versioning:', `${model}.atomicWriteOrderMode`, '"atomicWriteOrderMode"', 'true', 'Choose versioning', + '[\ + {value: "CLOCK", label: "CLOCK"},\ + {value: "PRIMARY", label: "PRIMARY"}\ + ]', + 'Write ordering mode determines which node assigns the write version, sender or the primary node\ + <ul>\ + <li>CLOCK - in this mode write versions are assigned on a sender node which generally leads to better performance</li>\ + <li>PRIMARY - in this mode version is assigned only on primary node. This means that sender will only send write request to primary node, which in turn will assign write version and forward it to backups</li>\ + </ul>') + .settings-row +dropdown('Write synchronization mode:', `${model}.writeSynchronizationMode`, '"writeSynchronizationMode"', 'true', 'PRIMARY_SYNC', '[\ http://git-wip-us.apache.org/repos/asf/ignite/blob/e04df7d1/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug index 2be5c53..8eda4a1 100644 --- a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug +++ b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug @@ -40,6 +40,26 @@ include /app/helpers/jade/mixins 'Select domain models to describe types in cache') .settings-row +cacheMode('Mode:', `${model}.cacheMode`, '"cacheMode"', 'PARTITIONED') + + //- Since ignite 2.0 + .settings-row(ng-if='$ctrl.available("2.0.0")') + +dropdown('Partition loss policy:', model + '.partitionLossPolicy', '"partitionLossPolicy"', 'true', 'IGNORE', + '[\ + {value: "READ_ONLY_SAFE", label: "READ_ONLY_SAFE"},\ + {value: "READ_ONLY_ALL", label: "READ_ONLY_ALL"},\ + {value: "READ_WRITE_SAFE", label: "READ_WRITE_SAFE"},\ + {value: "READ_WRITE_ALL", label: "READ_WRITE_ALL"},\ + {value: "IGNORE", label: "IGNORE"}\ + ]', + 'Defines how cache will behave in a case when one or more partitions are lost:\ + <ul>\ + <li>READ_ONLY_SAFE - all writes to the cache will be failed with an exception, reads will only be allowed for keys in non-lost partitions</li>\ + <li>READ_ONLY_ALL - all writes to the cache will be failed with an exception, all reads will proceed as if all partitions were in a consistent state</li>\ + <li>READ_WRITE_SAFE - all reads and writes will be allowed for keys in valid partitions</li>\ + <li>READ_WRITE_ALL - all reads and writes will proceed as if all partitions were in a consistent state</li>\ + <li>IGNORE - if partition is lost, reset its state and do not clear intermediate data</li>\ + </ul>') + .settings-row +dropdown('Atomicity:', `${model}.atomicityMode`, '"atomicityMode"', 'true', 'ATOMIC', '[\ @@ -57,31 +77,32 @@ include /app/helpers/jade/mixins +checkbox('Read from backup', `${model}.readFromBackup`, '"readFromBackup"', 'Flag indicating whether data can be read from backup<br/>\ If not set then always get data from primary node (never from backup)') - .settings-row - +dropdown('Partition loss policy:', `${model}.partitionLossPolicy`, '"partitionLossPolicy"', 'true', 'IGNORE', - '[\ - {value: "READ_ONLY_SAFE", label: "READ_ONLY_SAFE"},\ - {value: "READ_ONLY_ALL", label: "READ_ONLY_ALL"},\ - {value: "READ_WRITE_SAFE", label: "READ_WRITE_SAFE"},\ - {value: "READ_WRITE_ALL", label: "READ_WRITE_ALL"},\ - {value: "IGNORE", label: "IGNORE"}\ - ]', - 'Partition loss policies:\ - <ul>\ - <li>READ_ONLY_SAFE - in this mode all writes to the cache will be failed with an exception,\ - reads will only be allowed for keys in non-lost partitions.\ - Reads from lost partitions will be failed with an exception.</li>\ - <li>READ_ONLY_ALL - in this mode Ñll writes to the cache will be failed with an exception.\ - All reads will proceed as if all partitions were in a consistent state.\ - The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\ - <li>READ_WRITE_SAFE - in this mode Aall reads and writes will be allowed for keys in valid partitions.\ - All reads and writes for keys in lost partitions will be failed with an exception.</li>\ - <li>READ_WRITE_ALL - in this mode all reads and writes will proceed as if all partitions were in a consistent state.\ - The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\ - <li>IGNORE - in this mode if partition is lost, reset it state and do not clear intermediate data.\ - The result of reading from a previously lost and not cleared partition is undefined and may be different\ - on different nodes in the cluster.</li>\ - </ul>') + //- Since ignite 2.0 + .settings-row(ng-if='$ctrl.available("2.0.0")') + +dropdown('Partition loss policy:', `${model}.partitionLossPolicy`, '"partitionLossPolicy"', 'true', 'IGNORE', + '[\ + {value: "READ_ONLY_SAFE", label: "READ_ONLY_SAFE"},\ + {value: "READ_ONLY_ALL", label: "READ_ONLY_ALL"},\ + {value: "READ_WRITE_SAFE", label: "READ_WRITE_SAFE"},\ + {value: "READ_WRITE_ALL", label: "READ_WRITE_ALL"},\ + {value: "IGNORE", label: "IGNORE"}\ + ]', + 'Partition loss policies:\ + <ul>\ + <li>READ_ONLY_SAFE - in this mode all writes to the cache will be failed with an exception,\ + reads will only be allowed for keys in non-lost partitions.\ + Reads from lost partitions will be failed with an exception.</li>\ + <li>READ_ONLY_ALL - in this mode Ñll writes to the cache will be failed with an exception.\ + All reads will proceed as if all partitions were in a consistent state.\ + The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\ + <li>READ_WRITE_SAFE - in this mode Aall reads and writes will be allowed for keys in valid partitions.\ + All reads and writes for keys in lost partitions will be failed with an exception.</li>\ + <li>READ_WRITE_ALL - in this mode all reads and writes will proceed as if all partitions were in a consistent state.\ + The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\ + <li>IGNORE - in this mode if partition is lost, reset it state and do not clear intermediate data.\ + The result of reading from a previously lost and not cleared partition is undefined and may be different\ + on different nodes in the cluster.</li>\ + </ul>') .settings-row +checkbox('Copy on read', `${model}.copyOnRead`, '"copyOnRead"', 'Flag indicating whether copy of the value stored in cache should be created for cache operation implying return value<br/>\