You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/05/16 21:22:49 UTC

svn commit: r775511 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/client/HTablePool.java

Author: apurtell
Date: Sat May 16 19:22:49 2009
New Revision: 775511

URL: http://svn.apache.org/viewvc?rev=775511&view=rev
Log:
HBASE-1429 Allow passing of a configuration object to HTablePool

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTablePool.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=775511&r1=775510&r2=775511&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Sat May 16 19:22:49 2009
@@ -248,9 +248,11 @@
    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 @@
    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 @@
    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 @@
    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 @@
    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

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTablePool.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTablePool.java?rev=775511&r1=775510&r2=775511&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTablePool.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTablePool.java Sat May 16 19:22:49 2009
@@ -28,6 +28,7 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.util.Bytes;
 
 /**
@@ -39,6 +40,7 @@
   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;
@@ -48,8 +50,18 @@
    * @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 @@
    * 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 @@
   }
 
   /**
-   * 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 @@
    * @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 @@
         return pool.pop();
       }
     }
-    return new HTable(tableName);
+    return new HTable(config, tableName);
   }
 
   /**