diff --git a/CHANGES.txt b/CHANGES.txt index 9edd873fd85..26fd765fc9f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,8 @@ Release 0.91.0 - Unreleased changes at runtime (Gary Helmling via Andrew Purtell) HBASE-3677 Generate a globally unique cluster ID (changed ClusterStatus serialization) + HBASE-3762 HTableFactory.releaseHTableInterface() should throw IOException + instead of wrapping in RuntimeException (Ted Yu via garyh) BUG FIXES HBASE-3280 YouAreDeadException being swallowed in HRS getMaster diff --git a/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java b/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java index 569027aa1fc..a41f04059af 100644 --- a/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java +++ b/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java @@ -401,7 +401,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } @@ -414,7 +420,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } @@ -428,7 +440,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } @@ -442,7 +460,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } @@ -455,7 +479,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } @@ -473,7 +503,13 @@ public class AvroServer { ioe.message = new Utf8(e.getMessage()); throw ioe; } finally { - htablePool.putTable(htable); + try { + htablePool.putTable(htable); + } catch (IOException e) { + AIOError ioe = new AIOError(); + ioe.message = new Utf8(e.getMessage()); + throw ioe; + } } } diff --git a/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java b/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java index b7558968459..90f6cb9450f 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java @@ -40,11 +40,7 @@ public class HTableFactory implements HTableInterfaceFactory { } @Override - public void releaseHTableInterface(HTableInterface table) { - try { - table.close(); - } catch (IOException ioe) { - throw new RuntimeException(ioe); - } + public void releaseHTableInterface(HTableInterface table) throws IOException { + table.close(); } } \ No newline at end of file diff --git a/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java b/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java index 5d6829190f9..ab7efcc5529 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java @@ -19,6 +19,8 @@ */ package org.apache.hadoop.hbase.client; +import java.io.IOException; + import org.apache.hadoop.conf.Configuration; @@ -43,5 +45,5 @@ public interface HTableInterfaceFactory { * Release the HTable resource represented by the table. * @param table */ - void releaseHTableInterface(final HTableInterface table); + void releaseHTableInterface(final HTableInterface table) throws IOException; } diff --git a/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java b/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java index afd7bfc2881..88827a81ae8 100755 --- a/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java @@ -19,6 +19,7 @@ */ package org.apache.hadoop.hbase.client; +import java.io.IOException; import java.util.Map; import java.util.Queue; import java.util.concurrent.ConcurrentHashMap; @@ -114,7 +115,7 @@ public class HTablePool { * then the table instance gets closed after flushing buffered edits. * @param table table */ - public void putTable(HTableInterface table) { + public void putTable(HTableInterface table) throws IOException { Queue queue = tables.get(Bytes.toString(table.getTableName())); if(queue.size() >= maxSize) { // release table instance since we're not reusing it @@ -137,7 +138,7 @@ public class HTablePool { * * @param tableName */ - public void closeTablePool(final String tableName) { + public void closeTablePool(final String tableName) throws IOException { Queue queue = tables.get(tableName); if (queue != null) { HTableInterface table = queue.poll(); @@ -154,7 +155,7 @@ public class HTablePool { * * @param tableName */ - public void closeTablePool(final byte[] tableName) { + public void closeTablePool(final byte[] tableName) throws IOException { closeTablePool(Bytes.toString(tableName)); } diff --git a/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java b/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java index 31e111b18c3..55c3a3bb23c 100644 --- a/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java +++ b/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java @@ -189,7 +189,12 @@ public class RowResource extends ResourceBase { Response.Status.SERVICE_UNAVAILABLE); } finally { if (table != null) { - pool.putTable(table); + try { + pool.putTable(table); + } catch (IOException ioe) { + throw new WebApplicationException(ioe, + Response.Status.SERVICE_UNAVAILABLE); + } } } } @@ -248,7 +253,12 @@ public class RowResource extends ResourceBase { Response.Status.SERVICE_UNAVAILABLE); } finally { if (table != null) { - pool.putTable(table); + try { + pool.putTable(table); + } catch (IOException ioe) { + throw new WebApplicationException(ioe, + Response.Status.SERVICE_UNAVAILABLE); + } } } } @@ -337,7 +347,12 @@ public class RowResource extends ResourceBase { Response.Status.SERVICE_UNAVAILABLE); } finally { if (table != null) { - pool.putTable(table); + try { + pool.putTable(table); + } catch (IOException ioe) { + throw new WebApplicationException(ioe, + Response.Status.SERVICE_UNAVAILABLE); + } } } return Response.ok().build();