From 6cdf8db55ca42ab11cfb21081934e20976f91f12 Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Mon, 4 Mar 2019 13:57:48 -0800 Subject: [PATCH] HDFS-14331. RBF: IOE While Removing Mount Entry. Contributed by Ayush Saxena. --- .../server/federation/router/RouterAdminServer.java | 11 +++++++++-- .../server/federation/router/TestRouterQuota.java | 7 +++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterAdminServer.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterAdminServer.java index a2a5a4239f7..97d4d162add 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterAdminServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterAdminServer.java @@ -303,8 +303,15 @@ public class RouterAdminServer extends AbstractService public RemoveMountTableEntryResponse removeMountTableEntry( RemoveMountTableEntryRequest request) throws IOException { // clear sub-cluster's quota definition - synchronizeQuota(request.getSrcPath(), HdfsConstants.QUOTA_RESET, - HdfsConstants.QUOTA_RESET); + try { + synchronizeQuota(request.getSrcPath(), HdfsConstants.QUOTA_RESET, + HdfsConstants.QUOTA_RESET); + } catch (Exception e) { + // Ignore exception, if any while reseting quota. Specifically to handle + // if the actual destination doesn't exist. + LOG.warn("Unable to clear quota at the destinations for {}: {}", + request.getSrcPath(), e.getMessage()); + } return getMountTableStore().removeMountTableEntry(request); } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java index 034023c47aa..abcbe8fdbdc 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java @@ -20,6 +20,7 @@ package org.apache.hadoop.hdfs.server.federation.router; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; @@ -754,6 +755,12 @@ public class TestRouterQuota { assertNull(routerQuota); assertEquals(HdfsConstants.QUOTA_RESET, subClusterQuota.getQuota()); assertEquals(HdfsConstants.QUOTA_RESET, subClusterQuota.getSpaceQuota()); + + // Verify removing mount entry with actual destinations not present. + mountTable = MountTable.newInstance("/mount", + Collections.singletonMap("ns0", "/testdir16")); + addMountTable(mountTable); + assertTrue(removeMountTable("/mount")); } @Test