You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/12/06 19:29:01 UTC

svn commit: r1042756 - in /hbase/branches/0.90: CHANGES.txt src/main/ruby/hbase/admin.rb

Author: stack
Date: Mon Dec  6 18:29:01 2010
New Revision: 1042756

URL: http://svn.apache.org/viewvc?rev=1042756&view=rev
Log:
HBASE-3310 Failing creating/altering table with compression agrument from the HBase shell

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/ruby/hbase/admin.rb

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1042756&r1=1042755&r2=1042756&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Mon Dec  6 18:29:01 2010
@@ -281,7 +281,7 @@ Release 0.90.0 - Unreleased
                (Kannan Muthukkaruppan via Stack)
    HBASE-2410  spurious warnings from util.Sleeper
    HBASE-2335  mapred package docs don't say zookeeper jar is a dependent
-   HBASE-2417  HCM.locateRootRegion fails hard on "Connection refused"
+   HBASE-2416  HCM.locateRootRegion fails hard on "Connection refused"
    HBASE-2346  Usage of FilterList slows down scans
    HBASE-2341  ZK settings for initLimit/syncLimit should not have been removed
                from hbase-default.xml
@@ -724,7 +724,9 @@ Release 0.90.0 - Unreleased
    HBASE-3296  Newly created table ends up disabled instead of assigned
    HBASE-3304  Get spurious master fails during bootup
    HBASE-3298  Regionserver can close during a split causing double assignment
-   HBASE-3309  " Not running balancer because dead regionserver processing" is a lie
+   HBASE-3309  "Not running balancer because dead regionserver processing" is a lie
+   HBASE-3310  Failing creating/altering table with compression agrument from 
+               the HBase shell (Igor Ranitovic via Stack)
 
 
   IMPROVEMENTS

Modified: hbase/branches/0.90/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/ruby/hbase/admin.rb?rev=1042756&r1=1042755&r2=1042756&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/ruby/hbase/admin.rb (original)
+++ hbase/branches/0.90/src/main/ruby/hbase/admin.rb Mon Dec  6 18:29:01 2010
@@ -27,6 +27,7 @@ java_import org.apache.hadoop.hbase.HTab
 java_import org.apache.hadoop.hbase.HRegionInfo
 java_import org.apache.hadoop.hbase.util.Bytes
 java_import org.apache.zookeeper.ZooKeeper
+java_import org.apache.hadoop.hbase.io.hfile.Compression
 
 # Wrapper for org.apache.hadoop.hbase.client.HBaseAdmin
 
@@ -346,7 +347,7 @@ module Hbase
       return HColumnDescriptor.new(arg) if arg.kind_of?(String)
 
       raise(ArgumentError, "Column family #{arg} must have a name") unless name = arg[NAME]
-
+      
       family = htd.getFamily(name.to_java_bytes)
       # create it if it's a new family
       family ||= HColumnDescriptor.new(name.to_java_bytes)
@@ -356,10 +357,17 @@ module Hbase
       family.setScope(JInteger.valueOf(arg[REPLICATION_SCOPE])) if arg.include?(HColumnDescriptor::REPLICATION_SCOPE)
       family.setInMemory(JBoolean.valueOf(arg[IN_MEMORY])) if arg.include?(HColumnDescriptor::IN_MEMORY)
       family.setTimeToLive(JInteger.valueOf(arg[HColumnDescriptor::TTL])) if arg.include?(HColumnDescriptor::TTL)
-      family.setCompressionType(arg[HColumnDescriptor::COMPRESSION]) if arg.include?(HColumnDescriptor::COMPRESSION)
       family.setBlocksize(JInteger.valueOf(arg[HColumnDescriptor::BLOCKSIZE])) if arg.include?(HColumnDescriptor::BLOCKSIZE)
       family.setMaxVersions(JInteger.valueOf(arg[VERSIONS])) if arg.include?(HColumnDescriptor::VERSIONS)
 
+      if arg.include?(HColumnDescriptor::COMPRESSION)
+        compression = arg[HColumnDescriptor::COMPRESSION].upcase
+        unless Compression::Algorithm.constants.include?(compression)      
+          raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + Compression::Algorithm.constants.join(" ")) 
+        else 
+          family.setCompressionType(Compression::Algorithm.valueOf(compression))
+        end
+      end
       return family
     end