hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1401116 - /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
Date Mon, 22 Oct 2012 22:58:02 GMT
Author: apurtell
Date: Mon Oct 22 22:58:02 2012
New Revision: 1401116

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

Modified:
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java?rev=1401116&r1=1401115&r2=1401116&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java Mon Oct
22 22:58:02 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