Grokbase Groups HBase dev May 2010
FAQ
HBase shell 'alter' command cannot set table properties to False
----------------------------------------------------------------

Key: HBASE-2619
URL: https://issues.apache.org/jira/browse/HBASE-2619
Project: HBase
Issue Type: Bug
Components: scripts
Affects Versions: 0.20.4
Environment: CentOS
Reporter: Christo Wilson
Priority: Minor
Fix For: 0.21.0


The alter table command in the HBase shell is broken. Specifically, attempting to set boolean table options like BLOCKCACHE to False does not result in the expected behavior.

This is due to bugs in the file src/main/ruby/hbase/admin.rb, in the hcd() function. There many statements that look like this:

arg[IN_MEMORY]? JBoolean.valueOf(arg[IN_MEMORY]): HColumnDescriptor::DEFAULT_IN_MEMORY

The intent of this code is to 1) determine if a given parameter is present in the associative array, 2) use the supplied value if it exists, or 3) use the default value if it does not exist. However, in the case of boolean parameters that have been set to False this code instead evaluates the variable (to False) and then chooses the default parameter value, which is incorrect.

The following patch fixes the issue:


--- hbase-trunk-orig/src/main/ruby/hbase/admin.rb 2010-05-27 14:55:14.000000000 -0700
+++ hbase-trunk/src/main/ruby/hbase/admin.rb 2010-05-27 14:58:26.000000000 -0700
@@ -328,14 +328,14 @@
# 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[VERSIONS]? JInteger.new(arg[VERSIONS]): HColumnDescriptor::DEFAULT_VERSIONS,
- arg[HColumnDescriptor::COMPRESSION]? arg[HColumnDescriptor::COMPRESSION]: HColumnDescriptor::DEFAULT_COMPRESSION,
- arg[IN_MEMORY]? JBoolean.valueOf(arg[IN_MEMORY]): HColumnDescriptor::DEFAULT_IN_MEMORY,
- arg[HColumnDescriptor::BLOCKCACHE]? JBoolean.valueOf(arg[HColumnDescriptor::BLOCKCACHE]): HColumnDescriptor::DEFAULT_BLOCKCACHE,
- arg[HColumnDescriptor::BLOCKSIZE]? JInteger.valueOf(arg[HColumnDescriptor::BLOCKSIZE]): HColumnDescriptor::DEFAULT_BLOCKSIZE,
- arg[HColumnDescriptor::TTL]? JInteger.new(arg[HColumnDescriptor::TTL]): HColumnDescriptor::DEFAULT_TTL,
- arg[HColumnDescriptor::BLOOMFILTER]? arg[HColumnDescriptor::BLOOMFILTER]: HColumnDescriptor::DEFAULT_BLOOMFILTER,
- arg[HColumnDescriptor::REPLICATION_SCOPE]? JInteger.new(arg[REPLICATION_SCOPE]): HColumnDescriptor::DEFAULT_REPLICATION_SCOPE)
+ 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)? JBoolean.valueOf(arg[HColumnDescriptor::BLOOMFILTER]): HColumnDescriptor::DEFAULT_BLOOMFILTER,
+ arg.include?(HColumnDescriptor::REPLICATION_SCOPE)? JInteger.new(arg[REPLICATION_SCOPE]): HColumnDescriptor::DEFAULT_REPLICATION_SCOPE)
end

#----------------------------------------------------------------------------------------------


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieshbase, hadoop
postedMay 27, '10 at 10:10p
activeMay 27, '10 at 10:10p
posts1
users1
websitehbase.apache.org

1 user in discussion

Christo Wilson (JIRA): 1 post

People

Translate

site design / logo © 2021 Grokbase