HDFS-8640. Make reserved RBW space visible through JMX. (Contributed by kanaka kumar avvaru)
This commit is contained in:
parent
bc433908d3
commit
67a62da5c5
|
@ -669,6 +669,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HDFS-8462. Implement GETXATTRS and LISTXATTRS operations for WebImageViewer.
|
||||
(Jagadesh Kiran N via aajisaka)
|
||||
|
||||
HDFS-8640. Make reserved RBW space visible through JMX. (kanaka kumar
|
||||
avvaru via Arpit Agarwal)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
||||
|
|
|
@ -2559,13 +2559,15 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
final String directory;
|
||||
final long usedSpace; // size of space used by HDFS
|
||||
final long freeSpace; // size of free space excluding reserved space
|
||||
final long reservedSpace; // size of space reserved for non-HDFS and RBW
|
||||
final long reservedSpace; // size of space reserved for non-HDFS
|
||||
final long reservedSpaceForRBW; // size of space reserved RBW
|
||||
|
||||
VolumeInfo(FsVolumeImpl v, long usedSpace, long freeSpace) {
|
||||
this.directory = v.toString();
|
||||
this.usedSpace = usedSpace;
|
||||
this.freeSpace = freeSpace;
|
||||
this.reservedSpace = v.getReserved();
|
||||
this.reservedSpaceForRBW = v.getReservedForRbw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2599,6 +2601,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
innerInfo.put("usedSpace", v.usedSpace);
|
||||
innerInfo.put("freeSpace", v.freeSpace);
|
||||
innerInfo.put("reservedSpace", v.reservedSpace);
|
||||
innerInfo.put("reservedSpaceForRBW", v.reservedSpaceForRBW);
|
||||
info.put(v.directory, innerInfo);
|
||||
}
|
||||
return info;
|
||||
|
|
|
@ -49,11 +49,15 @@ import org.mockito.Mockito;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
/**
|
||||
* Ensure that the DN reserves disk space equivalent to a full block for
|
||||
* replica being written (RBW).
|
||||
|
@ -324,6 +328,30 @@ public class TestRbwSpaceReservation {
|
|||
fsVolumeImpl.getReservedForRbw() == 0);
|
||||
}
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testRBWInJMXBean() throws Exception {
|
||||
|
||||
final short replication = 1;
|
||||
startCluster(BLOCK_SIZE, replication, -1);
|
||||
|
||||
final String methodName = GenericTestUtils.getMethodName();
|
||||
final Path file = new Path("/" + methodName + ".01.dat");
|
||||
|
||||
try (FSDataOutputStream os = fs.create(file, replication)) {
|
||||
// Write 1 byte to the file
|
||||
os.write(new byte[1]);
|
||||
os.hsync();
|
||||
|
||||
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
|
||||
final ObjectName mxbeanName = new ObjectName(
|
||||
"Hadoop:service=DataNode,name=DataNodeInfo");
|
||||
final String volumeInfo = (String) mbs.getAttribute(mxbeanName,
|
||||
"VolumeInfo");
|
||||
|
||||
assertTrue(volumeInfo.contains("reservedSpaceForRBW"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stress test to ensure we are not leaking reserved space.
|
||||
* @throws IOException
|
||||
|
|
Loading…
Reference in New Issue