hbase-jruby 0.6.1-java → 0.6.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f32321b68a2ef60bd0f6204024a66f2128cfa063
4
- data.tar.gz: 09db1b0e3acde863d431e2ab53b56a300d728a2e
3
+ metadata.gz: 45fb6da67d84e5b2640f383441c9c5a97368acff
4
+ data.tar.gz: 4ca5274110f4a56277dd5671e6e8f35524214e16
5
5
  SHA512:
6
- metadata.gz: ccadd29f6013b881ae8293958d62bede38a735f649fb558e2baced52ce48ef830222fe4bcc9fc74285c70eff9b23f7a3bf19802dd8a01f59c1e2f5760df7b44b
7
- data.tar.gz: 106a15062df3e5c9c04d1dd9a906c130d1bd4cfd2621f33166bc7d30d0c0816777ec651b89459494fcce0547b822d1750bff231a5cc327be185f3fd2efe0eb6a
6
+ metadata.gz: 068015d5dcdf8f374251f31571b7549b0fb77ad82c915e6218d564705e547f365647466d45c21027bffd895e48128e20743b6f759d7497fdf77034b3cb858013
7
+ data.tar.gz: 6bbdbbb27743a7da0e079de10566b9adbad77e9866beeb560f697f97987233fff21c3ad428ad0e6fb8dbc2e32b72f245c0431f9f5b26afdae69b3ec10fb4c613
@@ -1,6 +1,15 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.6.2
5
+ -----
6
+
7
+ - Removed automatic cleanup of thread-local HTable instances
8
+ - Fixes issue #35
9
+ - Close of individual HTable instance turned out to be unnecessary
10
+ - `flushCommits` not required as `hbase-jruby` runs in auto-flush mode
11
+ - No need to close shared connection or its thread pool
12
+
4
13
  0.6.1
5
14
  -----
6
15
 
@@ -74,7 +74,6 @@ class HBase
74
74
  else
75
75
  HTablePool.new @config, java.lang.Integer::MAX_VALUE
76
76
  end
77
- @threads = Set.new
78
77
  @mutex = Mutex.new
79
78
  @schema = Schema.new
80
79
  @closed = false
@@ -107,7 +106,6 @@ class HBase
107
106
  unless @closed
108
107
  @closed = true
109
108
  @htable_pool.close if use_table_pool?
110
- clear_thread_locals
111
109
  @connection.close
112
110
 
113
111
  # To be deprecated
@@ -190,7 +188,6 @@ class HBase
190
188
  raise RuntimeError, 'Not using table pool' unless use_table_pool?
191
189
 
192
190
  @mutex.synchronize do
193
- clear_thread_locals
194
191
  @htable_pool.close
195
192
  @htable_pool = HTablePool.new @config, java.lang.Integer::MAX_VALUE
196
193
  end
@@ -198,32 +195,6 @@ class HBase
198
195
  end
199
196
 
200
197
  private
201
- def register_thread t
202
- # (NOTE) The cleanup routine can be inefficient when the number of
203
- # concurrent threads becomes large. However, since it is not likely that
204
- # there will be more than a few hundred threads in a typical JRuby process
205
- # and the code is executed only once per thread, let's simply assume that
206
- # it's okay.
207
- @mutex.synchronize do
208
- check_closed
209
- @threads << t
210
- alives, deads = @threads.partition { |e| e.alive? }
211
- @threads = Set.new(alives)
212
- deads.each do |dead|
213
- (dead[:hbase_jruby].delete(self) || {}).each do |_, htable|
214
- htable.close rescue nil
215
- end
216
- end
217
- end
218
- end
219
-
220
- def clear_thread_locals
221
- # Cleanup thread-local references
222
- @threads.each do |thr|
223
- thr[:hbase_jruby].delete self
224
- end
225
- end
226
-
227
198
  def get_htable name
228
199
  (@htable_pool || @connection).get_table name
229
200
  end
@@ -23,7 +23,6 @@ class Table
23
23
  # [:hbase_jruby][HBase connection][Table name]
24
24
  local_vars = Thread.current[:hbase_jruby] ||= {}
25
25
  unless local_htables = local_vars[@hbase]
26
- @hbase.send :register_thread, Thread.current
27
26
  local_htables = local_vars[@hbase] = {}
28
27
  end
29
28
  local_htables[@name] ||= @hbase.send :get_htable, @name
@@ -1,5 +1,5 @@
1
1
  class HBase
2
2
  module JRuby
3
- VERSION = '0.6.1'
3
+ VERSION = '0.6.2'
4
4
  end
5
5
  end
@@ -34,8 +34,6 @@ class TestHBase < TestHBaseJRubyBase
34
34
  assert @hbase.closed?
35
35
  assert table.closed?
36
36
 
37
- assert !Thread.current[:hbase_jruby].has_key?(@hbase)
38
-
39
37
  assert_raise(RuntimeError) { @hbase.list }
40
38
  assert_raise(RuntimeError) { table.exists? }
41
39
  assert_raise(RuntimeError) { table.drop! }
@@ -110,12 +108,6 @@ class TestHBase < TestHBaseJRubyBase
110
108
  # Now close the connection
111
109
  hbase2.close
112
110
 
113
- # Threads-local htable cache deleted
114
- assert_nil Thread.current[:hbase_jruby][hbase2]
115
- threads.each do |t|
116
- assert_nil t[:hbase_jruby][hbase2]
117
- end
118
-
119
111
  # Connection is already closed
120
112
  assert_raise(RuntimeError) { hbase2[TABLE] }
121
113
  assert_raise(RuntimeError) { table.htable }
@@ -20,20 +20,6 @@ class TestTable < TestHBaseJRubyBase
20
20
  end
21
21
  assert_equal 1, htables.uniq.length
22
22
 
23
- # Multi-threaded
24
- htables = []
25
- table = @hbase.table(TABLE)
26
- nthr = num_managed_threads
27
- 4.times do
28
- Thread.new {
29
- htables << table.htable
30
- assert_equal nthr + 1, num_managed_threads
31
- }.join
32
- end
33
- assert_equal 4, htables.uniq.length
34
- # XXX Implementation detail
35
- assert_equal nthr + 1, num_managed_threads
36
-
37
23
  assert_equal @hbase.table(TABLE).htable, @hbase[TABLE].htable
38
24
  end
39
25
 
@@ -49,30 +35,6 @@ class TestTable < TestHBaseJRubyBase
49
35
  assert_equal 2, htables.length
50
36
  end
51
37
 
52
- def num_managed_threads
53
- @hbase.instance_variable_get(:@threads).length
54
- end
55
-
56
- # FIXME
57
- # - Implementation detail
58
- # - Naive assertion
59
- # - Race condition
60
- def test_autoclose_htables
61
- nthr = num_managed_threads
62
- threads = 50.times.map { |i|
63
- Thread.new {
64
- @hbase[TABLE].htable
65
- sleep 0.5
66
- }
67
- }
68
- sleep 1
69
- assert num_managed_threads > nthr
70
-
71
- nthr = num_managed_threads
72
- Thread.new { @hbase[TABLE].htable }.join
73
- assert num_managed_threads < nthr
74
- end
75
-
76
38
  def test_put_then_get
77
39
  row1 = next_rowkey.to_s
78
40
  row2 = next_rowkey.to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hbase-jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: java
6
6
  authors:
7
7
  - Junegunn Choi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit