You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/10/12 14:17:53 UTC

[GitHub] [ignite] andrey-kuznetsov opened a new pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

andrey-kuznetsov opened a new pull request #8352:
URL: https://github.com/apache/ignite/pull/8352


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] andrey-kuznetsov commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
andrey-kuznetsov commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510934175



##########
File path: modules/ducktests/tests/ignitetest/tests/self_test.py
##########
@@ -53,3 +55,38 @@ def test_assertion_convertion(self, ignite_version):
         else:
             app.stop()
             assert False
+
+    def test_clock_sync(self):
+        """
+        Tests if clocks are synchronized between nodes.
+        """
+
+        service = GetTimeService(self.test_context, self.test_context.cluster.num_available_nodes())
+        service.start()
+
+        service.clocks.sort(key=operator.itemgetter(1))
+
+        for _ in service.clocks:
+            self.logger.info("NodeClock[%s] = %d" % (_[0], _[1]))
+
+        max_clock_spread_ms = 300
+        min_res = service.clocks[0]
+        max_res = service.clocks[-1]
+        assert max_res[1] - min_res[1] < max_clock_spread_ms, \
+            "Clock difference between %s and %s exceeds %d ms." % (min_res[0], max_res[0], max_clock_spread_ms)
+
+
+class GetTimeService(BackgroundThreadService):
+    """
+    Collects clock timestamps from a set of nodes.
+    """
+
+    def __init__(self, context, num_nodes):
+        super().__init__(context, num_nodes)
+        self.clocks = []
+
+    def start_node(self, node):
+        self.clocks.append((node.name, int(node.account.ssh_output("date +%s"))))

Review comment:
       Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#issuecomment-708411055


   Also, python check style is broken.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510396748



##########
File path: modules/ducktests/tests/ignitetest/tests/self_test.py
##########
@@ -53,3 +55,38 @@ def test_assertion_convertion(self, ignite_version):
         else:
             app.stop()
             assert False
+
+    def test_clock_sync(self):
+        """
+        Tests if clocks are synchronized between nodes.
+        """
+
+        service = GetTimeService(self.test_context, self.test_context.cluster.num_available_nodes())
+        service.start()
+
+        res = sorted(service.clocks.items(), key=operator.itemgetter(1))
+
+        for _ in res:
+            self.logger.info("NodeClock[%s] = %d" % (_[0], _[1]))
+
+        max_clock_spread_ms = 300
+        min_res = res[0]
+        max_res = res[-1]
+        assert max_res[1] - min_res[1] < max_clock_spread_ms, \
+            "Clock difference between %s and %s exceeds %d ms." % (min_res[0], max_res[0], max_clock_spread_ms)
+
+
+class GetTimeService(BackgroundThreadService):
+    """
+    Collects clock timestamps from a set of nodes.
+    """
+
+    def __init__(self, context, num_nodes):
+        super().__init__(context, num_nodes)
+        self.clocks = {}
+
+    def start_node(self, node):
+        self.clocks[node.name] = int(node.account.ssh_output("date +%s"))

Review comment:
       I'm not sure about name, is it unique among the cluster. So let's add additional check that len(res) equals to number of nodes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] andrey-kuznetsov commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
andrey-kuznetsov commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510387555



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/ClockSyncCheckerApplication.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.smoke_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.util.typedef.T2;
+
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+
+/**
+ * Checks if clocks are synchronized between nodes.
+ */
+public class ClockSyncCheckerApplication extends IgniteAwareApplication {
+    /** */
+    private static final String TIMESTAMP_CACHE = "TimestampCache";
+
+    /** */
+    private static final String MAX_CLOCK_DIVERGENCY_MS_PARAM = "maxClockDivergencyMs";
+
+    /** */
+    private static final long WAIT_TIMEOUT_MS = 5000;
+
+    /**
+     * Client node sends requests to all servers by putting distributed cache entries.
+     * Receiver gets request through remote event filter and replies by writing with its local timestamp to cache.
+     * Client listens for replies with continuous query and checks the difference between clocks.
+     * <p>
+     * Cache event handler does not allow to modify entries being handled (even asynchronously),
+     * so request and reply have different keys, structured as 2-tuples:
+     * request = (targetNodeId, 0), reply = (targetNodeId, timestamp); values are not used.
+     * <p>
+     * Cache mode should be replicated in order to run remote listeners on all server nodes reliably.
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        long maxClockDivergencyMs = jsonNode.get(MAX_CLOCK_DIVERGENCY_MS_PARAM).asLong();
+
+        IgniteCache<T2<UUID, Long>, Optional<Void>> cache = ignite.getOrCreateCache(
+            new CacheConfiguration<T2<UUID, Long>, Optional<Void>>(TIMESTAMP_CACHE)
+                .setCacheMode(CacheMode.REPLICATED));
+
+        cache.clear();
+
+        markInitialized();
+
+        ignite.cluster().forServers().nodes().forEach(server ->

Review comment:
       > Actually is it possible to configure local time for an Ignite instance?
   Nope.
   
   The test is rewritten without the use of Ignite.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510398137



##########
File path: modules/ducktests/tests/ignitetest/tests/smoke_test.py
##########
@@ -87,3 +87,28 @@ def test_zk_start_stop(self):
         zookeeper = ZookeeperService(self.test_context, num_nodes=3)
         zookeeper.start()
         zookeeper.stop()
+
+    @cluster(num_nodes=4)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_clock_sync(self, ignite_version):

Review comment:
       Let's remove this test from file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] andrey-kuznetsov commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
andrey-kuznetsov commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510851371



##########
File path: modules/ducktests/tests/ignitetest/tests/self_test.py
##########
@@ -53,3 +55,38 @@ def test_assertion_convertion(self, ignite_version):
         else:
             app.stop()
             assert False
+
+    def test_clock_sync(self):
+        """
+        Tests if clocks are synchronized between nodes.
+        """
+
+        service = GetTimeService(self.test_context, self.test_context.cluster.num_available_nodes())
+        service.start()
+
+        res = sorted(service.clocks.items(), key=operator.itemgetter(1))
+
+        for _ in res:
+            self.logger.info("NodeClock[%s] = %d" % (_[0], _[1]))
+
+        max_clock_spread_ms = 300
+        min_res = res[0]
+        max_res = res[-1]
+        assert max_res[1] - min_res[1] < max_clock_spread_ms, \
+            "Clock difference between %s and %s exceeds %d ms." % (min_res[0], max_res[0], max_clock_spread_ms)
+
+
+class GetTimeService(BackgroundThreadService):
+    """
+    Collects clock timestamps from a set of nodes.
+    """
+
+    def __init__(self, context, num_nodes):
+        super().__init__(context, num_nodes)
+        self.clocks = {}
+
+    def start_node(self, node):
+        self.clocks[node.name] = int(node.account.ssh_output("date +%s"))

Review comment:
       Agree, no uniqueness guaranteed. Turned dict into list.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] anton-vinogradov closed pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
anton-vinogradov closed pull request #8352:
URL: https://github.com/apache/ignite/pull/8352


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r504687214



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/ClockSyncCheckerApplication.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.smoke_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.util.typedef.T2;
+
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+
+/**
+ * Checks if clocks are synchronized between nodes.
+ */
+public class ClockSyncCheckerApplication extends IgniteAwareApplication {
+    /** */
+    private static final String TIMESTAMP_CACHE = "TimestampCache";
+
+    /** */
+    private static final String MAX_CLOCK_DIVERGENCY_MS_PARAM = "maxClockDivergencyMs";
+
+    /** */
+    private static final long WAIT_TIMEOUT_MS = 5000;
+
+    /**
+     * Client node sends requests to all servers by putting distributed cache entries.
+     * Receiver gets request through remote event filter and replies by writing with its local timestamp to cache.
+     * Client listens for replies with continuous query and checks the difference between clocks.
+     * <p>
+     * Cache event handler does not allow to modify entries being handled (even asynchronously),
+     * so request and reply have different keys, structured as 2-tuples:
+     * request = (targetNodeId, 0), reply = (targetNodeId, timestamp); values are not used.
+     * <p>
+     * Cache mode should be replicated in order to run remote listeners on all server nodes reliably.
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        long maxClockDivergencyMs = jsonNode.get(MAX_CLOCK_DIVERGENCY_MS_PARAM).asLong();
+
+        IgniteCache<T2<UUID, Long>, Optional<Void>> cache = ignite.getOrCreateCache(
+            new CacheConfiguration<T2<UUID, Long>, Optional<Void>>(TIMESTAMP_CACHE)
+                .setCacheMode(CacheMode.REPLICATED));
+
+        cache.clear();
+
+        markInitialized();
+
+        ignite.cluster().forServers().nodes().forEach(server ->

Review comment:
       Looks like over complicated. Ducktape provide SSH account. So we can just use it for getting local time without start of ignite at all.
   
   Actually is it possible to configure local time for an Ignite instance?

##########
File path: modules/ducktests/tests/ignitetest/tests/smoke_test.py
##########
@@ -87,3 +87,28 @@ def test_zk_start_stop(self):
         zookeeper = ZookeeperService(self.test_context, num_nodes=3)
         zookeeper.start()
         zookeeper.stop()
+
+    @cluster(num_nodes=4)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_clock_sync(self, ignite_version):

Review comment:
       It's not a smoke test of services. It checks that environment is configured correctly. So it's named as self tests. Actually there is a one test with the same goal - assertion_test. Let's rename it to smth like self_tests.py and move this test to the file.

##########
File path: modules/ducktests/tests/ignitetest/tests/smoke_test.py
##########
@@ -87,3 +87,28 @@ def test_zk_start_stop(self):
         zookeeper = ZookeeperService(self.test_context, num_nodes=3)
         zookeeper.start()
         zookeeper.stop()
+
+    @cluster(num_nodes=4)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_clock_sync(self, ignite_version):
+        """
+        Tests that clocks are synchronized between nodes.
+        """
+        num_nodes = 4

Review comment:
       Why do you check only 4 nodes. We should check that every node in a cluster is configured correctly.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] andrey-kuznetsov commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
andrey-kuznetsov commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510386822



##########
File path: modules/ducktests/tests/ignitetest/tests/smoke_test.py
##########
@@ -87,3 +87,28 @@ def test_zk_start_stop(self):
         zookeeper = ZookeeperService(self.test_context, num_nodes=3)
         zookeeper.start()
         zookeeper.stop()
+
+    @cluster(num_nodes=4)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_clock_sync(self, ignite_version):

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/tests/smoke_test.py
##########
@@ -87,3 +87,28 @@ def test_zk_start_stop(self):
         zookeeper = ZookeeperService(self.test_context, num_nodes=3)
         zookeeper.start()
         zookeeper.stop()
+
+    @cluster(num_nodes=4)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_clock_sync(self, ignite_version):
+        """
+        Tests that clocks are synchronized between nodes.
+        """
+        num_nodes = 4

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510861671



##########
File path: modules/ducktests/tests/ignitetest/tests/self_test.py
##########
@@ -53,3 +55,38 @@ def test_assertion_convertion(self, ignite_version):
         else:
             app.stop()
             assert False
+
+    def test_clock_sync(self):
+        """
+        Tests if clocks are synchronized between nodes.
+        """
+
+        service = GetTimeService(self.test_context, self.test_context.cluster.num_available_nodes())
+        service.start()
+
+        service.clocks.sort(key=operator.itemgetter(1))
+
+        for _ in service.clocks:
+            self.logger.info("NodeClock[%s] = %d" % (_[0], _[1]))
+
+        max_clock_spread_ms = 300
+        min_res = service.clocks[0]
+        max_res = service.clocks[-1]
+        assert max_res[1] - min_res[1] < max_clock_spread_ms, \
+            "Clock difference between %s and %s exceeds %d ms." % (min_res[0], max_res[0], max_clock_spread_ms)
+
+
+class GetTimeService(BackgroundThreadService):
+    """
+    Collects clock timestamps from a set of nodes.
+    """
+
+    def __init__(self, context, num_nodes):
+        super().__init__(context, num_nodes)
+        self.clocks = []
+
+    def start_node(self, node):
+        self.clocks.append((node.name, int(node.account.ssh_output("date +%s"))))

Review comment:
       `date +%s` returns seconds. But max_clock_spread_ms is milliseconds.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] andrey-kuznetsov commented on a change in pull request #8352: IGNITE-13448 Ducktests selftest: time is synchronized on nodes

Posted by GitBox <gi...@apache.org>.
andrey-kuznetsov commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510387555



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/ClockSyncCheckerApplication.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.smoke_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.util.typedef.T2;
+
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+
+/**
+ * Checks if clocks are synchronized between nodes.
+ */
+public class ClockSyncCheckerApplication extends IgniteAwareApplication {
+    /** */
+    private static final String TIMESTAMP_CACHE = "TimestampCache";
+
+    /** */
+    private static final String MAX_CLOCK_DIVERGENCY_MS_PARAM = "maxClockDivergencyMs";
+
+    /** */
+    private static final long WAIT_TIMEOUT_MS = 5000;
+
+    /**
+     * Client node sends requests to all servers by putting distributed cache entries.
+     * Receiver gets request through remote event filter and replies by writing with its local timestamp to cache.
+     * Client listens for replies with continuous query and checks the difference between clocks.
+     * <p>
+     * Cache event handler does not allow to modify entries being handled (even asynchronously),
+     * so request and reply have different keys, structured as 2-tuples:
+     * request = (targetNodeId, 0), reply = (targetNodeId, timestamp); values are not used.
+     * <p>
+     * Cache mode should be replicated in order to run remote listeners on all server nodes reliably.
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        long maxClockDivergencyMs = jsonNode.get(MAX_CLOCK_DIVERGENCY_MS_PARAM).asLong();
+
+        IgniteCache<T2<UUID, Long>, Optional<Void>> cache = ignite.getOrCreateCache(
+            new CacheConfiguration<T2<UUID, Long>, Optional<Void>>(TIMESTAMP_CACHE)
+                .setCacheMode(CacheMode.REPLICATED));
+
+        cache.clear();
+
+        markInitialized();
+
+        ignite.cluster().forServers().nodes().forEach(server ->

Review comment:
       > Actually is it possible to configure local time for an Ignite instance?
   Nope.
   
   The rest is rewritten without the use of Ignite.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org