HBASE-3762 HTableFactory.releaseHTableInterface() should throw IOException not wrap in RTE
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1091165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9fe4b7c5bc
commit
a7f8453d50
|
@ -6,6 +6,8 @@ Release 0.91.0 - Unreleased
|
||||||
changes at runtime (Gary Helmling via Andrew Purtell)
|
changes at runtime (Gary Helmling via Andrew Purtell)
|
||||||
HBASE-3677 Generate a globally unique cluster ID (changed
|
HBASE-3677 Generate a globally unique cluster ID (changed
|
||||||
ClusterStatus serialization)
|
ClusterStatus serialization)
|
||||||
|
HBASE-3762 HTableFactory.releaseHTableInterface() should throw IOException
|
||||||
|
instead of wrapping in RuntimeException (Ted Yu via garyh)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
HBASE-3280 YouAreDeadException being swallowed in HRS getMaster
|
HBASE-3280 YouAreDeadException being swallowed in HRS getMaster
|
||||||
|
|
|
@ -401,7 +401,13 @@ public class AvroServer {
|
||||||
ioe.message = new Utf8(e.getMessage());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
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());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
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());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
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());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
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());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
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());
|
ioe.message = new Utf8(e.getMessage());
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
htablePool.putTable(htable);
|
htablePool.putTable(htable);
|
||||||
|
} catch (IOException e) {
|
||||||
|
AIOError ioe = new AIOError();
|
||||||
|
ioe.message = new Utf8(e.getMessage());
|
||||||
|
throw ioe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,7 @@ public class HTableFactory implements HTableInterfaceFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseHTableInterface(HTableInterface table) {
|
public void releaseHTableInterface(HTableInterface table) throws IOException {
|
||||||
try {
|
|
||||||
table.close();
|
table.close();
|
||||||
} catch (IOException ioe) {
|
|
||||||
throw new RuntimeException(ioe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,6 +19,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,5 +45,5 @@ public interface HTableInterfaceFactory {
|
||||||
* Release the HTable resource represented by the table.
|
* Release the HTable resource represented by the table.
|
||||||
* @param table
|
* @param table
|
||||||
*/
|
*/
|
||||||
void releaseHTableInterface(final HTableInterface table);
|
void releaseHTableInterface(final HTableInterface table) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -114,7 +115,7 @@ public class HTablePool {
|
||||||
* then the table instance gets closed after flushing buffered edits.
|
* then the table instance gets closed after flushing buffered edits.
|
||||||
* @param table table
|
* @param table table
|
||||||
*/
|
*/
|
||||||
public void putTable(HTableInterface table) {
|
public void putTable(HTableInterface table) throws IOException {
|
||||||
Queue<HTableInterface> queue = tables.get(Bytes.toString(table.getTableName()));
|
Queue<HTableInterface> queue = tables.get(Bytes.toString(table.getTableName()));
|
||||||
if(queue.size() >= maxSize) {
|
if(queue.size() >= maxSize) {
|
||||||
// release table instance since we're not reusing it
|
// release table instance since we're not reusing it
|
||||||
|
@ -137,7 +138,7 @@ public class HTablePool {
|
||||||
*
|
*
|
||||||
* @param tableName
|
* @param tableName
|
||||||
*/
|
*/
|
||||||
public void closeTablePool(final String tableName) {
|
public void closeTablePool(final String tableName) throws IOException {
|
||||||
Queue<HTableInterface> queue = tables.get(tableName);
|
Queue<HTableInterface> queue = tables.get(tableName);
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
HTableInterface table = queue.poll();
|
HTableInterface table = queue.poll();
|
||||||
|
@ -154,7 +155,7 @@ public class HTablePool {
|
||||||
*
|
*
|
||||||
* @param tableName
|
* @param tableName
|
||||||
*/
|
*/
|
||||||
public void closeTablePool(final byte[] tableName) {
|
public void closeTablePool(final byte[] tableName) throws IOException {
|
||||||
closeTablePool(Bytes.toString(tableName));
|
closeTablePool(Bytes.toString(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,12 @@ public class RowResource extends ResourceBase {
|
||||||
Response.Status.SERVICE_UNAVAILABLE);
|
Response.Status.SERVICE_UNAVAILABLE);
|
||||||
} finally {
|
} finally {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
try {
|
||||||
pool.putTable(table);
|
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);
|
Response.Status.SERVICE_UNAVAILABLE);
|
||||||
} finally {
|
} finally {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
try {
|
||||||
pool.putTable(table);
|
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);
|
Response.Status.SERVICE_UNAVAILABLE);
|
||||||
} finally {
|
} finally {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
try {
|
||||||
pool.putTable(table);
|
pool.putTable(table);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new WebApplicationException(ioe,
|
||||||
|
Response.Status.SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
|
|
Loading…
Reference in New Issue