HBASE-1429 Allow passing of a configuration object to HTablePool
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@775511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cff0b8bb04
commit
5465455602
18
CHANGES.txt
18
CHANGES.txt
|
@ -248,9 +248,11 @@ Release 0.20.0 - Unreleased
|
|||
HBASE-1417 Cleanup disorientating RPC message
|
||||
HBASE-1424 have shell print regioninfo and location on first load if
|
||||
DEBUG enabled
|
||||
HBASE-1008 [performance] The replay of logs on server crash takes way too long
|
||||
HBASE-1008 [performance] The replay of logs on server crash takes way too
|
||||
long
|
||||
HBASE-1394 Uploads sometimes fall to 0 requests/second (Binding up on
|
||||
HLog#append?)
|
||||
HBASE-1429 Allow passing of a configuration object to HTablePool
|
||||
|
||||
OPTIMIZATIONS
|
||||
HBASE-1412 Change values for delete column and column family in KeyValue
|
||||
|
@ -280,7 +282,8 @@ Release 0.19.0 - 01/21/2009
|
|||
HBASE-912 PE is broken when other tables exist
|
||||
HBASE-853 [shell] Cannot describe meta tables (Izaak Rubin via Stack)
|
||||
HBASE-844 Can't pass script to hbase shell
|
||||
HBASE-837 Add unit tests for ThriftServer.HBaseHandler (Izaak Rubin via Stack)
|
||||
HBASE-837 Add unit tests for ThriftServer.HBaseHandler (Izaak Rubin via
|
||||
Stack)
|
||||
HBASE-913 Classes using log4j directly
|
||||
HBASE-914 MSG_REPORT_CLOSE has a byte array for a message
|
||||
HBASE-918 Region balancing during startup makes cluster unstable
|
||||
|
@ -291,7 +294,7 @@ Release 0.19.0 - 01/21/2009
|
|||
HBASE-924 Update hadoop in lib on 0.18 hbase branch to 0.18.1
|
||||
HBASE-929 Clarify that ttl in HColumnDescriptor is seconds
|
||||
HBASE-930 RegionServer stuck: HLog: Could not append. Requesting close of
|
||||
log java.io.IOException: Could not get block locations. Aborting...
|
||||
log java.io.IOException: Could not get block locations
|
||||
HBASE-926 If no master, regionservers should hang out rather than fail on
|
||||
connection and shut themselves down
|
||||
HBASE-919 Master and Region Server need to provide root region location if
|
||||
|
@ -301,11 +304,13 @@ Release 0.19.0 - 01/21/2009
|
|||
HBASE-939 NPE in HStoreKey
|
||||
HBASE-945 Be consistent in use of qualified/unqualified mapfile paths
|
||||
HBASE-946 Row with 55k deletes timesout scanner lease
|
||||
HBASE-950 HTable.commit no longer works with existing RowLocks though it's still in API
|
||||
HBASE-950 HTable.commit no longer works with existing RowLocks though it's
|
||||
still in API
|
||||
HBASE-952 Deadlock in HRegion.batchUpdate
|
||||
HBASE-954 Don't reassign root region until ProcessServerShutdown has split
|
||||
the former region server's log
|
||||
HBASE-957 PerformanceEvaluation tests if table exists by comparing descriptors
|
||||
HBASE-957 PerformanceEvaluation tests if table exists by comparing
|
||||
descriptors
|
||||
HBASE-728, HBASE-956, HBASE-955 Address thread naming, which threads are
|
||||
Chores, vs Threads, make HLog manager the write ahead log and
|
||||
not extend it to provided optional HLog sync operations.
|
||||
|
@ -320,7 +325,8 @@ Release 0.19.0 - 01/21/2009
|
|||
HBASE-977 Arcane HStoreKey comparator bug
|
||||
HBASE-979 REST web app is not started automatically
|
||||
HBASE-980 Undo core of HBASE-975, caching of start and end row
|
||||
HBASE-982 Deleting a column in MapReduce fails (Doğacan Güney via Stack)
|
||||
HBASE-982 Deleting a column in MapReduce fails (Doğacan Güney via
|
||||
Stack)
|
||||
HBASE-984 Fix javadoc warnings
|
||||
HBASE-985 Fix javadoc warnings
|
||||
HBASE-951 Either shut down master or let it finish cleanup
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Deque;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
/**
|
||||
|
@ -39,17 +40,28 @@ public class HTablePool {
|
|||
private static final Map<byte[], HTablePool> poolMap =
|
||||
new TreeMap<byte[], HTablePool>(Bytes.BYTES_COMPARATOR);
|
||||
|
||||
private final HBaseConfiguration config;
|
||||
private final byte[] tableName;
|
||||
private final Deque<HTable> pool;
|
||||
private final int maxSize;
|
||||
|
||||
/**
|
||||
* Get a shared table pool.
|
||||
* @param tableName the table name
|
||||
* @return the table pool
|
||||
*/
|
||||
public static HTablePool getPool(HBaseConfiguration config,
|
||||
byte[] tableName) {
|
||||
return getPool(config, tableName, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a shared table pool.
|
||||
* @param tableName the table name
|
||||
* @return the table pool
|
||||
*/
|
||||
public static HTablePool getPool(byte[] tableName) {
|
||||
return getPool(tableName, 10);
|
||||
return getPool(new HBaseConfiguration(), tableName, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,15 +71,17 @@ public class HTablePool {
|
|||
* shared pool will be allocated with <i>maxSize</i> as the size limit.
|
||||
* However, if the shared pool already exists, and was created with a
|
||||
* different (or default) value for <i>maxSize</i>, it will not be changed.
|
||||
* @param config HBase configuration
|
||||
* @param tableName the table name
|
||||
* @param maxSize the maximum size of the pool
|
||||
* @return the table pool
|
||||
*/
|
||||
public static HTablePool getPool(byte[] tableName, int maxSize) {
|
||||
public static HTablePool getPool(HBaseConfiguration config, byte[] tableName,
|
||||
int maxSize) {
|
||||
synchronized (poolMap) {
|
||||
HTablePool pool = poolMap.get(tableName);
|
||||
if (pool == null) {
|
||||
pool = new HTablePool(tableName, maxSize);
|
||||
pool = new HTablePool(config, tableName, maxSize);
|
||||
poolMap.put(tableName, pool);
|
||||
}
|
||||
return pool;
|
||||
|
@ -75,12 +89,16 @@ public class HTablePool {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
* @param config HBase configuration
|
||||
* @param tableName the table name
|
||||
* @param maxSize maximum pool size
|
||||
*/
|
||||
public HTablePool(byte[] tableName) {
|
||||
public HTablePool(HBaseConfiguration config, byte[] tableName,
|
||||
int maxSize) {
|
||||
this.config = config;
|
||||
this.tableName = tableName;
|
||||
this.maxSize = 10;
|
||||
this.maxSize = maxSize;
|
||||
this.pool = new ArrayDeque<HTable>(this.maxSize);
|
||||
}
|
||||
|
||||
|
@ -90,9 +108,15 @@ public class HTablePool {
|
|||
* @param maxSize maximum pool size
|
||||
*/
|
||||
public HTablePool(byte[] tableName, int maxSize) {
|
||||
this.tableName = tableName;
|
||||
this.maxSize = maxSize;
|
||||
this.pool = new ArrayDeque<HTable>(this.maxSize);
|
||||
this(new HBaseConfiguration(), tableName, maxSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param tableName the table name
|
||||
*/
|
||||
public HTablePool(byte[] tableName) {
|
||||
this(new HBaseConfiguration(), tableName, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +133,7 @@ public class HTablePool {
|
|||
return pool.pop();
|
||||
}
|
||||
}
|
||||
return new HTable(tableName);
|
||||
return new HTable(config, tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue