hbase-jruby 0.1.5-java → 0.1.6-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.1.6
5
+ -----
6
+ - Maven dependencies for 0.94 and 0.92
7
+ - Progress reporting for synchronous table administration
8
+ - Added asynchronous versions of table administration methods
9
+
4
10
  0.1.5
5
11
  -----
6
12
  - Added support for shorter integers
data/README.md CHANGED
@@ -17,7 +17,7 @@ Anyhow, JRuby is Ruby, not Java, right?
17
17
  ```ruby
18
18
  require 'hbase-jruby'
19
19
 
20
- HBase.resolve_dependency! 'cdh4.1.2'
20
+ HBase.resolve_dependency! 'cdh4.1'
21
21
 
22
22
  hbase = HBase.new
23
23
  table = hbase.table(:test_table)
@@ -47,7 +47,16 @@ table.delete(:rowkey9)
47
47
 
48
48
  ## Installation
49
49
 
50
- $ gem install hbase-jruby
50
+ ### From Rubygems
51
+
52
+ gem install hbase-jruby
53
+
54
+ ### From source
55
+
56
+ git clone -b devel https://github.com/junegunn/hbase-jruby.git
57
+ cd hbase-jruby
58
+ rake build
59
+ gem install pkg/hbase-jruby-0.1.6-java.gem
51
60
 
52
61
  ## Setting up
53
62
 
@@ -62,18 +71,19 @@ which automatically resolves Hadoop/HBase dependency.
62
71
  #### Preconfigured dependencies
63
72
 
64
73
  Apache Maven is the de facto standard dependency management mechanism for Java projects.
65
- Current version of *hbase-jruby* is shipped with Maven dependency specifications
74
+ Current version of *hbase-jruby* is shipped with
75
+ [Maven dependency specifications](https://github.com/junegunn/hbase-jruby/blob/master/lib/hbase-jruby/pom/pom.xml)
66
76
  for the following Hadoop/HBase distributions.
67
77
 
68
- * [cdh4.1.2](https://github.com/junegunn/hbase-jruby/blob/master/lib/hbase-jruby/pom/cdh4.1.2.xml)
69
- * Recommended as of now
70
- * [cdh3u5](https://github.com/junegunn/hbase-jruby/blob/master/lib/hbase-jruby/pom/cdh3u5.xml)
71
- * Does not support some features
78
+ * cdh4.1
79
+ * cdh3
80
+ * 0.94
81
+ * 0.92
72
82
 
73
83
  ```ruby
74
84
  require 'hbase-jruby'
75
85
 
76
- HBase.resolve_dependency! 'cdh4.1.2'
86
+ HBase.resolve_dependency! 'cdh4.1'
77
87
  ```
78
88
 
79
89
  (If you're behind an http proxy, set up your ~/.m2/settings.xml file
@@ -693,7 +703,7 @@ ba.unshift 200, true
693
703
  ba << { short: 300 }
694
704
  ```
695
705
 
696
- concatenate another ByteArray,
706
+ concatenate another ByteArray,
697
707
 
698
708
  ```ruby
699
709
  ba += HBase::ByteArray(1024)
@@ -718,7 +728,10 @@ ba.java # Returns the native Java byte array (byte[])
718
728
 
719
729
  ### Table administration
720
730
 
721
- `HBase#Table` provides a few *synchronous* table administration methods.
731
+ `HBase#Table` provides a few synchronous (`HTable#method_name!`) and
732
+ asynchronous (`HTable#method_name`) table administration methods.
733
+ Synchronous *bang* methods for table alteration take an optional block and pass the progress of the operation to it
734
+ as a pair of parameters, the number of regions processed and total number of regions to process.
722
735
 
723
736
  ```ruby
724
737
  # Create a table with configurable table-level properties
@@ -730,14 +743,25 @@ table.create!(
730
743
  :max_filesize => 256 * 1024 ** 2,
731
744
  :deferred_log_flush => false)
732
745
 
733
- # Alter table properties
734
- table.alter!(
746
+ # Alter table properties (asynchronous)
747
+ table.alter(
735
748
  :max_filesize => 512 * 1024 ** 2,
736
749
  :memstore_flushsize => 64 * 1024 ** 2,
737
750
  :readonly => false,
738
751
  :deferred_log_flush => true
739
752
  )
740
753
 
754
+ # Alter table properties (synchronous)
755
+ table.alter!(
756
+ :max_filesize => 512 * 1024 ** 2,
757
+ :memstore_flushsize => 64 * 1024 ** 2,
758
+ :readonly => false,
759
+ :deferred_log_flush => true
760
+ ) { |progress, total|
761
+ # Progress report with an optional block
762
+ puts [progress, total].join('/')
763
+ }
764
+
741
765
  # Add column family
742
766
  table.add_family! :cf3, :compression => :snappy,
743
767
  :bloomfilter => :row
@@ -782,6 +806,7 @@ end
782
806
  ```bash
783
807
  # Bash script
784
808
  export HBASE_JRUBY_TEST_ZK='your-hbaase.domain.net'
809
+ export HBASE_JRUBY_TEST_DIST='0.94'
785
810
 
786
811
  # Test both for 1.8 and 1.9
787
812
  for v in --1.8 --1.9; do
@@ -1,26 +1,28 @@
1
- require 'thread'
2
-
3
1
  class HBase
4
2
  # @private
5
3
  module Admin
6
4
  private
7
5
  def with_admin
8
- (@admin_mutex ||= Mutex.new).synchronize do
9
- begin
10
- admin = HBaseAdmin.new(@config)
11
- yield admin
12
- ensure
13
- admin.close if admin
14
- end
6
+ begin
7
+ admin = HBaseAdmin.new(@config)
8
+ yield admin
9
+ ensure
10
+ admin.close if admin
15
11
  end
16
12
  end
17
13
 
18
- def wait_async_admin admin
14
+ def wait_async_admin admin, &block
15
+ prev_yet = nil
19
16
  while true
20
17
  pair = admin.getAlterStatus(@name.to_java_bytes)
21
18
  yet = pair.getFirst
22
19
  total = pair.getSecond
23
20
 
21
+ if block && yet != prev_yet
22
+ block.call (total - yet), total
23
+ prev_yet = yet
24
+ end
25
+
24
26
  break if yet == 0
25
27
  sleep 1
26
28
  end
@@ -23,36 +23,22 @@ class HBase
23
23
  mvn = `which mvn`
24
24
  raise RuntimeError, "Cannot find executable `mvn`" if mvn.empty?
25
25
 
26
- distname = dist.downcase.sub(/\.xml$/, '')
27
- path = [
28
- File.expand_path("../pom/#{distname}.xml", __FILE__),
29
- dist.to_s,
30
- ].select { |f| File.exists? f }.first
31
-
32
- # Try github head
33
- unless path
34
- begin
35
- xml = open("https://raw.github.com/junegunn/hbase-jruby/master/lib/hbase-jruby/pom/#{distname}.xml").read
36
- tempfiles << tf = Tempfile.new("#{distname}.xml")
37
- tf.close(false)
38
- path = tf.path
39
- File.open(path, 'w') do |f|
40
- f << xml
41
- end
42
- rescue OpenURI::HTTPError => e
43
- # No such distribution anywhere. Leave path to be nil.
44
- end
26
+ if File.exists?(dist)
27
+ path = dist
28
+ else
29
+ path = File.expand_path("../pom/pom.xml", __FILE__)
30
+ profile = "-P #{dist}"
45
31
  end
46
32
 
47
- raise ArgumentError, "Invalid distribution: #{dist}" unless path
48
-
49
33
  # Download dependent JAR files and build classpath string
50
34
  tempfiles << tf = Tempfile.new('hbase-jruby-classpath')
51
35
  tf.close(false)
52
- system "mvn org.apache.maven.plugins:maven-dependency-plugin:2.5.1:resolve org.apache.maven.plugins:maven-dependency-plugin:2.5.1:build-classpath -Dsilent=true -Dmdep.outputFile=#{tf.path} -f #{path} #{silencer}"
36
+ system "mvn org.apache.maven.plugins:maven-dependency-plugin:2.5.1:resolve org.apache.maven.plugins:maven-dependency-plugin:2.5.1:build-classpath -Dsilent=true -Dmdep.outputFile=#{tf.path} #{profile} -f #{path} #{silencer}"
53
37
 
54
38
  raise RuntimeError.new("Error occurred. Set verbose parameter to see the log.") unless $?.exitstatus == 0
55
39
 
40
+ output = File.read(tf.path)
41
+ raise ArgumentError.new("Invalid profile: #{dist}") if output.empty?
56
42
  File.read(tf.path).split(':')
57
43
  end
58
44
 
@@ -11,6 +11,11 @@ class HBase
11
11
  # Connects to HBase
12
12
  # @param [Hash] config A key-value pairs to build HBaseConfiguration from
13
13
  def initialize config = {}
14
+ unless defined?(Java::OrgApacheHadoopConf::Configuration)
15
+ raise NameError.new(
16
+ "Required Java classes not loaded. Set up CLASSPATH or try `HBase.resolve_dependency!`")
17
+ end
18
+
14
19
  HBase.import_java_classes!
15
20
 
16
21
  @config =
@@ -0,0 +1,201 @@
1
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+
5
+ <groupId>hbase-jruby</groupId>
6
+ <artifactId>hbase-project</artifactId>
7
+ <version>0.1.6</version>
8
+ <packaging>jar</packaging>
9
+
10
+ <name>hbase-jruby</name>
11
+
12
+ <profiles>
13
+ <profile>
14
+ <id>cdh4.1</id>
15
+ <properties>
16
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17
+ <hadoop.version>2.0.0-cdh4.1.2</hadoop.version>
18
+ <hbase.version>0.92.1-cdh4.1.2</hbase.version>
19
+ </properties>
20
+ <repositories>
21
+ <repository>
22
+ <id>cloudera-releases</id>
23
+ <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
24
+ <releases>
25
+ <enabled>true</enabled>
26
+ </releases>
27
+ <snapshots>
28
+ <enabled>false</enabled>
29
+ </snapshots>
30
+ </repository>
31
+ </repositories>
32
+
33
+ <dependencies>
34
+ <dependency>
35
+ <groupId>org.apache.hadoop</groupId>
36
+ <artifactId>hadoop-common</artifactId>
37
+ <version>${hadoop.version}</version>
38
+ <scope>compile</scope>
39
+ </dependency>
40
+
41
+ <dependency>
42
+ <groupId>org.apache.hbase</groupId>
43
+ <artifactId>hbase</artifactId>
44
+ <version>${hbase.version}</version>
45
+ <scope>compile</scope>
46
+ </dependency>
47
+ </dependencies>
48
+ </profile>
49
+
50
+ <profile>
51
+ <id>cdh3</id>
52
+ <properties>
53
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
54
+ <hbase.version>0.90.6-cdh3u5</hbase.version>
55
+ <hadoop.version>0.20.2-cdh3u5</hadoop.version>
56
+ </properties>
57
+
58
+ <repositories>
59
+ <repository>
60
+ <id>cloudera-releases</id>
61
+ <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
62
+ <releases>
63
+ <enabled>true</enabled>
64
+ </releases>
65
+ <snapshots>
66
+ <enabled>false</enabled>
67
+ </snapshots>
68
+ </repository>
69
+ </repositories>
70
+
71
+ <dependencies>
72
+ <dependency>
73
+ <groupId>org.apache.hbase</groupId>
74
+ <artifactId>hbase</artifactId>
75
+ <version>${hbase.version}</version>
76
+ <scope>compile</scope>
77
+ </dependency>
78
+ </dependencies>
79
+ </profile>
80
+
81
+ <profile>
82
+ <id>0.92</id>
83
+ <properties>
84
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
85
+ <hadoop.version>1.1.1</hadoop.version>
86
+ <hbase.version>0.92.2</hbase.version>
87
+ </properties>
88
+
89
+ <dependencies>
90
+ <dependency>
91
+ <groupId>org.apache.hadoop</groupId>
92
+ <artifactId>hadoop-core</artifactId>
93
+ <version>${hadoop.version}</version>
94
+ <scope>compile</scope>
95
+ </dependency>
96
+
97
+ <dependency>
98
+ <groupId>org.apache.hbase</groupId>
99
+ <artifactId>hbase</artifactId>
100
+ <version>${hbase.version}</version>
101
+ <scope>compile</scope>
102
+ </dependency>
103
+ </dependencies>
104
+ </profile>
105
+
106
+ <profile>
107
+ <id>0.94</id>
108
+ <properties>
109
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
110
+ <hadoop.version>1.1.1</hadoop.version>
111
+ <hbase.version>0.94.3</hbase.version>
112
+ </properties>
113
+
114
+ <dependencies>
115
+ <dependency>
116
+ <groupId>org.apache.hadoop</groupId>
117
+ <artifactId>hadoop-core</artifactId>
118
+ <version>${hadoop.version}</version>
119
+ <scope>compile</scope>
120
+ </dependency>
121
+
122
+ <dependency>
123
+ <groupId>org.apache.hbase</groupId>
124
+ <artifactId>hbase</artifactId>
125
+ <version>${hbase.version}</version>
126
+ <scope>compile</scope>
127
+ </dependency>
128
+ </dependencies>
129
+ </profile>
130
+
131
+ <!-- For backward compatibility -->
132
+ <profile>
133
+ <id>cdh4.1.2</id>
134
+ <properties>
135
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
136
+ <hadoop.version>2.0.0-cdh4.1.2</hadoop.version>
137
+ <hbase.version>0.92.1-cdh4.1.2</hbase.version>
138
+ </properties>
139
+ <repositories>
140
+ <repository>
141
+ <id>cloudera-releases</id>
142
+ <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
143
+ <releases>
144
+ <enabled>true</enabled>
145
+ </releases>
146
+ <snapshots>
147
+ <enabled>false</enabled>
148
+ </snapshots>
149
+ </repository>
150
+ </repositories>
151
+
152
+ <dependencies>
153
+ <dependency>
154
+ <groupId>org.apache.hadoop</groupId>
155
+ <artifactId>hadoop-common</artifactId>
156
+ <version>${hadoop.version}</version>
157
+ <scope>compile</scope>
158
+ </dependency>
159
+
160
+ <dependency>
161
+ <groupId>org.apache.hbase</groupId>
162
+ <artifactId>hbase</artifactId>
163
+ <version>${hbase.version}</version>
164
+ <scope>compile</scope>
165
+ </dependency>
166
+ </dependencies>
167
+ </profile>
168
+
169
+ <profile>
170
+ <id>cdh3u5</id>
171
+ <properties>
172
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
173
+ <hbase.version>0.90.6-cdh3u5</hbase.version>
174
+ <hadoop.version>0.20.2-cdh3u5</hadoop.version>
175
+ </properties>
176
+
177
+ <repositories>
178
+ <repository>
179
+ <id>cloudera-releases</id>
180
+ <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
181
+ <releases>
182
+ <enabled>true</enabled>
183
+ </releases>
184
+ <snapshots>
185
+ <enabled>false</enabled>
186
+ </snapshots>
187
+ </repository>
188
+ </repositories>
189
+
190
+ <dependencies>
191
+ <dependency>
192
+ <groupId>org.apache.hbase</groupId>
193
+ <artifactId>hbase</artifactId>
194
+ <version>${hbase.version}</version>
195
+ <scope>compile</scope>
196
+ </dependency>
197
+ </dependencies>
198
+ </profile>
199
+ </profiles>
200
+ </project>
201
+
@@ -4,11 +4,18 @@ class Scoped
4
4
  # @author Junegunn Choi <junegunn.c@gmail.com>
5
5
  module Aggregation
6
6
  module Admin
7
- # Enables aggregation support for the table
7
+ # Enables aggregation support for the table (asynchronous)
8
8
  # @return [nil]
9
- def enable_aggregation!
9
+ def enable_aggregation
10
10
  cpc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation'
11
- add_coprocessor! cpc unless has_coprocessor?(cpc)
11
+ add_coprocessor cpc unless has_coprocessor?(cpc)
12
+ end
13
+
14
+ # Enables aggregation support for the table (synchronous)
15
+ # @return [nil]
16
+ def enable_aggregation! &block
17
+ cpc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation'
18
+ add_coprocessor! cpc, &block unless has_coprocessor?(cpc)
12
19
  end
13
20
  end
14
21
 
@@ -106,7 +106,7 @@ class Table
106
106
  todo.call if todo # Avoids mutex relocking
107
107
  end
108
108
 
109
- # Alters the table
109
+ # Alters the table (synchronous)
110
110
  # @param [Hash] props Table properties
111
111
  # @return [nil]
112
112
  # @example
@@ -116,53 +116,55 @@ class Table
116
116
  # :readonly => false,
117
117
  # :deferred_log_flush => true
118
118
  # )
119
- def alter! props
120
- with_admin do |admin|
121
- htd = admin.get_table_descriptor(@name.to_java_bytes)
122
- patch_table_descriptor! htd, props
123
- while_disabled(admin) do
124
- admin.modifyTable @name.to_java_bytes, htd
125
- wait_async_admin(admin)
126
- end
127
- end
119
+ def alter! props, &block
120
+ _alter props, true, &block
128
121
  end
129
122
 
130
- # Adds the column family
123
+ # Alters the table (asynchronous)
124
+ # @see HBase::Table#alter!
125
+ def alter props
126
+ _alter props, false
127
+ end
128
+
129
+ # Adds the column family (synchronous)
131
130
  # @param [#to_s] name The name of the column family
132
131
  # @param [Hash] opts Column family properties
133
132
  # @return [nil]
134
- def add_family! name, opts
135
- with_admin do |admin|
136
- while_disabled(admin) do
137
- admin.addColumn @name, hcd(name.to_s, opts)
138
- wait_async_admin(admin)
139
- end
140
- end
133
+ def add_family! name, opts, &block
134
+ _add_family name, opts, true, &block
135
+ end
136
+
137
+ # Adds the column family (asynchronous)
138
+ # @see HBase::Table#add_family!
139
+ def add_family name, opts
140
+ _add_family name, opts, false
141
141
  end
142
142
 
143
143
  # Alters the column family
144
144
  # @param [#to_s] name The name of the column family
145
145
  # @param [Hash] opts Column family properties
146
146
  # @return [nil]
147
- def alter_family! name, opts
148
- with_admin do |admin|
149
- while_disabled(admin) do
150
- admin.modifyColumn @name, hcd(name.to_s, opts)
151
- wait_async_admin(admin)
152
- end
153
- end
147
+ def alter_family! name, opts, &block
148
+ _alter_family name, opts, true, &block
149
+ end
150
+
151
+ # Alters the column family (asynchronous)
152
+ # @see HBase::Table#alter_family!
153
+ def alter_family name, opts
154
+ _alter_family name, opts, false
154
155
  end
155
156
 
156
157
  # Removes the column family
157
158
  # @param [#to_s] name The name of the column family
158
159
  # @return [nil]
159
- def delete_family! name
160
- with_admin do |admin|
161
- while_disabled(admin) do
162
- admin.deleteColumn @name, name.to_s
163
- wait_async_admin(admin)
164
- end
165
- end
160
+ def delete_family! name, &block
161
+ _delete_family name, true, &block
162
+ end
163
+
164
+ # Removes the column family (asynchronous)
165
+ # @see HBase::Table#delete_family!
166
+ def delete_family name
167
+ _delete_family name, false
166
168
  end
167
169
 
168
170
  # Adds the table coprocessor to the table
@@ -171,39 +173,26 @@ class Table
171
173
  # @option props [String] path The path of the JAR file
172
174
  # @option props [Fixnum] priority Coprocessor priority
173
175
  # @option props [Hash<#to_s, #to_s>] params Arbitrary key-value parameter pairs passed into the coprocessor
174
- def add_coprocessor! class_name, props = {}
175
- with_admin do |admin|
176
- while_disabled(admin) do
176
+ def add_coprocessor! class_name, props = {}, &block
177
+ _add_coprocessor class_name, props, true, &block
178
+ end
177
179
 
178
- htd = admin.get_table_descriptor(@name.to_java_bytes)
179
- if props.empty?
180
- htd.addCoprocessor class_name
181
- else
182
- path, priority, params = props.values_at :path, :priority, :params
183
- params = Hash[ params.map { |k, v| [k.to_s, v.to_s] } ]
184
- htd.addCoprocessor class_name, path, priority || Coprocessor::PRIORITY_USER, params
185
- end
186
- admin.modifyTable @name.to_java_bytes, htd
187
- wait_async_admin(admin)
188
- end
189
- end
180
+ # Adds the table coprocessor to the table (asynchronous)
181
+ def add_coprocessor class_name, props = {}
182
+ _add_coprocessor class_name, props, false
190
183
  end
191
184
 
192
185
  # Removes the coprocessor from the table.
193
186
  # @param [String] class_name Full class name of the coprocessor
194
187
  # @return [nil]
195
- def remove_coprocessor! name
196
- unless org.apache.hadoop.hbase.HTableDescriptor.respond_to?(:removeCoprocessor)
197
- raise NotImplementedError, "org.apache.hadoop.hbase.HTableDescriptor.removeCoprocessor not implemented"
198
- end
199
- with_admin do |admin|
200
- while_disabled(admin) do
201
- htd = admin.get_table_descriptor(@name.to_java_bytes)
202
- htd.removeCoprocessor name
203
- admin.modifyTable @name.to_java_bytes, htd
204
- wait_async_admin(admin)
205
- end
206
- end
188
+ def remove_coprocessor! class_name, &block
189
+ _remove_coprocessor class_name, true, &block
190
+ end
191
+
192
+ # Removes the coprocessor from the table (asynchronous)
193
+ # @see HBase::Table#remove_coprocessor!
194
+ def remove_coprocessor class_name
195
+ _remove_coprocessor class_name, false
207
196
  end
208
197
 
209
198
  # Return if the table has the coprocessor of the given class name
@@ -498,6 +487,76 @@ private
498
487
  end
499
488
  htd
500
489
  end
490
+
491
+ def _alter props, bang, &block
492
+ with_admin do |admin|
493
+ htd = admin.get_table_descriptor(@name.to_java_bytes)
494
+ patch_table_descriptor! htd, props
495
+ while_disabled(admin) do
496
+ admin.modifyTable @name.to_java_bytes, htd
497
+ wait_async_admin(admin, &block) if bang
498
+ end
499
+ end
500
+ end
501
+
502
+ def _add_family name, opts, bang, &block
503
+ with_admin do |admin|
504
+ while_disabled(admin) do
505
+ admin.addColumn @name, hcd(name.to_s, opts)
506
+ wait_async_admin(admin, &block) if bang
507
+ end
508
+ end
509
+ end
510
+
511
+ def _alter_family name, opts, bang, &block
512
+ with_admin do |admin|
513
+ while_disabled(admin) do
514
+ admin.modifyColumn @name, hcd(name.to_s, opts)
515
+ wait_async_admin(admin, &block) if bang
516
+ end
517
+ end
518
+ end
519
+
520
+ def _delete_family name, bang, &block
521
+ with_admin do |admin|
522
+ while_disabled(admin) do
523
+ admin.deleteColumn @name, name.to_s
524
+ wait_async_admin(admin, &block) if bang
525
+ end
526
+ end
527
+ end
528
+
529
+ def _add_coprocessor class_name, props = {}, bang, &block
530
+ with_admin do |admin|
531
+ while_disabled(admin) do
532
+
533
+ htd = admin.get_table_descriptor(@name.to_java_bytes)
534
+ if props.empty?
535
+ htd.addCoprocessor class_name
536
+ else
537
+ path, priority, params = props.values_at :path, :priority, :params
538
+ params = Hash[ params.map { |k, v| [k.to_s, v.to_s] } ]
539
+ htd.addCoprocessor class_name, path, priority || Coprocessor::PRIORITY_USER, params
540
+ end
541
+ admin.modifyTable @name.to_java_bytes, htd
542
+ wait_async_admin(admin, &block) if bang
543
+ end
544
+ end
545
+ end
546
+
547
+ def _remove_coprocessor name, bang, &block
548
+ unless org.apache.hadoop.hbase.HTableDescriptor.respond_to?(:removeCoprocessor)
549
+ raise NotImplementedError, "org.apache.hadoop.hbase.HTableDescriptor.removeCoprocessor not implemented"
550
+ end
551
+ with_admin do |admin|
552
+ while_disabled(admin) do
553
+ htd = admin.get_table_descriptor(@name.to_java_bytes)
554
+ htd.removeCoprocessor name
555
+ admin.modifyTable @name.to_java_bytes, htd
556
+ wait_async_admin(admin, &block) if bang
557
+ end
558
+ end
559
+ end
501
560
  end#Table
502
561
  end#HBase
503
562
 
@@ -1,5 +1,5 @@
1
1
  class HBase
2
2
  module JRuby
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
data/test/helper.rb CHANGED
@@ -11,7 +11,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
11
11
  require "hbase-jruby"
12
12
 
13
13
  # Required
14
- unless HBase.resolve_dependency!('cdh4.1.2').all? { |f| File.exists? f }
14
+ unless HBase.resolve_dependency!(ENV.fetch 'HBASE_JRUBY_TEST_DIST').all? { |f| File.exists? f }
15
15
  puts "Invalid return value from HBase.resolve_dependency!"
16
16
  exit 1
17
17
  end
@@ -81,14 +81,20 @@ class TestTableAdmin < TestHBaseJRubyBase
81
81
 
82
82
  max_fs = 512 * 1024 ** 2
83
83
  mem_fs = 64 * 1024 ** 2
84
-
84
+
85
+ progress = total = nil
85
86
  @table.alter!(
86
87
  :max_filesize => max_fs,
87
88
  :memstore_flushsize => mem_fs,
88
89
  :readonly => false,
89
90
  :deferred_log_flush => true
90
- )
91
-
91
+ ) do |p, t|
92
+ progress = p
93
+ total = t
94
+ end
95
+ assert_equal total, progress
96
+ assert progress > 0
97
+
92
98
  assert_equal max_fs, @table.descriptor.get_max_file_size
93
99
  assert_equal mem_fs, @table.descriptor.get_mem_store_flush_size
94
100
  assert_equal false, @table.descriptor.is_read_only
@@ -140,7 +146,7 @@ class TestTableAdmin < TestHBaseJRubyBase
140
146
  :blockcache => true,
141
147
  :blocksize => 128 * 1024,
142
148
  :bloomfilter => :row,
143
- :compression => :snappy,
149
+ :compression => :gzip,
144
150
  # :data_block_encoding => org.apache.hadoop.hbase.io.encoding.DataBlockEncoding::DIFF,
145
151
  # :encode_on_disk => true,
146
152
  # :keep_deleted_cells => true,
@@ -157,7 +163,7 @@ class TestTableAdmin < TestHBaseJRubyBase
157
163
  assert_equal 'ROW', cf[:bloomfilter]
158
164
  assert_equal '0', cf[:replication_scope]
159
165
  assert_equal '10', cf[:versions]
160
- assert_equal 'SNAPPY', cf[:compression]
166
+ assert_equal 'GZIP', cf[:compression]
161
167
  assert_equal '5', cf[:min_versions]
162
168
  assert_equal '100', cf[:ttl]
163
169
  assert_equal '131072', cf[:blocksize]
@@ -166,5 +172,5 @@ class TestTableAdmin < TestHBaseJRubyBase
166
172
 
167
173
  @table.drop!
168
174
  end
169
- end
175
+ end unless ENV['HBASE_JRUBY_TEST_SKIP_ADMIN']
170
176
 
metadata CHANGED
@@ -2,27 +2,27 @@
2
2
  name: hbase-jruby
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: java
7
7
  authors:
8
8
  - Junegunn Choi
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-02 00:00:00.000000000 Z
12
+ date: 2013-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
16
16
  version_requirements: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: !binary |-
21
21
  MA==
22
22
  none: false
23
23
  requirement: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: !binary |-
28
28
  MA==
@@ -33,14 +33,14 @@ dependencies:
33
33
  name: simplecov
34
34
  version_requirements: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - ! '>='
36
+ - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: !binary |-
39
39
  MA==
40
40
  none: false
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ! '>='
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: !binary |-
46
46
  MA==
@@ -54,7 +54,7 @@ executables: []
54
54
  extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
- - .gitignore
57
+ - ".gitignore"
58
58
  - CHANGELOG.md
59
59
  - Gemfile
60
60
  - LICENSE.txt
@@ -68,8 +68,7 @@ files:
68
68
  - lib/hbase-jruby/column_key.rb
69
69
  - lib/hbase-jruby/dependency.rb
70
70
  - lib/hbase-jruby/hbase.rb
71
- - lib/hbase-jruby/pom/cdh3u5.xml
72
- - lib/hbase-jruby/pom/cdh4.1.2.xml
71
+ - lib/hbase-jruby/pom/pom.xml
73
72
  - lib/hbase-jruby/result.rb
74
73
  - lib/hbase-jruby/scoped.rb
75
74
  - lib/hbase-jruby/scoped/aggregation.rb
@@ -95,14 +94,14 @@ require_paths:
95
94
  - lib
96
95
  required_ruby_version: !ruby/object:Gem::Requirement
97
96
  requirements:
98
- - - ! '>='
97
+ - - ">="
99
98
  - !ruby/object:Gem::Version
100
99
  version: !binary |-
101
100
  MA==
102
101
  none: false
103
102
  required_rubygems_version: !ruby/object:Gem::Requirement
104
103
  requirements:
105
- - - ! '>='
104
+ - - ">="
106
105
  - !ruby/object:Gem::Version
107
106
  version: !binary |-
108
107
  MA==
@@ -1,40 +0,0 @@
1
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
- <modelVersion>4.0.0</modelVersion>
4
-
5
- <groupId>com.daumcorp.datatech.hbase.client</groupId>
6
- <artifactId>hbase-project</artifactId>
7
- <version>cdh3u5</version>
8
- <packaging>jar</packaging>
9
-
10
- <name>hbase-jruby</name>
11
-
12
- <properties>
13
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14
- <hbase.version>0.90.6-cdh3u5</hbase.version>
15
- <hadoop.version>0.20.2-cdh3u5</hadoop.version>
16
- </properties>
17
-
18
- <repositories>
19
- <repository>
20
- <id>cloudera-releases</id>
21
- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
22
- <releases>
23
- <enabled>true</enabled>
24
- </releases>
25
- <snapshots>
26
- <enabled>false</enabled>
27
- </snapshots>
28
- </repository>
29
- </repositories>
30
-
31
- <dependencies>
32
- <dependency>
33
- <groupId>org.apache.hbase</groupId>
34
- <artifactId>hbase</artifactId>
35
- <version>${hbase.version}</version>
36
- <scope>compile</scope>
37
- </dependency>
38
- </dependencies>
39
- </project>
40
-
@@ -1,47 +0,0 @@
1
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
- <modelVersion>4.0.0</modelVersion>
4
-
5
- <groupId>com.daumcorp.datatech.hbase.client</groupId>
6
- <artifactId>hbase-project</artifactId>
7
- <version>cdh4</version>
8
- <packaging>jar</packaging>
9
-
10
- <name>hbase-jruby</name>
11
-
12
- <properties>
13
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14
- <hadoop.version>2.0.0-cdh4.1.2</hadoop.version>
15
- <hbase.version>0.92.1-cdh4.1.2</hbase.version>
16
- </properties>
17
-
18
- <repositories>
19
- <repository>
20
- <id>cloudera-releases</id>
21
- <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
22
- <releases>
23
- <enabled>true</enabled>
24
- </releases>
25
- <snapshots>
26
- <enabled>false</enabled>
27
- </snapshots>
28
- </repository>
29
- </repositories>
30
-
31
- <dependencies>
32
- <dependency>
33
- <groupId>org.apache.hadoop</groupId>
34
- <artifactId>hadoop-common</artifactId>
35
- <version>${hadoop.version}</version>
36
- <scope>compile</scope>
37
- </dependency>
38
-
39
- <dependency>
40
- <groupId>org.apache.hbase</groupId>
41
- <artifactId>hbase</artifactId>
42
- <version>${hbase.version}</version>
43
- <scope>compile</scope>
44
- </dependency>
45
- </dependencies>
46
- </project>
47
-