You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2015/02/18 17:23:37 UTC

svn commit: r1660663 - /hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java

Author: brock
Date: Wed Feb 18 16:23:36 2015
New Revision: 1660663

URL: http://svn.apache.org/r1660663
Log:
HIVE-9706 - HBase handler support for snapshots should confirm properties before use (Sean Busbey via Brock)

Modified:
    hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java

Modified: hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java?rev=1660663&r1=1660662&r2=1660663&view=diff
==============================================================================
--- hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java (original)
+++ hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java Wed Feb 18 16:23:36 2015
@@ -88,10 +88,16 @@ public class HBaseStorageHandler extends
   private static final String HBASE_SNAPSHOT_TABLE_DIR_KEY = "hbase.TableSnapshotInputFormat.table.dir";
   /** HBase-internal config by which input format received restore dir after HBASE-11335. */
   private static final String HBASE_SNAPSHOT_RESTORE_DIR_KEY = "hbase.TableSnapshotInputFormat.restore.dir";
-  /** HBase config by which a SlabCache is sized. */
-  private static final String HBASE_OFFHEAP_PCT_KEY = "hbase.offheapcache.percentage";
-  /** HBase config by which a BucketCache is sized. */
-  private static final String HBASE_BUCKETCACHE_SIZE_KEY = "hbase.bucketcache.size";
+  private static final String[] HBASE_CACHE_KEYS = new String[] {
+      /** HBase config by which a SlabCache is sized. From HBase [0.98.3, 1.0.0) */
+      "hbase.offheapcache.percentage",
+      /** HBase config by which a BucketCache is sized. */
+      "hbase.bucketcache.size",
+      /** HBase config by which the bucket cache implementation is chosen. From HBase 0.98.10+ */
+      "hbase.bucketcache.ioengine",
+      /** HBase config by which a BlockCache is sized. */
+      "hfile.block.cache.size"
+  };
 
   final static public String DEFAULT_PREFIX = "default.";
 
@@ -395,8 +401,14 @@ public class HBaseStorageHandler extends
 
           TableMapReduceUtil.resetCacheConfig(hbaseConf);
           // copy over configs touched by above method
-          jobProperties.put(HBASE_OFFHEAP_PCT_KEY, hbaseConf.get(HBASE_OFFHEAP_PCT_KEY));
-          jobProperties.put(HBASE_BUCKETCACHE_SIZE_KEY, hbaseConf.get(HBASE_BUCKETCACHE_SIZE_KEY));
+          for (String cacheKey : HBASE_CACHE_KEYS) {
+            final String value = hbaseConf.get(cacheKey);
+            if (value != null) {
+              jobProperties.put(cacheKey, value);
+            } else {
+              jobProperties.remove(cacheKey);
+            }
+          }
         } catch (IOException e) {
           throw new IllegalArgumentException(e);
         }