secfree created HDFS-16406:
------------------------------

             Summary: DataNode metric ReadsFromLocalClient does not count 
short-circuit reads
                 Key: HDFS-16406
                 URL: https://issues.apache.org/jira/browse/HDFS-16406
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: secfree
            Assignee: secfree


The following test case failed. 

{code}
  @Test
  public void testNodeLocalMetrics() throws Exception {
    Assume.assumeTrue(null == DomainSocket.getLoadingFailureReason());
    Configuration conf = new HdfsConfiguration();
    conf.setBoolean(HdfsClientConfigKeys.Read.ShortCircuit.KEY, true);
    TemporarySocketDirectory sockDir = new TemporarySocketDirectory();
    DomainSocket.disableBindPathValidation();
    conf.set(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
        new File(sockDir.getDir(),
            "testNodeLocalMetrics._PORT.sock").getAbsolutePath());
    MiniDFSCluster cluster = new 
MiniDFSCluster.Builder(conf).numDataNodes(1).build();
    try {
      cluster.waitActive();
      FileSystem fs = cluster.getFileSystem();
      Path testFile = new Path("/testNodeLocalMetrics.txt");
      long file_len = 10;
      DFSTestUtil.createFile(fs, testFile, file_len, (short)1, 1L);
      DFSTestUtil.readFile(fs, testFile);
      List<DataNode> datanodes = cluster.getDataNodes();
      assertEquals(datanodes.size(), 1);
      DataNode datanode = datanodes.get(0);
      MetricsRecordBuilder rb = getMetrics(datanode.getMetrics().name());

      // Write related metrics
      assertCounter("WritesFromLocalClient", 1L, rb);
      // Read related metrics
      assertCounter("ReadsFromLocalClient", 1L, rb); // failed here
    } finally {
      if (cluster != null) {
        cluster.shutdown();
      }
    }
  }
{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to