Search in sources :

Example 16 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testCustomScript.

/**
     * @throws Exception If failed.
     */
public void testCustomScript() throws Exception {
    joinedLatch = new CountDownLatch(1);
    String script = U.isWindows() ? CUSTOM_SCRIPT_WIN : CUSTOM_SCRIPT_LINUX;
    script = Paths.get(U.getIgniteHome()).relativize(U.resolveIgnitePath(script).toPath()).toString();
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), null, script), null, false, 0, 16);
    assert res.size() == 1;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert joinedCnt.get() == 1;
    assert leftCnt.get() == 0;
    assert ignite.cluster().nodes().size() == 1;
    assert CUSTOM_CFG_ATTR_VAL.equals(F.first(ignite.cluster().nodes()).<String>attribute(CUSTOM_CFG_ATTR_KEY));
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 17 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testRestartNodesByIdsC.

/**
     * @throws Exception If failed.
     */
public void testRestartNodesByIdsC() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    joinedLatch = new CountDownLatch(2);
    leftLatch = new CountDownLatch(2);
    Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
    ignite.cluster().restartNodes(F.asList(it.next().id(), it.next().id()));
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 18 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodes.

/**
     * @throws Exception If failed.
     */
public void testStopNodes() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    leftLatch = new CountDownLatch(3);
    ignite.cluster().stopNodes();
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().isEmpty();
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 19 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodesByIdsC.

/**
     * @throws Exception If failed.
     */
public void testStopNodesByIdsC() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    leftLatch = new CountDownLatch(2);
    Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
    ignite.cluster().stopNodes(F.asList(it.next().id(), it.next().id()));
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 1;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 20 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testRestartNodeById.

/**
     * @throws Exception If failed.
     */
public void testRestartNodeById() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    joinedLatch = new CountDownLatch(1);
    leftLatch = new CountDownLatch(1);
    ignite.cluster().restartNodes(Collections.singleton(F.first(ignite.cluster().forRemotes().nodes()).id()));
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Aggregations

ClusterStartNodeResult (org.apache.ignite.cluster.ClusterStartNodeResult)20 CountDownLatch (java.util.concurrent.CountDownLatch)18 IgniteException (org.apache.ignite.IgniteException)18 ClusterNode (org.apache.ignite.cluster.ClusterNode)7 UUID (java.util.UUID)3 StartNodeCallable (org.apache.ignite.internal.util.nodestart.StartNodeCallable)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 ClusterGroupEmptyException (org.apache.ignite.cluster.ClusterGroupEmptyException)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 GridCompoundFuture (org.apache.ignite.internal.util.future.GridCompoundFuture)1 IgniteRemoteStartSpecification (org.apache.ignite.internal.util.nodestart.IgniteRemoteStartSpecification)1 IgniteSshHelper (org.apache.ignite.internal.util.nodestart.IgniteSshHelper)1