|
@@ -25,10 +25,6 @@ import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeStat;
|
|
|
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
|
|
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
|
|
|
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
|
|
-import org.apache.hadoop.hdds.protocol.proto
|
|
|
- .StorageContainerDatanodeProtocolProtos.ReportState;
|
|
|
-import org.apache.hadoop.hdds.protocol.proto
|
|
|
- .StorageContainerDatanodeProtocolProtos.SCMNodeReport;
|
|
|
import org.apache.hadoop.hdds.protocol.proto
|
|
|
.StorageContainerDatanodeProtocolProtos.SCMStorageReport;
|
|
|
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
|
@@ -82,10 +78,6 @@ public class TestNodeManager {
|
|
|
|
|
|
private File testDir;
|
|
|
|
|
|
- private ReportState reportState = ReportState.newBuilder()
|
|
|
- .setState(ReportState.states.noContainerReports)
|
|
|
- .setCount(0).build();
|
|
|
-
|
|
|
@Rule
|
|
|
public ExpectedException thrown = ExpectedException.none();
|
|
|
|
|
@@ -153,7 +145,7 @@ public class TestNodeManager {
|
|
|
DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
|
|
|
nodeManager);
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
}
|
|
|
|
|
|
// Wait for 4 seconds max.
|
|
@@ -200,8 +192,7 @@ public class TestNodeManager {
|
|
|
// Need 100 nodes to come out of chill mode, only one node is sending HB.
|
|
|
nodeManager.setMinimumChillModeNodes(100);
|
|
|
nodeManager.sendHeartbeat(TestUtils.getDatanodeDetails(nodeManager)
|
|
|
- .getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ .getProtoBufMessage(), null);
|
|
|
GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
|
|
|
100, 4 * 1000);
|
|
|
assertFalse("Not enough heartbeat, Node manager should have" +
|
|
@@ -229,7 +220,7 @@ public class TestNodeManager {
|
|
|
// Send 10 heartbeat from same node, and assert we never leave chill mode.
|
|
|
for (int x = 0; x < 10; x++) {
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
}
|
|
|
|
|
|
GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
|
|
@@ -260,7 +251,7 @@ public class TestNodeManager {
|
|
|
|
|
|
// These should never be processed.
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
|
|
|
// Let us just wait for 2 seconds to prove that HBs are not processed.
|
|
|
Thread.sleep(2 * 1000);
|
|
@@ -289,8 +280,7 @@ public class TestNodeManager {
|
|
|
nodemanager.register(datanodeDetails.getProtoBufMessage(),
|
|
|
TestUtils.createNodeReport(reports));
|
|
|
List<SCMCommand> command = nodemanager.sendHeartbeat(
|
|
|
- datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ datanodeDetails.getProtoBufMessage(), null);
|
|
|
Assert.assertTrue(nodemanager.getAllNodes().contains(datanodeDetails));
|
|
|
Assert.assertTrue("On regular HB calls, SCM responses a "
|
|
|
+ "datanode with an empty command list", command.isEmpty());
|
|
@@ -309,7 +299,7 @@ public class TestNodeManager {
|
|
|
@Override public Boolean get() {
|
|
|
List<SCMCommand> command =
|
|
|
nodemanager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
return command.size() == 1 && command.get(0).getType()
|
|
|
.equals(SCMCmdType.reregisterCommand);
|
|
|
}
|
|
@@ -341,7 +331,7 @@ public class TestNodeManager {
|
|
|
DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
|
|
|
nodeManager);
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
}
|
|
|
GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
|
|
|
100, 4 * 1000);
|
|
@@ -433,18 +423,18 @@ public class TestNodeManager {
|
|
|
|
|
|
// Heartbeat once
|
|
|
nodeManager.sendHeartbeat(staleNode.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
|
|
|
// Heartbeat all other nodes.
|
|
|
for (DatanodeDetails dn : nodeList) {
|
|
|
- nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null, reportState);
|
|
|
+ nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null);
|
|
|
}
|
|
|
|
|
|
// Wait for 2 seconds .. and heartbeat good nodes again.
|
|
|
Thread.sleep(2 * 1000);
|
|
|
|
|
|
for (DatanodeDetails dn : nodeList) {
|
|
|
- nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null, reportState);
|
|
|
+ nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null);
|
|
|
}
|
|
|
|
|
|
// Wait for 2 seconds, wait a total of 4 seconds to make sure that the
|
|
@@ -461,7 +451,7 @@ public class TestNodeManager {
|
|
|
|
|
|
// heartbeat good nodes again.
|
|
|
for (DatanodeDetails dn : nodeList) {
|
|
|
- nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null, reportState);
|
|
|
+ nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null);
|
|
|
}
|
|
|
|
|
|
// 6 seconds is the dead window for this test , so we wait a total of
|
|
@@ -497,7 +487,7 @@ public class TestNodeManager {
|
|
|
public void testScmCheckForErrorOnNullDatanodeDetails() throws IOException,
|
|
|
InterruptedException, TimeoutException {
|
|
|
try (SCMNodeManager nodeManager = createNodeManager(getConf())) {
|
|
|
- nodeManager.sendHeartbeat(null, null, reportState);
|
|
|
+ nodeManager.sendHeartbeat(null, null);
|
|
|
} catch (NullPointerException npe) {
|
|
|
GenericTestUtils.assertExceptionContains("Heartbeat is missing " +
|
|
|
"DatanodeDetails.", npe);
|
|
@@ -575,11 +565,11 @@ public class TestNodeManager {
|
|
|
DatanodeDetails deadNode =
|
|
|
TestUtils.getDatanodeDetails(nodeManager);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- staleNode.getProtoBufMessage(), null, reportState);
|
|
|
+ staleNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- deadNode.getProtoBufMessage(), null, reportState);
|
|
|
+ deadNode.getProtoBufMessage(), null);
|
|
|
|
|
|
// Sleep so that heartbeat processing thread gets to run.
|
|
|
Thread.sleep(500);
|
|
@@ -606,15 +596,15 @@ public class TestNodeManager {
|
|
|
*/
|
|
|
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- staleNode.getProtoBufMessage(), null, reportState);
|
|
|
+ staleNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- deadNode.getProtoBufMessage(), null, reportState);
|
|
|
+ deadNode.getProtoBufMessage(), null);
|
|
|
|
|
|
Thread.sleep(1500);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
Thread.sleep(2 * 1000);
|
|
|
assertEquals(1, nodeManager.getNodeCount(HEALTHY));
|
|
|
|
|
@@ -635,12 +625,12 @@ public class TestNodeManager {
|
|
|
*/
|
|
|
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- staleNode.getProtoBufMessage(), null, reportState);
|
|
|
+ staleNode.getProtoBufMessage(), null);
|
|
|
Thread.sleep(1500);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
Thread.sleep(2 * 1000);
|
|
|
|
|
|
// 3.5 seconds have elapsed for stale node, so it moves into Stale.
|
|
@@ -674,11 +664,11 @@ public class TestNodeManager {
|
|
|
* back all the nodes in healthy state.
|
|
|
*/
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- healthyNode.getProtoBufMessage(), null, reportState);
|
|
|
+ healthyNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- staleNode.getProtoBufMessage(), null, reportState);
|
|
|
+ staleNode.getProtoBufMessage(), null);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- deadNode.getProtoBufMessage(), null, reportState);
|
|
|
+ deadNode.getProtoBufMessage(), null);
|
|
|
Thread.sleep(500);
|
|
|
//Assert all nodes are healthy.
|
|
|
assertEquals(3, nodeManager.getAllNodes().size());
|
|
@@ -699,7 +689,7 @@ public class TestNodeManager {
|
|
|
int sleepDuration) throws InterruptedException {
|
|
|
while (!Thread.currentThread().isInterrupted()) {
|
|
|
for (DatanodeDetails dn : list) {
|
|
|
- manager.sendHeartbeat(dn.getProtoBufMessage(), null, reportState);
|
|
|
+ manager.sendHeartbeat(dn.getProtoBufMessage(), null);
|
|
|
}
|
|
|
Thread.sleep(sleepDuration);
|
|
|
}
|
|
@@ -785,7 +775,7 @@ public class TestNodeManager {
|
|
|
// No Thread just one time HBs the node manager, so that these will be
|
|
|
// marked as dead nodes eventually.
|
|
|
for (DatanodeDetails dn : deadNodeList) {
|
|
|
- nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null, reportState);
|
|
|
+ nodeManager.sendHeartbeat(dn.getProtoBufMessage(), null);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -950,7 +940,7 @@ public class TestNodeManager {
|
|
|
DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
|
|
|
nodeManager);
|
|
|
nodeManager.sendHeartbeat(
|
|
|
- datanodeDetails.getProtoBufMessage(), null, reportState);
|
|
|
+ datanodeDetails.getProtoBufMessage(), null);
|
|
|
String status = nodeManager.getChillModeStatus();
|
|
|
Assert.assertThat(status, containsString("Still in chill " +
|
|
|
"mode, waiting on nodes to report in."));
|
|
@@ -978,7 +968,7 @@ public class TestNodeManager {
|
|
|
for (int x = 0; x < 20; x++) {
|
|
|
DatanodeDetails datanode = TestUtils.getDatanodeDetails(nodeManager);
|
|
|
nodeManager.sendHeartbeat(datanode.getProtoBufMessage(),
|
|
|
- null, reportState);
|
|
|
+ null);
|
|
|
}
|
|
|
|
|
|
Thread.sleep(500);
|
|
@@ -1023,7 +1013,7 @@ public class TestNodeManager {
|
|
|
.createStorageReport(capacity, used, free, storagePath,
|
|
|
null, dnId, 1);
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- TestUtils.createNodeReport(reports), reportState);
|
|
|
+ TestUtils.createNodeReport(reports));
|
|
|
}
|
|
|
GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
|
|
|
100, 4 * 1000);
|
|
@@ -1073,7 +1063,7 @@ public class TestNodeManager {
|
|
|
null, dnId, 1);
|
|
|
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- TestUtils.createNodeReport(reports), reportState);
|
|
|
+ TestUtils.createNodeReport(reports));
|
|
|
Thread.sleep(100);
|
|
|
}
|
|
|
|
|
@@ -1154,7 +1144,7 @@ public class TestNodeManager {
|
|
|
.createStorageReport(capacity, expectedScmUsed, expectedRemaining,
|
|
|
storagePath, null, dnId, 1);
|
|
|
nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
|
|
|
- TestUtils.createNodeReport(reports), reportState);
|
|
|
+ TestUtils.createNodeReport(reports));
|
|
|
|
|
|
// Wait up to 5 seconds so that the dead node becomes healthy
|
|
|
// Verify usage info should be updated.
|