hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1400196 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
Date Fri, 19 Oct 2012 17:58:27 GMT
Author: tedyu
Date: Fri Oct 19 17:58:27 2012
New Revision: 1400196

URL: http://svn.apache.org/viewvc?rev=1400196&view=rev
Log:
HBASE-6583 Enhance Hbase load test tool to automatically create column families if not present
(Sergey Shelukhin)


Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java?rev=1400196&r1=1400195&r2=1400196&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
Fri Oct 19 17:58:27 2012
@@ -155,6 +155,10 @@ public class LoadTestTool extends Abstra
     admin.disableTable(tableName);
     for (byte[] cf : columnFamilies) {
       HColumnDescriptor columnDesc = tableDesc.getFamily(cf);
+      boolean isNewCf = columnDesc == null;
+      if (isNewCf) {
+        columnDesc = new HColumnDescriptor(cf);
+      }
       if (bloomType != null) {
         columnDesc.setBloomFilterType(bloomType);
       }
@@ -165,7 +169,11 @@ public class LoadTestTool extends Abstra
         columnDesc.setDataBlockEncoding(dataBlockEncodingAlgo);
         columnDesc.setEncodeOnDisk(!encodeInCacheOnly);
       }
-      admin.modifyColumn(tableName, columnDesc);
+      if (isNewCf) {
+        admin.addColumn(tableName, columnDesc);
+      } else {
+        admin.modifyColumn(tableName, columnDesc);
+      }
     }
     LOG.info("Enabling table " + Bytes.toString(tableName));
     admin.enableTable(tableName);



Mime
View raw message