HBASE-16196 Update to JRuby 9.1.9.0

* Get hbase-shell to use latest current JRuby release.
* Update license information to reflect the changes to jruby-complete.jar
* Update shell scripts for Ruby 1.8->2.x incompatabilities
* Update joni and jcodings to compatible versions

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Mike Drob 2017-05-18 09:32:40 -07:00 committed by Sean Busbey
parent dda9ae0295
commit 140ce1453e
19 changed files with 122 additions and 208 deletions

View File

@ -21,12 +21,12 @@
require 'optparse' require 'optparse'
include Java include Java
import org.apache.hadoop.hbase.HBaseConfiguration java_import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.ConnectionFactory java_import org.apache.hadoop.hbase.client.ConnectionFactory
import org.apache.hadoop.hbase.client.HBaseAdmin java_import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.zookeeper.ZKUtil java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
import org.apache.commons.logging.Log java_import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory java_import org.apache.commons.logging.LogFactory
# Name of this script # Name of this script
NAME = "draining_servers" NAME = "draining_servers"

View File

@ -18,10 +18,10 @@
# Prints the hostname of the machine running the active master. # Prints the hostname of the machine running the active master.
include Java include Java
import org.apache.hadoop.hbase.HBaseConfiguration java_import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.ServerName java_import org.apache.hadoop.hbase.ServerName
import org.apache.hadoop.hbase.zookeeper.ZKUtil java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher java_import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher
# disable debug/info logging on this script for clarity # disable debug/info logging on this script for clarity
log_level = org.apache.log4j.Level::ERROR log_level = org.apache.log4j.Level::ERROR

View File

@ -45,19 +45,19 @@ end
require 'java' require 'java'
import org.apache.hadoop.hbase.HBaseConfiguration java_import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.TableName java_import org.apache.hadoop.hbase.TableName
import org.apache.hadoop.hbase.HConstants java_import org.apache.hadoop.hbase.HConstants
import org.apache.hadoop.hbase.MasterNotRunningException java_import org.apache.hadoop.hbase.MasterNotRunningException
import org.apache.hadoop.hbase.client.HBaseAdmin java_import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.client.Table java_import org.apache.hadoop.hbase.client.Table
import org.apache.hadoop.hbase.client.Scan java_import org.apache.hadoop.hbase.client.Scan
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter java_import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter
import org.apache.hadoop.hbase.util.Bytes java_import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.HRegionInfo java_import org.apache.hadoop.hbase.HRegionInfo
import org.apache.hadoop.hbase.MetaTableAccessor java_import org.apache.hadoop.hbase.MetaTableAccessor
import org.apache.hadoop.hbase.HTableDescriptor java_import org.apache.hadoop.hbase.HTableDescriptor
import org.apache.hadoop.hbase.client.ConnectionFactory java_import org.apache.hadoop.hbase.client.ConnectionFactory
# disable debug logging on this script for clarity # disable debug logging on this script for clarity
log_level = org.apache.log4j.Level::ERROR log_level = org.apache.log4j.Level::ERROR

View File

@ -24,13 +24,14 @@
# #
include Java include Java
import org.apache.commons.logging.LogFactory java_import org.apache.commons.logging.LogFactory
import org.apache.hadoop.hbase.HBaseConfiguration java_import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.hbase.HConstants java_import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.HBaseAdmin java_import org.apache.hadoop.hbase.HConstants
import org.apache.hadoop.hbase.HTableDescriptor java_import org.apache.hadoop.hbase.HTableDescriptor
import org.apache.hadoop.conf.Configuration java_import org.apache.hadoop.hbase.TableName
import org.apache.hadoop.hbase.client.ConnectionFactory java_import org.apache.hadoop.hbase.client.ConnectionFactory
java_import org.apache.hadoop.hbase.client.HBaseAdmin
# Name of this script # Name of this script
NAME = "copy_tables_desc" NAME = "copy_tables_desc"
@ -44,7 +45,7 @@ end
def copy (src, dst, table) def copy (src, dst, table)
# verify if table exists in source cluster # verify if table exists in source cluster
begin begin
t = src.getTableDescriptor(table.to_java_bytes) t = src.getTableDescriptor(TableName.valueOf(table))
rescue org.apache.hadoop.hbase.TableNotFoundException rescue org.apache.hadoop.hbase.TableNotFoundException
puts "Source table \"%s\" doesn't exist, skipping." % table puts "Source table \"%s\" doesn't exist, skipping." % table
return return

View File

@ -23,9 +23,9 @@
# ./bin/hbase org.jruby.Main bin/shutdown_regionserver.rb c2021:16020 # ./bin/hbase org.jruby.Main bin/shutdown_regionserver.rb c2021:16020
include Java include Java
import org.apache.hadoop.hbase.HBaseConfiguration java_import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.HBaseAdmin java_import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.client.ConnectionFactory java_import org.apache.hadoop.hbase.client.ConnectionFactory
def usage(msg=nil) def usage(msg=nil)
$stderr.puts 'Usage: shutdown_regionserver.rb <host:port>..' $stderr.puts 'Usage: shutdown_regionserver.rb <host:port>..'

View File

@ -1349,134 +1349,52 @@ JRuby Incorporated Works
Some additional libraries distributed with JRuby are not covered by Some additional libraries distributed with JRuby are not covered by
JRuby's licence. JRuby's licence.
## skip bytelist and yydebug because they're covered by the jruby copyright and license ## skip bytelist, jnr-posix, jruby-openssl, jruby-readline, psych, and yydebug
## because they're covered by the jruby copyright and license
## skip rails benchmark javascript, because it's not in the complete jar ## skip rails benchmark javascript, because it's not in the complete jar
## jruby bundles asm, but we already ref that in our included deps
jline2 is distributed under the BSD license (available above) and is
Copyright (c) 2002-2012, the original author or authors.
All rights reserved.
jzlib is distributed under the BSD license (available above) and is:
Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved.
The "rake" library (http://rake.rubyforge.org/) is distributed under The "rake" library (http://rake.rubyforge.org/) is distributed under
the MIT license (available above), and has the following copyright: the MIT license (available above), and has the following copyright:
Copyright (c) 2003, 2004 Jim Weirich Copyright (c) 2003, 2004 Jim Weirich
## jruby bundles asm, but we already ref that in our included deps
## joda-time only in NOTICE because it's ASLv2
## commons-logging in NOTICE because it's ASLv2
build_lib/apt-mirror-api.jar, build_lib/bnd-0.0.249.jar,
BSF and ant are distributed under the Apache Software License,
Version 1.1 (shown below)
--- ASL v1.1 license
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
--- End ASL v1.1 license
build_lib/constantine.jar (http://kenai.com/projects/constantine)
## jruby bundles jcodings and joni, but we already ref that in our included deps ## jruby bundles jcodings and joni, but we already ref that in our included deps
distributed under the MIT license (available above).
## section on ASLv2 incorporated works just in NOTICE Bouncycastle is released under the MIT license (available above),
## skip emma and junit; both aren't in the complete jar and is Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle.
build_lib/jline-* (http://jline.sourceforge.net) is distributed
under the following BSD-style license:
Redistribution and use in source and binary forms, with or jnr-x86asm is distributed under the MIT license (available above),
without modification, are permitted provided that the following with the following copyrights:
conditions are met:
Redistributions of source code must retain the above copyright Copyright (C) 2010 Wayne Meissner
notice, this list of conditions and the following disclaimer. Copyright (c) 2008-2009, Petr Kobalicek <kobalicek.petr@gmail.com>
Redistributions in binary form must reproduce the above copyright ## The following only in NOTICE because they are all ASLv2
notice, this list of conditions and the following disclaimer ## invokebinder, jffi, jitescript, jnr-constants, jnr-enxio, jnr-ffi,
in the documentation and/or other materials provided with ## jnr-netdb, jnr-unixsocket, joda-time, maven, nailgun, options,
the distribution. ## snakeyaml, unsafe-fences
Neither the name of JLine nor the names of its contributors ## Skip racc, json-generator, json-parser because it is under Ruby license
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
## I couldn't determine what use of bouncycastle this referred to
## so I'm not sure if it's included in the jruby-complete jar or not.
Bouncycastle is released under the MIT license (available above),
and is Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle.
The "yecht" library is Copyright (c) 2009-2011 Ola Bini, and released
under the MIT license (available above).
## jruby bundles jquery, but we already ref that above. ## jruby bundles jquery, but we already ref that above.
most files found in lib/ruby/1.8, lib/ruby/1.9, and lib/ruby/site_ruby/1.8/rubygems* JRuby distributes some ruby modules which are distributed under Ruby
are distributed under The Ruby License's non-GPL provision (available below). license:
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>. Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the GPL You can redistribute it and/or modify it under either the terms of the
(see the file GPL), or the conditions below: 2-clause BSDL (see the file BSDL), or the conditions below:
1. You may make and give away verbatim copies of the source form of the 1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the software without restriction, provided that you duplicate all of the
@ -2574,10 +2492,6 @@ Common Public License - v 1.0
more than one year after the cause of action arose. Each party waives more than one year after the cause of action arose. Each party waives
its rights to a jury trial in any resulting litigation. its rights to a jury trial in any resulting litigation.
#end #end
## We put the JRuby incorporated works bits here, since we first reference JRuby in the CPL section.
#if($jruby)
#jruby_license()
#end
#if(!(${epl.isEmpty()})) #if(!(${epl.isEmpty()}))
==== ====
## print all the EPL 1.0 licensed works ## print all the EPL 1.0 licensed works
@ -2833,4 +2747,8 @@ This product includes the following works licensed under the Eclipse Public Lice
Agreement more than one year after the cause of action arose. Each Agreement more than one year after the cause of action arose. Each
party waives its rights to a jury trial in any resulting litigation. party waives its rights to a jury trial in any resulting litigation.
#end #end
## We put the JRuby incorporated works bits here, since we first reference JRuby in the EPL section.
#if($jruby)
#jruby_license()
#end
#end #end

View File

@ -175,38 +175,29 @@ JRuby Incorporated Works
Some additional libraries distributed with JRuby are not covered by Some additional libraries distributed with JRuby are not covered by
JRuby's licence. JRuby's licence.
## skip bytelist and yydebug because they're covered by the jruby copyright and license ## skip bytelist, jnr-posix, jruby-openssl, jruby-readline, psych, and yydebug
## because they're covered by the jruby copyright and license
## skip rails benchmark javascript, because it's not in the complete jar ## skip rails benchmark javascript, because it's not in the complete jar
## skip rake because MIT
## jruby bundles asm, but we already ref that in our included deps ## jruby bundles asm, but we already ref that in our included deps
build_lib/apt-mirror-api.jar, build_lib/bnd-0.0.249.jar, ## skip jline2, jzlib because BSD-3
BSF and ant are distributed under the Apache Software License,
Version 1.1 ## skip rake because MIT
## skip constantine because MIT
## jruby bundles jcodings and joni, but we already ref that in our included deps ## jruby bundles jcodings and joni, but we already ref that in our included deps
build_lib/commons-logging-1.1.1.jar ## skip Bouncycastle, jnr-x86asm because MIT
build_lib/jarjar-1.0rc8.jar (http://code.google.com/p/jarjar),
build_lib/joda-time-1.6.2.jar (http://joda-time.sourceforge.net),
build_lib/jffi*jar (https://github.com/wmeissner/jffi),
build_lib/jaffl.jar (https://github.com/wmeissner/jaffl),
build_lib/jnr-netdb.jar (http://github.com/wmeissner/jnr-netdb),
build_lib/dynalang-0.3.jar (http://dynalang.sourceforge.net),
build_lib/nailgun-0.7.1.jar and tool/nailgun/ng.exe
(http://martiansoftware.com/nailgun) are distributed under the
Apache License version 2.0.
## skip emma and junit; both aren't in the complete jar
## skip jline because BSD-3
## skip bouncy because MIT
## skip yecht because MIT
## skip jquery because MIT
most files found in lib/ruby/1.8, lib/ruby/1.9, and lib/ruby/site_ruby/1.8/rubygems* invokebinder, jffi, jitescript, jnr-constants, jnr-enxio, jnr-ffi,
are distributed under The Ruby License's non-GPL provision, see LICENSE for details and jnr-netdb, jnr-unixsocket, joda-time, maven, nailgun, options,
http://jruby.org/ for source. snakeyaml, unsafe-fences are distributed under the Apache License
version 2.0.
## Skip racc, json-generator, json-parser because it is under Ruby license
## jruby bundles jquery, but we already ref that above.
#end #end
## first bundled source ## first bundled source
#if(${bundled-logo}) #if(${bundled-logo})

View File

@ -2671,11 +2671,11 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
<licenses> <licenses>
<license> <license>
<name>Common Public License Version 1.0</name> <name>Eclipse Public License 1.0</name>
<url>http://www-128.ibm.com/developerworks/library/os-cpl.html</url> <url>http://www.eclipse.org/legal/epl-v10.html</url>
<distribution>repo</distribution> <distribution>repo</distribution>
<comments> <comments>
Copyright (c) 2007-2011 The JRuby project Copyright (c) 2007-2017 The JRuby project
</comments> </comments>
</license> </license>
</licenses> </licenses>

View File

@ -76,9 +76,9 @@ module Hbase
end end
begin begin
@admin.compactRegion(table_or_region_name.to_java_bytes, family_bytes, false) @admin.compactRegion(table_or_region_name.to_java_bytes, family_bytes)
rescue java.lang.IllegalArgumentException => e rescue java.lang.IllegalArgumentException => e
@admin.compact(TableName.valueOf(table_or_region_name), family_bytes, false, compact_type) @admin.compact(TableName.valueOf(table_or_region_name), family_bytes, compact_type)
end end
end end
@ -472,14 +472,17 @@ module Hbase
#---------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------
# Returns table's structure description # Returns table's structure description
def describe(table_name) def describe(table_name)
tableExists(table_name)
@admin.getTableDescriptor(TableName.valueOf(table_name)).to_s @admin.getTableDescriptor(TableName.valueOf(table_name)).to_s
end end
def get_column_families(table_name) def get_column_families(table_name)
tableExists(table_name)
@admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies() @admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies()
end end
def get_table_attributes(table_name) def get_table_attributes(table_name)
tableExists(table_name)
@admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes @admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes
end end
@ -868,7 +871,7 @@ module Hbase
family.setMobEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB) family.setMobEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB)
family.setMobThreshold(JLong.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD) family.setMobThreshold(JLong.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD)
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER)
bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase.to_sym
unless org.apache.hadoop.hbase.regionserver.BloomType.constants.include?(bloomtype) unless org.apache.hadoop.hbase.regionserver.BloomType.constants.include?(bloomtype)
raise(ArgumentError, "BloomFilter type #{bloomtype} is not supported. Use one of " + org.apache.hadoop.hbase.regionserver.StoreFile::BloomType.constants.join(" ")) raise(ArgumentError, "BloomFilter type #{bloomtype} is not supported. Use one of " + org.apache.hadoop.hbase.regionserver.StoreFile::BloomType.constants.join(" "))
else else
@ -876,7 +879,7 @@ module Hbase
end end
end end
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION)
compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION).upcase compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION).upcase.to_sym
unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression) unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression)
raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" ")) raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" "))
else else
@ -894,7 +897,7 @@ module Hbase
end end
end end
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT)
compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT).upcase compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT).upcase.to_sym
unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression) unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression)
raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" ")) raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" "))
else else
@ -906,7 +909,7 @@ module Hbase
family.setStoragePolicy(storage_policy) family.setStoragePolicy(storage_policy)
end end
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY)
mob_partition_policy = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY).upcase mob_partition_policy = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY).upcase.to_sym
unless org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.include?(mob_partition_policy) unless org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.include?(mob_partition_policy)
raise(ArgumentError, "MOB_COMPACT_PARTITION_POLICY #{mob_partition_policy} is not supported. Use one of " + org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.join(" ")) raise(ArgumentError, "MOB_COMPACT_PARTITION_POLICY #{mob_partition_policy} is not supported. Use one of " + org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.join(" "))
else else

View File

@ -154,7 +154,7 @@ module Hbase
yield(user_name, "#{namespace},#{table},#{family},#{qualifier}: #{action.to_s}") yield(user_name, "#{namespace},#{table},#{family},#{qualifier}: #{action.to_s}")
else else
res[user_name] ||= {} res[user_name] ||= {}
res[user_name][family + ":" +qualifier] = action res[user_name]["#{family}:#{qualifier}"] = action
end end
count += 1 count += 1
end end

View File

@ -27,9 +27,9 @@
# whether the table exists and returns nil regardless. # whether the table exists and returns nil regardless.
include Java include Java
include_class('java.lang.Integer') {|package,name| "J#{name}" } java_import('java.lang.Integer') { |_package, name| "J#{name}" }
include_class('java.lang.Long') {|package,name| "J#{name}" } java_import('java.lang.Long') { |_package, name| "J#{name}" }
include_class('java.lang.Boolean') {|package,name| "J#{name}" } java_import('java.lang.Boolean') { |_package, name| "J#{name}" }
module HBaseConstants module HBaseConstants
COLUMN = "COLUMN" COLUMN = "COLUMN"

View File

@ -19,7 +19,7 @@
require 'rbconfig' require 'rbconfig'
module IRB module IRB
WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/ WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
# Subclass of IRB so can intercept methods # Subclass of IRB so can intercept methods
class HIRB < Irb class HIRB < Irb

View File

@ -39,7 +39,9 @@ module Shell
translate_hbase_exceptions(*args) { send(cmd, *args) } translate_hbase_exceptions(*args) { send(cmd, *args) }
rescue => e rescue => e
rootCause = e rootCause = e
while rootCause != nil && rootCause.respond_to?(:cause) && rootCause.cause != nil
# JRuby9000 made RubyException respond to cause, ignore it for back compat
while !rootCause.is_a?(Exception) && rootCause.respond_to?(:cause) && !rootCause.cause.nil?
rootCause = rootCause.cause rootCause = rootCause.cause
end end
if @shell.interactive? if @shell.interactive?
@ -105,13 +107,8 @@ module Shell
def translate_hbase_exceptions(*args) def translate_hbase_exceptions(*args)
yield yield
rescue => e rescue => cause
# Since exceptions will be thrown from the java code, 'e' will always be NativeException. # let individual command handle exceptions first
# Check for the original java exception and use it if present.
raise e unless e.respond_to?(:cause) && e.cause != nil
cause = e.cause
# let individual command handle exceptions first
if self.respond_to?(:handle_exceptions) if self.respond_to?(:handle_exceptions)
self.handle_exceptions(cause, *args) self.handle_exceptions(cause, *args)
end end
@ -153,7 +150,7 @@ module Shell
end end
# Throw the other exception which hasn't been handled above # Throw the other exception which hasn't been handled above
raise e raise cause
end end
end end
end end

View File

@ -31,10 +31,13 @@ module Shell
end end
def refresh_width() def refresh_width()
@max_width = 0
if $stdout.tty? if $stdout.tty?
@max_width = Java::jline.Terminal.getTerminal().getTerminalWidth() begin
else @max_width = Java::jline.TerminalFactory.get.getWidth
@max_width = 0 rescue NameError => e
# nocommit debug log and ignore
end
end end
end end

View File

@ -58,7 +58,7 @@ public abstract class AbstractTestShell {
List<String> loadPaths = new ArrayList<>(2); List<String> loadPaths = new ArrayList<>(2);
loadPaths.add("src/main/ruby"); loadPaths.add("src/main/ruby");
loadPaths.add("src/test/ruby"); loadPaths.add("src/test/ruby");
jruby.getProvider().setLoadPaths(loadPaths); jruby.setLoadPaths(loadPaths);
jruby.put("$TEST_CLUSTER", TEST_UTIL); jruby.put("$TEST_CLUSTER", TEST_UTIL);
System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging.verbose", "true");
System.setProperty("jruby.jit.logging", "true"); System.setProperty("jruby.jit.logging", "true");

View File

@ -39,7 +39,7 @@ public class TestShellNoCluster extends AbstractTestShell {
List<String> loadPaths = new ArrayList<>(2); List<String> loadPaths = new ArrayList<>(2);
loadPaths.add("src/main/ruby"); loadPaths.add("src/main/ruby");
loadPaths.add("src/test/ruby"); loadPaths.add("src/test/ruby");
jruby.getProvider().setLoadPaths(loadPaths); jruby.setLoadPaths(loadPaths);
jruby.put("$TEST_CLUSTER", TEST_UTIL); jruby.put("$TEST_CLUSTER", TEST_UTIL);
System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging.verbose", "true");
System.setProperty("jruby.jit.logging", "true"); System.setProperty("jruby.jit.logging", "true");

View File

@ -77,7 +77,7 @@ public class TestShellRSGroups {
List<String> loadPaths = new ArrayList<>(2); List<String> loadPaths = new ArrayList<>(2);
loadPaths.add(basePath+"/src/main/ruby"); loadPaths.add(basePath+"/src/main/ruby");
loadPaths.add(basePath+"/src/test/ruby"); loadPaths.add(basePath+"/src/test/ruby");
jruby.getProvider().setLoadPaths(loadPaths); jruby.setLoadPaths(loadPaths);
jruby.put("$TEST_CLUSTER", TEST_UTIL); jruby.put("$TEST_CLUSTER", TEST_UTIL);
System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging.verbose", "true");
System.setProperty("jruby.jit.logging", "true"); System.setProperty("jruby.jit.logging", "true");

View File

@ -248,8 +248,8 @@ module Hbase
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
define_test "describe should fail for non-existent tables" do define_test "describe should fail for non-existent tables" do
assert_raise(NativeException) do assert_raise(ArgumentError) do
admin.describe('.NOT.EXISTS.') admin.describe('NOT.EXISTS')
end end
end end

View File

@ -1262,7 +1262,7 @@
<jersey.version>2.22.2</jersey.version> <jersey.version>2.22.2</jersey.version>
<jetty6.version>6.1.26</jetty6.version> <jetty6.version>6.1.26</jetty6.version>
<jetty.jspapi.version>6.1.14</jetty.jspapi.version> <jetty.jspapi.version>6.1.14</jetty.jspapi.version>
<jruby.version>1.6.8</jruby.version> <jruby.version>9.1.9.0</jruby.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version> <hamcrest.version>1.3</hamcrest.version>
<htrace.version>3.1.0-incubating</htrace.version> <htrace.version>3.1.0-incubating</htrace.version>
@ -1280,8 +1280,9 @@
<jettison.version>1.3.3</jettison.version> <jettison.version>1.3.3</jettison.version>
<netty.version>4.1.1.Final</netty.version> <netty.version>4.1.1.Final</netty.version>
<netty.hadoop.version>3.6.2.Final</netty.hadoop.version> <netty.hadoop.version>3.6.2.Final</netty.hadoop.version>
<joni.version>2.1.2</joni.version> <!--Make sure these joni/jcodings are compatible with the versions used by jruby-->
<jcodings.version>1.0.8</jcodings.version> <joni.version>2.1.11</joni.version>
<jcodings.version>1.0.18</jcodings.version>
<spy.version>2.11.6</spy.version> <spy.version>2.11.6</spy.version>
<bouncycastle.version>1.46</bouncycastle.version> <bouncycastle.version>1.46</bouncycastle.version>
<kerby.version>1.0.0-RC2</kerby.version> <kerby.version>1.0.0-RC2</kerby.version>