hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r1026526 - in /hbase/trunk: CHANGES.txt pom.xml src/main/ruby/hbase/admin.rb
Date Fri, 22 Oct 2010 23:28:08 GMT
Author: jdcryans
Date: Fri Oct 22 23:28:07 2010
New Revision: 1026526

URL: http://svn.apache.org/viewvc?rev=1026526&view=rev
Log:
HBASE-2984  [shell] Altering a family shouldn't reset to default unchanged
            attributes
HBASE-3143  Adding the tests' hbase-site.xml to the jar breaks some clients

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/pom.xml
    hbase/trunk/src/main/ruby/hbase/admin.rb

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1026526&r1=1026525&r2=1026526&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Oct 22 23:28:07 2010
@@ -606,6 +606,9 @@ Release 0.21.0 - Unreleased
    HBASE-2998  rolling-restart.sh shouldn't rely on zoo.cfg
    HBASE-3145  importtsv fails when the line contains no data
                (Kazuki Ohta via Todd Lipcon)
+   HBASE-2984  [shell] Altering a family shouldn't reset to default unchanged
+               attributes
+   HBASE-3143  Adding the tests' hbase-site.xml to the jar breaks some clients
 
 
   IMPROVEMENTS

Modified: hbase/trunk/pom.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/pom.xml?rev=1026526&r1=1026525&r2=1026526&view=diff
==============================================================================
--- hbase/trunk/pom.xml (original)
+++ hbase/trunk/pom.xml Fri Oct 22 23:28:07 2010
@@ -291,6 +291,7 @@
             <exclude>org/apache/jute/**</exclude>
             <exclude>org/apache/zookeeper/**</exclude>
             <exclude>**/*.jsp</exclude>
+            <exclude>**/hbase-site.xml</exclude>
           </excludes>
         </configuration>
       </plugin>

Modified: hbase/trunk/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/hbase/admin.rb?rev=1026526&r1=1026525&r2=1026526&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/hbase/admin.rb (original)
+++ hbase/trunk/src/main/ruby/hbase/admin.rb Fri Oct 22 23:28:07 2010
@@ -132,7 +132,7 @@ module Hbase
         end
 
         # Add column to the table
-        descriptor = hcd(arg)
+        descriptor = hcd(arg, htd)
         if arg[COMPRESSION_COMPACT]
           descriptor.setValue(COMPRESSION_COMPACT, arg[COMPRESSION_COMPACT])
         end
@@ -219,7 +219,7 @@ module Hbase
 
         # No method parameter, try to use the args as a column definition
         unless method = arg.delete(METHOD)
-          descriptor = hcd(arg)
+          descriptor = hcd(arg, htd)
           if arg[COMPRESSION_COMPACT]
             descriptor.setValue(COMPRESSION_COMPACT, arg[COMPRESSION_COMPACT])
           end
@@ -320,29 +320,26 @@ module Hbase
 
     #----------------------------------------------------------------------------------------------
     # Return a new HColumnDescriptor made of passed args
-    def hcd(arg)
+    def hcd(arg, htd)
       # String arg, single parameter constructor
       return HColumnDescriptor.new(arg) if arg.kind_of?(String)
 
-      # TODO: This is brittle code.
-      # Here is current HCD constructor:
-      # public HColumnDescriptor(final byte [] familyName, final int maxVersions,
-      # final String compression, final boolean inMemory,
-      # final boolean blockCacheEnabled, final int blocksize,
-      # final int timeToLive, final boolean bloomFilter, final int scope) {
       raise(ArgumentError, "Column family #{arg} must have a name") unless name = arg[NAME]
 
-      # TODO: What encoding are Strings in jruby?
-      return HColumnDescriptor.new(name.to_java_bytes,
-        # JRuby uses longs for ints. Need to convert.  Also constants are String
-        arg.include?(VERSIONS)? JInteger.new(arg[VERSIONS]): HColumnDescriptor::DEFAULT_VERSIONS,
-        arg.include?(HColumnDescriptor::COMPRESSION)? arg[HColumnDescriptor::COMPRESSION]:
HColumnDescriptor::DEFAULT_COMPRESSION,
-        arg.include?(IN_MEMORY)? JBoolean.valueOf(arg[IN_MEMORY]): HColumnDescriptor::DEFAULT_IN_MEMORY,
-        arg.include?(HColumnDescriptor::BLOCKCACHE)? JBoolean.valueOf(arg[HColumnDescriptor::BLOCKCACHE]):
HColumnDescriptor::DEFAULT_BLOCKCACHE,
-        arg.include?(HColumnDescriptor::BLOCKSIZE)? JInteger.valueOf(arg[HColumnDescriptor::BLOCKSIZE]):
HColumnDescriptor::DEFAULT_BLOCKSIZE,
-        arg.include?(HColumnDescriptor::TTL)? JInteger.new(arg[HColumnDescriptor::TTL]):
HColumnDescriptor::DEFAULT_TTL,
-        arg.include?(HColumnDescriptor::BLOOMFILTER)? arg[HColumnDescriptor::BLOOMFILTER]:
HColumnDescriptor::DEFAULT_BLOOMFILTER,
-        arg.include?(HColumnDescriptor::REPLICATION_SCOPE)? JInteger.new(arg[REPLICATION_SCOPE]):
HColumnDescriptor::DEFAULT_REPLICATION_SCOPE)
+      family = htd.getFamily(name.to_java_bytes)
+      # create it if it's a new family
+      family ||= HColumnDescriptor.new(name.to_java_bytes)
+
+      family.setBlockCacheEnabled(JBoolean.valueOf(arg[HColumnDescriptor::BLOCKCACHE])) if
arg.include?(HColumnDescriptor::BLOCKCACHE)
+      family.setBloomFilterType(arg[HColumnDescriptor::BLOOMFILTER]) if arg.include?(HColumnDescriptor::BLOOMFILTER)
+      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)
+
+      return family
     end
 
     #----------------------------------------------------------------------------------------------



Mime
View raw message