HDFS-7215.Add JvmPauseMonitor to NFS gateway. Contributed by Brandon Li

(cherry picked from commit 4e134a02a4b6f30704b99dfb166dc361daf426ea)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
This commit is contained in:
Brandon Li 2014-10-21 11:49:10 -07:00
parent 33e020cb19
commit c800e058ea
5 changed files with 27 additions and 5 deletions

View File

@ -50,7 +50,7 @@ public void start(boolean register) {
startTCPServer(); // Start TCP server startTCPServer(); // Start TCP server
if (register) { if (register) {
ShutdownHookManager.get().addShutdownHook(new Unregister(), ShutdownHookManager.get().addShutdownHook(new NfsShutdownHook(),
SHUTDOWN_HOOK_PRIORITY); SHUTDOWN_HOOK_PRIORITY);
try { try {
rpcProgram.register(PortmapMapping.TRANSPORT_TCP, nfsBoundPort); rpcProgram.register(PortmapMapping.TRANSPORT_TCP, nfsBoundPort);
@ -74,10 +74,11 @@ private void startTCPServer() {
*/ */
public static final int SHUTDOWN_HOOK_PRIORITY = 10; public static final int SHUTDOWN_HOOK_PRIORITY = 10;
private class Unregister implements Runnable { private class NfsShutdownHook implements Runnable {
@Override @Override
public synchronized void run() { public synchronized void run() {
rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, nfsBoundPort); rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, nfsBoundPort);
rpcProgram.stopDaemons();
} }
} }
} }

View File

@ -136,8 +136,9 @@ protected void register(PortmapMapping mapEntry, boolean set) {
} }
} }
// Start extra daemons // Start extra daemons or services
public void startDaemons() {} public void startDaemons() {}
public void stopDaemons() {}
@Override @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)

View File

@ -126,6 +126,7 @@
import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.AuthorizationException; import org.apache.hadoop.security.authorize.AuthorizationException;
import org.apache.hadoop.util.JvmPauseMonitor;
import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.Channel;
@ -158,6 +159,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
private String writeDumpDir; // The dir save dump files private String writeDumpDir; // The dir save dump files
private final RpcCallCache rpcCallCache; private final RpcCallCache rpcCallCache;
private JvmPauseMonitor pauseMonitor;
public RpcProgramNfs3(NfsConfiguration config, DatagramSocket registrationSocket, public RpcProgramNfs3(NfsConfiguration config, DatagramSocket registrationSocket,
boolean allowInsecurePorts) throws IOException { boolean allowInsecurePorts) throws IOException {
@ -219,7 +221,21 @@ private void clearDirectory(String writeDumpDir) throws IOException {
@Override @Override
public void startDaemons() { public void startDaemons() {
writeManager.startAsyncDataSerivce(); if (pauseMonitor == null) {
pauseMonitor = new JvmPauseMonitor(config);
pauseMonitor.start();
}
writeManager.startAsyncDataSerivce();
}
@Override
public void stopDaemons() {
if (writeManager != null) {
writeManager.shutdownAsyncDataService();
}
if (pauseMonitor != null) {
pauseMonitor.stop();
}
} }
// Checks the type of IOException and maps it to appropriate Nfs3Status code. // Checks the type of IOException and maps it to appropriate Nfs3Status code.

View File

@ -627,6 +627,8 @@ Release 2.6.0 - UNRELEASED
HDFS-7259. Unresponseive NFS mount point due to deferred COMMIT response. HDFS-7259. Unresponseive NFS mount point due to deferred COMMIT response.
(brandonli) (brandonli)
HDFS-7215.Add JvmPauseMonitor to NFS gateway (brandonli)
BREAKDOWN OF HDFS-6581 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-6581 SUBTASKS AND RELATED JIRAS
HDFS-6921. Add LazyPersist flag to FileStatus. (Arpit Agarwal) HDFS-6921. Add LazyPersist flag to FileStatus. (Arpit Agarwal)

View File

@ -171,7 +171,9 @@ HDFS NFS Gateway
</property> </property>
---- ----
* Customize log settings. To get NFS debug trace, users can edit the log4j.property file * JVM and log settings. You can export JVM settings (e.g., heap size and GC log) in
HADOOP_NFS3_OPTS. More NFS related settings can be found in hadoop-env.sh.
To get NFS debug trace, you can edit the log4j.property file
to add the following. Note, debug trace, especially for ONCRPC, can be very verbose. to add the following. Note, debug trace, especially for ONCRPC, can be very verbose.
To change logging level: To change logging level: