[ignite] branch master updated: IGNITE-13676 Java thin client: Fix message read after SECURITY_VIOLATION error - Fixes #8428.

2020-11-05 Thread alexpl
This is an automated email from the ASF dual-hosted git repository.

alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 8ac005f  IGNITE-13676 Java thin client: Fix message read after 
SECURITY_VIOLATION error - Fixes #8428.
8ac005f is described below

commit 8ac005f94b6f15a82cd7b9dc3b5ced2352e389eb
Author: Aleksey Plekhanov 
AuthorDate: Thu Nov 5 17:57:41 2020 +0300

IGNITE-13676 Java thin client: Fix message read after SECURITY_VIOLATION 
error - Fixes #8428.

Signed-off-by: Aleksey Plekhanov 
---
 .../org/apache/ignite/internal/client/thin/TcpClientChannel.java | 6 --
 .../security/client/ThinClientPermissionCheckTest.java   | 9 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java
index 4f3ee40..c357672 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java
@@ -461,9 +461,11 @@ class TcpClientChannel implements ClientChannel {
 if (msgSize > hdrSize)
 res = dataInput.spinRead(msgSize - hdrSize);
 }
-else if (status == ClientStatus.SECURITY_VIOLATION)
+else if (status == ClientStatus.SECURITY_VIOLATION) {
+dataInput.spinRead(msgSize - hdrSize); // Read message to the end.
+
 err = new ClientAuthorizationException();
-else {
+} else {
 resIn = new BinaryHeapInputStream(dataInput.spinRead(msgSize - 
hdrSize));
 
 String errMsg = ClientUtils.createBinaryReader(null, 
resIn).readString();
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/client/ThinClientPermissionCheckTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/client/ThinClientPermissionCheckTest.java
index 1230aba..152e2570 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/client/ThinClientPermissionCheckTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/client/ThinClientPermissionCheckTest.java
@@ -262,6 +262,15 @@ public class ThinClientPermissionCheckTest extends 
AbstractSecurityTest {
 assertThrowsWithCause(() -> runOperation(CLIENT, op), 
ClientAuthorizationException.class);
 }
 
+/** */
+@Test
+public void testAllowedOperationAfterSecurityViolation() throws Exception {
+try (IgniteClient client = startClient(CLIENT_READ)) {
+assertThrowsWithCause(() -> client.cache(CACHE).put("key", 
"value"), ClientAuthorizationException.class);
+assertNull(client.cache(CACHE).get("key"));
+}
+}
+
 /**
  * Gets all operations.
  *



[ignite] branch ignite-ducktape updated: IGNITE-13645 : Discovery ducktape test should detect failed nodes by asking the cluster. (#8409)

2020-11-05 Thread av
This is an automated email from the ASF dual-hosted git repository.

av pushed a commit to branch ignite-ducktape
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-ducktape by this push:
 new a44d5a3  IGNITE-13645 : Discovery ducktape test should detect failed 
nodes by asking the cluster. (#8409)
a44d5a3 is described below

commit a44d5a3695663475563b661b305421efcd6f3422
Author: Vladsz83 
AuthorDate: Thu Nov 5 18:23:55 2020 +0300

IGNITE-13645 : Discovery ducktape test should detect failed nodes by asking 
the cluster. (#8409)
---
 .../services/utils/templates/log4j.xml.j2  |  4 +++
 .../tests/ignitetest/tests/discovery_test.py   | 31 +-
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git 
a/modules/ducktests/tests/ignitetest/services/utils/templates/log4j.xml.j2 
b/modules/ducktests/tests/ignitetest/services/utils/templates/log4j.xml.j2
index b2a9a7b..a0eeff0 100644
--- a/modules/ducktests/tests/ignitetest/services/utils/templates/log4j.xml.j2
+++ b/modules/ducktests/tests/ignitetest/services/utils/templates/log4j.xml.j2
@@ -48,6 +48,10 @@
 
 
 
+
+
+
+
 
 
 
diff --git a/modules/ducktests/tests/ignitetest/tests/discovery_test.py 
b/modules/ducktests/tests/ignitetest/tests/discovery_test.py
index f2be35b..fbd392c 100644
--- a/modules/ducktests/tests/ignitetest/tests/discovery_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/discovery_test.py
@@ -163,8 +163,7 @@ class DiscoveryTest(IgniteTest):
 
 results['Ignite cluster start time (s)'] = start_servers_sec
 
-failed_nodes, survived_node = choose_node_to_kill(servers, 
test_config.nodes_to_kill,
-  
test_config.sequential_failure)
+failed_nodes = choose_node_to_kill(servers, test_config.nodes_to_kill, 
test_config.sequential_failure)
 
 if test_config.load_type is not ClusterLoad.NONE:
 load_config = ignite_config._replace(client_mode=True) if 
test_config.with_zk else \
@@ -181,12 +180,11 @@ class DiscoveryTest(IgniteTest):
 
 start_load_app(self.test_context, ignite_config=load_config, 
params=params, modules=modules)
 
-results.update(self._simulate_nodes_failure(servers, 
node_fail_task(ignite_config, test_config), failed_nodes,
-survived_node))
+results.update(self._simulate_nodes_failure(servers, 
node_fail_task(ignite_config, test_config), failed_nodes))
 
 return results
 
-def _simulate_nodes_failure(self, servers, kill_node_task, failed_nodes, 
survived_node):
+def _simulate_nodes_failure(self, servers, kill_node_task, failed_nodes):
 """
 Perform node failure scenario
 """
@@ -206,20 +204,19 @@ class DiscoveryTest(IgniteTest):
 logged_timestamps = []
 data = {}
 
-for failed_id in ids_to_wait:
-logged_timestamps.append(
-get_event_time(servers, survived_node, 
node_failed_event_pattern(failed_id)))
+for survivor in [n for n in servers.nodes if n not in failed_nodes]:
+for failed_id in ids_to_wait:
+logged_timestamps.append(get_event_time(servers, survivor, 
node_failed_event_pattern(failed_id)))
+
+self._check_failed_number(failed_nodes, survivor)
 
-self._check_failed_number(failed_nodes, survived_node)
 self._check_not_segmented(failed_nodes)
 
 logged_timestamps.sort(reverse=True)
 
-first_kill_time = epoch_mills(first_terminated)
-detection_delay = epoch_mills(logged_timestamps[0]) - first_kill_time
-
-data['Detection of node(s) failure (ms)'] = detection_delay
-data['All detection delays (ms):'] = str([epoch_mills(ts) - 
first_kill_time for ts in logged_timestamps])
+data['Detection of node(s) failure (ms)'] = 
epoch_mills(logged_timestamps[0]) - epoch_mills(first_terminated)
+data['All detection delays (ms):'] = str(
+[epoch_mills(ts) - epoch_mills(first_terminated) for ts in 
logged_timestamps])
 data['Nodes failed'] = len(failed_nodes)
 
 return data
@@ -348,13 +345,9 @@ def choose_node_to_kill(servers, nodes_to_kill, 
sequential):
 idx = random.randint(0, len(to_kill) - nodes_to_kill)
 to_kill = to_kill[idx:idx + nodes_to_kill]
 
-survive = random.choice([node for node in servers.nodes if node not in 
to_kill])
-
 assert len(to_kill) == nodes_to_kill, "Unable to pick up required number 
of nodes to kill."
 
-assert survive, "Unable to select survived node to monitor the cluster on 
it."
-
-return to_kill, survive
+return to_kill
 
 
 def order(node):



[ignite] branch master updated: IGNITE-13658 Introduce volatileDsMemPlc for volatile data structures caches

2020-11-05 Thread ilyak
This is an automated email from the ASF dual-hosted git repository.

ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new f806b01  IGNITE-13658 Introduce volatileDsMemPlc for volatile data 
structures caches
f806b01 is described below

commit f806b014c02f55490e09e01673aa729e8b67e6b2
Author: zstan 
AuthorDate: Thu Nov 5 17:50:20 2020 +0300

IGNITE-13658 Introduce volatileDsMemPlc for volatile data structures caches

Implement checking for volatile data region feature.
Always start and use volatile data region, since only a subset of nodes may 
be persistent.

Fixes #8423.

Signed-off-by: Ilya Kasnacheev 
---
 .../util/GridCommandHandlerClusterByClassTest.java |  18 ++-
 .../org/apache/ignite/internal/IgniteFeatures.java |   3 +
 .../dht/GridDhtTopologyFutureAdapter.java  |   9 +-
 .../IgniteCacheDatabaseSharedManager.java  |  34 +++-
 .../datastructures/DataStructuresProcessor.java|  29 +++-
 .../internal/GridNodeMetricsLogSelfTest.java   |   6 +-
 .../GridCacheConfigurationValidationSelfTest.java  |  10 ++
 .../OutOfMemoryVolatileRegionTest.java | 175 +
 .../MemoryPolicyInitializationTest.java|  12 +-
 .../IgniteCacheDataStructuresSelfTestSuite.java|   2 +
 .../Cache/DataRegionMetricsTest.cs |  13 +-
 .../Cache/MemoryMetricsTest.cs |  10 +-
 12 files changed, 293 insertions(+), 28 deletions(-)

diff --git 
a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java
 
b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java
index 4403e38..a8dc398 100644
--- 
a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java
+++ 
b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java
@@ -891,15 +891,18 @@ public class GridCommandHandlerClusterByClassTest extends 
GridCommandHandlerClus
 corruptDataEntry(storedSysCacheCtx.caches().get(0), new 
GridCacheInternalKeyImpl("sq" + parts / 2,
 "default-ds-group"), false, true);
 
-CacheGroupContext memorySysCacheCtx = 
ignite.context().cache().cacheGroup(CU.cacheId("default-volatile-ds-group"));
+CacheGroupContext memoryVolatileCacheCtx = 
ignite.context().cache().cacheGroup(CU.cacheId(
+"default-volatile-ds-group@volatileDsMemPlc"));
 
-assertNotNull(memorySysCacheCtx);
+assertNotNull(memoryVolatileCacheCtx);
+assertEquals("volatileDsMemPlc", 
memoryVolatileCacheCtx.dataRegion().config().getName());
+assertEquals(false, 
memoryVolatileCacheCtx.dataRegion().config().isPersistenceEnabled());
 
-corruptDataEntry(memorySysCacheCtx.caches().get(0), new 
GridCacheInternalKeyImpl("s0",
-"default-volatile-ds-group"), true, false);
+corruptDataEntry(memoryVolatileCacheCtx.caches().get(0), new 
GridCacheInternalKeyImpl("s0",
+"default-volatile-ds-group@volatileDsMemPlc"), true, false);
 
-corruptDataEntry(memorySysCacheCtx.caches().get(0), new 
GridCacheInternalKeyImpl("s" + parts / 2,
-"default-volatile-ds-group"), false, true);
+corruptDataEntry(memoryVolatileCacheCtx.caches().get(0), new 
GridCacheInternalKeyImpl("s" + parts / 2,
+"default-volatile-ds-group@volatileDsMemPlc"), false, true);
 
 assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", 
"--cache-filter", "SYSTEM"));
 
@@ -910,7 +913,8 @@ public class GridCommandHandlerClusterByClassTest extends 
GridCommandHandlerClus
 
 U.log(log, dumpWithConflicts);
 
-assertContains(log, dumpWithConflicts, "found 4 conflict 
partitions: [counterConflicts=2, " +
+// Non-persistent caches do not have counter conflicts
+assertContains(log, dumpWithConflicts, "found 3 conflict 
partitions: [counterConflicts=1, " +
 "hashConflicts=2]");
 }
 else
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteFeatures.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteFeatures.java
index e1f09e5..f9704ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteFeatures.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteFeatures.java
@@ -108,6 +108,9 @@ public enum IgniteFeatures {
 /** Distributed change timeout for dump long operations. */
 DISTRIBUTED_CHANGE_LONG_OPERATIONS_DUMP_TIMEOUT(30),
 
+/** New region for volatile data. */
+VOLATILE_DATA_STRUCTURES_REGION(33),
+
 /** Check secondary indexes inline size on join/by control utility 
request. */
 CHECK_INDEX_INLINE_SIZES(36),
 
diff --git 

[ignite] branch ignite-ducktape updated: IGNITE-13660 Unexpected NODE_LEFT on graceful stop (at ducktests) (#8422)

2020-11-05 Thread av
This is an automated email from the ASF dual-hosted git repository.

av pushed a commit to branch ignite-ducktape
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-ducktape by this push:
 new fa6389e  IGNITE-13660 Unexpected NODE_LEFT on graceful stop (at 
ducktests) (#8422)
fa6389e is described below

commit fa6389ee02a453c1b04fb9714f291351caf0bcf4
Author: Anton Vinogradov 
AuthorDate: Thu Nov 5 13:30:44 2020 +0300

IGNITE-13660 Unexpected NODE_LEFT on graceful stop (at ducktests) (#8422)
---
 .../IgniteCachePutClient.java  |  4 +-
 .../tests/self_test/TestKillableApplication.java   | 39 
 .../self_test/TestSelfKillableApplication.java | 36 +++
 .../ducktest/utils/IgniteAwareApplication.java | 10 +--
 .../tests/ignitetest/services/utils/ignite_spec.py |  1 +
 .../{client_in_out_test.py => client_test.py}  | 73 +-
 .../tests/{assertion_test.py => self_test.py}  | 46 +-
 .../tests/ignitetest/tests/suites/fast_suite.yml   |  2 +-
 8 files changed, 159 insertions(+), 52 deletions(-)

diff --git 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/start_stop_client/IgniteCachePutClient.java
 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/client_test/IgniteCachePutClient.java
similarity index 95%
rename from 
modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/start_stop_client/IgniteCachePutClient.java
rename to 
modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/client_test/IgniteCachePutClient.java
index b0ecd63..0a337ce 100644
--- 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/start_stop_client/IgniteCachePutClient.java
+++ 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/client_test/IgniteCachePutClient.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.ducktest.tests.start_stop_client;
+package org.apache.ignite.internal.ducktest.tests.client_test;
 
 import java.util.Optional;
 import java.util.UUID;
@@ -33,7 +33,7 @@ public class IgniteCachePutClient extends 
IgniteAwareApplication {
 
 long pacing = Optional.ofNullable(jsonNode.get("pacing"))
 .map(JsonNode::asLong)
-.orElse(0l);
+.orElse(0L);
 
 log.info("Test props:" +
 " cacheName=" + cacheName +
diff --git 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestKillableApplication.java
 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestKillableApplication.java
new file mode 100644
index 000..c9f4e67
--- /dev/null
+++ 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestKillableApplication.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.ducktest.tests.self_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ *
+ */
+public class TestKillableApplication extends IgniteAwareApplication {
+/** {@inheritDoc} */
+@Override public void run(JsonNode jsonNode) throws Exception {
+markInitialized();
+
+while (!terminated())
+U.sleep(100);
+
+U.sleep(5000);
+
+markFinished();
+}
+}
diff --git 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestSelfKillableApplication.java
 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestSelfKillableApplication.java
new file mode 100644
index 000..f0e1f4d
--- /dev/null
+++ 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/self_test/TestSelfKillableApplication.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work