Repository: ignite
Updated Branches:
  refs/heads/master 0f432e3fe -> a800c36f1


IGNITE-9748 Web Console: Added suport for MVCC on "Configuration" screens.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a800c36f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a800c36f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a800c36f

Branch: refs/heads/master
Commit: a800c36f1603f1c206d3847a04e0f9eb22ae547f
Parents: 0f432e3
Author: Vasiliy Sisko <[email protected]>
Authored: Tue Oct 16 11:27:00 2018 +0700
Committer: Alexey Kuznetsov <[email protected]>
Committed: Tue Oct 16 11:27:00 2018 +0700

----------------------------------------------------------------------
 .../internal/visor/VisorDataTransferObject.java |  3 +
 .../visor/node/VisorGridConfiguration.java      | 22 ++++-
 .../visor/node/VisorMvccConfiguration.java      | 94 ++++++++++++++++++++
 modules/web-console/backend/app/schemas.js      |  6 +-
 .../cache-edit-form/templates/general.pug       | 18 ++--
 .../cluster-edit-form/template.tpl.pug          |  3 +
 .../cluster-edit-form/templates/mvcc.pug        | 46 ++++++++++
 .../page-configure-basic/controller.js          |  3 +-
 .../app/components/page-configure/style.scss    |  1 +
 .../generator/AbstractTransformer.js            |  5 ++
 .../generator/ConfigurationGenerator.js         | 12 ++-
 .../web-console/frontend/app/services/Caches.js |  3 +-
 12 files changed, 200 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
index 6ba3aa7..6fd51cd 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
@@ -50,6 +50,9 @@ public abstract class VisorDataTransferObject implements 
Externalizable {
     /** Version 3. */
     protected static final byte V3 = 3;
 
+    /** Version 4. */
+    protected static final byte V4 = 4;
+
     /**
      * @param col Source collection.
      * @param <T> Collection type.

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/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 85849a5..a9144ab 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
@@ -126,6 +126,9 @@ public class VisorGridConfiguration extends 
VisorDataTransferObject {
     /** Client connector configuration */
     private VisorClientConnectorConfiguration clnConnCfg;
 
+    /** MVCC configuration. */
+    private VisorMvccConfiguration mvccCfg;
+
     /**
      * Default constructor.
      */
@@ -192,6 +195,8 @@ public class VisorGridConfiguration extends 
VisorDataTransferObject {
 
         if (dsCfg != null)
             dataStorage = new VisorDataStorageConfiguration(dsCfg);
+
+        mvccCfg = new VisorMvccConfiguration(c);
     }
 
     /**
@@ -383,9 +388,16 @@ public class VisorGridConfiguration extends 
VisorDataTransferObject {
         return dataStorage;
     }
 
+    /**
+     * @return MVCC configuration.
+     */
+    public VisorMvccConfiguration getMvccConfiguration() {
+        return mvccCfg;
+    }
+
     /** {@inheritDoc} */
     @Override public byte getProtocolVersion() {
-        return V3;
+        return V4;
     }
 
     /** {@inheritDoc} */
@@ -417,6 +429,7 @@ public class VisorGridConfiguration extends 
VisorDataTransferObject {
         U.writeCollection(out, srvcCfgs);
         out.writeObject(dataStorage);
         out.writeObject(clnConnCfg);
+        out.writeObject(mvccCfg);
     }
 
     /** {@inheritDoc} */
@@ -447,11 +460,14 @@ public class VisorGridConfiguration extends 
VisorDataTransferObject {
         sqlConnCfg = (VisorSqlConnectorConfiguration) in.readObject();
         srvcCfgs = U.readList(in);
 
-        if (protoVer >= V2)
+        if (protoVer > V1)
             dataStorage = (VisorDataStorageConfiguration)in.readObject();
 
-        if (protoVer >= V3)
+        if (protoVer > V2)
             clnConnCfg = (VisorClientConnectorConfiguration)in.readObject();
+
+        if (protoVer > V3)
+            mvccCfg = (VisorMvccConfiguration)in.readObject();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java
new file mode 100644
index 0000000..1bcaa21
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java
@@ -0,0 +1,94 @@
+/*
+ * 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 org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for data store configuration.
+ */
+public class VisorMvccConfiguration extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Number of MVCC vacuum cleanup threads. */
+    private int mvccVacuumThreadCnt;
+
+    /** Time interval between vacuum runs */
+    private long mvccVacuumFreq;
+
+    /**
+     * Default constructor.
+     */
+    public VisorMvccConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cfg Ignite configuration.
+     */
+    public VisorMvccConfiguration(IgniteConfiguration cfg) {
+        assert cfg != null;
+
+        mvccVacuumThreadCnt = cfg.getMvccVacuumThreadCount();
+        mvccVacuumFreq = cfg.getMvccVacuumFrequency();
+    }
+
+    /**
+     * @return Number of MVCC vacuum threads.
+     */
+    public int getMvccVacuumThreadCount() {
+        return mvccVacuumThreadCnt;
+    }
+
+    /**
+     * @return Time interval between MVCC vacuum runs in milliseconds.
+     */
+    public long getMvccVacuumFrequency() {
+        return mvccVacuumFreq;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return V1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws 
IOException {
+        out.writeInt(mvccVacuumThreadCnt);
+        out.writeLong(mvccVacuumFreq);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) 
throws IOException, ClassNotFoundException {
+        mvccVacuumThreadCnt = in.readInt();
+        mvccVacuumFreq = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorMvccConfiguration.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/backend/app/schemas.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/schemas.js 
b/modules/web-console/backend/app/schemas.js
index 5898ed8..cf174f7 100644
--- a/modules/web-console/backend/app/schemas.js
+++ b/modules/web-console/backend/app/schemas.js
@@ -136,7 +136,7 @@ module.exports.factory = function(mongoose) {
         clusters: [{type: ObjectId, ref: 'Cluster'}],
         domains: [{type: ObjectId, ref: 'DomainModel'}],
         cacheMode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 
'LOCAL']},
-        atomicityMode: {type: String, enum: ['ATOMIC', 'TRANSACTIONAL']},
+        atomicityMode: {type: String, enum: ['ATOMIC', 'TRANSACTIONAL', 
'TRANSACTIONAL_SNAPSHOT']},
         partitionLossPolicy: {
             type: String,
             enum: ['READ_ONLY_SAFE', 'READ_ONLY_ALL', 'READ_WRITE_SAFE', 
'READ_WRITE_ALL', 'IGNORE']
@@ -1109,7 +1109,9 @@ module.exports.factory = function(mongoose) {
             rateTimeInterval: Number,
             tlbSize: Number,
             subIntervals: Number
-        }
+        },
+        mvccVacuumThreadCount: Number,
+        mvccVacuumFrequency: Number
     });
 
     Cluster.index({name: 1, space: 1}, {unique: true});

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/templates/general.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/templates/general.pug
 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/templates/general.pug
index 9552396..ba5d5ad 100644
--- 
a/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/templates/general.pug
+++ 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/templates/general.pug
@@ -74,16 +74,18 @@ panel-collapsible(opened=`::true` ng-form=form)
                     name: '"atomicityMode"',
                     placeholder: 'ATOMIC',
                     options: '[\
-                                            {value: "ATOMIC", label: 
"ATOMIC"},\
-                                            {value: "TRANSACTIONAL", label: 
"TRANSACTIONAL"}\
-                                        ]',
+                        {value: "ATOMIC", label: "ATOMIC"},\
+                        {value: "TRANSACTIONAL", label: "TRANSACTIONAL"},\
+                        {value: "TRANSACTIONAL_SNAPSHOT", label: 
"TRANSACTIONAL_SNAPSHOT"}\
+                    ]',
                     tip: 'Atomicity:\
-                                        <ul>\
-                                            <li>ATOMIC - in this mode 
distributed transactions and distributed locking are not supported</li>\
-                                            <li>TRANSACTIONAL - in this mode 
specified fully ACID-compliant transactional cache behavior</li>\
-                                        </ul>'
+                        <ul>\
+                            <li>ATOMIC - in this mode distributed transactions 
and distributed locking are not supported</li>\
+                            <li>TRANSACTIONAL - in this mode specified fully 
ACID-compliant transactional cache behavior</li>\
+                            <li>TRANSACTIONAL_SNAPSHOT - in this mode 
specified fully ACID-compliant transactional cache behavior for both key-value 
API and SQL transactions</li>\
+                        </ul>'
                 })
-            .pc-form-grid-col-30(ng-is=`${model}.cacheMode === 'PARTITIONED'`)
+            .pc-form-grid-col-30(ng-if=`${model}.cacheMode === 'PARTITIONED'`)
                 +form-field__number({
                     label: 'Backups:',
                     model: `${model}.backups`,

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/template.tpl.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/template.tpl.pug
 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/template.tpl.pug
index d5cb909..e30cfdb 100644
--- 
a/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/template.tpl.pug
+++ 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/template.tpl.pug
@@ -50,6 +50,9 @@ form(id='cluster' name='ui.inputForm' novalidate)
         include ./templates/misc
         include ./templates/metrics
 
+        //- Since ignite 2.7
+        include ./templates/mvcc
+
         //- Deprecated in ignite 2.1
         include ./templates/odbc
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/templates/mvcc.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/templates/mvcc.pug
 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/templates/mvcc.pug
new file mode 100644
index 0000000..2799520
--- /dev/null
+++ 
b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/templates/mvcc.pug
@@ -0,0 +1,46 @@
+//-
+    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 = 'mvcc'
+-var model = '$ctrl.clonedCluster'
+
+panel-collapsible(ng-show='$ctrl.available("2.7.0")' ng-form=form 
on-open=`ui.loadPanel('${form}')`)
+    panel-title Multiversion concurrency control (MVCC)
+    panel-description Multiversion concurrency control (MVCC) configuration.
+    panel-content.pca-form-row(ng-if=`ui.isPanelLoaded('${form}')`)
+        .pca-form-column-6.pc-form-grid-row
+            .pc-form-grid-col-30(ng-if='$ctrl.available("2.1.0")')
+                +form-field__number({
+                    label: 'Vacuum thread pool size:',
+                    model: `${model}.mvccVacuumThreadCount`,
+                    name: '"MvccVacuumThreadCount"',
+                    placeholder: '2',
+                    min: '0',
+                    tip: 'Number of MVCC vacuum cleanup threads'
+                })
+            .pc-form-grid-col-30(ng-if='$ctrl.available("2.1.0")')
+                +form-field__number({
+                    label: 'Vacuum intervals:',
+                    model: `${model}.mvccVacuumFrequency`,
+                    name: '"MvccVacuumFrequency"',
+                    placeholder: '5000',
+                    min: '0',
+                    tip: 'Time interval between vacuum runs in ms'
+                })
+        .pca-form-column-6
+            +preview-xml-java(model, 'clusterMvcc')

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/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 88c6163..f5515fb 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
@@ -155,11 +155,12 @@ export default class PageConfigureBasicController {
         this.cachesColDefs = [
             {name: 'Name:', cellClass: 'pc-form-grid-col-10'},
             {name: 'Mode:', cellClass: 'pc-form-grid-col-10'},
-            {name: 'Atomicity:', cellClass: 'pc-form-grid-col-10', tip: `
+            {name: 'Atomicity:', cellClass: 'pc-form-grid-col-20', tip: `
                 Atomicity:
                 <ul>
                     <li>ATOMIC - in this mode distributed transactions and 
distributed locking are not supported</li>
                     <li>TRANSACTIONAL - in this mode specified fully 
ACID-compliant transactional cache behavior</li>
+                    <li>TRANSACTIONAL_SNAPSHOT - in this mode specified fully 
ACID-compliant transactional cache behavior for both key-value API and SQL 
transactions</li>
                 </ul>
             `},
             {name: 'Backups:', cellClass: 'pc-form-grid-col-10', tip: `

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/frontend/app/components/page-configure/style.scss
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/page-configure/style.scss 
b/modules/web-console/frontend/app/components/page-configure/style.scss
index 365e058..9e9661c 100644
--- a/modules/web-console/frontend/app/components/page-configure/style.scss
+++ b/modules/web-console/frontend/app/components/page-configure/style.scss
@@ -222,6 +222,7 @@ list-editable .pc-form-group__text-title {
         &>.pc-form-grid-col-10 {
             flex-basis: calc(25%);
         }
+
         &>.pc-form-grid-col-20 {
             flex-basis: calc(50%);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/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 e0aece7..ab69bb8 100644
--- 
a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ 
b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -154,6 +154,11 @@ export default class AbstractTransformer {
     }
 
     // Generate marshaller group.
+    static clusterMvcc(cluster, available) {
+        return this.toSection(this.generator.clusterMvcc(cluster, available));
+    }
+
+    // Generate marshaller group.
     static clusterMarshaller(cluster, available) {
         return this.toSection(this.generator.clusterMarshaller(cluster, 
available));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/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 2a1a506..d80967e 100644
--- 
a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ 
b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -107,6 +107,7 @@ export default class IgniteConfigurationGenerator {
 
         this.clusterMisc(cluster, available, cfg);
         this.clusterMetrics(cluster, available, cfg);
+        this.clusterMvcc(cluster, available, cfg);
         this.clusterODBC(cluster.odbc, available, cfg);
 
         // Since ignite 2.1 deprecated in ignite 2.3
@@ -1516,7 +1517,6 @@ export default class IgniteConfigurationGenerator {
     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')
@@ -1530,6 +1530,16 @@ export default class IgniteConfigurationGenerator {
         return cfg;
     }
 
+    // Generate MVCC configuration.
+    static clusterMvcc(cluster, available, cfg = 
this.igniteConfigurationBean(cluster)) {
+        if (available('2.7.0')) {
+            cfg.intProperty('mvccVacuumThreadCount')
+                .intProperty('mvccVacuumFrequency');
+        }
+
+        return cfg;
+    }
+
     // Generate IGFSs configs.
     static clusterIgfss(igfss, available, cfg = 
this.igniteConfigurationBean()) {
         const igfsCfgs = _.map(igfss, (igfs) => {

http://git-wip-us.apache.org/repos/asf/ignite/blob/a800c36f/modules/web-console/frontend/app/services/Caches.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Caches.js 
b/modules/web-console/frontend/app/services/Caches.js
index 7df4bb6..626395d 100644
--- a/modules/web-console/frontend/app/services/Caches.js
+++ b/modules/web-console/frontend/app/services/Caches.js
@@ -31,7 +31,8 @@ export default class Caches {
     /** @type {ig.menu<ig.config.cache.AtomicityModes>} */
     atomicityModes = [
         {value: 'ATOMIC', label: 'ATOMIC'},
-        {value: 'TRANSACTIONAL', label: 'TRANSACTIONAL'}
+        {value: 'TRANSACTIONAL', label: 'TRANSACTIONAL'},
+        {value: 'TRANSACTIONAL_SNAPSHOT', label: 'TRANSACTIONAL_SNAPSHOT'}
     ];
 
     /**

Reply via email to