You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/07/04 08:19:24 UTC

[01/28] ignite git commit: Fixed addDiagnosticRequest for exchange future.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2.1.2-exchange 058ed1cd5 -> 377cc9d7a


Fixed addDiagnosticRequest for exchange future.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: f618640e6972ed28153e72ce0eb0747d87b83018
Parents: 8445b31
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 28 13:20:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 28 13:20:22 2017 +0300

----------------------------------------------------------------------
 .../distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f618640e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 1f13e56..3dc2242 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -2059,7 +2059,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 else if (!remaining.isEmpty()){
                     UUID nodeId = remaining.iterator().next();
 
-                    diagCtx.exchangeInfo(crd.id(), topologyVersion(), "Exchange future on coordinator waiting for " +
+                    diagCtx.exchangeInfo(nodeId, topologyVersion(), "Exchange future on coordinator waiting for " +
                         "server response [node=" + nodeId + ", topVer=" + topologyVersion() + ']');
                 }
             }


[14/28] ignite git commit: IGNITE-5627 Refactored grid columns menu.

Posted by sb...@apache.org.
IGNITE-5627 Refactored grid columns menu.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 4a1fef5cb2442833e1110fc45b341cb146592bd3
Parents: 531a0de
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Fri Jun 30 16:47:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 16:47:18 2017 +0700

----------------------------------------------------------------------
 modules/web-console/frontend/.eslintrc          |   2 +-
 modules/web-console/frontend/app/app.js         |   4 +
 .../grid-column-selector/component.js           |  29 ++
 .../grid-column-selector/controller.js          | 111 +++++
 .../grid-column-selector/controller.spec.js     | 435 +++++++++++++++++++
 .../components/grid-column-selector/index.js    |  24 +
 .../components/grid-column-selector/style.scss  |  24 +
 .../grid-column-selector/template.pug           |  28 ++
 .../list-of-registered-users.categories.js      |  22 +-
 .../list-of-registered-users.column-defs.js     |   4 +-
 .../list-of-registered-users.controller.js      |  46 --
 .../list-of-registered-users.scss               |   3 +
 .../list-of-registered-users.tpl.pug            |  26 +-
 .../components/pcbProtectFromBsSelectRender.js  |  32 --
 .../components/page-configure-basic/index.js    |   2 -
 .../page-configure-basic/template.pug           |   4 +-
 .../protect-from-bs-select-render/directive.js  |  32 ++
 .../protect-from-bs-select-render/index.js      |  24 +
 .../frontend/app/helpers/jade/mixins.pug        |   1 -
 .../frontend/app/modules/sql/sql.controller.js  |  21 +-
 .../frontend/app/primitives/btn/index.scss      |   8 +-
 .../frontend/app/primitives/dropdown/index.pug  |   2 +-
 .../app/primitives/ui-grid-settings/index.pug   |  33 --
 .../frontend/public/stylesheets/style.scss      |  13 +
 .../web-console/frontend/views/sql/sql.tpl.pug  |   6 +-
 25 files changed, 764 insertions(+), 172 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.eslintrc b/modules/web-console/frontend/.eslintrc
index 6778b86..d88fb97 100644
--- a/modules/web-console/frontend/.eslintrc
+++ b/modules/web-console/frontend/.eslintrc
@@ -178,7 +178,7 @@ rules:
     prefer-const: 1
     prefer-spread: 2
     quote-props: [2, "as-needed"]
-    quotes: [2, "single"]
+    quotes: [2, "single", {"allowTemplateLiterals": true}]
     radix: 1
     semi: [2, "always"]
     semi-spacing: [2, {"before": false, "after": true}]

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 61372a2..7b8196e 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -123,7 +123,9 @@ import userNotifications from './components/user-notifications';
 import pageConfigure from './components/page-configure';
 import pageConfigureBasic from './components/page-configure-basic';
 import pageConfigureAdvanced from './components/page-configure-advanced';
+import gridColumnSelector from './components/grid-column-selector';
 import bsSelectMenu from './components/bs-select-menu';
+import protectFromBsSelectRender from './components/protect-from-bs-select-render';
 
 // Inject external modules.
 import IgniteModules from 'IgniteModules/index';
@@ -189,7 +191,9 @@ angular
     pageConfigure.name,
     pageConfigureBasic.name,
     pageConfigureAdvanced.name,
+    gridColumnSelector.name,
     bsSelectMenu.name,
+    protectFromBsSelectRender.name,
     // Ignite modules.
     IgniteModules.name
 ])

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/component.js b/modules/web-console/frontend/app/components/grid-column-selector/component.js
new file mode 100644
index 0000000..957c821f
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/component.js
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+import template from './template.pug';
+import controller from './controller.js';
+import './style.scss';
+
+export default {
+    template,
+    controller,
+    transclude: true,
+    bindings: {
+        gridApi: '<'
+    }
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/controller.js b/modules/web-console/frontend/app/components/grid-column-selector/controller.js
new file mode 100644
index 0000000..1f04861
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/controller.js
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+import uniq from 'lodash/fp/uniq';
+import difference from 'lodash/difference';
+import findLast from 'lodash/findLast';
+
+const hasGrouping = (changes) => {
+    return changes.gridApi.currentValue !== changes.gridApi.previousValue && changes.gridApi.currentValue.grouping;
+};
+const id = (column) => column.categoryDisplayName || column.displayName || column.name;
+const picksrc = (state) => state.categories.length ? state.categories : state.columns;
+
+export default class GridColumnSelectorController {
+    static $inject = ['$scope', 'uiGridConstants'];
+
+    constructor($scope, uiGridConstants) {
+        Object.assign(this, {$scope, uiGridConstants});
+    }
+
+    $onChanges(changes) {
+        if (changes && 'gridApi' in changes && changes.gridApi.currentValue) {
+            this.applyValues();
+            this.gridApi.grid.registerDataChangeCallback(() => this.applyValues(), [this.uiGridConstants.dataChange.COLUMN]);
+            if (hasGrouping(changes)) this.gridApi.grouping.on.groupingChanged(this.$scope, () => this.applyValues());
+        }
+    }
+
+    applyValues() {
+        this.state = this.getState();
+        this.columnsMenu = this.makeMenu();
+        this.selectedColumns = this.getSelectedColumns();
+        this.setSelectedColumns();
+    }
+
+    getSelectedColumns() {
+        return picksrc(this.state).filter((i) => i.isVisible && i.isInMenu).map((i) => id(i.item));
+    }
+
+    makeMenu() {
+        return picksrc(this.state).filter((i) => i.isInMenu).map((i) => ({
+            name: id(i.item),
+            item: i.item
+        }));
+    }
+
+    getState() {
+        const api = this.gridApi;
+        const columns = api.grid.options.columnDefs;
+        const categories = api.grid.options.categories || [];
+        const grouping = api.grouping
+            ? api.grouping.getGrouping().grouping.map((g) => columns.find((c) => c.name === g.colName).categoryDisplayName)
+            : [];
+        const mapfn = (item) => ({
+            item,
+            isInMenu: item.enableHiding !== false && !grouping.includes(item.name),
+            isVisible: grouping.includes(item.name) || item.visible !== false
+        });
+        return ({
+            categories: categories.map(mapfn),
+            columns: columns.map(mapfn)
+        });
+    }
+
+    findScrollToNext(columns, prevColumns) {
+        if (!prevColumns) return;
+        const diff = difference(columns, prevColumns);
+        if (diff.length === 1 && columns.includes(diff[0])) return diff[0];
+    }
+
+    setSelectedColumns() {
+        const {selectedColumns} = this;
+        const scrollToNext = this.findScrollToNext(selectedColumns, this.prevSelectedColumns);
+        this.prevSelectedColumns = selectedColumns;
+        const all = this.state.categories.concat(this.state.columns);
+        const itemsToShow = uniq(all.filter((i) => !i.isInMenu && i.isVisible).map((i) => id(i.item)).concat(selectedColumns));
+        (this.gridApi.grid.options.categories || []).concat(this.gridApi.grid.options.columnDefs).forEach((item) => {
+            item.visible = itemsToShow.includes(id(item));
+        });
+        // Scrolls to the last matching columnDef, useful if it was out of view after being enabled.
+        this.refreshColumns().then(() => {
+            if (scrollToNext) {
+                const column = findLast(this.gridApi.grid.options.columnDefs, (c) => id(c) === scrollToNext);
+                this.gridApi.grid.scrollTo(null, column);
+            }
+        });
+    }
+
+    // gridApi.grid.refreshColumns method does not allow to wait until async operation completion.
+    // This method does roughly the same, but returns a Promise.
+    refreshColumns() {
+        return this.gridApi.grid.processColumnsProcessors(this.gridApi.grid.columns)
+        .then((renderableColumns) => this.gridApi.grid.setVisibleColumns(renderableColumns))
+        .then(() => this.gridApi.grid.redrawInPlace())
+        .then(() => this.gridApi.grid.refreshCanvas(true));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js b/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
new file mode 100644
index 0000000..d163a9c
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
@@ -0,0 +1,435 @@
+/*
+ * 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.
+ */
+
+import {suite, test} from 'mocha';
+import {assert} from 'chai';
+import {spy, stub} from 'sinon';
+
+import Controller from './controller';
+
+const mocks = () => new Map([
+    ['$scope', {}],
+    ['uiGridConstants', {
+        dataChange: {
+            COLUMN: 'COLUMN'
+        }
+    }]
+]);
+
+const apiMock = () => ({
+    grid: {
+        options: {
+            columnDefs: []
+        },
+        registerDataChangeCallback: spy(),
+        processColumnsProcessors: spy((v) => Promise.resolve(v)),
+        setVisibleColumns: spy((v) => Promise.resolve(v)),
+        redrawInPlace: spy((v) => Promise.resolve(v)),
+        refreshCanvas: spy((v) => Promise.resolve(v)),
+        scrollTo: spy()
+    },
+    grouping: {
+        on: {
+            groupingChanged: spy()
+        },
+        getGrouping: stub().returns({grouping: []})
+    }
+});
+
+suite('grid-column-selector component controller', () => {
+    test('$onChanges', () => {
+        const c = new Controller(...mocks().values());
+        c.applyValues = spy(c.applyValues.bind(c));
+        const api = apiMock();
+        c.gridApi = api;
+        c.$onChanges({gridApi: {currentValue: api}});
+
+        assert.equal(c.applyValues.callCount, 1, 'calls applyValues');
+        assert.isFunction(
+            c.gridApi.grid.registerDataChangeCallback.lastCall.args[0]
+        );
+
+        c.gridApi.grid.registerDataChangeCallback.lastCall.args[0]();
+
+        assert.equal(
+            c.applyValues.callCount,
+            2,
+            'registers applyValues as data change callback'
+        );
+        assert.deepEqual(
+            c.gridApi.grid.registerDataChangeCallback.lastCall.args[1],
+            [c.uiGridConstants.dataChange.COLUMN],
+            'registers data change callback for COLUMN'
+        );
+        assert.equal(
+            c.gridApi.grouping.on.groupingChanged.lastCall.args[0],
+            c.$scope,
+            'registers grouping change callback with correct $scope'
+        );
+
+        c.gridApi.grouping.on.groupingChanged.lastCall.args[1]();
+
+        assert.equal(
+            c.applyValues.callCount,
+            3,
+            'registers applyValues as grouping change callback'
+        );
+    });
+    test('applyValues', () => {
+        const c = new Controller(...mocks().values());
+        const mock = {
+            getState: stub().returns({}),
+            makeMenu: stub().returns({}),
+            getSelectedColumns: stub().returns({}),
+            setSelectedColumns: spy()
+        };
+        c.applyValues.call(mock);
+
+        assert.equal(
+            mock.state,
+            mock.getState.lastCall.returnValue,
+            'assigns getState return value as this.state'
+        );
+        assert.equal(
+            mock.columnsMenu,
+            mock.makeMenu.lastCall.returnValue,
+            'assigns makeMenu return value as this.columnsMenu'
+        );
+        assert.equal(
+            mock.selectedColumns,
+            mock.getSelectedColumns.lastCall.returnValue,
+            'assigns getSelectedColumns return value as this.selectedColumns'
+        );
+        assert.equal(
+            mock.setSelectedColumns.callCount,
+            1,
+            'calls setSelectedColumns once'
+        );
+    });
+    test('getSelectedColumns, using categories', () => {
+        const c = new Controller(...mocks().values());
+        c.state = {
+            categories: [
+                {isVisible: false},
+                {isVisible: true, isInMenu: false},
+                {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+                {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+                {isVisible: true, isInMenu: true, item: {name: '3'}}
+            ],
+            columns: []
+        };
+
+        assert.deepEqual(
+            c.getSelectedColumns(),
+            ['1', '2', '3'],
+            'returns correct value, prefers categories over columns'
+        );
+    });
+    test('getSelectedColumns, using columnDefs', () => {
+        const c = new Controller(...mocks().values());
+        c.state = {
+            categories: [
+            ],
+            columns: [
+                {isVisible: false},
+                {isVisible: true, isInMenu: false},
+                {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+                {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+                {isVisible: true, isInMenu: true, item: {name: '3'}}
+            ]
+        };
+
+        assert.deepEqual(
+            c.getSelectedColumns(),
+            ['1', '2', '3'],
+            'returns correct value, uses columns if there are no categories'
+        );
+    });
+    test('makeMenu, using categories', () => {
+        const c = new Controller(...mocks().values());
+        c.state = {
+            categories: [
+                {isVisible: false},
+                {isVisible: true, isInMenu: false},
+                {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+                {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+                {isVisible: true, isInMenu: true, item: {name: '3'}}
+            ],
+            columns: []
+        };
+
+        assert.deepEqual(
+            c.makeMenu(),
+            [
+                {item: {categoryDisplayName: '1'}, name: '1'},
+                {item: {displayName: '2'}, name: '2'},
+                {item: {name: '3'}, name: '3'}
+            ],
+            'returns correct value, prefers categories over columns'
+        );
+    });
+    test('makeMenu, using columns', () => {
+        const c = new Controller(...mocks().values());
+        c.state = {
+            categories: [],
+            columns: [
+                {isVisible: false},
+                {isVisible: true, isInMenu: false},
+                {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+                {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+                {isVisible: true, isInMenu: true, item: {name: '3'}}
+            ]
+        };
+
+        assert.deepEqual(
+            c.makeMenu(),
+            [
+                {item: {categoryDisplayName: '1'}, name: '1'},
+                {item: {displayName: '2'}, name: '2'},
+                {item: {name: '3'}, name: '3'}
+            ],
+            'returns correct value, uses columns if there are no categories'
+        );
+    });
+    test('getState', () => {
+        const c = new Controller(...mocks().values());
+        c.gridApi = apiMock();
+        c.gridApi.grouping.getGrouping = () => ({grouping: [{colName: 'a', categoryDisplayName: 'A'}]});
+        c.gridApi.grid.options.columnDefs = [
+            {visible: false, name: 'a', categoryDisplayName: 'A'},
+            {visible: true, name: 'a1', categoryDisplayName: 'A'},
+            {visible: true, name: 'a2', categoryDisplayName: 'A'},
+            {visible: true, name: 'b1', categoryDisplayName: 'B'},
+            {visible: true, name: 'b2', categoryDisplayName: 'B'},
+            {visible: true, name: 'b3', categoryDisplayName: 'B'},
+            {visible: true, name: 'c1', categoryDisplayName: 'C'},
+            {visible: true, name: 'c2', categoryDisplayName: 'C', enableHiding: false},
+            {visible: false, name: 'c3', categoryDisplayName: 'C'}
+        ];
+        c.gridApi.grid.options.categories = [
+            {categoryDisplayName: 'A', enableHiding: false, visible: true},
+            {categoryDisplayName: 'B', enableHiding: true, visible: false},
+            {categoryDisplayName: 'C', enableHiding: true, visible: true}
+        ];
+
+        assert.deepEqual(
+            c.getState(),
+            {
+                categories: [{
+                    isInMenu: false,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'A',
+                        enableHiding: false,
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: false,
+                    item: {
+                        categoryDisplayName: 'B',
+                        enableHiding: true,
+                        visible: false
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'C',
+                        enableHiding: true,
+                        visible: true
+                    }
+                }],
+                columns: [{
+                    isInMenu: true,
+                    isVisible: false,
+                    item: {
+                        categoryDisplayName: 'A',
+                        name: 'a',
+                        visible: false
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'A',
+                        name: 'a1',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'A',
+                        name: 'a2',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'B',
+                        name: 'b1',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'B',
+                        name: 'b2',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'B',
+                        name: 'b3',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'C',
+                        name: 'c1',
+                        visible: true
+                    }
+                }, {
+                    isInMenu: false,
+                    isVisible: true,
+                    item: {
+                        categoryDisplayName: 'C',
+                        name: 'c2',
+                        visible: true,
+                        enableHiding: false
+                    }
+                }, {
+                    isInMenu: true,
+                    isVisible: false,
+                    item: {
+                        categoryDisplayName: 'C',
+                        name: 'c3',
+                        visible: false
+                    }
+                }]
+            },
+            'returns correct value'
+        );
+    });
+    test('findScrollToNext', () => {
+        assert.deepEqual(
+            Controller.prototype.findScrollToNext([1, 2, 3], [1, 2]),
+            3,
+            `returns new item if it's in selected collection end`
+        );
+        assert.deepEqual(
+            Controller.prototype.findScrollToNext([1, 2], [1, 3]),
+            2,
+            `returns new item if it's in selected collection middle`
+        );
+        assert.deepEqual(
+            Controller.prototype.findScrollToNext([1, 2, 3], [2, 3]),
+            1,
+            `returns new item if it's in selected collection start`
+        );
+        assert.equal(
+            Controller.prototype.findScrollToNext([1, 2, 3, 4, 5], [1]),
+            void 0,
+            `returns nothing if there's more than one new item`
+        );
+        assert.equal(
+            Controller.prototype.findScrollToNext([1, 2], [1, 2, 3]),
+            void 0,
+            `returns nothing if items were removed`
+        );
+    });
+    test('setSelectedColumns', () => {
+        const c = new Controller(...mocks().values());
+        const api = c.gridApi = apiMock();
+        c.refreshColumns = stub().returns(({then: (f) => f()}));
+        c.gridApi.grid.options.columnDefs = [
+            {name: 'a', visible: false, categoryDisplayName: 'A'},
+            {name: 'a1', visible: false, categoryDisplayName: 'A'},
+            {name: 'b', visible: true, categoryDisplayName: 'B'}
+        ];
+        c.gridApi.grid.options.categories = [
+            {categoryDisplayName: 'A', visible: false},
+            {categoryDisplayName: 'B'}
+        ];
+        c.$onChanges({gridApi: {currentValue: api}});
+        c.selectedColumns = ['A', 'B'];
+        c.setSelectedColumns();
+
+        assert.equal(
+            c.refreshColumns.callCount,
+            2,
+            'calls refreshColumns'
+        );
+        assert.deepEqual(
+            c.gridApi.grid.options.categories,
+            [
+                {categoryDisplayName: 'A', visible: true},
+                {categoryDisplayName: 'B', visible: true}
+            ],
+            'changes category visibility'
+        );
+        assert.deepEqual(
+            c.gridApi.grid.options.columnDefs,
+            [
+                {name: 'a', visible: true, categoryDisplayName: 'A'},
+                {name: 'a1', visible: true, categoryDisplayName: 'A'},
+                {name: 'b', visible: true, categoryDisplayName: 'B'}
+            ],
+            'changes column visibility'
+        );
+        assert.deepEqual(
+            c.gridApi.grid.scrollTo.lastCall.args,
+            [null, {name: 'a1', visible: true, categoryDisplayName: 'A'}],
+            'scrolls to last added column'
+        );
+    });
+    test('refreshColumns', () => {
+        const c = new Controller(...mocks().values());
+        c.gridApi = apiMock();
+        c.gridApi.grid.columns = [1, 2, 3];
+
+        return c.refreshColumns().then(() => {
+            assert.equal(
+                c.gridApi.grid.processColumnsProcessors.lastCall.args[0],
+                c.gridApi.grid.columns,
+                'calls processColumnsProcessors with correct args'
+            );
+            assert.equal(
+                c.gridApi.grid.setVisibleColumns.lastCall.args[0],
+                c.gridApi.grid.columns,
+                'calls setVisibleColumns with correct args'
+            );
+            assert.equal(
+                c.gridApi.grid.redrawInPlace.callCount,
+                1,
+                'calls redrawInPlace'
+            );
+            assert.equal(
+                c.gridApi.grid.refreshCanvas.lastCall.args[0],
+                true,
+                'calls refreshCanvas with correct args'
+            );
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/index.js b/modules/web-console/frontend/app/components/grid-column-selector/index.js
new file mode 100644
index 0000000..16ef655
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/index.js
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import component from './component';
+
+export default angular
+    .module('ignite-console.grid-column-selector', [])
+    .component('gridColumnSelector', component);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/style.scss b/modules/web-console/frontend/app/components/grid-column-selector/style.scss
new file mode 100644
index 0000000..5e0d5d4
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/style.scss
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+grid-column-selector {
+    display: inline-block;
+
+    .btn-ignite, .icon {
+        margin: 0 !important;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/template.pug b/modules/web-console/frontend/app/components/grid-column-selector/template.pug
new file mode 100644
index 0000000..86fd152
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/template.pug
@@ -0,0 +1,28 @@
+//-
+    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.
+
+button.btn-ignite.btn-ignite--link-dashed-secondary(
+    protect-from-bs-select-render
+    bs-select
+    ng-model='$ctrl.selectedColumns'
+    ng-change='$ctrl.setSelectedColumns()'
+    ng-model-options='{debounce: {default: 5}}',
+    bs-options='column.name as column.name for column in $ctrl.columnsMenu'
+    bs-on-before-show='$ctrl.onShow'
+    data-multiple='true'
+    ng-transclude
+)
+    svg(ignite-icon='gear').icon

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
index 01b1fc8..e73dd17 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
@@ -16,15 +16,15 @@
  */
 
 export default [
-    {name: 'Actions', visible: false, selectable: false},
-    {name: 'User', visible: true, selectable: false},
-    {name: 'Email', visible: true, selectable: true},
-    {name: 'Company', visible: true, selectable: true},
-    {name: 'Country', visible: true, selectable: true},
-    {name: 'Last login', visible: false, selectable: true},
-    {name: 'Last activity', visible: true, selectable: true},
-    {name: 'Configurations', visible: false, selectable: true},
-    {name: 'Total activities', visible: true, selectable: true},
-    {name: 'Configuration\'s activities', visible: false, selectable: true},
-    {name: 'Queries\' activities', visible: false, selectable: true}
+    {name: 'Actions', visible: false, enableHiding: false},
+    {name: 'User', visible: true, enableHiding: false},
+    {name: 'Email', visible: true, enableHiding: true},
+    {name: 'Company', visible: true, enableHiding: true},
+    {name: 'Country', visible: true, enableHiding: true},
+    {name: 'Last login', visible: false, enableHiding: true},
+    {name: 'Last activity', visible: true, enableHiding: true},
+    {name: 'Configurations', visible: false, enableHiding: true},
+    {name: 'Total activities', visible: true, enableHiding: true},
+    {name: 'Configuration\'s activities', visible: false, enableHiding: true},
+    {name: 'Queries\' activities', visible: false, enableHiding: true}
 ];

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
index baf5aed..493c239 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -49,8 +49,8 @@ const ACTIONS_TEMPLATE = `
 const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
 
 export default [
-    {name: 'actions', displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
-    {name: 'user', displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
+    {name: 'actions', enableHiding: false, displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
+    {name: 'user', enableHiding: false, displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
     {name: 'email', displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
     {name: 'company', displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 180, enableFiltering: true, filter: { placeholder: 'Filter by company...' }},
     {name: 'country', displayName: 'Country', categoryDisplayName: 'Country', field: 'countryCode', minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by country...' }},

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index c006003..58e93b4 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -246,52 +246,6 @@ export default class IgniteListOfRegisteredUsersCtrl {
             this.selected = ids;
     }
 
-    _enableColumns(_categories, visible) {
-        _.forEach(_categories, (cat) => {
-            cat.visible = visible;
-
-            _.forEach(this.gridOptions.columnDefs, (col) => {
-                if (col.categoryDisplayName === cat.name)
-                    col.visible = visible;
-            });
-        });
-
-        // Check to all selected columns.
-        this.gridOptions.selectedAll = true;
-        _.forEach(this._selectableColumns(), ({ visible }) => this.gridOptions.selectedAll = visible);
-
-        // Workaround for this.gridApi.grid.refresh() didn't return promise.
-        this.gridApi.grid.processColumnsProcessors(this.gridApi.grid.columns)
-            .then((renderableColumns) => this.gridApi.grid.setVisibleColumns(renderableColumns))
-            .then(() => this.gridApi.grid.redrawInPlace())
-            .then(() => this.gridApi.grid.refreshCanvas(true))
-            .then(() => {
-                if (visible) {
-                    const categoryDisplayName = _.last(_categories).name;
-
-                    const col = _.findLast(this.gridOptions.columnDefs, {categoryDisplayName});
-
-                    this.gridApi.grid.scrollTo(null, col);
-                }
-            });
-    }
-
-    _selectableColumns() {
-        return _.filter(this.gridOptions.categories, (cat) => cat.selectable);
-    }
-
-    toggleColumns(category, visible) {
-        this._enableColumns([category], visible);
-    }
-
-    selectAllColumns() {
-        this._enableColumns(this._selectableColumns(), true);
-    }
-
-    clearAllColumns() {
-        this._enableColumns(this._selectableColumns(), false);
-    }
-
     exportCsv() {
         this.gridApi.exporter.csvExport('visible', 'visible');
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
index d94fb2e..71d93a7 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
@@ -20,6 +20,9 @@ ignite-list-of-registered-users {
 }
 
 .list-of-registered-users {
+  .ui-grid-settings--heading {
+    display: flex;
+  }
   & > a {
     display: inline-block;
     margin: 10px;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
index 85a2070..3558ab5 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
@@ -16,21 +16,6 @@
 
 include /app/helpers/jade/mixins
 
-mixin grid-settings()
-    .grid-settings
-        svg(ignite-icon='gear' data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
-        ul.select.dropdown-menu(role='menu')
-            li
-                a(ng-click='$ctrl.gridOptions.selectedAll ? $ctrl.clearAllColumns() : $ctrl.selectAllColumns()')
-                    i.fa.fa-check-square-o.pull-left(ng-if='$ctrl.gridOptions.selectedAll')
-                    i.fa.fa-square-o.pull-left(ng-if='!$ctrl.gridOptions.selectedAll')
-                    span All
-            li(ng-repeat='item in $ctrl.gridOptions.categories|filter:{selectable:true}')
-                a(ng-click='$ctrl.toggleColumns(item, !item.visible)')
-                    i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
-                    i.fa.fa-square-o.pull-left(ng-if='!item.visible')
-                    span {{::item.name}}
-
 .list-of-registered-users
     ul.tabs.tabs--blue
         li(role='presentation' ng-class='{ active: $ctrl.groupBy === "user" }') 
@@ -52,7 +37,14 @@ mixin grid-settings()
     .panel--ignite
         .panel-heading.ui-grid-settings
             .panel-title
-                +ignite-form-field-bsdropdown('Actions', '$ctrl.action', 'action', '!$ctrl.selected.length', false, '$ctrl.actionOptions')
+                +ignite-form-field-bsdropdown({
+                    label: 'Actions',
+                    model: '$ctrl.action',
+                    name: 'action',
+                    disabled: '!$ctrl.selected.length',
+                    required: false,
+                    options: '$ctrl.actionOptions'
+                })
                 button.btn-ignite.btn-ignite--primary-outline(ng-click='$ctrl.exportCsv()' bs-tooltip='' data-title='Export table to csv' data-placement='top')
                     svg(ignite-icon='csv')
                 form.ui-grid-settings-dateperiod(name=form novalidate)
@@ -67,7 +59,7 @@ mixin grid-settings()
                     span(ng-if='$ctrl.groupBy === "user"') List of registered users
                     span(ng-if='$ctrl.groupBy === "company"') List of registered companies
                     span(ng-if='$ctrl.groupBy === "country"') List of registered countries
-                    +grid-settings
+                    grid-column-selector(grid-api='$ctrl.gridApi')
                 .panel-selected(ng-show='$ctrl.selected.length')
                     | {{ $ctrl.selected.length }} item{{ $ctrl.selected.length > 1 ? 's' : '' }} selected            
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js b/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
deleted file mode 100644
index 5d0ef53..0000000
--- a/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
+++ /dev/null
@@ -1,32 +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.
- */
-
-export default function pcbProtectFromBsSelectRender() {
-    return {
-        link(scope, el, attr, ctrl) {
-            const {$render} = ctrl;
-
-            Object.defineProperty(ctrl, '$render', {
-                set() {},
-                get() {
-                    return $render;
-                }
-            });
-        },
-        require: 'ngModel'
-    };
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/index.js b/modules/web-console/frontend/app/components/page-configure-basic/index.js
index 1bec7cb..21ae777 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/index.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/index.js
@@ -20,12 +20,10 @@ import angular from 'angular';
 import component from './component';
 import service from './service';
 
-import pcbProtectFromBsSelectRender from './components/pcbProtectFromBsSelectRender';
 import pcbScaleNumber from './components/pcbScaleNumber';
 
 export default angular
     .module('ignite-console.page-configure-basic', [])
     .component('pageConfigureBasic', component)
-    .directive('pcbProtectFromBsSelectRender', pcbProtectFromBsSelectRender)
     .directive('pcbScaleNumber', pcbScaleNumber)
     .service('PageConfigureBasic', service);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/template.pug b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
index 36dfb20..ab8f43c 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/template.pug
+++ b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
@@ -99,7 +99,7 @@ form(novalidate name=form)
                 bs-select
                 bs-options='size as size.label for size in $ctrl.sizesMenu'
                 ng-model='$ctrl.memorySizeScale'
-                pcb-protect-from-bs-select-render
+                protect-from-bs-select-render
             )
                 | {{ $ctrl.memorySizeScale.label }}
                 span.fa.fa-caret-down.icon-right
@@ -153,7 +153,7 @@ form(novalidate name=form)
                 bs-options='cache._id as cache.name for cache in $ctrl.cachesMenu'
                 data-multiple='true'
                 data-placement='top-left'
-                pcb-protect-from-bs-select-render
+                protect-from-bs-select-render
             )
                 | + Select from existing caches
         

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js b/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js
new file mode 100644
index 0000000..e51d477
--- /dev/null
+++ b/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+export default function protectFromBsSelectRender() {
+    return {
+        link(scope, el, attr, ctrl) {
+            const {$render} = ctrl;
+
+            Object.defineProperty(ctrl, '$render', {
+                set() {},
+                get() {
+                    return $render;
+                }
+            });
+        },
+        require: 'ngModel'
+    };
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js b/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js
new file mode 100644
index 0000000..fd63000
--- /dev/null
+++ b/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import directive from './directive';
+
+export default angular
+    .module('ignite-console.protect-from-bs-select-render', [])
+    .directive('protectFromBsSelectRender', directive);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 9dfdab3..fc193eb 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -20,7 +20,6 @@ include ../../primitives/datepicker/index
 include ../../primitives/timepicker/index
 include ../../primitives/dropdown/index
 include ../../primitives/tooltip/index
-include ../../primitives/ui-grid-settings/index
 include ../../primitives/switcher/index
 
 //- Mixin for advanced options toggle.

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/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 5c678d6..633f167 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -57,25 +57,6 @@ class Paragraph {
 
         _.assign(this, paragraph);
 
-        const _enableColumns = (categories, visible) => {
-            _.forEach(categories, (cat) => {
-                cat.visible = visible;
-
-                _.forEach(this.gridOptions.columnDefs, (col) => {
-                    if (col.displayName === cat.name)
-                        col.visible = visible;
-                });
-            });
-
-            this.gridOptions.api.grid.refresh();
-        };
-
-        const _selectableColumns = () => _.filter(this.gridOptions.categories, (cat) => cat.selectable);
-
-        this.toggleColumns = (category, visible) => _enableColumns([category], visible);
-        this.selectAllColumns = () => _enableColumns(_selectableColumns(), true);
-        this.clearAllColumns = () => _enableColumns(_selectableColumns(), false);
-
         Object.defineProperty(this, 'gridOptions', {value: {
             enableGridMenu: false,
             enableColumnMenus: false,
@@ -101,7 +82,7 @@ class Paragraph {
                     this.categories.push({
                         name: col.fieldName,
                         visible: self.columnFilter(col),
-                        selectable: true
+                        enableHiding: true
                     });
 
                     return cols;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/btn/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/btn/index.scss b/modules/web-console/frontend/app/primitives/btn/index.scss
index 6fb76c8..94b5bd2 100644
--- a/modules/web-console/frontend/app/primitives/btn/index.scss
+++ b/modules/web-console/frontend/app/primitives/btn/index.scss
@@ -17,6 +17,9 @@
 
 @import "./../../../public/stylesheets/variables.scss";
 
+$btn-content-padding: 10px 12px;
+$btn-content-padding-with-border: 9px 11px;
+
 @mixin active-focus-shadows(
     $focus: (0 0 5px #095d9a, 0 0 5px #095d9a),
     $active: (inset 0 1px 3px 0 rgba(0, 0, 0, 0.5))
@@ -39,7 +42,6 @@
 }
 
 .btn-ignite {
-    $content-padding: 10px 12px;
     $icon-margin: 8px;
 
     display: inline-flex;
@@ -48,7 +50,7 @@
     align-items: center;
     box-sizing: border-box;
     margin: 0;
-    padding: $content-padding;
+    padding: $btn-content-padding;
 
     border: none;
     border-radius: $ignite-button-border-radius;
@@ -128,6 +130,7 @@
     border: 1px solid $accent-color;
     background: white;
     color: $accent-color;
+    padding: $btn-content-padding-with-border;
 
     &:hover, &.hover,
     &:active, &.active {
@@ -248,6 +251,7 @@
     background-color: white;
     color: #424242;
     border: 1px solid #dedede;
+    padding: $btn-content-padding-with-border;
 
     &:hover, &.hover,
     &:active, &.active {

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/dropdown/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/dropdown/index.pug b/modules/web-console/frontend/app/primitives/dropdown/index.pug
index 3a5f1b1..c145244 100644
--- a/modules/web-console/frontend/app/primitives/dropdown/index.pug
+++ b/modules/web-console/frontend/app/primitives/dropdown/index.pug
@@ -14,7 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 
-mixin ignite-form-field-bsdropdown(label, model, name, disabled, required, options, tip)
+mixin ignite-form-field-bsdropdown({label, model, name, disabled, required, options, tip})
     .dropdown--ignite.ignite-form-field
         .btn-ignite.btn-ignite--primary-outline(
             data-ng-model=model

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug b/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
deleted file mode 100644
index 8f1487e..0000000
--- a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
+++ /dev/null
@@ -1,33 +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.
-
-mixin ui-grid-settings()
-    .ui-grid-settings
-        i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
-        ul.select.dropdown-menu(role='menu')
-            li(ng-repeat='item in paragraph.gridOptions.categories|filter:{selectable:true}')
-                a(ng-click='paragraph.toggleColumns(item, !item.visible)')
-                    i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
-                    i.fa.fa-square-o.pull-left(ng-if='!item.visible')
-                    span {{::item.name}}
-            li.divider
-            li
-                a(ng-click='paragraph.selectAllColumns()') Select all
-            li
-                a(ng-click='paragraph.clearAllColumns()') Clear all
-            li.divider
-            li
-                a(ng-click='$hide()') Close

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 857cdce..305e7f7 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -604,6 +604,19 @@ button.form-control {
 
             padding: 5px 10px;
         }
+
+        grid-column-selector {
+            margin-right: 5px;
+
+            .btn-ignite {
+                padding: 5px 0;
+                box-shadow: none !important;
+
+                .fa {
+                    font-size: 14px;
+                }
+            }
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index 94251f9..f215c43 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -124,7 +124,8 @@ mixin query-actions
 mixin table-result-heading-query
     .total.row
         .col-xs-4
-            +ui-grid-settings
+            grid-column-selector(grid-api='paragraph.gridOptions.api')
+                .fa.fa-bars.icon
             label Page: #[b {{paragraph.page}}]
             label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
             label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
@@ -139,7 +140,8 @@ mixin table-result-heading-query
 mixin table-result-heading-scan
     .total.row
         .col-xs-4
-            +ui-grid-settings
+            grid-column-selector(grid-api='paragraph.gridOptions.api')
+                .fa.fa-bars.icon
             label Page: #[b {{paragraph.page}}]
             label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
             label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]


[27/28] ignite git commit: Merge remote-tracking branch 'professional/ignite-2.1.2' into ignite-2.1.2

Posted by sb...@apache.org.
Merge remote-tracking branch 'professional/ignite-2.1.2' into ignite-2.1.2


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: ae5ec942710c9c70829288169474787d1e682b35
Parents: 64596ea 7d42dea
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Mon Jul 3 18:20:55 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Mon Jul 3 18:20:55 2017 +0300

----------------------------------------------------------------------
 .../GridCacheAtomicSequenceImpl.java            | 55 ++++++++++++--------
 ...titionedAtomicSequenceMultiThreadedTest.java | 32 ++++++++++++
 2 files changed, 64 insertions(+), 23 deletions(-)
----------------------------------------------------------------------



[19/28] ignite git commit: IGNITE-5656 Fixed misaligned checkboxs.

Posted by sb...@apache.org.
IGNITE-5656 Fixed misaligned checkboxs.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: ad739d59d5517994cdab18a8a5dad3cad7b9dfa0
Parents: 18bbb14
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Mon Jul 3 15:39:56 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Jul 3 15:39:56 2017 +0700

----------------------------------------------------------------------
 .../frontend/app/helpers/jade/form/form-field-checkbox.pug      | 2 +-
 modules/web-console/frontend/app/primitives/tooltip/index.pug   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ad739d59/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
index 21be8b2..497680b 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
@@ -36,4 +36,4 @@ mixin form-field-checkbox(label, model, name, disabled, required, tip)
                     )
             span #{label}
 
-            +tooltip(tip, tipOpts)
+            +tooltip(tip, tipOpts, 'tipLabel')

http://git-wip-us.apache.org/repos/asf/ignite/blob/ad739d59/modules/web-console/frontend/app/primitives/tooltip/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/tooltip/index.pug b/modules/web-console/frontend/app/primitives/tooltip/index.pug
index de1b116..632fc61 100644
--- a/modules/web-console/frontend/app/primitives/tooltip/index.pug
+++ b/modules/web-console/frontend/app/primitives/tooltip/index.pug
@@ -14,12 +14,13 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 
-mixin tooltip(title, options)
+mixin tooltip(title, options, tipClass = 'tipField')
     if title
-        i.tipField.icon-help(
+        i.icon-help(
             bs-tooltip=''
 
             data-title=title
             data-container=options && options.container || false
             data-placement=options && options.placement || false
+            class=`${tipClass}`
         )


[08/28] ignite git commit: IGNITE-5076: improved multi-threaded start of nodes

Posted by sb...@apache.org.
IGNITE-5076: improved multi-threaded start of nodes


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 94170406cd974408ffe6b8276c785b443832484e
Parents: f6cbba3
Author: Slava Koptilin <sl...@gmail.com>
Authored: Mon Jun 26 15:37:26 2017 +0300
Committer: agura <ag...@gridgain.com>
Committed: Thu Jun 29 16:41:04 2017 +0300

----------------------------------------------------------------------
 .../ignite/testframework/junits/GridAbstractTest.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/94170406/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
old mode 100644
new mode 100755
index 58eceaa..24fba95
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -691,12 +691,14 @@ public abstract class GridAbstractTest extends TestCase {
      * @throws Exception If failed.
      */
     protected Ignite startGridsMultiThreaded(int cnt) throws Exception {
-        if (cnt == 1)
-            return startGrids(1);
+        assert cnt > 0 : "Number of grids must be a positive number";
 
-        Ignite ignite = startGridsMultiThreaded(0, cnt);
+        Ignite ignite = startGrids(1);
 
-        checkTopology(cnt);
+        if (cnt > 1) {
+            startGridsMultiThreaded(1, cnt - 1);
+            checkTopology(cnt);
+        }
 
         return ignite;
     }


[04/28] ignite git commit: fail added to IgnitePersistentStoreDataStructuresTest::testSet, link to JIRA is provided

Posted by sb...@apache.org.
fail added to IgnitePersistentStoreDataStructuresTest::testSet, link to JIRA is provided


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 0bd6e8f44bcd8385b82480a4bf850b39d2adb3cf
Parents: fe5f551
Author: Sergey Chugunov <se...@gmail.com>
Authored: Thu Jun 29 11:55:25 2017 +0300
Committer: Sergey Chugunov <se...@gmail.com>
Committed: Thu Jun 29 11:55:25 2017 +0300

----------------------------------------------------------------------
 .../cache/persistence/IgnitePersistentStoreDataStructuresTest.java | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0bd6e8f4/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 1cae210..5561d95 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
@@ -170,6 +170,8 @@ public class IgnitePersistentStoreDataStructuresTest extends GridCommonAbstractT
      * @throws Exception If failed.
      */
     public void testSet() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-5553");
+
         Ignite ignite = startGrids(4);
 
         ignite.active(true);


[07/28] ignite git commit: IGNITE-5611 Update some selects to new design.

Posted by sb...@apache.org.
IGNITE-5611 Update some selects to new design.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 50376045c2585ecf7a944d54846256e7b9bb514f
Parents: 4936c88
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Thu Jun 29 20:11:27 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 29 20:11:27 2017 +0700

----------------------------------------------------------------------
 modules/web-console/frontend/app/app.config.js  |  3 +-
 modules/web-console/frontend/app/app.js         |  2 +
 .../app/components/bs-select-menu/controller.js | 28 +++++++
 .../app/components/bs-select-menu/directive.js  | 30 ++++++++
 .../app/components/bs-select-menu/index.js      | 24 ++++++
 .../app/components/bs-select-menu/style.scss    | 77 ++++++++++++++++++++
 .../app/components/bs-select-menu/template.pug  | 49 +++++++++++++
 .../page-configure-basic/controller.js          |  2 +-
 .../page-configure-basic/controller.spec.js     |  1 -
 .../page-configure-basic/template.pug           |  1 -
 .../directives/ui-ace-pojos/ui-ace-pojos.pug    |  2 +-
 .../helpers/jade/form/form-field-dropdown.pug   |  1 -
 .../frontend/app/helpers/jade/mixins.pug        |  2 +-
 .../states/configuration/caches/node-filter.pug |  2 +-
 .../states/configuration/caches/store.pug       |  2 +-
 .../configuration/clusters/deployment.pug       |  2 +-
 .../clusters/general/discovery/zookeeper.pug    |  2 +-
 .../states/configuration/clusters/hadoop.pug    |  2 +-
 .../configuration/clusters/load-balancing.pug   |  2 +-
 .../states/configuration/clusters/logger.pug    |  2 +-
 .../configuration/clusters/logger/log4j.pug     |  2 +-
 .../configuration/clusters/logger/log4j2.pug    |  2 +-
 .../states/configuration/clusters/swap.pug      |  2 +-
 .../frontend/controllers/domains-controller.js  |  3 -
 .../views/configuration/domains-import.tpl.pug  | 13 ++--
 .../frontend/views/templates/select.tpl.pug     | 26 -------
 26 files changed, 230 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/app.config.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.config.js b/modules/web-console/frontend/app/app.config.js
index f93ee7e..b9741d1 100644
--- a/modules/web-console/frontend/app/app.config.js
+++ b/modules/web-console/frontend/app/app.config.js
@@ -29,7 +29,6 @@ _.mixin({
 });
 
 import alertTemplateUrl from 'views/templates/alert.tpl.pug';
-import selectTemplateUrl from 'views/templates/select.tpl.pug';
 import dropdownTemplateUrl from 'views/templates/dropdown.tpl.pug';
 import validationTemplateUrl from 'views/templates/validation-error.tpl.pug';
 
@@ -77,7 +76,7 @@ igniteConsoleCfg.config(['$selectProvider', ($selectProvider) => {
         maxLength: '5',
         allText: 'Select All',
         noneText: 'Clear All',
-        templateUrl: selectTemplateUrl,
+        template: '<bs-select-menu></bs-select-menu>',
         iconCheckmark: 'fa fa-check',
         caretHtml: ''
     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index fb444d9..61372a2 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -123,6 +123,7 @@ import userNotifications from './components/user-notifications';
 import pageConfigure from './components/page-configure';
 import pageConfigureBasic from './components/page-configure-basic';
 import pageConfigureAdvanced from './components/page-configure-advanced';
+import bsSelectMenu from './components/bs-select-menu';
 
 // Inject external modules.
 import IgniteModules from 'IgniteModules/index';
@@ -188,6 +189,7 @@ angular
     pageConfigure.name,
     pageConfigureBasic.name,
     pageConfigureAdvanced.name,
+    bsSelectMenu.name,
     // Ignite modules.
     IgniteModules.name
 ])

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/bs-select-menu/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/controller.js b/modules/web-console/frontend/app/components/bs-select-menu/controller.js
new file mode 100644
index 0000000..f8c0171
--- /dev/null
+++ b/modules/web-console/frontend/app/components/bs-select-menu/controller.js
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+export default class {
+    static $inject = ['$scope'];
+
+    constructor($scope) {
+        Object.assign(this, {$scope});
+    }
+
+    areAllSelected() {
+        return this.$scope.$matches.every(({index}) => this.$scope.$isActive(index));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/bs-select-menu/directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/directive.js b/modules/web-console/frontend/app/components/bs-select-menu/directive.js
new file mode 100644
index 0000000..44aa199
--- /dev/null
+++ b/modules/web-console/frontend/app/components/bs-select-menu/directive.js
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+import template from './template.pug';
+import controller from './controller';
+import './style.scss';
+
+export default function bsSelectMenu() {
+    return {
+        template,
+        controller,
+        controllerAs: '$ctrl',
+        restrict: 'E',
+        replace: true // Workaround: without [replace: true] bs-select detects incorrect menu size.
+    };
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/bs-select-menu/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/index.js b/modules/web-console/frontend/app/components/bs-select-menu/index.js
new file mode 100644
index 0000000..e64e1fa
--- /dev/null
+++ b/modules/web-console/frontend/app/components/bs-select-menu/index.js
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import directive from './directive';
+
+export default angular
+    .module('ignite-console.bs-select-menu', [])
+    .directive('bsSelectMenu', directive);

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/bs-select-menu/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/style.scss b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
new file mode 100644
index 0000000..67dec24
--- /dev/null
+++ b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+.bs-select-menu {
+    @import '../../../public/stylesheets/variables.scss';
+
+    $item-height: 30px;
+    $max-visible-items: 11;
+
+    z-index: 2000;
+    padding: 0;
+    margin: 0;
+    list-style: none;
+    position: absolute;
+    font-family: Roboto;
+    outline: none !important;
+    overflow-y: auto;
+    overflow-x: hidden;
+    max-height: $max-visible-items * $item-height;
+    max-width: 280px;
+    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.3);
+    border-radius: $ignite-button-border-radius;
+    border: 1px solid #c5c5c5;
+    background: white;
+
+    .bssm-active-indicator {
+        font-size: 14px;
+        width: 12px;
+        color: #afafaf;
+
+        &.bssm-active-indicator__active {
+            color: $ignite-brand-success;
+        }
+    }
+
+    .bssm-item-text {
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+    }
+
+    &>li {
+        width: 100%;
+
+        &>.bssm-item-button {
+            width: 100%;
+            justify-content: flex-start;
+            border-bottom: 1px solid #dedede;
+            padding-bottom: 9px;
+            background-color: transparent;
+            border-radius: 0;
+
+            &:hover {
+                background-color: #eeeeee;
+            }
+        }
+
+        &:last-child > .bssm-item-button {
+            border-bottom: none;
+            padding-bottom: 10px;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/bs-select-menu/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/template.pug b/modules/web-console/frontend/app/components/bs-select-menu/template.pug
new file mode 100644
index 0000000..91f3d8e
--- /dev/null
+++ b/modules/web-console/frontend/app/components/bs-select-menu/template.pug
@@ -0,0 +1,49 @@
+//-
+    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.
+
+ul.bs-select-menu(
+    tabindex='-1'
+    ng-show='$isVisible()'
+    role='select'
+)
+    li(ng-if='$showAllNoneButtons || ($isMultiple && $matches.length > 2)')
+        button.btn-ignite.bssm-item-button(
+            ng-click='$ctrl.areAllSelected() ? $selectNone() : $selectAll()'
+            type='button'
+        )
+            span.bssm-active-indicator.icon.icon-left.fa(
+                ng-class=`{
+                    'fa-check-square bssm-active-indicator__active': $ctrl.areAllSelected(),
+                    'fa-square-o': !$ctrl.areAllSelected()
+                }`
+            )
+            | All
+    li(role='presentation' ng-repeat='match in $matches')
+        button.btn-ignite.bssm-item-button(
+            type='button'
+            role='menuitem'
+            tabindex='-1'
+            ng-click='$select($index, $event)'
+            data-placement='right auto'
+            title='{{ ::match.label }}'
+        )
+            span.bssm-active-indicator.icon.icon-left.fa(
+                ng-class=`{
+                    'fa-check-square bssm-active-indicator__active': $isActive($index),
+                    'fa-square-o': !$isActive($index)
+                }`
+            )
+            span.bssm-item-text(ng-bind-html='match.label')

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/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 ac99977..c0b56ac 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
@@ -113,7 +113,7 @@ export default class PageConfigureBasicController {
     getClustersMenu(clusters = new Map()) {
         const newOne = {_id: -1, name: '+ Add new cluster'};
         return clusters.size
-            ? [newOne, {}, ...clusters.values()]
+            ? [newOne, ...clusters.values()]
             : [newOne];
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
index 4798219..f23b410 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
@@ -188,7 +188,6 @@ suite('page-configure-basic component controller', () => {
                 ],
                 clustersMenu: [
                     {_id: -1, name: '+ Add new cluster'},
-                    {},
                     {_id: 1, name: '1', caches: [1, 2]},
                     {_id: 2, name: '2'}
                 ],

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/components/page-configure-basic/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/template.pug b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
index 91b0692..36dfb20 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/template.pug
+++ b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
@@ -152,7 +152,6 @@ form(novalidate name=form)
                 }`
                 bs-options='cache._id as cache.name for cache in $ctrl.cachesMenu'
                 data-multiple='true'
-                data-all-none-buttons='true'
                 data-placement='top-left'
                 pcb-protect-from-bs-select-render
             )

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.pug b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.pug
index 4bee5e5..bb8e6d352 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.pug
+++ b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.pug
@@ -22,7 +22,7 @@ mixin check-tooltip(message)
         .col-xs-2.col-sm-2.col-md-2
             label POJO class:
         .col-xs-10.col-sm-10.col-md-10.summary-pojo-list
-            button.select-toggle.form-control(ng-model='ctrl.class' bs-select bs-options='item for item in ctrl.classes' data-container='')
+            button.select-toggle.form-control(ng-model='ctrl.class' bs-select bs-options='item for item in ctrl.classes')
     .details-row.checkbox
         .col-xs-2.col-sm-2.col-md-2
         .col-xs-10.col-sm-10.col-md-10

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
index 2f13d69..d0f95d4 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
@@ -31,7 +31,6 @@ mixin ignite-form-field-dropdown(label, model, name, disabled, required, multipl
             bs-options=`item.value as item.label for item in ${options}`
 
             data-multiple=multiple ? '1' : false
-            data-container='body > .wrapper'
 
             tabindex='0'
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index e18fcb1..9dfdab3 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -499,7 +499,7 @@ mixin evictionPolicy(model, name, enabled, required, tip)
             {value: "LRU", label: "LRU"},\
             {value: "FIFO", label: "FIFO"},\
             {value: "SORTED", label: "Sorted"},\
-            {value: undefined, label: "Not set"}\
+            {value: null, label: "Not set"}\
         ]', tip)
     span(ng-show=kind)
         +showHideLink('expanded', 'settings')

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.pug
index 1b34b60..e184941 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.pug
@@ -38,7 +38,7 @@ include /app/helpers/jade/mixins
                         '[\
                             {value: "IGFS", label: "IGFS nodes"},\
                             {value: "Custom", label: "Custom"},\
-                            {value: undefined, label: "Not set"}\
+                            {value: null, label: "Not set"}\
                         ]',
                         'Node filter variant'
                     )

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
index 3af24df..d68b57e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
@@ -62,7 +62,7 @@ mixin hibernateField(name, model, items, valid, save, newItem)
                             {value: "CacheJdbcPojoStoreFactory", label: "JDBC POJO store factory"},\
                             {value: "CacheJdbcBlobStoreFactory", label: "JDBC BLOB store factory"},\
                             {value: "CacheHibernateBlobStoreFactory", label: "Hibernate BLOB store factory"},\
-                            {value: undefined, label: "Not set"}\
+                            {value: null, label: "Not set"}\
                         ]',
                         'Factory for persistent storage for cache data\
                         <ul>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.pug
index 25ee62a..74b2acf 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.pug
@@ -127,7 +127,7 @@ include /app/helpers/jade/mixins
                             {value: "URI", label: "URI"},\
                             {value: "Local", label: "Local"}, \
                             {value: "Custom", label: "Custom"},\
-                            {value: undefined, label: "Default"}\
+                            {value: null, label: "Default"}\
                         ]',
                         'Grid deployment SPI is in charge of deploying tasks and classes from different sources:\
                         <ul>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.pug
index 6220eb0..6531d1d 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.pug
@@ -43,7 +43,7 @@ mixin discovery-zookeeper(modelAt = 'backupItem')
                     {value: "OneTime", label: "Only once"},\
                     {value: "Forever", label: "Always allow retry"},\
                     {value: "Custom", label: "Custom"},\
-                    {value: undefined, label: "Default"}\
+                    {value: null, label: "Default"}\
                 ]',
                 'Available retry policies:\
                 <ul>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/hadoop.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/hadoop.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/hadoop.pug
index b45efa4..22852cb 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/hadoop.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/hadoop.pug
@@ -40,7 +40,7 @@ include /app/helpers/jade/mixins
                     +dropdown('Map reduce planner:', plannerModel + '.kind', '"MapReducePlanner"', 'true', 'Default', '[\
                         {value: "Weighted", label: "Weighted"},\
                         {value: "Custom", label: "Custom"},\
-                        {value: undefined, label: "Default"}\
+                        {value: null, label: "Default"}\
                     ]', 'Implementation of map reduce planner\
                     <ul>\
                         <li>Weighted - Planner which assigns mappers and reducers based on their "weights"</li>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.pug
index b80f430..4fbc54e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.pug
@@ -68,7 +68,7 @@ include /app/helpers/jade/mixins
                                         {value: "CPU", label: "CPU load"},\
                                         {value: "ProcessingTime", label: "Processing time"},\
                                         {value: "Custom", label: "Custom"},\
-                                        {value: undefined, label: "Default"}\
+                                        {value: null, label: "Default"}\
                                     ]', 'Implementation of node load probing\
                                     <ul>\
                                         <li>Job count - Based on active and waiting job count</li>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/logger.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger.pug
index f135114..e750365 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger.pug
@@ -40,7 +40,7 @@ include /app/helpers/jade/mixins
                             {value: "JCL", label: "Jakarta Commons Logging (JCL)"},\
                             {value: "Null", label: "Null logger"},\
                             {value: "Custom", label: "Custom"},\
-                            {value: undefined, label: "Default"}\
+                            {value: null, label: "Default"}\
                         ]',
                         'Logger implementations\
                         <ul>\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j.pug
index fadaea4..c4ab379 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j.pug
@@ -32,7 +32,7 @@ div
                 {value: "DEBUG", label: "DEBUG"},\
                 {value: "TRACE", label: "TRACE"},\
                 {value: "ALL", label: "ALL"},\
-                {value: undefined, label: "Default"}\
+                {value: null, label: "Default"}\
             ]',
             'Level for internal log4j implementation')
     .details-row

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j2.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j2.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j2.pug
index d90ca09..299386f 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j2.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/log4j2.pug
@@ -32,7 +32,7 @@ div
                 {value: "DEBUG", label: "DEBUG"},\
                 {value: "TRACE", label: "TRACE"},\
                 {value: "ALL", label: "ALL"},\
-                {value: undefined, label: "Default"}\
+                {value: null, label: "Default"}\
             ]',
             'Level for internal log4j2 implementation')
     .details-row

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
index d278a09..019b0cc 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
@@ -36,7 +36,7 @@ include /app/helpers/jade/mixins
                     +dropdown('Swap space SPI:', `${swapModel}.kind`, '"swapSpaceSpi"', 'true', 'Choose swap SPI',
                         '[\
                             {value: "FileSwapSpaceSpi", label: "File-based swap"},\
-                            {value: undefined, label: "Not set"}\
+                            {value: null, label: "Not set"}\
                         ]',
                         'Provides a mechanism in grid for storing data on disk<br/>\
                         Ignite cache uses swap space to overflow data to disk if it cannot fit in memory\

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 25bb877..7a16c50 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -661,9 +661,6 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
                 }
 
                 if (!_.isEmpty($scope.caches)) {
-                    if (item.cachesOrTemplates.length > 0)
-                        item.cachesOrTemplates.push(null);
-
                     _.forEach($scope.caches, function(cache) {
                         item.cachesOrTemplates.push(cache);
                     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 29bbf4a..7097197 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -66,7 +66,6 @@ mixin td-ellipses-lbl(w, lbl)
                                 'Choose JDBC driver', '', 'jdbcDriverJars',
                                 'Select appropriate JAR with JDBC driver<br> To add another driver you need to place it into "/jdbc-drivers" folder of Ignite Web Agent<br> Refer to Ignite Web Agent README.txt for for more information'
                             )(
-                                data-container='.modal-domain-import'
                                 data-ignite-form-field-input-autofocus='true'
                             )
                         .settings-row.settings-row_small-label
@@ -137,8 +136,8 @@ mixin td-ellipses-lbl(w, lbl)
                                                         div.td-ellipsis
                                                             a(ng-if='!table.edit' ng-click='startEditDbTableCache(table)') {{tableActionView(table)}}
                                                             div(style='display: flex' ng-if='table.edit')
-                                                                button.select-toggle.form-control(style='width: 35%; margin-right: 5px' bs-select ng-model='table.action' data-container='.modal-domain-import' bs-options='item.value as item.shortLabel for item in importActions')
-                                                                button.select-toggle.form-control(style='width: 65%; margin-right: 0' bs-select ng-model='table.cacheOrTemplate' data-container='.modal-domain-import' bs-options='item.value as item.label for item in table.cachesOrTemplates')
+                                                                button.select-toggle.form-control(style='width: 35%; margin-right: 5px' bs-select ng-model='table.action' bs-options='item.value as item.shortLabel for item in importActions')
+                                                                button.select-toggle.form-control(style='width: 65%; margin-right: 0' bs-select ng-model='table.cacheOrTemplate'  bs-options='item.value as item.label for item in table.cachesOrTemplates')
                                                     td
                     .settings-row
                         label Defaults to be applied for filtered tables
@@ -146,9 +145,9 @@ mixin td-ellipses-lbl(w, lbl)
                     .settings-row
                         .col-sm-11
                             .col-sm-6(style='padding-right: 5px')
-                                button.select-toggle.form-control(bs-select ng-model='importCommon.action' data-container='.modal-domain-import' bs-options='item.value as item.label for item in importActions')
+                                button.select-toggle.form-control(bs-select ng-model='importCommon.action' bs-options='item.value as item.label for item in importActions')
                             .col-sm-6(style='padding-left: 5px; padding-right: 5px')
-                                button.select-toggle.form-control(bs-select ng-model='importCommon.cacheOrTemplate' data-container='.modal-domain-import' bs-options='item.value as item.label for item in importCommon.cachesOrTemplates')
+                                button.select-toggle.form-control(bs-select ng-model='importCommon.cacheOrTemplate' bs-options='item.value as item.label for item in importCommon.cachesOrTemplates')
                         .col-sm-1(style='padding-left: 5px')
                             button.btn.btn-primary(ng-click='applyDefaults()') Apply
                 .import-domain-model-wizard-page(ng-show='importDomain.action == "options"')
@@ -167,12 +166,12 @@ mixin td-ellipses-lbl(w, lbl)
                         .settings-row(ng-show=generatePojo)
                             +checkbox('Generate aliases for query fields', 'ui.generateFieldAliases', '"domainGenerateFieldAliases"', 'Generate aliases for query fields with database field names when database field name differ from Java field name')
                         .settings-row.settings-row_small-label(ng-show=generatePojo)
-                            +java-package('Package:', 'ui.packageName', '"domainPackageName"', true, true, 'Package that will be used for POJOs generation')(data-container='.modal-domain-import')
+                            +java-package('Package:', 'ui.packageName', '"domainPackageName"', true, true, 'Package that will be used for POJOs generation')
                         .settings-row.settings-row_small-label
                             +ignite-form-field-dropdown('Clusters:', 'ui.generatedCachesClusters', '"generatedCachesClusters"', false, false, true,
                                 'Choose clusters for generated caches', '', 'clusters',
                                 'Choose clusters that will be associated with generated caches'
-                            )(data-container='.modal-domain-import')
+                            )
             .modal-footer
                 label(ng-hide='importDomain.action == "drivers" || (importDomain.action == "connect" && importDomain.demo)').labelField {{importDomain.info}}
                 a.btn.btn-primary(ng-hide='importDomain.action == "drivers" || importDomain.action == "connect"' ng-click='importDomainPrev()' bs-tooltip='' data-title='{{prevTooltipText()}}' data-placement='bottom') Prev

http://git-wip-us.apache.org/repos/asf/ignite/blob/50376045/modules/web-console/frontend/views/templates/select.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/select.tpl.pug b/modules/web-console/frontend/views/templates/select.tpl.pug
deleted file mode 100644
index aa6a2ef..0000000
--- a/modules/web-console/frontend/views/templates/select.tpl.pug
+++ /dev/null
@@ -1,26 +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.
-
-ul.select.dropdown-menu(tabindex='-1' ng-show='$isVisible()' role='select')
-    li(ng-if='$showAllNoneButtons || ($isMultiple && $matches.length > 2)')
-        a(id='li-dropdown-select-all' ng-click='$selectAll()') {{$allText}} ({{$matches.length}})
-        a(id='li-dropdown-select-none' ng-click='$selectNone()') {{$noneText}}
-        hr(style='margin: 5px 0')
-    li(role='presentation' ng-repeat='match in $matches')
-        hr(ng-if='match.value == undefined' style='margin: 5px 0')
-        a(id='li-dropdown-item-{{$index}}'  role='menuitem' tabindex='-1' ng-class='{active: $isActive($index)}' ng-click='$select($index, $event)' bs-tooltip='widthIsSufficient && !widthIsSufficient("li-dropdown-item-{{$index}}", $index, match.label) ? match.label : ""' data-placement='right auto')
-            i(class='{{$iconCheckmark}}' ng-if='$isActive($index)' ng-class='{active: $isActive($index)}')
-            span(ng-bind-html='match.label')


[16/28] ignite git commit: ignite-5383 Do not perform cache key validation when BinaryMarshaller is used This closes #2096

Posted by sb...@apache.org.
ignite-5383 Do not perform cache key validation when BinaryMarshaller is used
This closes #2096


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: b762417ab43d78d451feaaa1d1b046ff020a8424
Parents: ce5f8e9
Author: daradurvs <da...@gmail.com>
Authored: Fri Jun 30 17:18:45 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 17:18:45 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheAdapter.java       | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b762417a/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 e08d13a..25213a7 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
@@ -351,6 +351,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         init();
 
         aff = new GridCacheAffinityImpl<>(ctx);
+
+        // The check of methods 'equals' and 'hashCode' that they had been overrode isn't required, since BinaryMarshaller doesn't use them.
+        if (keyCheck && ctx.binaryMarshaller())
+            keyCheck = false;
     }
 
     /**


[02/28] ignite git commit: IGNITE-5599 Added log throttling.

Posted by sb...@apache.org.
IGNITE-5599 Added log throttling.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 459dc9e455ca23968210a50ebe87d312846cc48b
Parents: 1ced55b
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 29 14:43:42 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 29 14:43:42 2017 +0700

----------------------------------------------------------------------
 .../ignite/console/agent/rest/RestExecutor.java | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/459dc9e4/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
index 52d37c4..3936374 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
@@ -32,9 +32,13 @@ import okhttp3.OkHttpClient;
 import okhttp3.Request;
 import okhttp3.RequestBody;
 import okhttp3.Response;
-import org.apache.ignite.console.demo.*;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.console.demo.AgentClusterDemo;
 import org.apache.ignite.internal.processors.rest.protocols.http.jetty.GridJettyObjectMapper;
-import org.apache.log4j.Logger;
+import org.apache.ignite.internal.util.typedef.internal.LT;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.slf4j.Slf4jLogger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_AUTH_FAILED;
 import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_FAILED;
@@ -45,7 +49,7 @@ import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS
  */
 public class RestExecutor {
     /** */
-    private static final Logger log = Logger.getLogger(RestExecutor.class);
+    private static final IgniteLogger log = new Slf4jLogger(LoggerFactory.getLogger(RestExecutor.class));
 
     /** JSON object mapper. */
     private static final ObjectMapper mapper = new GridJettyObjectMapper();
@@ -166,12 +170,15 @@ public class RestExecutor {
             }
 
             if (resp.code() == 401)
-                return RestResult.fail(STATUS_AUTH_FAILED, "Failed to authenticate in grid. Please check agent\'s login and password or node port.");
+                return RestResult.fail(STATUS_AUTH_FAILED, "Failed to authenticate in grid. " +
+                    "Please check agent\'s login and password or node port.");
 
             return RestResult.fail(STATUS_FAILED, "Failed connect to node and execute REST command.");
         }
-        catch (ConnectException ignore) {
-            log.warn("Please ensure that nodes have ignite-rest-http module in classpath (was copied from libs/optional to libs folder).");
+        catch (ConnectException ignored) {
+            LT.warn(log, "Failed connect to node and execute REST command. " +
+                "Please ensure that nodes have [ignite-rest-http] module in classpath " +
+                "(was copied from libs/optional to libs folder).");
 
             throw new ConnectException("Failed connect to node and execute REST command [url=" + urlBuilder + "]");
         }
@@ -187,14 +194,15 @@ public class RestExecutor {
      */
     public RestResult execute(boolean demo, String path, Map<String, Object> params,
         String mtd, Map<String, Object> headers, String body) {
-        log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
+        if (log.isDebugEnabled())
+            log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
                 ", parameters=" + params + "]");
 
         try {
             return sendRequest(demo, path, params, mtd, headers, body);
         }
         catch (Exception e) {
-            log.info("Failed to execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
+            U.error(log, "Failed to execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
                 ", parameters=" + params + "]", e);
 
             return RestResult.fail(404, e.getMessage());


[28/28] ignite git commit: Merge remote-tracking branch 'remotes/community/ignite-2.1.2' into ignite-2.1.2-exchange

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-2.1.2' into ignite-2.1.2-exchange


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 377cc9d7aeaf3472ec35611c27154783d4ce2a51
Parents: 058ed1c ae5ec94
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jul 4 11:18:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jul 4 11:18:57 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  11 +-
 .../cache/CacheAffinitySharedManager.java       |  26 +-
 .../processors/cache/ClusterCachesInfo.java     |  13 +-
 .../cache/DynamicCacheChangeRequest.java        |   1 +
 .../processors/cache/ExchangeActions.java       | 109 ++++-
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../GridCachePartitionExchangeManager.java      |  25 +-
 .../processors/cache/GridCacheProcessor.java    |  67 +--
 .../dht/GridClientPartitionTopology.java        |   5 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  13 +-
 .../dht/preloader/GridDhtPartitionMap.java      |  13 +-
 .../distributed/near/GridNearCacheAdapter.java  |   4 +-
 .../wal/FileWriteAheadLogManager.java           |   6 +-
 .../GridCacheAtomicSequenceImpl.java            |  52 ++-
 .../internal/util/GridPartitionStateMap.java    |  60 ++-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   5 +
 .../messages/TcpDiscoveryAbstractMessage.java   |   8 +-
 ...titionedAtomicSequenceMultiThreadedTest.java |  32 ++
 .../CacheLateAffinityAssignmentTest.java        |  81 +++-
 .../near/GridCacheNearEvictionSelfTest.java     |   5 +-
 .../near/GridCacheNearMetricsSelfTest.java      |  29 +-
 .../GridCachePartitionedNodeRestartTest.java    |   5 -
 ...IgnitePersistentStoreDataStructuresTest.java |   2 +
 .../testframework/junits/GridAbstractTest.java  |  10 +-
 .../testsuites/IgniteUtilSelfTestSuite.java     |   3 +
 .../ignite/util/GridPartitionMapSelfTest.java   | 162 +++++++
 modules/web-console/frontend/.eslintrc          |   2 +-
 modules/web-console/frontend/app/app.config.js  |   3 +-
 modules/web-console/frontend/app/app.js         |   6 +
 .../app/components/bs-select-menu/controller.js |  28 ++
 .../app/components/bs-select-menu/directive.js  |  30 ++
 .../app/components/bs-select-menu/index.js      |  24 +
 .../app/components/bs-select-menu/style.scss    |  78 ++++
 .../app/components/bs-select-menu/template.pug  |  49 +++
 .../grid-column-selector/component.js           |  29 ++
 .../grid-column-selector/controller.js          | 111 +++++
 .../grid-column-selector/controller.spec.js     | 435 +++++++++++++++++++
 .../components/grid-column-selector/index.js    |  24 +
 .../components/grid-column-selector/style.scss  |  24 +
 .../grid-column-selector/template.pug           |  28 ++
 .../input-dialog/input-dialog.tpl.pug           |   2 +-
 .../list-of-registered-users.categories.js      |  22 +-
 .../list-of-registered-users.column-defs.js     |   4 +-
 .../list-of-registered-users.controller.js      |  46 --
 .../list-of-registered-users.scss               |   3 +
 .../list-of-registered-users.tpl.pug            |  26 +-
 .../components/pcbProtectFromBsSelectRender.js  |  32 --
 .../page-configure-basic/controller.js          |   2 +-
 .../page-configure-basic/controller.spec.js     |   1 -
 .../components/page-configure-basic/index.js    |   2 -
 .../page-configure-basic/template.pug           |   5 +-
 .../protect-from-bs-select-render/directive.js  |  32 ++
 .../protect-from-bs-select-render/index.js      |  24 +
 .../directives/ui-ace-pojos/ui-ace-pojos.pug    |   2 +-
 .../helpers/jade/form/form-field-checkbox.pug   |   2 +-
 .../helpers/jade/form/form-field-dropdown.pug   |   1 -
 .../frontend/app/helpers/jade/mixins.pug        |   3 +-
 .../frontend/app/modules/sql/sql.controller.js  |  21 +-
 .../states/configuration/caches/node-filter.pug |   2 +-
 .../states/configuration/caches/store.pug       |   2 +-
 .../configuration/clusters/deployment.pug       |   2 +-
 .../clusters/general/discovery/zookeeper.pug    |   2 +-
 .../states/configuration/clusters/hadoop.pug    |   2 +-
 .../configuration/clusters/load-balancing.pug   |   2 +-
 .../states/configuration/clusters/logger.pug    |   2 +-
 .../configuration/clusters/logger/log4j.pug     |   2 +-
 .../configuration/clusters/logger/log4j2.pug    |   2 +-
 .../states/configuration/clusters/swap.pug      |   2 +-
 .../frontend/app/primitives/btn/index.scss      |   8 +-
 .../frontend/app/primitives/dropdown/index.pug  |   2 +-
 .../frontend/app/primitives/tooltip/index.pug   |   5 +-
 .../app/primitives/ui-grid-settings/index.pug   |  33 --
 .../frontend/controllers/domains-controller.js  |   3 -
 .../frontend/public/stylesheets/style.scss      |  17 +
 .../views/configuration/domains-import.tpl.pug  |  13 +-
 .../web-console/frontend/views/sql/sql.tpl.pug  |   6 +-
 .../frontend/views/templates/select.tpl.pug     |  26 --
 .../ignite/console/agent/rest/RestExecutor.java |  24 +-
 78 files changed, 1637 insertions(+), 372 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/377cc9d7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/377cc9d7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/377cc9d7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 119326a,402d874..e238b11
--- 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
@@@ -2110,35 -2117,28 +2117,30 @@@ public class GridCacheProcessor extend
      public void onExchangeDone(
          AffinityTopologyVersion topVer,
          @Nullable ExchangeActions exchActions,
-         Throwable err
+         @Nullable Throwable err
      ) {
 +        long start = U.currentTimeMillis();
 +
          initCacheProxies(topVer, err);
  
-         if (exchActions != null && exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
-             ctx.dataStructures().restoreStructuresState(ctx);
- 
-         if (exchActions != null && err == null) {
-             Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps = null;
- 
-             boolean forceCheckpoint = false;
- 
-             for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
-                 GridCacheContext<?, ?> stopCtx;
-                 boolean destroy;
+         if (exchActions == null)
+             return;
  
-                 if (!forceCheckpoint){
-                     try {
-                         sharedCtx.database().waitForCheckpoint("caches stop");
-                     }
-                     catch (IgniteCheckedException e) {
-                         U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
-                     }
+         if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
+             ctx.dataStructures().restoreStructuresState(ctx);
  
-                     forceCheckpoint = true;
+         if (err == null) {
+             // Force checkpoint if there is any cache stop request
+             if (exchActions.cacheStopRequests().size() > 0) {
+                 try {
+                     sharedCtx.database().waitForCheckpoint("caches stop");
                  }
+                 catch (IgniteCheckedException e) {
+                     U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
+                 }
+             }
  
+             for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
                  stopGateway(action.request());
  
                  sharedCtx.database().checkpointReadLock();
@@@ -2162,14 -2166,9 +2168,11 @@@
                  }
              }
  
-             for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop())
-                 stopCacheGroup(grpDesc.groupId());
- 
-             if (stoppedGrps != null && !sharedCtx.kernalContext().clientNode())
-                 sharedCtx.database().onCacheGroupsStopped(stoppedGrps);
+             if (!sharedCtx.kernalContext().clientNode())
+                 sharedCtx.database().onCacheGroupsStopped(stoppedGroups);
          }
 +
 +        log.info("processor onExchangeDone [topVer=" + topVer + ", time=" + (U.currentTimeMillis() - start) + ']');
      }
  
      /**


[05/28] ignite git commit: Fixed "IGNITE-5521 Large near caches lead to cluster instability with metrics enabled". This closes #2201.

Posted by sb...@apache.org.
Fixed "IGNITE-5521 Large near caches lead to cluster instability with metrics enabled". This closes #2201.

Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: f6cbba3f50668bc5dedd5b3e4b3a98ab94956492
Parents: f618640
Author: mcherkasov <mc...@gridgain.com>
Authored: Thu Jun 29 12:15:33 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 29 12:15:33 2017 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearCacheAdapter.java  |  4 +--
 .../near/GridCacheNearEvictionSelfTest.java     |  5 ++--
 .../near/GridCacheNearMetricsSelfTest.java      | 29 +++++++++++++++++++-
 3 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f6cbba3f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 5b53935..b27591e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -37,7 +37,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
-import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheClearAllRunnable;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -46,7 +45,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheLocalConcurrentMap;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
 import org.apache.ignite.internal.processors.cache.GridCachePreloader;
-import org.apache.ignite.internal.processors.cache.GridCacheValueCollection;
 import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter;
@@ -298,7 +296,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return nearEntries().size() + dht().size();
+        return dht().size();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6cbba3f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index 1b09cff..9c7c933 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -163,12 +163,13 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
 
             for (int i = 0; i < gridCnt; i++) {
                 final GridCacheAdapter cache = internalCache(i);
+                final GridCacheAdapter near =  near(i);
 
                 // Repeatedly check cache sizes because of concurrent cache updates.
                 assertTrue(GridTestUtils.waitForCondition(new PA() {
                     @Override public boolean apply() {
                         // Every node contains either near, backup, or primary.
-                        return cnt == cache.size();
+                        return cnt == cache.size() + near.nearSize();
                     }
                 }, getTestTimeout()));
 
@@ -181,4 +182,4 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
             stopAllGrids();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6cbba3f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index 30e9146..f9d567d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -21,7 +21,9 @@ import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 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.internal.IgniteEx;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -100,6 +102,31 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     /**
      * @throws Exception If failed.
      */
+    public void testNearCacheDoesNotAffectCacheSize() throws Exception {
+        IgniteCache<Integer, Integer> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
+
+        for (int i = 0; i < 100 ; i++)
+            cache0.put(i, i);
+
+        IgniteEx g1 = grid(1);
+
+        IgniteCache<Integer, Integer> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+
+        ClusterNode localNode = g1.cluster().localNode();
+
+        int beforeSize = cache1.localMetrics().getSize();
+
+        for (int i = 0; i < 100 ; i++) {
+            if (!affinity(cache1).isPrimaryOrBackup(localNode, i))
+                cache1.get(i); // put entry to near cache
+        }
+
+        assertEquals(beforeSize, cache1.localMetrics().getSize());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testPrimaryPut() throws Exception {
         Ignite g0 = grid(0);
 
@@ -417,4 +444,4 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
             }
         }
     }
-}
\ No newline at end of file
+}


[03/28] ignite git commit: IGNITE-4467 Added missing style.

Posted by sb...@apache.org.
IGNITE-4467 Added missing style.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: fe5f551963bdda28e6b64b9827c226a6fcddb684
Parents: 459dc9e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 29 15:12:55 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 29 15:12:55 2017 +0700

----------------------------------------------------------------------
 .../frontend/app/components/input-dialog/input-dialog.tpl.pug      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fe5f5519/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
index 416d79b..5c6e173 100644
--- a/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
@@ -16,7 +16,7 @@
 
 include /app/helpers/jade/mixins
 
-.modal.modal--ignite(tabindex='-1' role='dialog')
+.modal.modal--ignite.theme--ignite(tabindex='-1' role='dialog')
     .modal-dialog
         form.modal-content(name='ctrl.form' novalidate)
             .modal-header


[12/28] ignite git commit: ignite-5593 Fixed exchange futures leak

Posted by sb...@apache.org.
ignite-5593 Fixed exchange futures leak


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: ce5f8e9016f088e55d13051075ca13b8d3317c06
Parents: 771288f
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Fri Jun 30 10:34:11 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 10:34:11 2017 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      |  2 +-
 .../CacheLateAffinityAssignmentTest.java        | 73 ++++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ce5f8e90/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index d997b79..cbb07f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -261,7 +261,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                                 exchFut = exchangeFuture(exchId, evt, cache, null, msg);
                             }
                         }
-                        else {
+                        else if (msg.exchangeId().topologyVersion().topologyVersion() >= cctx.discovery().localJoinEvent().topologyVersion()) {
                             exchangeFuture(msg.exchangeId(), null, null, null, null)
                                 .onAffinityChangeMessage(evt.eventNode(), msg);
                         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ce5f8e90/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 db3f5cd..c0c3d70 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
@@ -69,6 +69,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.PA;
@@ -1167,6 +1168,78 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Wait for rebalance, send affinity change message, but affinity already changed (new node joined).
+     *
+     * @throws Exception If failed.
+     */
+    public void testDelayAssignmentAffinityChanged2() throws Exception {
+        Ignite ignite0 = startServer(0, 1);
+
+        TestTcpDiscoverySpi discoSpi0 =
+            (TestTcpDiscoverySpi)ignite0.configuration().getDiscoverySpi();
+        TestRecordingCommunicationSpi commSpi0 =
+            (TestRecordingCommunicationSpi)ignite0.configuration().getCommunicationSpi();
+
+        startClient(1, 2);
+
+        checkAffinity(2, topVer(2, 0), true);
+
+        startServer(2, 3);
+
+        checkAffinity(3, topVer(3, 1), false);
+
+        discoSpi0.blockCustomEvent();
+
+        stopNode(2, 4);
+
+        discoSpi0.waitCustomEvent();
+
+        blockSupplySend(commSpi0, CACHE_NAME1);
+
+        final IgniteInternalFuture<?> startedFuture = multithreadedAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                startServer(3, 5);
+
+                return null;
+            }
+        }, 1, "server-starter");
+
+        Thread.sleep(2_000);
+
+        discoSpi0.stopBlock();
+
+        boolean started = GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return startedFuture.isDone();
+            }
+        }, 10_000);
+
+        if (!started)
+            startedFuture.cancel();
+
+        assertTrue(started);
+
+        checkAffinity(3, topVer(5, 0), false);
+
+        checkNoExchange(3, topVer(5, 1));
+
+        commSpi0.stopBlock();
+
+        checkAffinity(3, topVer(5, 1), true);
+
+        long nodeJoinTopVer = grid(3).context().discovery().localJoinEvent().topologyVersion();
+
+        assertEquals(5, nodeJoinTopVer);
+
+        List<GridDhtPartitionsExchangeFuture> exFutures = grid(3).context().cache().context().exchange().exchangeFutures();
+
+        for (GridDhtPartitionsExchangeFuture f : exFutures) {
+            //Shouldn't contains staled futures.
+            assertTrue(f.topologyVersion().topologyVersion() >= nodeJoinTopVer);
+        }
+    }
+
+    /**
      * Wait for rebalance, cache is destroyed and created again.
      *
      * @throws Exception If failed.


[10/28] ignite git commit: ignite-2.1.2 detectLostPartitions minor optimization

Posted by sb...@apache.org.
ignite-2.1.2 detectLostPartitions minor optimization


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 5699be758110d007c2cae3da2edf83245c01907f
Parents: db8112f
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 30 09:21:41 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 09:21:41 2017 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtPartitionTopologyImpl.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5699be75/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index a6f1831..1eab708 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -1556,8 +1556,12 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
             for (GridDhtPartitionMap partMap : node2part.values()) {
                 for (Map.Entry<Integer, GridDhtPartitionState> e : partMap.entrySet()) {
-                    if (e.getValue() == OWNING)
+                    if (e.getValue() == OWNING) {
                         lost.remove(e.getKey());
+
+                        if (lost.isEmpty())
+                            break;
+                    }
                 }
             }
 


[21/28] ignite git commit: Merge remote-tracking branch 'community/ignite-2.1.2' into ignite-2.1.2

Posted by sb...@apache.org.
Merge remote-tracking branch 'community/ignite-2.1.2' into ignite-2.1.2


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: f202e0fe62cc40d555b3efb038de7c7fd7a96f47
Parents: ddeb935 ad739d5
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jul 3 11:40:35 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jul 3 11:40:35 2017 +0300

----------------------------------------------------------------------
 .../frontend/app/helpers/jade/form/form-field-checkbox.pug      | 2 +-
 modules/web-console/frontend/app/primitives/tooltip/index.pug   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[23/28] ignite git commit: Optimize allocations in GridPartitionStateMap

Posted by sb...@apache.org.
Optimize allocations in GridPartitionStateMap


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: e1ce7c972cc128b7aa82eb9baab50623292dc202
Parents: f202e0f
Author: Alexei Scherbakov <al...@gmail.com>
Authored: Mon Jul 3 13:49:52 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jul 3 13:49:52 2017 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      |   8 +-
 .../dht/GridClientPartitionTopology.java        |   5 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   7 +-
 .../dht/preloader/GridDhtPartitionMap.java      |  13 +-
 .../internal/util/GridPartitionStateMap.java    |  60 ++++++-
 .../CacheLateAffinityAssignmentTest.java        |   8 +-
 .../testsuites/IgniteUtilSelfTestSuite.java     |   3 +
 .../ignite/util/GridPartitionMapSelfTest.java   | 162 +++++++++++++++++++
 8 files changed, 240 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 85719b7..0e541c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -64,7 +64,6 @@ import org.apache.ignite.internal.pagemem.snapshot.StartSnapshotOperationAckDisc
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridClientPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
@@ -86,6 +85,7 @@ import org.apache.ignite.internal.processors.query.schema.SchemaNodeLeaveExchang
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.GridListSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
+import org.apache.ignite.internal.util.GridPartitionStateMap;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.IgnitePair;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -1039,7 +1039,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             cctx.versions().last(),
             true);
 
-        Map<Object, T2<Integer,Map<Integer, GridDhtPartitionState>>> dupData = new HashMap<>();
+        Map<Object, T2<Integer, GridPartitionStateMap>> dupData = new HashMap<>();
 
         for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
             if (!grp.isLocal()) {
@@ -1086,7 +1086,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
      * @param affKey Cache affinity key.
      */
     private void addPartitionMap(GridDhtPartitionsSingleMessage m,
-        Map<Object, T2<Integer, Map<Integer, GridDhtPartitionState>>> dupData,
+        Map<Object, T2<Integer, GridPartitionStateMap>> dupData,
         boolean compress,
         Integer cacheId,
         GridDhtPartitionMap map,
@@ -1094,7 +1094,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
         Integer dupDataCache = null;
 
         if (compress) {
-            T2<Integer, Map<Integer, GridDhtPartitionState>> state0 = dupData.get(affKey);
+            T2<Integer, GridPartitionStateMap> state0 = dupData.get(affKey);
 
             if (state0 != null && state0.get2().equals(map.map())) {
                 dupDataCache = state0.get1();

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 26d12d6..9e9f4fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
+import org.apache.ignite.internal.util.GridPartitionStateMap;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
@@ -396,7 +397,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
 
         try {
             return new GridDhtPartitionMap(cctx.localNodeId(), updateSeq.get(), topVer,
-                Collections.<Integer, GridDhtPartitionState>emptyMap(), true);
+                GridPartitionStateMap.EMPTY, true);
         }
         finally {
             lock.readLock().unlock();
@@ -874,7 +875,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
 
         if (map == null)
             node2part.put(nodeId, map = new GridDhtPartitionMap(nodeId, updateSeq, topVer,
-                Collections.<Integer, GridDhtPartitionState>emptyMap(), false));
+                GridPartitionStateMap.EMPTY, false));
 
         map.updateSequence(updateSeq, topVer);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 1eab708..c205c3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
+import org.apache.ignite.internal.util.GridPartitionStateMap;
 import org.apache.ignite.internal.util.StripedCompositeReadWriteLock;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
@@ -813,7 +814,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
     /** {@inheritDoc} */
     @Override public GridDhtPartitionMap localPartitionMap() {
-        Map<Integer, GridDhtPartitionState> map = new HashMap<>();
+        GridPartitionStateMap map = new GridPartitionStateMap(locParts.length());
 
         lock.readLock().lock();
 
@@ -830,7 +831,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
             return new GridDhtPartitionMap(ctx.localNodeId(),
                 updateSeq.get(),
                 topVer,
-                Collections.unmodifiableMap(map),
+                map,
                 true);
         }
         finally {
@@ -1897,7 +1898,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                 map = new GridDhtPartitionMap(locNodeId,
                     updateSeq,
                     topVer,
-                    Collections.<Integer, GridDhtPartitionState>emptyMap(),
+                    GridPartitionStateMap.EMPTY,
                     false);
 
                 node2part.put(locNodeId, map);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 0b44d3c..cfd4400 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -73,7 +73,7 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
     public GridDhtPartitionMap(UUID nodeId,
         long updateSeq,
         AffinityTopologyVersion top,
-        Map<Integer, GridDhtPartitionState> m,
+        GridPartitionStateMap m,
         boolean onlyActive) {
         assert nodeId != null;
         assert updateSeq > 0;
@@ -82,14 +82,7 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
         this.updateSeq = updateSeq;
         this.top = top;
 
-        map = new GridPartitionStateMap(m.size());
-
-        for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
-            GridDhtPartitionState state = e.getValue();
-
-            if (!onlyActive || state.active())
-                put(e.getKey(), state);
-        }
+        map = new GridPartitionStateMap(m, onlyActive);
     }
 
     /**
@@ -185,7 +178,7 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
     /**
      * @return Underlying map.
      */
-    public Map<Integer, GridDhtPartitionState> map() {
+    public GridPartitionStateMap map() {
         return map;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/main/java/org/apache/ignite/internal/util/GridPartitionStateMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridPartitionStateMap.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridPartitionStateMap.java
index 72f8469..173ddbe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridPartitionStateMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridPartitionStateMap.java
@@ -17,14 +17,12 @@
 
 package org.apache.ignite.internal.util;
 
-import java.io.Externalizable;
 import java.io.Serializable;
 import java.util.AbstractMap;
 import java.util.AbstractSet;
 import java.util.BitSet;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Set;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
 
@@ -34,6 +32,9 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
  * Null values are prohibited.
  */
 public class GridPartitionStateMap extends AbstractMap<Integer, GridDhtPartitionState> implements Serializable {
+    /** Empty map. */
+    public static final GridPartitionStateMap EMPTY = new GridPartitionStateMap(0);
+
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -51,7 +52,7 @@ public class GridPartitionStateMap extends AbstractMap<Integer, GridDhtPartition
     @Override public Set<Entry<Integer, GridDhtPartitionState>> entrySet() {
         return new AbstractSet<Entry<Integer, GridDhtPartitionState>>() {
             @Override public Iterator<Entry<Integer, GridDhtPartitionState>> iterator() {
-                final int size = states.length() == 0 ? 0 : (states.length() - 1)/ BITS + 1;
+                final int size = states.isEmpty() ? 0 : (states.length() - 1)/ BITS + 1;
 
                 return new Iterator<Entry<Integer, GridDhtPartitionState>>() {
                     private int next;
@@ -65,6 +66,9 @@ public class GridPartitionStateMap extends AbstractMap<Integer, GridDhtPartition
                     }
 
                     @Override public Entry<Integer, GridDhtPartitionState> next() {
+                        if (!hasNext())
+                            throw new NoSuchElementException();
+
                         cur = next;
                         next++;
 
@@ -111,6 +115,32 @@ public class GridPartitionStateMap extends AbstractMap<Integer, GridDhtPartition
         states = new BitSet(parts);
     }
 
+    /**
+     * Creates map copy.
+     * @param from Source map.
+     * @param onlyActive Retains only active partitions.
+     */
+    public GridPartitionStateMap(GridPartitionStateMap from, boolean onlyActive) {
+        size = from.size();
+
+        states = (BitSet)from.states.clone();
+
+        if (onlyActive) {
+            int part = 0;
+
+            int maxPart = states.size() / BITS;
+
+            while (part < maxPart) {
+                GridDhtPartitionState state = from.state(part);
+
+                if (state != null && !state.active())
+                    remove(part);
+
+                part++;
+            }
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public GridDhtPartitionState put(Integer key, GridDhtPartitionState val) {
         assert val != null;
@@ -169,6 +199,24 @@ public class GridPartitionStateMap extends AbstractMap<Integer, GridDhtPartition
         for (int i = 0; i < BITS; i++)
             st |= ((states.get(off + i) ? 1 : 0) << i);
 
-        return st == 0 ? null : GridDhtPartitionState.values()[st - 1];
+        return st == 0 ? null : GridDhtPartitionState.fromOrdinal(st - 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridPartitionStateMap map = (GridPartitionStateMap)o;
+
+        return size == map.size && states.equals(map.states);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return 31 * states.hashCode() + size;
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/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 6fac920..f1ecfa4 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,6 +48,7 @@ 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.events.DiscoveryEvent;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.GridNodeOrderComparator;
@@ -55,7 +56,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.TestRecordingCommunicationSpi;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
-import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl;
@@ -180,6 +180,12 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
             discoSpi.setJoinTimeout(30_000);
         }
 
+        MemoryConfiguration cfg1 = new MemoryConfiguration();
+
+        cfg1.setDefaultMemoryPolicySize(50 * 1024 * 1024L);
+
+        cfg.setMemoryConfiguration(cfg1);
+
         cfg.setClientMode(client);
 
         return cfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 64a94fd..1298a75 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -42,6 +42,7 @@ import org.apache.ignite.thread.IgniteThreadPoolSizeTest;
 import org.apache.ignite.util.GridIntListSelfTest;
 import org.apache.ignite.util.GridLongListSelfTest;
 import org.apache.ignite.util.GridMessageCollectionTest;
+import org.apache.ignite.util.GridPartitionMapSelfTest;
 import org.apache.ignite.util.GridQueueSelfTest;
 import org.apache.ignite.util.GridSpinReadWriteLockSelfTest;
 import org.apache.ignite.util.GridStringBuilderFactorySelfTest;
@@ -99,6 +100,8 @@ public class IgniteUtilSelfTestSuite extends TestSuite {
         GridTestUtils.addTestIfNeeded(suite, GridNioSslSelfTest.class, ignoredTests);
         suite.addTestSuite(GridNioDelimitedBufferSelfTest.class);
 
+        suite.addTestSuite(GridPartitionMapSelfTest.class);
+
         //dbx
         suite.addTestSuite(PageIdUtilsSelfTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1ce7c97/modules/core/src/test/java/org/apache/ignite/util/GridPartitionMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridPartitionMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridPartitionMapSelfTest.java
new file mode 100644
index 0000000..ebb4cd7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridPartitionMapSelfTest.java
@@ -0,0 +1,162 @@
+/*
+ * 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.util;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.util.GridPartitionStateMap;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Grid utils tests.
+ */
+@GridCommonTest(group = "Utils")
+public class GridPartitionMapSelfTest extends GridCommonAbstractTest {
+    /** */
+    public void testPartitionStateMap() {
+        GridPartitionStateMap map = initMap(new GridPartitionStateMap());
+
+        Set<Map.Entry<Integer, GridDhtPartitionState>> entries = map.entrySet();
+
+        assertEquals(10, map.size());
+
+        for (Map.Entry<Integer, GridDhtPartitionState> entry : entries)
+            entry.setValue(GridDhtPartitionState.OWNING);
+
+        assertEquals(10, map.size());
+
+        for (GridDhtPartitionState state : map.values())
+            assertEquals(GridDhtPartitionState.OWNING, state);
+
+        Set<Map.Entry<Integer, GridDhtPartitionState>> tmp = new HashSet<>();
+
+        for (Map.Entry<Integer, GridDhtPartitionState> entry : entries) {
+            tmp.add(entry);
+
+            entry.setValue(GridDhtPartitionState.LOST);
+        }
+
+        for (Map.Entry<Integer, GridDhtPartitionState> entry : tmp)
+            entry.setValue(GridDhtPartitionState.LOST);
+
+        for (GridDhtPartitionState state : map.values())
+            assertEquals(GridDhtPartitionState.LOST, state);
+
+        assertFalse(map.containsKey(10));
+
+        assertNull(map.remove(10));
+
+        assertEquals(10, map.size());
+
+        assertEquals(GridDhtPartitionState.LOST, map.put(9, GridDhtPartitionState.EVICTED));
+
+        assertEquals(10, map.size());
+
+        assertEquals(GridDhtPartitionState.EVICTED, map.put(9, GridDhtPartitionState.EVICTED));
+
+        assertEquals(10, map.size());
+
+        map.remove(5);
+
+        assertEquals(9, map.size());
+        assertEquals(9, map.keySet().size());
+        assertEquals(9, map.values().size());
+
+        map.clear();
+
+        assertEquals(0, map.size());
+        assertEquals(0, map.keySet().size());
+        assertEquals(0, map.values().size());
+    }
+
+    /** */
+    public void testEqualsAndHashCode() {
+        GridPartitionStateMap map1 = initMap(new GridPartitionStateMap());
+
+        GridPartitionStateMap map2 = initMap(new GridPartitionStateMap());
+
+        assertEquals(map1, map2);
+
+        assertEquals(map1.hashCode(), map2.hashCode());
+
+        assertFalse(map1.equals(new HashMap()));
+
+        assertFalse(map1.equals(null));
+    }
+
+    /**
+     *
+     */
+    public void testCopy() {
+        GridPartitionStateMap map1 = initMap(new GridPartitionStateMap());
+
+        GridPartitionStateMap cp1 = new GridPartitionStateMap(map1, false);
+
+        assertEquals(map1, cp1);
+
+        GridPartitionStateMap map2 = new GridPartitionStateMap();
+        map2.put(0, GridDhtPartitionState.MOVING);
+        map2.put(1, GridDhtPartitionState.RENTING);
+        map2.put(2, GridDhtPartitionState.LOST);
+        map2.put(3, GridDhtPartitionState.OWNING);
+        map2.put(5, GridDhtPartitionState.MOVING);
+        map2.put(6, GridDhtPartitionState.RENTING);
+        map2.put(7, GridDhtPartitionState.LOST);
+        map2.put(8, GridDhtPartitionState.OWNING);
+
+        GridPartitionStateMap cp2 = new GridPartitionStateMap(map1, true);
+
+        assertEquals(map2, cp2);
+    }
+
+    /**
+     *
+     */
+    public void testCopyNoActive() {
+        GridPartitionStateMap map2 = new GridPartitionStateMap();
+
+        map2.put(100, GridDhtPartitionState.EVICTED);
+        map2.put(101, GridDhtPartitionState.EVICTED);
+        map2.put(102, GridDhtPartitionState.EVICTED);
+        map2.put(103, GridDhtPartitionState.OWNING);
+
+        GridPartitionStateMap cp2 = new GridPartitionStateMap(map2, true);
+
+        assertEquals(1, cp2.size());
+    }
+
+    /** */
+    private GridPartitionStateMap initMap(GridPartitionStateMap map) {
+        map.put(0, GridDhtPartitionState.MOVING);
+        map.put(1, GridDhtPartitionState.RENTING);
+        map.put(2, GridDhtPartitionState.LOST);
+        map.put(3, GridDhtPartitionState.OWNING);
+        map.put(4, GridDhtPartitionState.EVICTED);
+        map.put(5, GridDhtPartitionState.MOVING);
+        map.put(6, GridDhtPartitionState.RENTING);
+        map.put(7, GridDhtPartitionState.LOST);
+        map.put(8, GridDhtPartitionState.OWNING);
+        map.put(9, GridDhtPartitionState.EVICTED);
+
+        return map;
+    }
+}
\ No newline at end of file


[15/28] ignite git commit: Fixed CSS for IE11.

Posted by sb...@apache.org.
Fixed CSS for IE11.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6239e04a8273faa7763d2e11e933b1852637ff03
Parents: 4a1fef5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 30 17:51:39 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 17:51:39 2017 +0700

----------------------------------------------------------------------
 modules/web-console/frontend/public/stylesheets/style.scss | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6239e04a/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 305e7f7..183dc29 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -2185,3 +2185,7 @@ html,body,.splash-screen {
         line-height: $line-height-base;
     }
 }
+
+.center-container {
+    position: absolute !important;
+}


[17/28] ignite git commit: Fixed "IGNITE-5521 Large near caches lead to cluster instability with metrics enabled". This closes #2201.

Posted by sb...@apache.org.
Fixed "IGNITE-5521 Large near caches lead to cluster instability with metrics enabled". This closes #2201.

Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: c697d4509b2d3ff7ef5bed93a9b697f45c830f8c
Parents: 6239e04
Author: mcherkasov <mc...@gridgain.com>
Authored: Thu Jun 29 12:15:33 2017 +0300
Committer: mcherkasov <mc...@gridgain.com>
Committed: Fri Jun 30 18:40:41 2017 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearCacheAdapter.java  |  4 +--
 .../near/GridCacheNearEvictionSelfTest.java     |  5 ++--
 .../near/GridCacheNearMetricsSelfTest.java      | 29 +++++++++++++++++++-
 3 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 5b53935..b27591e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -37,7 +37,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
-import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheClearAllRunnable;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -46,7 +45,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheLocalConcurrentMap;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
 import org.apache.ignite.internal.processors.cache.GridCachePreloader;
-import org.apache.ignite.internal.processors.cache.GridCacheValueCollection;
 import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter;
@@ -298,7 +296,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return nearEntries().size() + dht().size();
+        return dht().size();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index 1b09cff..9c7c933 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -163,12 +163,13 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
 
             for (int i = 0; i < gridCnt; i++) {
                 final GridCacheAdapter cache = internalCache(i);
+                final GridCacheAdapter near =  near(i);
 
                 // Repeatedly check cache sizes because of concurrent cache updates.
                 assertTrue(GridTestUtils.waitForCondition(new PA() {
                     @Override public boolean apply() {
                         // Every node contains either near, backup, or primary.
-                        return cnt == cache.size();
+                        return cnt == cache.size() + near.nearSize();
                     }
                 }, getTestTimeout()));
 
@@ -181,4 +182,4 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
             stopAllGrids();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index 30e9146..f9d567d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -21,7 +21,9 @@ import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 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.internal.IgniteEx;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -100,6 +102,31 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     /**
      * @throws Exception If failed.
      */
+    public void testNearCacheDoesNotAffectCacheSize() throws Exception {
+        IgniteCache<Integer, Integer> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
+
+        for (int i = 0; i < 100 ; i++)
+            cache0.put(i, i);
+
+        IgniteEx g1 = grid(1);
+
+        IgniteCache<Integer, Integer> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+
+        ClusterNode localNode = g1.cluster().localNode();
+
+        int beforeSize = cache1.localMetrics().getSize();
+
+        for (int i = 0; i < 100 ; i++) {
+            if (!affinity(cache1).isPrimaryOrBackup(localNode, i))
+                cache1.get(i); // put entry to near cache
+        }
+
+        assertEquals(beforeSize, cache1.localMetrics().getSize());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testPrimaryPut() throws Exception {
         Ignite g0 = grid(0);
 
@@ -417,4 +444,4 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
             }
         }
     }
-}
\ No newline at end of file
+}


[20/28] ignite git commit: IGNITE-5529 Stop exchange worker before cancelling exchange futures.

Posted by sb...@apache.org.
IGNITE-5529 Stop exchange worker before cancelling exchange futures.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: ddeb935b12009fa969f5971a51a054d429045c8b
Parents: 18bbb14
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Mon Jul 3 11:39:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jul 3 11:39:57 2017 +0300

----------------------------------------------------------------------
 .../cache/GridCachePartitionExchangeManager.java     | 15 ++++++++-------
 .../near/GridCachePartitionedNodeRestartTest.java    |  5 -----
 2 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ddeb935b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 19d99a4..85719b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -522,6 +522,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 "Client node disconnected: " + cctx.igniteInstanceName()) :
             new IgniteInterruptedCheckedException("Node is stopping: " + cctx.igniteInstanceName());
 
+        // Stop exchange worker
+        U.cancel(exchWorker);
+
+        if (log.isDebugEnabled())
+            log.debug("Before joining on exchange worker: " + exchWorker);
+
+        U.join(exchWorker, log);
+
         // Finish all exchange futures.
         ExchangeFutureSet exchFuts0 = exchFuts;
 
@@ -538,13 +546,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 cctx.io().removeOrderedHandler(true, rebalanceTopic(cnt));
         }
 
-        U.cancel(exchWorker);
-
-        if (log.isDebugEnabled())
-            log.debug("Before joining on exchange worker: " + exchWorker);
-
-        U.join(exchWorker, log);
-
         ResendTimeoutObject resendTimeoutObj = pendingResend.getAndSet(null);
 
         if (resendTimeoutObj != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddeb935b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index 1d325a5..d7a0cdd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -56,11 +56,6 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
         return cc;
     }
 
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-5529");
-    }
-
-
     /** {@inheritDoc} */
     @Override public void testRestart() throws Exception {
         super.testRestart();


[09/28] ignite git commit: Code commenting after dev list questions

Posted by sb...@apache.org.
Code commenting after dev list questions


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: db8112fc67c7d539e7ce28f65669b33b38fabebc
Parents: 5037604
Author: dpavlov <dp...@gridgain.com>
Authored: Fri Jun 23 21:02:02 2017 +0300
Committer: dpavlov <dp...@gridgain.com>
Committed: Thu Jun 29 21:03:48 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 5 +++++
 .../discovery/tcp/messages/TcpDiscoveryAbstractMessage.java  | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/db8112fc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 184b6cd..03afff5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -3981,6 +3981,11 @@ class ServerImpl extends TcpDiscoveryImpl {
         /**
          * Processes node added message.
          *
+         * For coordinator node method marks the messages as verified for rest of nodes to apply the
+         * changes this message is issued for.
+         *
+         * Node added message is processed by other nodes only after coordinator verification.
+         *
          * @param msg Node added message.
          * @deprecated Due to current protocol node add process cannot be dropped in the middle of the ring,
          *      if new node auth fails due to config inconsistency. So, we need to finish add

http://git-wip-us.apache.org/repos/asf/ignite/blob/db8112fc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
index e982b2f..a23cb63 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -57,7 +57,13 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
     /** Message ID. */
     private IgniteUuid id;
 
-    /** Verifier node ID. */
+    /**
+     * Verifier node ID.
+     * Node can mark the messages as verified for rest of nodes to apply the
+     * changes this message is issued for, i.e. node added message, node failed or
+     * left message are processed by other nodes only after coordinator
+     * verification.
+     */
     private UUID verifierNodeId;
 
     /** Topology version. */


[18/28] ignite git commit: GG-12330 Do not destroy single cache if cache group will be destroyed

Posted by sb...@apache.org.
GG-12330 Do not destroy single cache if cache group will be destroyed


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 18bbb14e35eecaddb86ec4361f18a652b9559836
Parents: c697d45
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Fri Jun 30 21:22:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 21:22:28 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java       |  26 ++---
 .../processors/cache/ClusterCachesInfo.java     |  13 ++-
 .../cache/DynamicCacheChangeRequest.java        |   1 +
 .../processors/cache/ExchangeActions.java       | 109 +++++++++++++++----
 .../processors/cache/GridCacheProcessor.java    |  58 +++++-----
 5 files changed, 141 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/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 5984ef5..9516f84 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
@@ -772,10 +772,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         for (ExchangeActions.ActionData action : exchActions.cacheStopRequests())
             cctx.cache().blockGateway(action.request().cacheName(), true, action.request().restart());
 
-        for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
-            cctx.exchange().clearClientTopology(grpDesc.groupId());
+        for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
+            cctx.exchange().clearClientTopology(action.descriptor().groupId());
 
-            CacheGroupContext gctx = cctx.cache().cacheGroup(grpDesc.groupId());
+            CacheGroupContext gctx = cctx.cache().cacheGroup(action.descriptor().groupId());
 
             if (gctx != null) {
                 IgniteCheckedException ex;
@@ -797,11 +797,11 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         Set<Integer> stoppedGrps = null;
 
         if (crd && lateAffAssign) {
-            for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
-                if (grpDesc.config().getCacheMode() != LOCAL) {
-                    CacheGroupHolder cacheGrp = grpHolders.remove(grpDesc.groupId());
+            for (ExchangeActions.CacheGroupActionData data : exchActions.cacheGroupsToStop()) {
+                if (data.descriptor().config().getCacheMode() != LOCAL) {
+                    CacheGroupHolder cacheGrp = grpHolders.remove(data.descriptor().groupId());
 
-                    assert cacheGrp != null : grpDesc;
+                    assert cacheGrp != null : data.descriptor();
 
                     if (stoppedGrps == null)
                         stoppedGrps = new HashSet<>();
@@ -2270,7 +2270,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                 if (!registeredGrps.containsKey(grpDesc.groupId()))
                     registeredGrps.put(grpDesc.groupId(), grpDesc);
 
-                if (!registeredCaches.containsKey(desc.cacheName()))
+                if (!registeredCaches.containsKey(desc.cacheId()))
                     registeredCaches.put(desc.cacheId(), desc);
             }
         }
@@ -2279,14 +2279,14 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
          * @param exchActions Exchange actions.
          */
         void updateCachesInfo(ExchangeActions exchActions) {
-            for (CacheGroupDescriptor stopDesc : exchActions.cacheGroupsToStop()) {
-                CacheGroupDescriptor rmvd = registeredGrps.remove(stopDesc.groupId());
+            for (ExchangeActions.CacheGroupActionData stopAction : exchActions.cacheGroupsToStop()) {
+                CacheGroupDescriptor rmvd = registeredGrps.remove(stopAction.descriptor().groupId());
 
-                assert rmvd != null : stopDesc.cacheOrGroupName();
+                assert rmvd != null : stopAction.descriptor().cacheOrGroupName();
             }
 
-            for (CacheGroupDescriptor startDesc : exchActions.cacheGroupsToStart()) {
-                CacheGroupDescriptor old = registeredGrps.put(startDesc.groupId(), startDesc);
+            for (ExchangeActions.CacheGroupActionData startAction : exchActions.cacheGroupsToStart()) {
+                CacheGroupDescriptor old = registeredGrps.put(startAction.descriptor().groupId(), startAction.descriptor());
 
                 assert old == null : old;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/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 15345d9..4e9dcf1 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
@@ -539,7 +539,18 @@ class ClusterCachesInfo {
 
                         ctx.discovery().removeCacheGroup(grpDesc);
 
-                        exchangeActions.addCacheGroupToStop(grpDesc);
+                        exchangeActions.addCacheGroupToStop(grpDesc, req.destroy());
+
+                        assert exchangeActions.checkStopRequestConsistency(grpDesc.groupId());
+
+                        // If all caches in group will be destroyed it is not necessary to destroy single cache
+                        // because group will be stopped anyway.
+                        if (req.destroy()) {
+                            for (ExchangeActions.ActionData action : exchangeActions.cacheStopRequests()) {
+                                if (action.descriptor().groupId() == grpDesc.groupId())
+                                    action.request().destroy(false);
+                            }
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index 2c9e7f2..6d5eaf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -427,6 +427,7 @@ public class DynamicCacheChangeRequest implements Serializable {
             ", nodeId=" + initiatingNodeId +
             ", clientStartOnly=" + clientStartOnly +
             ", stop=" + stop +
+            ", destroy=" + destroy +
             ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index 1a6b068..9caf9aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@ -35,10 +35,10 @@ import org.jetbrains.annotations.Nullable;
  */
 public class ExchangeActions {
     /** */
-    private List<CacheGroupDescriptor> cacheGrpsToStart;
+    private List<CacheGroupActionData> cacheGrpsToStart;
 
     /** */
-    private List<CacheGroupDescriptor> cacheGrpsToStop;
+    private List<CacheGroupActionData> cacheGrpsToStop;
 
     /** */
     private Map<String, ActionData> cachesToStart;
@@ -53,6 +53,29 @@ public class ExchangeActions {
     private ClusterState newState;
 
     /**
+     * @param grpId Group ID.
+     * @return Always {@code true}, fails with assert error if inconsistent.
+     */
+    boolean checkStopRequestConsistency(int grpId) {
+        Boolean destroy = null;
+
+        // Check that caches associated with that group will be all stopped only or all destroyed.
+        for (ExchangeActions.ActionData action : cacheStopRequests()) {
+            if (action.descriptor().groupId() == grpId) {
+                if (destroy == null)
+                    destroy = action.request().destroy();
+                else {
+                    assert action.request().destroy() == destroy
+                        : "Both cache stop only and cache destroy request associated with one group in batch "
+                        + cacheStopRequests();
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
      * @return {@code True} if server nodes should not participate in exchange.
      */
     public boolean clientOnlyExchange() {
@@ -237,14 +260,14 @@ public class ExchangeActions {
         if (cacheGrpsToStart == null)
             cacheGrpsToStart = new ArrayList<>();
 
-        cacheGrpsToStart.add(grpDesc);
+        cacheGrpsToStart.add(new CacheGroupActionData(grpDesc));
     }
 
     /**
      * @return Cache groups to start.
      */
-    public List<CacheGroupDescriptor> cacheGroupsToStart() {
-        return cacheGrpsToStart != null ? cacheGrpsToStart : Collections.<CacheGroupDescriptor>emptyList();
+    public List<CacheGroupActionData> cacheGroupsToStart() {
+        return cacheGrpsToStart != null ? cacheGrpsToStart : Collections.<CacheGroupActionData>emptyList();
     }
 
     /**
@@ -253,8 +276,8 @@ public class ExchangeActions {
      */
     public boolean cacheGroupStarting(int grpId) {
         if (cacheGrpsToStart != null) {
-            for (CacheGroupDescriptor grp : cacheGrpsToStart) {
-                if (grp.groupId() == grpId)
+            for (CacheGroupActionData grp : cacheGrpsToStart) {
+                if (grp.desc.groupId() == grpId)
                     return true;
             }
         }
@@ -264,21 +287,22 @@ public class ExchangeActions {
 
     /**
      * @param grpDesc Group descriptor.
+     * @param destroy Destroy flag.
      */
-    public void addCacheGroupToStop(CacheGroupDescriptor grpDesc) {
+    public void addCacheGroupToStop(CacheGroupDescriptor grpDesc, boolean destroy) {
         assert grpDesc != null;
 
         if (cacheGrpsToStop == null)
             cacheGrpsToStop = new ArrayList<>();
 
-        cacheGrpsToStop.add(grpDesc);
+        cacheGrpsToStop.add(new CacheGroupActionData(grpDesc, destroy));
     }
 
     /**
      * @return Cache groups to start.
      */
-    public List<CacheGroupDescriptor> cacheGroupsToStop() {
-        return cacheGrpsToStop != null ? cacheGrpsToStop : Collections.<CacheGroupDescriptor>emptyList();
+    public List<CacheGroupActionData> cacheGroupsToStop() {
+        return cacheGrpsToStop != null ? cacheGrpsToStop : Collections.<CacheGroupActionData>emptyList();
     }
 
     /**
@@ -287,8 +311,8 @@ public class ExchangeActions {
      */
     public boolean cacheGroupStopping(int grpId) {
         if (cacheGrpsToStop != null) {
-            for (CacheGroupDescriptor grp : cacheGrpsToStop) {
-                if (grp.groupId() == grpId)
+            for (CacheGroupActionData grp : cacheGrpsToStop) {
+                if (grp.desc.groupId() == grpId)
                     return true;
             }
         }
@@ -312,10 +336,10 @@ public class ExchangeActions {
      */
     static class ActionData {
         /** */
-        private DynamicCacheChangeRequest req;
+        private final DynamicCacheChangeRequest req;
 
         /** */
-        private DynamicCacheDescriptor desc;
+        private final DynamicCacheDescriptor desc;
 
         /**
          * @param req Request.
@@ -344,16 +368,59 @@ public class ExchangeActions {
         }
     }
 
+    /**
+     *
+     */
+    static class CacheGroupActionData {
+        /** */
+        private final CacheGroupDescriptor desc;
+
+        /** */
+        private final boolean destroy;
+
+        /**
+         * @param desc Group descriptor
+         * @param destroy Destroy flag
+         */
+        CacheGroupActionData(CacheGroupDescriptor desc, boolean destroy) {
+            assert desc != null;
+
+            this.desc = desc;
+            this.destroy = destroy;
+        }
+
+        /**
+         * @param desc Group descriptor
+         */
+        CacheGroupActionData(CacheGroupDescriptor desc) {
+            this(desc, false);
+        }
+
+        /**
+         * @return Group descriptor
+         */
+        public CacheGroupDescriptor descriptor() {
+            return desc;
+        }
+
+        /**
+         * @return Destroy flag
+         */
+        public boolean destroy() {
+            return destroy;
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
-        Object startGrps = F.viewReadOnly(cacheGrpsToStart, new C1<CacheGroupDescriptor, String>() {
-            @Override public String apply(CacheGroupDescriptor desc) {
-                return desc.cacheOrGroupName();
+        Object startGrps = F.viewReadOnly(cacheGrpsToStart, new C1<CacheGroupActionData, String>() {
+            @Override public String apply(CacheGroupActionData data) {
+                return data.desc.cacheOrGroupName();
             }
         });
-        Object stopGrps = F.viewReadOnly(cacheGrpsToStop, new C1<CacheGroupDescriptor, String>() {
-            @Override public String apply(CacheGroupDescriptor desc) {
-                return desc.cacheOrGroupName();
+        Object stopGrps = F.viewReadOnly(cacheGrpsToStop, new C1<CacheGroupActionData, String>() {
+            @Override public String apply(CacheGroupActionData data) {
+                return data.desc.cacheOrGroupName() + ", destroy=" + data.destroy;
             }
         });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/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 c425bfb..bb6d068 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
@@ -2110,40 +2110,34 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     public void onExchangeDone(
         AffinityTopologyVersion topVer,
         @Nullable ExchangeActions exchActions,
-        Throwable err
+        @Nullable Throwable err
     ) {
         initCacheProxies(topVer, err);
 
-        if (exchActions != null && exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
-            ctx.dataStructures().restoreStructuresState(ctx);
-
-        if (exchActions != null && err == null) {
-            Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps = null;
-
-            boolean forceCheckpoint = false;
-
-            for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
-                GridCacheContext<?, ?> stopCtx;
-                boolean destroy;
+        if (exchActions == null)
+            return;
 
-                if (!forceCheckpoint){
-                    try {
-                        sharedCtx.database().waitForCheckpoint("caches stop");
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
-                    }
+        if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
+            ctx.dataStructures().restoreStructuresState(ctx);
 
-                    forceCheckpoint = true;
+        if (err == null) {
+            // Force checkpoint if there is any cache stop request
+            if (exchActions.cacheStopRequests().size() > 0) {
+                try {
+                    sharedCtx.database().waitForCheckpoint("caches stop");
                 }
+                catch (IgniteCheckedException e) {
+                    U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
+                }
+            }
 
+            for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
                 stopGateway(action.request());
 
                 sharedCtx.database().checkpointReadLock();
 
                 try {
-                    stopCtx = prepareCacheStop(action.request().cacheName(), action.request().destroy());
-                    destroy = action.request().destroy();
+                    prepareCacheStop(action.request().cacheName(), action.request().destroy());
 
                     if (exchActions.newClusterState() == null)
                         ctx.state().onCacheStop(action.request());
@@ -2151,20 +2145,22 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 finally {
                     sharedCtx.database().checkpointReadUnlock();
                 }
+            }
+
+            List<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGroups = new ArrayList<>();
 
-                if (stopCtx != null && !stopCtx.group().hasCaches()) {
-                    if (stoppedGrps == null)
-                        stoppedGrps = new ArrayList<>();
+            for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
+                Integer groupId = action.descriptor().groupId();
 
-                    stoppedGrps.add(F.t(stopCtx.group(), destroy));
+                if (cacheGrps.containsKey(groupId)) {
+                    stoppedGroups.add(F.t(cacheGrps.get(groupId), action.destroy()));
+
+                    stopCacheGroup(groupId);
                 }
             }
 
-            for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop())
-                stopCacheGroup(grpDesc.groupId());
-
-            if (stoppedGrps != null && !sharedCtx.kernalContext().clientNode())
-                sharedCtx.database().onCacheGroupsStopped(stoppedGrps);
+            if (!sharedCtx.kernalContext().clientNode())
+                sharedCtx.database().onCacheGroupsStopped(stoppedGroups);
         }
     }
 


[25/28] ignite git commit: IGNITE-5613 - Fixed race on local sequence increment and distributed update

Posted by sb...@apache.org.
IGNITE-5613 - Fixed race on local sequence increment and distributed update


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 7d42dea8e3e50707c34e8e8d211cd54da1505210
Parents: c4ddda3
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Jul 3 17:05:48 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jul 3 17:05:48 2017 +0300

----------------------------------------------------------------------
 .../GridCacheAtomicSequenceImpl.java            | 55 ++++++++++++--------
 ...titionedAtomicSequenceMultiThreadedTest.java | 32 ++++++++++++
 2 files changed, 64 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7d42dea8/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 725e4aa..47fa49e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@ -382,39 +382,48 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
 
                     long newUpBound;
 
-                    curLocVal = locVal;
+                    // Even though we hold a transaction lock here, we must hold the local update lock here as well
+                    // because we mutate multipe variables (locVal and upBound).
+                    localUpdate.lock();
 
-                    // If local range was already reserved in another thread.
-                    if (curLocVal + l <= upBound) {
-                        locVal = curLocVal + l;
+                    try {
+                        curLocVal = locVal;
 
-                        return updated ? curLocVal + l : curLocVal;
-                    }
+                        // If local range was already reserved in another thread.
+                        if (curLocVal + l <= upBound) {
+                            locVal = curLocVal + l;
 
-                    long curGlobalVal = seq.get();
+                            return updated ? curLocVal + l : curLocVal;
+                        }
 
-                    long newLocVal;
+                        long curGlobalVal = seq.get();
 
-                    /* We should use offset because we already reserved left side of range.*/
-                    long off = batchSize > 1 ? batchSize - 1 : 1;
+                        long newLocVal;
 
-                    // Calculate new values for local counter, global counter and upper bound.
-                    if (curLocVal + l >= curGlobalVal) {
-                        newLocVal = curLocVal + l;
+                        /* We should use offset because we already reserved left side of range.*/
+                        long off = batchSize > 1 ? batchSize - 1 : 1;
 
-                        newUpBound = newLocVal + off;
-                    }
-                    else {
-                        newLocVal = curGlobalVal;
+                        // Calculate new values for local counter, global counter and upper bound.
+                        if (curLocVal + l >= curGlobalVal) {
+                            newLocVal = curLocVal + l;
 
-                        newUpBound = newLocVal + off;
-                    }
+                            newUpBound = newLocVal + off;
+                        }
+                        else {
+                            newLocVal = curGlobalVal;
 
-                    locVal = newLocVal;
-                    upBound = newUpBound;
+                            newUpBound = newLocVal + off;
+                        }
 
-                    if (updated)
-                        curLocVal = newLocVal;
+                        locVal = newLocVal;
+                        upBound = newUpBound;
+
+                        if (updated)
+                            curLocVal = newLocVal;
+                    }
+                    finally {
+                        localUpdate.unlock();
+                    }
 
                     // Global counter must be more than reserved upper bound.
                     seq.set(newUpBound + 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d42dea8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceMultiThreadedTest.java
index 945650d..4db9bd3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceMultiThreadedTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned;
 
 import java.util.Random;
 import java.util.UUID;
+import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteAtomicSequence;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheMode;
@@ -26,6 +27,7 @@ import org.apache.ignite.configuration.AtomicConfiguration;
 import org.apache.ignite.internal.processors.cache.datastructures.IgniteAtomicsAbstractTest;
 import org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
 
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -281,6 +283,36 @@ public class GridCachePartitionedAtomicSequenceMultiThreadedTest extends IgniteA
     }
 
     /**
+     * @throws Exception if failed.
+     */
+    public void testMultipleSequences() throws Exception {
+        final int seqCnt = 5;
+        final int threadCnt = 5;
+        final int incCnt = 1_000;
+
+        final IgniteAtomicSequence[] seqs = new IgniteAtomicSequence[seqCnt];
+
+        String seqName = UUID.randomUUID().toString();
+
+        for (int i = 0; i < seqs.length; i++)
+            seqs[i] = grid(0).atomicSequence(seqName, 0, true);
+
+        GridTestUtils.runMultiThreaded(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < incCnt; i++) {
+                    for (IgniteAtomicSequence seq : seqs)
+                        seq.incrementAndGet();
+                }
+
+                return null;
+            }
+        }, threadCnt, "load");
+
+        for (IgniteAtomicSequence seq : seqs)
+            assertEquals(seqCnt * threadCnt * incCnt, seq.get());
+    }
+
+    /**
      * Executes given closure in a given number of threads given number of times.
      *
      * @param c Closure to execute.


[22/28] ignite git commit: IGNITE-5613 - Fixed deadlock on sequence update inside transaction

Posted by sb...@apache.org.
IGNITE-5613 - Fixed deadlock on sequence update inside transaction


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 7db925c1c445260ffe45a8ede54d24d99db0fddd
Parents: b762417
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Jun 29 17:11:39 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jul 3 12:14:59 2017 +0300

----------------------------------------------------------------------
 .../GridCacheAtomicSequenceImpl.java            | 99 ++++++++++++--------
 1 file changed, 59 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7db925c1/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 5a87e4a..31ec16f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@ -30,6 +30,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
@@ -91,8 +92,14 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
     /**  Sequence batch size */
     private volatile int batchSize;
 
-    /** Synchronization lock. */
-    private final Lock lock = new ReentrantLock();
+    /** Synchronization lock for local value updates. */
+    private final Lock localUpdate = new ReentrantLock();
+
+    /** Synchronization for distributed sequence update. Acquired by threads with free topology (not in TX). */
+    private final ReentrantLock distUpdateFreeTop = new ReentrantLock();
+
+    /** Synchronization for distributed sequence update. Acquired by threads with locked topology (inside TX). */
+    private final ReentrantLock distUpdateLockedTop = new ReentrantLock();
 
     /** Callable for execution {@link #incrementAndGet} operation in async and sync mode.  */
     private final Callable<Long> incAndGetCall = internalUpdate(1, true);
@@ -214,7 +221,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
 
         assert l > 0;
 
-        lock.lock();
+        localUpdate.lock();
 
         try {
             // If reserved range isn't exhausted.
@@ -225,7 +232,24 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
 
                 return updated ? locVal0 + l : locVal0;
             }
+        }
+        finally {
+            localUpdate.unlock();
+        }
+
+        AffinityTopologyVersion lockedVer = ctx.shared().lockedTopologyVersion(null);
+
+        // We need two separate locks here because two independent thread may attempt to update the sequence
+        // simultaneously, one thread with locked topology and other with unlocked.
+        // We cannot use the same lock for both cases because it leads to a deadlock when free-topology thread
+        // waits for topology change, and locked topology thread waits to acquire the lock.
+        // If a thread has locked topology, it must bypass sync with non-locked threads, but at the same time
+        // we do not want multiple threads to attempt to run identical cache updates.
+        ReentrantLock distLock = lockedVer == null ? distUpdateFreeTop : distUpdateLockedTop;
+
+        distLock.lock();
 
+        try {
             if (updateCall == null)
                 updateCall = internalUpdate(l, updated);
 
@@ -240,7 +264,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
             }
         }
         finally {
-            lock.unlock();
+            distLock.unlock();
         }
     }
 
@@ -260,13 +284,13 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
     @Override public void batchSize(int size) {
         A.ensure(size > 0, " Batch size can't be less then 0: " + size);
 
-        lock.lock();
+        localUpdate.lock();
 
         try {
             batchSize = size;
         }
         finally {
-            lock.unlock();
+            localUpdate.unlock();
         }
     }
 
@@ -348,6 +372,8 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
     private Callable<Long> internalUpdate(final long l, final boolean updated) {
         return new Callable<Long>() {
             @Override public Long call() throws Exception {
+                assert distUpdateFreeTop.isHeldByCurrentThread() || distUpdateLockedTop.isHeldByCurrentThread();
+
                 try (GridNearTxLocal tx = CU.txStartInternal(ctx, seqView, PESSIMISTIC, REPEATABLE_READ)) {
                     GridCacheAtomicSequenceValue seq = seqView.get(key);
 
@@ -359,46 +385,39 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
 
                     long newUpBound;
 
-                    lock.lock();
+                    curLocVal = locVal;
 
-                    try {
-                        curLocVal = locVal;
+                    // If local range was already reserved in another thread.
+                    if (curLocVal + l <= upBound) {
+                        locVal = curLocVal + l;
 
-                        // If local range was already reserved in another thread.
-                        if (curLocVal + l <= upBound) {
-                            locVal = curLocVal + l;
-
-                            return updated ? curLocVal + l : curLocVal;
-                        }
+                        return updated ? curLocVal + l : curLocVal;
+                    }
 
-                        long curGlobalVal = seq.get();
+                    long curGlobalVal = seq.get();
 
-                        long newLocVal;
+                    long newLocVal;
 
-                        /* We should use offset because we already reserved left side of range.*/
-                        long off = batchSize > 1 ? batchSize - 1 : 1;
+                    /* We should use offset because we already reserved left side of range.*/
+                    long off = batchSize > 1 ? batchSize - 1 : 1;
 
-                        // Calculate new values for local counter, global counter and upper bound.
-                        if (curLocVal + l >= curGlobalVal) {
-                            newLocVal = curLocVal + l;
+                    // Calculate new values for local counter, global counter and upper bound.
+                    if (curLocVal + l >= curGlobalVal) {
+                        newLocVal = curLocVal + l;
 
-                            newUpBound = newLocVal + off;
-                        }
-                        else {
-                            newLocVal = curGlobalVal;
+                        newUpBound = newLocVal + off;
+                    }
+                    else {
+                        newLocVal = curGlobalVal;
 
-                            newUpBound = newLocVal + off;
-                        }
+                        newUpBound = newLocVal + off;
+                    }
 
-                        locVal = newLocVal;
-                        upBound = newUpBound;
+                    locVal = newLocVal;
+                    upBound = newUpBound;
 
-                        if (updated)
-                            curLocVal = newLocVal;
-                    }
-                    finally {
-                        lock.unlock();
-                    }
+                    if (updated)
+                        curLocVal = newLocVal;
 
                     // Global counter must be more than reserved upper bound.
                     seq.set(newUpBound + 1);
@@ -419,13 +438,13 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
     }
 
     /** {@inheritDoc} */
-    @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
-        this.seqView = kctx.cache().atomicsCache();
-        this.ctx = seqView.context();
+    @Override public void onActivate(GridKernalContext kctx) {
+        seqView = kctx.cache().atomicsCache();
+        ctx = seqView.context();
     }
 
     /** {@inheritDoc} */
-    @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+    @Override public void onDeActivate(GridKernalContext kctx) {
 
     }
 


[26/28] ignite git commit: ignite-2.1.2 more assert info in wal manager

Posted by sb...@apache.org.
ignite-2.1.2 more assert info in wal manager


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 64596ea8348105bf7b0e931af89e31190a2b53e5
Parents: c4ddda3
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Mon Jul 3 18:20:35 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Mon Jul 3 18:20:35 2017 +0300

----------------------------------------------------------------------
 .../cache/persistence/wal/FileWriteAheadLogManager.java        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/64596ea8/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 225776d..5918141 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
@@ -1918,7 +1918,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
             lock.lock();
 
             try {
-                assert head.get() instanceof FakeRecord: "head";
+                WALRecord rec = head.get();
+
+                assert rec instanceof FakeRecord : "Expected head FakeRecord, actual head "
+                    + (rec != null ? rec.getClass().getSimpleName() : "null");
+
                 assert written == lastFsyncPos || mode != WALMode.DEFAULT :
                     "fsync [written=" + written + ", lastFsync=" + lastFsyncPos + ']';
 


[11/28] ignite git commit: IGNITE-5202 - Fixed memory configuration logging - Fixes #1930.

Posted by sb...@apache.org.
IGNITE-5202 - Fixed memory configuration logging - Fixes #1930.

Signed-off-by: Alexey Goncharuk <al...@gmail.com>


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 771288f4f76f81511498095e12130dc5d2899ce1
Parents: 9417040
Author: Sergey Chugunov <se...@gmail.com>
Authored: Fri Jun 30 10:10:11 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 30 10:10:11 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/IgniteKernal.java    | 11 ++++++++---
 .../internal/processors/cache/GridCacheProcessor.java    |  8 +++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/771288f4/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 456acf9..4bc4dd5 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
@@ -2461,7 +2461,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
             for (CacheConfiguration c : cacheCfgs) {
                 String cacheName = U.maskName(c.getName());
 
-                String memPlcName = U.maskName(c.getMemoryPolicyName());
+                String memPlcName = c.getMemoryPolicyName();
+
+                if (CU.isSystemCache(cacheName))
+                    memPlcName = "sysMemPlc";
+                else if (memPlcName == null && cfg.getMemoryConfiguration() != null)
+                    memPlcName = cfg.getMemoryConfiguration().getDefaultMemoryPolicyName();
 
                 if (!memPlcNamesMapping.containsKey(memPlcName))
                     memPlcNamesMapping.put(memPlcName, new ArrayList<String>());
@@ -2477,10 +2482,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                 for (String s : e.getValue())
                     sb.a("'").a(s).a("', ");
 
-                sb.d(sb.length() - 2, sb.length()).a("]");
+                sb.d(sb.length() - 2, sb.length()).a("], ");
             }
 
-            U.log(log, "Configured caches [" + sb.toString() + ']');
+            U.log(log, "Configured caches [" + sb.d(sb.length() - 2, sb.length()).toString() + ']');
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/771288f4/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 96b45df..91325fd 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
@@ -1251,11 +1251,17 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         cacheCtx.onStarted();
 
+        String memPlcName = cfg.getMemoryPolicyName();
+
+        if (memPlcName == null
+            && ctx.config().getMemoryConfiguration() != null)
+            memPlcName = ctx.config().getMemoryConfiguration().getDefaultMemoryPolicyName();
+
 
         if (log.isInfoEnabled()) {
             log.info("Started cache [name=" + cfg.getName() +
                 (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
-                ", memoryPolicyName=" + cfg.getMemoryPolicyName() +
+                ", memoryPolicyName=" + memPlcName +
                 ", mode=" + cfg.getCacheMode() +
                 ", atomicity=" + cfg.getAtomicityMode() + ']');
 }


[06/28] ignite git commit: IGNITE-5076: improved multi-threaded start of nodes

Posted by sb...@apache.org.
IGNITE-5076: improved multi-threaded start of nodes


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 4936c8887f3ea58875c257ac2b999f90b6d9818f
Parents: 0bd6e8f
Author: Slava Koptilin <sl...@gmail.com>
Authored: Mon Jun 26 15:37:26 2017 +0300
Committer: agura <ag...@gridgain.com>
Committed: Thu Jun 29 15:45:22 2017 +0300

----------------------------------------------------------------------
 .../ignite/testframework/junits/GridAbstractTest.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4936c888/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
old mode 100644
new mode 100755
index 01b27ad..a9a870e
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -692,12 +692,14 @@ public abstract class GridAbstractTest extends TestCase {
      * @throws Exception If failed.
      */
     protected Ignite startGridsMultiThreaded(int cnt) throws Exception {
-        if (cnt == 1)
-            return startGrids(1);
+        assert cnt > 0 : "Number of grids must be a positive number";
 
-        Ignite ignite = startGridsMultiThreaded(0, cnt);
+        Ignite ignite = startGrids(1);
 
-        checkTopology(cnt);
+        if (cnt > 1) {
+            startGridsMultiThreaded(1, cnt - 1);
+            checkTopology(cnt);
+        }
 
         return ignite;
     }


[13/28] ignite git commit: IGNITE-5611 Fix text color cascading issue.

Posted by sb...@apache.org.
IGNITE-5611 Fix text color cascading issue.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 531a0de302a00e2285bf4bc16bee1f1bdcc7d4f1
Parents: 5699be7
Author: Ilya Borisov <kl...@gmail.com>
Authored: Fri Jun 30 14:16:49 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 14:39:27 2017 +0700

----------------------------------------------------------------------
 .../web-console/frontend/app/components/bs-select-menu/style.scss   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/531a0de3/modules/web-console/frontend/app/components/bs-select-menu/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/style.scss b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
index 67dec24..faddd3c 100644
--- a/modules/web-console/frontend/app/components/bs-select-menu/style.scss
+++ b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
@@ -36,6 +36,7 @@
     border-radius: $ignite-button-border-radius;
     border: 1px solid #c5c5c5;
     background: white;
+    color: initial; // Fixes color inheritance inside some containers
 
     .bssm-active-indicator {
         font-size: 14px;


[24/28] ignite git commit: Merge branch master into ignite-2.1.2

Posted by sb...@apache.org.
Merge branch master into ignite-2.1.2


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: c4ddda3c730ccc3d5de4245049819605769e918c
Parents: e1ce7c9 7db925c
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Jul 3 15:30:39 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jul 3 15:30:39 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 11 ++-
 .../processors/cache/GridCacheAdapter.java      |  4 +
 .../GridCachePartitionExchangeManager.java      |  2 +-
 .../processors/cache/GridCacheProcessor.java    |  9 +-
 .../GridDhtPartitionsExchangeFuture.java        |  2 +-
 .../GridCacheAtomicSequenceImpl.java            | 99 ++++++++++++--------
 .../CacheLateAffinityAssignmentTest.java        | 73 +++++++++++++++
 7 files changed, 154 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 0e541c8,cbb07f9..2b5a4ff
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@@ -264,12 -261,13 +264,12 @@@ public class GridCachePartitionExchange
                                  exchFut = exchangeFuture(exchId, evt, cache, null, msg);
                              }
                          }
-                         else
 -                        else if (msg.exchangeId().topologyVersion().topologyVersion() >= cctx.discovery().localJoinEvent().topologyVersion()) {
++                        else if (msg.exchangeId().topologyVersion().topologyVersion() >= cctx.discovery().localJoinEvent().topologyVersion())
                              exchangeFuture(msg.exchangeId(), null, null, null, null)
                                  .onAffinityChangeMessage(evt.eventNode(), msg);
 -                        }
                      }
 -                    else if (customMsg instanceof StartFullSnapshotAckDiscoveryMessage
 -                        && !((StartFullSnapshotAckDiscoveryMessage)customMsg).hasError()) {
 +                    else if (customMsg instanceof StartSnapshotOperationAckDiscoveryMessage
 +                        && ((StartSnapshotOperationAckDiscoveryMessage)customMsg).needExchange()) {
                          exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
  
                          exchFut = exchangeFuture(exchId, evt, null, null, null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index bb6d068,91325fd..402d874
--- 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
@@@ -1213,10 -1261,10 +1220,10 @@@ public class GridCacheProcessor extend
          if (log.isInfoEnabled()) {
              log.info("Started cache [name=" + cfg.getName() +
                  (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
-                 ", memoryPolicyName=" + cfg.getMemoryPolicyName() +
+                 ", memoryPolicyName=" + memPlcName +
                  ", mode=" + cfg.getCacheMode() +
                  ", atomicity=" + cfg.getAtomicityMode() + ']');
 -}
 +        }
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 29f5880,31ec16f..725e4aa
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@@ -416,9 -438,9 +435,9 @@@ public final class GridCacheAtomicSeque
      }
  
      /** {@inheritDoc} */
-     @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
-         this.ctx = kctx.cache().<GridCacheInternalKey, GridCacheAtomicSequenceValue>context().cacheContext(ctx.cacheId());
-         this.seqView = ctx.cache();
+     @Override public void onActivate(GridKernalContext kctx) {
 -        seqView = kctx.cache().atomicsCache();
 -        ctx = seqView.context();
++        ctx = kctx.cache().<GridCacheInternalKey, GridCacheAtomicSequenceValue>context().cacheContext(ctx.cacheId());
++        seqView = ctx.cache();
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ddda3c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------