fix review comments
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/06af8fcd Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/06af8fcd Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/06af8fcd Branch: refs/heads/master Commit: 06af8fcdcdf1ba098baf734865c4835bf692d083 Parents: fcc9325 Author: Liu Ming <[email protected]> Authored: Fri Apr 27 01:59:07 2018 -0400 Committer: Liu Ming <[email protected]> Committed: Fri Apr 27 01:59:07 2018 -0400 ---------------------------------------------------------------------- .../java/org/trafodion/sql/HBaseClient.java | 31 ++++++++------------ 1 file changed, 13 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/06af8fcd/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java ---------------------------------------------------------------------- diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java index 94517bf..2cdfa49 100644 --- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java +++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java @@ -580,6 +580,7 @@ public class HBaseClient { } if(setDescRet!= null) + { if(setDescRet.storagePolicyChanged()) { //change the HDFS storage policy @@ -611,23 +612,19 @@ public class HBaseClient { if (logger.isDebugEnabled()) logger.debug("createk table fullPath is " + fullPath); - String invokeret = invokeSetStoragePolicy(fs, fullPath, setDescRet.storagePolicy_ ) ; + admin.close(); //close here, invokeSetStoragePolicy may throw exception - if( invokeret != null) - { - //error handling - admin.close(); - throw new IOException(invokeret); - } + invokeSetStoragePolicy(fs, fullPath, setDescRet.storagePolicy_ ) ; } - - admin.close(); + } + else + admin.close(); return true; } - private static String invokeSetStoragePolicy(final FileSystem fs, final String pathstr, - final String storagePolicy) { - String ret = null; + private static void invokeSetStoragePolicy(final FileSystem fs, final String pathstr, + final String storagePolicy) + throws IOException { Path path = new Path(pathstr); Method m = null; try { @@ -635,11 +632,11 @@ public class HBaseClient { new Class<?>[] { Path.class, String.class }); m.setAccessible(true); } catch (NoSuchMethodException e) { - ret = "FileSystem doesn't support setStoragePolicy"; m = null; + throw new IOException("FileSystem doesn't support setStoragePolicy"); } catch (SecurityException e) { - ret = "No access to setStoragePolicy on FileSystem from the SecurityManager"; - m = null; // could happen on setAccessible() or getDeclaredMethod() + m = null; + throw new IOException("No access to setStoragePolicy on FileSystem from the SecurityManager"); } if (m != null) { try { @@ -649,11 +646,9 @@ public class HBaseClient { } } catch (Exception e) { logger.error("invoke set storage policy error : " + e); - ret = "invoke set storage policy error : " + e.getMessage(); + throw new IOException(e); } } - - return ret; } public boolean registerTruncateOnAbort(String tblName, long transID)
