|
@@ -72,7 +72,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.Path;
|
|
-import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException;
|
|
|
|
import org.apache.hadoop.hdfs.HAUtil;
|
|
import org.apache.hadoop.hdfs.HAUtil;
|
|
import org.apache.hadoop.hdfs.protocol.UnresolvedPathException;
|
|
import org.apache.hadoop.hdfs.protocol.UnresolvedPathException;
|
|
import org.apache.hadoop.hdfs.protocolPB.AsyncRpcProtocolPBUtil;
|
|
import org.apache.hadoop.hdfs.protocolPB.AsyncRpcProtocolPBUtil;
|
|
@@ -398,8 +397,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
NotReplicatedYetException.class,
|
|
NotReplicatedYetException.class,
|
|
IOException.class,
|
|
IOException.class,
|
|
ConnectException.class,
|
|
ConnectException.class,
|
|
- RetriableException.class,
|
|
|
|
- PathIsNotEmptyDirectoryException.class);
|
|
|
|
|
|
+ RetriableException.class);
|
|
|
|
|
|
this.rpcServer.addSuppressedLoggingExceptions(
|
|
this.rpcServer.addSuppressedLoggingExceptions(
|
|
StandbyException.class, UnresolvedPathException.class);
|
|
StandbyException.class, UnresolvedPathException.class);
|
|
@@ -464,7 +462,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
/**
|
|
/**
|
|
* Init router async handlers and router async responders.
|
|
* Init router async handlers and router async responders.
|
|
*/
|
|
*/
|
|
- protected void initAsyncThreadPool() {
|
|
|
|
|
|
+ public void initAsyncThreadPool() {
|
|
int asyncHandlerCount = conf.getInt(DFS_ROUTER_RPC_ASYNC_HANDLER_COUNT,
|
|
int asyncHandlerCount = conf.getInt(DFS_ROUTER_RPC_ASYNC_HANDLER_COUNT,
|
|
DFS_ROUTER_RPC_ASYNC_HANDLER_COUNT_DEFAULT);
|
|
DFS_ROUTER_RPC_ASYNC_HANDLER_COUNT_DEFAULT);
|
|
int asyncResponderCount = conf.getInt(DFS_ROUTER_RPC_ASYNC_RESPONDER_COUNT,
|
|
int asyncResponderCount = conf.getInt(DFS_ROUTER_RPC_ASYNC_RESPONDER_COUNT,
|
|
@@ -607,7 +605,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* @return routerStateIdContext
|
|
* @return routerStateIdContext
|
|
*/
|
|
*/
|
|
@VisibleForTesting
|
|
@VisibleForTesting
|
|
- protected RouterStateIdContext getRouterStateIdContext() {
|
|
|
|
|
|
+ public RouterStateIdContext getRouterStateIdContext() {
|
|
return routerStateIdContext;
|
|
return routerStateIdContext;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -710,7 +708,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* @throws StandbyException If the Router is in safe mode and cannot serve
|
|
* @throws StandbyException If the Router is in safe mode and cannot serve
|
|
* client requests.
|
|
* client requests.
|
|
*/
|
|
*/
|
|
- void checkOperation(OperationCategory op)
|
|
|
|
|
|
+ public void checkOperation(OperationCategory op)
|
|
throws StandbyException {
|
|
throws StandbyException {
|
|
// Log the function we are currently calling.
|
|
// Log the function we are currently calling.
|
|
if (rpcMonitor != null) {
|
|
if (rpcMonitor != null) {
|
|
@@ -776,8 +774,9 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* If the namespace is unavailable, retry with other namespaces.
|
|
* If the namespace is unavailable, retry with other namespaces.
|
|
* @param <T> expected return type.
|
|
* @param <T> expected return type.
|
|
* @param method the remote method.
|
|
* @param method the remote method.
|
|
|
|
+ * @param clazz the type of return value.
|
|
* @return the response received after invoking method.
|
|
* @return the response received after invoking method.
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @throws IOException if there is no namespace available or other ioExceptions.
|
|
*/
|
|
*/
|
|
<T> T invokeAtAvailableNs(RemoteMethod method, Class<T> clazz)
|
|
<T> T invokeAtAvailableNs(RemoteMethod method, Class<T> clazz)
|
|
throws IOException {
|
|
throws IOException {
|
|
@@ -810,10 +809,11 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* Asynchronous version of invokeAtAvailableNs method.
|
|
* Asynchronous version of invokeAtAvailableNs method.
|
|
* @param <T> expected return type.
|
|
* @param <T> expected return type.
|
|
* @param method the remote method.
|
|
* @param method the remote method.
|
|
|
|
+ * @param clazz the type of return value.
|
|
* @return the response received after invoking method.
|
|
* @return the response received after invoking method.
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @throws IOException if there is no namespace available or other ioExceptions.
|
|
*/
|
|
*/
|
|
- <T> T invokeAtAvailableNsAsync(RemoteMethod method, Class<T> clazz)
|
|
|
|
|
|
+ public <T> T invokeAtAvailableNsAsync(RemoteMethod method, Class<T> clazz)
|
|
throws IOException {
|
|
throws IOException {
|
|
String nsId = subclusterResolver.getDefaultNamespace();
|
|
String nsId = subclusterResolver.getDefaultNamespace();
|
|
// If default Ns is not present return result from first namespace.
|
|
// If default Ns is not present return result from first namespace.
|
|
@@ -851,7 +851,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* @param ioe IOException .
|
|
* @param ioe IOException .
|
|
* @param nss List of name spaces in the federation
|
|
* @param nss List of name spaces in the federation
|
|
* @return the response received after invoking method.
|
|
* @return the response received after invoking method.
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @throws IOException if there is no namespace available or other ioExceptions.
|
|
*/
|
|
*/
|
|
<T> T invokeOnNs(RemoteMethod method, Class<T> clazz, IOException ioe,
|
|
<T> T invokeOnNs(RemoteMethod method, Class<T> clazz, IOException ioe,
|
|
Set<FederationNamespaceInfo> nss) throws IOException {
|
|
Set<FederationNamespaceInfo> nss) throws IOException {
|
|
@@ -885,7 +885,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* @param ioe IOException .
|
|
* @param ioe IOException .
|
|
* @param nss List of name spaces in the federation
|
|
* @param nss List of name spaces in the federation
|
|
* @return the response received after invoking method.
|
|
* @return the response received after invoking method.
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @throws IOException if there is no namespace available or other ioExceptions.
|
|
*/
|
|
*/
|
|
<T> T invokeOnNsAsync(RemoteMethod method, Class<T> clazz, IOException ioe,
|
|
<T> T invokeOnNsAsync(RemoteMethod method, Class<T> clazz, IOException ioe,
|
|
Set<FederationNamespaceInfo> nss) throws IOException {
|
|
Set<FederationNamespaceInfo> nss) throws IOException {
|
|
@@ -2131,7 +2131,7 @@ public class RouterRpcServer extends AbstractService implements ClientProtocol,
|
|
* @param clazz Class of the values.
|
|
* @param clazz Class of the values.
|
|
* @return Array with the outputs.
|
|
* @return Array with the outputs.
|
|
*/
|
|
*/
|
|
- static <T> T[] merge(
|
|
|
|
|
|
+ public static <T> T[] merge(
|
|
Map<FederationNamespaceInfo, T[]> map, Class<T> clazz) {
|
|
Map<FederationNamespaceInfo, T[]> map, Class<T> clazz) {
|
|
|
|
|
|
// Put all results into a set to avoid repeats
|
|
// Put all results into a set to avoid repeats
|