Repository: ignite Updated Branches: refs/heads/ignite-1537 01466aa11 -> 7661cc9e8
ignite-1.5 Fixed test. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7661cc9e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7661cc9e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7661cc9e Branch: refs/heads/ignite-1537 Commit: 7661cc9e878dd03ff42424bc6da03b701405d4ce Parents: 01466aa Author: sboikov <[email protected]> Authored: Thu Dec 24 14:21:31 2015 +0300 Committer: sboikov <[email protected]> Committed: Thu Dec 24 14:21:31 2015 +0300 ---------------------------------------------------------------------- .../internal/util/nio/GridNioRecoveryDescriptor.java | 7 ------- .../spi/communication/tcp/TcpCommunicationSpi.java | 12 ++++++------ .../GridTcpCommunicationSpiRecoveryAckSelfTest.java | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7661cc9e/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java index 5647239..429f990 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java @@ -134,13 +134,6 @@ public class GridNioRecoveryDescriptor { } /** - * @return Received messages count. - */ - public long receivedCount() { - return rcvCnt; - } - - /** * @return Maximum size of unacknowledged messages queue. */ public int queueLimit() { http://git-wip-us.apache.org/repos/asf/ignite/blob/7661cc9e/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index bf6e869..6cdfe9a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -620,7 +620,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter nioSrvr.resend(ses); if (sndRes) - nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recovery.receivedCount())); + nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recovery.received())); recovery.connected(); @@ -714,7 +714,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter } }; - nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recoveryDesc.receivedCount()), lsnr); + nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recoveryDesc.received()), lsnr); } else { try { @@ -2587,16 +2587,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter else ch.write(ByteBuffer.wrap(U.IGNITE_HEADER)); - ClusterNode localNode = getLocalNode(); + ClusterNode locNode = getLocalNode(); - if (localNode == null) + if (locNode == null) throw new IgniteCheckedException("Local node has not been started or " + "fully initialized [isStopping=" + getSpiContext().isStopping() + ']'); if (recovery != null) { - HandshakeMessage msg = new HandshakeMessage(localNode.id(), + HandshakeMessage msg = new HandshakeMessage(locNode.id(), recovery.incrementConnectCount(), - recovery.receivedCount()); + recovery.received()); if (log.isDebugEnabled()) log.debug("Write handshake message [rmtNode=" + rmtNodeId + ", msg=" + msg + ']'); http://git-wip-us.apache.org/repos/asf/ignite/blob/7661cc9e/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java index 9e78fb9..d07a1e6 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java @@ -149,6 +149,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS int expMsgs = 0; + long totAcked = 0; + for (int i = 0; i < 5; i++) { info("Iteration: " + i); @@ -160,6 +162,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS expMsgs += msgPerIter; + final long totAcked0 = totAcked; + for (TcpCommunicationSpi spi : spis) { GridNioServer srv = U.field(spi, "nioSrvr"); @@ -177,6 +181,14 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { + long acked = GridTestUtils.getFieldValue(recoveryDesc, "acked"); + + return acked > totAcked0; + } + }, 5000); + + GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { return recoveryDesc.messagesFutures().isEmpty(); } }, 10_000); @@ -204,6 +216,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS assertEquals(expMsgs, lsnr.rcvCnt.get()); } + + totAcked += msgPerIter; } } finally {
