zookeeper-ng 1.5 → 1.5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +57 -0
- data/.gitmodules +1 -1
- data/CHANGELOG +15 -2
- data/README.markdown +5 -28
- data/Rakefile +5 -5
- data/ext/c_zookeeper.rb +16 -16
- data/ext/patches/{zkc-3.4.5-overflow.patch → zkc-3.4.5-buffer-overflow.patch} +4 -4
- data/ext/patches/zkc-3.4.5-config.patch +5454 -0
- data/ext/zkrb.c +7 -2
- data/java/java_base.rb +2 -4
- data/lib/zookeeper/version.rb +1 -1
- data/spec/forked_connection_spec.rb +3 -5
- data/spec/shared/connection_examples.rb +5 -1
- data/spec/support/10_spawn_zookeeper.rb +0 -4
- data/zookeeper.gemspec +11 -3
- metadata +9 -8
- data/.travis.yml +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6473be848423f7878fa40c93e2cc543fbdcb148ba4db39698e11d65ec4604375
|
4
|
+
data.tar.gz: c06ed9f06b9c07001ba2896a84fdbccbc786e9494306ac1dd8f2ccb0237183d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cc469179ea18351407272fc327c0177191bc9f9b598ffebb09b57234e5b918393fa5a3288e7b0427b4ea59d584f7b8cdb77543308fb5ab1bc2c20c8e50b6adf
|
7
|
+
data.tar.gz: bfdada1f2447cadfb6ee6074705ce82b9082ff9f44fbe58a03b7a762bc19c353663c504c2e9c15d5ea0a4b2ded427dc3fe555b9973c8a2837aca2c52f7c136a4
|
@@ -0,0 +1,57 @@
|
|
1
|
+
on:
|
2
|
+
pull_request:
|
3
|
+
branches:
|
4
|
+
- master
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Ruby ${{ matrix.ruby }} / GCC ${{ matrix.gcc }} / ${{ matrix.os }}
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
os:
|
17
|
+
- ubuntu-latest
|
18
|
+
- macos-latest
|
19
|
+
ruby:
|
20
|
+
- '2.5'
|
21
|
+
- '2.6'
|
22
|
+
- '2.7'
|
23
|
+
- '3.0'
|
24
|
+
- '3.1'
|
25
|
+
- 'jruby'
|
26
|
+
gcc:
|
27
|
+
- 7
|
28
|
+
- latest
|
29
|
+
exclude:
|
30
|
+
- os: macos-latest
|
31
|
+
gcc: 7
|
32
|
+
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
with:
|
36
|
+
submodules: recursive
|
37
|
+
|
38
|
+
- name: Set up GCC
|
39
|
+
if: ${{ matrix.gcc != 'latest' }}
|
40
|
+
uses: egor-tensin/setup-gcc@v1
|
41
|
+
with:
|
42
|
+
version: ${{ matrix.gcc }}
|
43
|
+
platform: x64
|
44
|
+
|
45
|
+
- name: Set up Ruby
|
46
|
+
uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
bundler-cache: true
|
50
|
+
cache-version: 1_${{ matrix.ruby }}_${{ matrix.os }}
|
51
|
+
|
52
|
+
- name: Run Tests
|
53
|
+
env:
|
54
|
+
RAILS_ENV: test
|
55
|
+
SPAWN_ZOOKEEPER: true
|
56
|
+
run: |
|
57
|
+
bundle exec rake
|
data/.gitmodules
CHANGED
data/CHANGELOG
CHANGED
@@ -1,5 +1,18 @@
|
|
1
|
-
v1.5
|
2
|
-
*
|
1
|
+
v1.5.2
|
2
|
+
* Ruby 3.1 compatibility (h/t: @casperisfine)
|
3
|
+
|
4
|
+
v1.5.1
|
5
|
+
* Update config.guess to support newer environments (h/t: @malmckay)
|
6
|
+
|
7
|
+
v1.5.0
|
8
|
+
* (housekeeping) Moves build to Github Actions from TravisCI
|
9
|
+
* (housekeeping) Drops build support for MRI Ruby < 2.5 and other rubies
|
10
|
+
* Build on Ruby 3 (#99) (h/t: @malmckay)
|
11
|
+
* Build on MacOS (#98) (h/t: @malmckay)
|
12
|
+
* Work around compiler errors on newer versions of gcc (#97) (h/t: @nickmarden)
|
13
|
+
* Fix a typo on a has_key (#83) (h/t: @lexspoon)
|
14
|
+
* Adds support macOS dylib (#86) (h/t: @pftg)
|
15
|
+
* Fix compilation on ARM (#82) (h/t: @cdonati)
|
3
16
|
|
4
17
|
v1.4.11
|
5
18
|
* backported fix for ZOOKEEPER-2253 by @chchen - #76
|
data/README.markdown
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# zookeeper #
|
2
2
|
|
3
|
-
|
3
|
+
![Build Status](https://github.com/zk-ruby/zookeeper/actions/workflows/build.yml/badge.svg)
|
4
|
+
|
4
5
|
|
5
6
|
An interface to the Zookeeper cluster coordination server.
|
6
7
|
|
@@ -10,14 +11,10 @@ For a higher-level interface with a more convenient API and features such as loc
|
|
10
11
|
|
11
12
|
As of 1.1.0, this library is fork-safe (which was not easy to accomplish). This means you can use it without worry in unicorn, resque, and whatever other fork-philic frameworks you sick little monkeys are using this week. The only rule is that after a fork(), you need to call `#reopen` on the client ASAP, because if you try to peform any other action, an exception will be raised. Other than that, there is no special action that is needed in the parent.
|
12
13
|
|
13
|
-
## Big Plans for 1.0 ##
|
14
|
-
|
15
|
-
The 1.0 release will feature a reorganization of the heirarchy. There will be a single top-level `Zookeeper` namespace (as opposed to the current layout, with 5-6 different top-level constants), and for the next several releases, there will be a backwards compatible require for users that still need to use the old names.
|
16
|
-
|
17
14
|
## License
|
18
15
|
|
19
|
-
Copyright 2008 Phillip Pearson, and 2010 Twitter, Inc.
|
20
|
-
Licensed under the MIT License. See the included LICENSE file.
|
16
|
+
Copyright 2008 Phillip Pearson, and 2010 Twitter, Inc.
|
17
|
+
Licensed under the MIT License. See the included LICENSE file.
|
21
18
|
|
22
19
|
Portions copyright 2008-2010 the Apache Software Foundation, licensed under the
|
23
20
|
Apache 2 license, and used with permission.
|
@@ -28,26 +25,6 @@ Portions contributed to the open source community by HPDC, L.P.
|
|
28
25
|
|
29
26
|
sudo gem install zookeeper
|
30
27
|
|
31
|
-
### rbenv is awesome
|
32
|
-
|
33
|
-
UPDATE: this appears to have been fixed by @eric in [this patch](http://git.io/PEPgnA). If you use rbenv, please report any issues, but I believe it should work now.
|
34
|
-
|
35
|
-
Let me start out by saying I prefer rvm, and that I really don't know a whole lot about linking on OS X. Or Linux. Any suggestions or constructive insults would be greatly appreciated if you have insight into what i'm doing wrong here.
|
36
|
-
|
37
|
-
So, it seems that [ruby-build][] doesn't use `--enable-shared` by default. I'm told this is for speed.
|
38
|
-
|
39
|
-
If you run into problems with installing this gem (specifically with linking ex. `Undefined symbols for architecture x86_64`) and you're using rbenv, for now you need to ensure that your ruby was built with `--enable-shared`. I'm sorry for the inconvenience. (no, really)
|
40
|
-
|
41
|
-
```shell
|
42
|
-
~ $ CONFIGURE_OPTS='--enable-shared --disable-install-doc' rbenv install 1.9.3-p194
|
43
|
-
```
|
44
|
-
|
45
|
-
[ruby-build]: https://github.com/sstephenson/ruby-build
|
46
|
-
|
47
|
-
### A note for REE users
|
48
|
-
|
49
|
-
The zookeeper client is required to send a heartbeat packet every N seconds to the server. If it misses its deadline 3 times in a row, the session will be lost. The way the client is implemented in versions `>= 1.2`, a *ruby* thread acts as the event thread (this was necessary to provide a fork-safe client with a parent process that is able to preserve state). Some users have reported issues where under load in "massive codebases," they have problems where calls will time out. Given the nature of the thread scheduler in 1.8, one should be careful if upgrading from `0.4.4` to `>= 1.2`.
|
50
|
-
|
51
28
|
## Usage
|
52
29
|
|
53
30
|
Connect to a server:
|
@@ -75,7 +52,7 @@ Calls take a dictionary of parameters. With the exception of set\_acl, the only
|
|
75
52
|
|
76
53
|
### A Bit about this repository ###
|
77
54
|
|
78
|
-
Twitter's open source office was kind enough to transfer this repository to facilitate development and administration of this repository. The `zookeeper` gem's last three releases were recorded in branches `v0.4.2`, `v0.4.3` and `v0.4.4`. Releases of the `slyphon-zookeeper` gem were cut off of the fork, and unfortunately (due to an oversight on my part) were tagged with unrelated versions. Those were tagged with names `release/0.9.2`.
|
55
|
+
Twitter's open source office was kind enough to transfer this repository to facilitate development and administration of this repository. The `zookeeper` gem's last three releases were recorded in branches `v0.4.2`, `v0.4.3` and `v0.4.4`. Releases of the `slyphon-zookeeper` gem were cut off of the fork, and unfortunately (due to an oversight on my part) were tagged with unrelated versions. Those were tagged with names `release/0.9.2`.
|
79
56
|
|
80
57
|
The plan is to keep the `slyphon-zookeeper` tags, and to tag the `zookeeper` releases `twitter/release/0.4.x`.
|
81
58
|
|
data/Rakefile
CHANGED
@@ -38,7 +38,7 @@ if File.exists?(release_ops_path)
|
|
38
38
|
|
39
39
|
orig_dir = Dir.getwd
|
40
40
|
|
41
|
-
|
41
|
+
Dir.chdir tmpdir do
|
42
42
|
sh "git co #{tag} && git reset --hard && git clean -fdx"
|
43
43
|
|
44
44
|
ENV['JAVA_GEM'] = nil
|
@@ -77,7 +77,7 @@ end
|
|
77
77
|
VALGRIND_BASIC_OPTS = '--num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no --trace-children=yes'
|
78
78
|
|
79
79
|
task 'valgrind' do
|
80
|
-
|
80
|
+
Dir.chdir 'ext' do
|
81
81
|
sh "rake clean build"
|
82
82
|
end
|
83
83
|
|
@@ -86,7 +86,7 @@ end
|
|
86
86
|
|
87
87
|
namespace :build do
|
88
88
|
task :clean do
|
89
|
-
|
89
|
+
Dir.chdir 'ext' do
|
90
90
|
sh 'rake clean'
|
91
91
|
end
|
92
92
|
|
@@ -94,7 +94,7 @@ namespace :build do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
task :clobber do
|
97
|
-
|
97
|
+
Dir.chdir 'ext' do
|
98
98
|
sh 'rake clobber'
|
99
99
|
end
|
100
100
|
|
@@ -104,7 +104,7 @@ end
|
|
104
104
|
|
105
105
|
desc "Build C component"
|
106
106
|
task :build do
|
107
|
-
|
107
|
+
Dir.chdir 'ext' do
|
108
108
|
sh "rake"
|
109
109
|
end
|
110
110
|
end
|
data/ext/c_zookeeper.rb
CHANGED
@@ -48,7 +48,7 @@ class CZookeeper
|
|
48
48
|
|
49
49
|
# keep track of the pid that created us
|
50
50
|
update_pid!
|
51
|
-
|
51
|
+
|
52
52
|
# used by the C layer. CZookeeper sets this to true when the init method
|
53
53
|
# has completed. once this is set to true, it stays true.
|
54
54
|
#
|
@@ -68,7 +68,7 @@ class CZookeeper
|
|
68
68
|
@_receive_timeout_msec = opts[:receive_timeout_msec] || DEFAULT_RECEIVE_TIMEOUT_MSEC
|
69
69
|
|
70
70
|
@mutex = Monitor.new
|
71
|
-
|
71
|
+
|
72
72
|
# used to signal that we're running
|
73
73
|
@running_cond = @mutex.new_cond
|
74
74
|
|
@@ -80,7 +80,7 @@ class CZookeeper
|
|
80
80
|
@state = ZOO_CLOSED_STATE
|
81
81
|
|
82
82
|
@pipe_read, @pipe_write = IO.pipe
|
83
|
-
|
83
|
+
|
84
84
|
@event_thread = nil
|
85
85
|
|
86
86
|
# hash of in-flight Continuation instances
|
@@ -142,7 +142,7 @@ class CZookeeper
|
|
142
142
|
|
143
143
|
nil
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
# call this to stop the event loop, you can resume with the
|
147
147
|
# resume method
|
148
148
|
#
|
@@ -157,7 +157,7 @@ class CZookeeper
|
|
157
157
|
def resume_after_fork_in_parent
|
158
158
|
logger.debug { "##{__method__}" }
|
159
159
|
|
160
|
-
@mutex.synchronize do
|
160
|
+
@mutex.synchronize do
|
161
161
|
@_shutting_down = nil
|
162
162
|
start_event_thread
|
163
163
|
end
|
@@ -181,7 +181,7 @@ class CZookeeper
|
|
181
181
|
return false unless wait_until_running(timeout)
|
182
182
|
|
183
183
|
@state_mutex.synchronize do
|
184
|
-
while true
|
184
|
+
while true
|
185
185
|
if timeout
|
186
186
|
now = Time.now
|
187
187
|
break if (@state == ZOO_CONNECTED_STATE) || unhealthy? || (now > time_to_stop)
|
@@ -212,7 +212,7 @@ class CZookeeper
|
|
212
212
|
!unhealthy?
|
213
213
|
end
|
214
214
|
|
215
|
-
# submits a job for processing
|
215
|
+
# submits a job for processing
|
216
216
|
# blocks the caller until result has returned
|
217
217
|
def submit_and_block(meth, *args)
|
218
218
|
@mutex.synchronize do
|
@@ -230,9 +230,9 @@ class CZookeeper
|
|
230
230
|
wake_event_loop!
|
231
231
|
cnt.value
|
232
232
|
end
|
233
|
-
|
233
|
+
|
234
234
|
# this method is part of the reopen/close code, and is responsible for
|
235
|
-
# shutting down the dispatch thread.
|
235
|
+
# shutting down the dispatch thread.
|
236
236
|
#
|
237
237
|
# this method must be EXTERNALLY SYNCHRONIZED!
|
238
238
|
#
|
@@ -243,7 +243,7 @@ class CZookeeper
|
|
243
243
|
logger.debug { "##{__method__}" }
|
244
244
|
shut_down!
|
245
245
|
wake_event_loop!
|
246
|
-
@event_thread.join
|
246
|
+
@event_thread.join
|
247
247
|
@event_thread = nil
|
248
248
|
end
|
249
249
|
end
|
@@ -259,7 +259,7 @@ class CZookeeper
|
|
259
259
|
# or until timeout seconds have passed.
|
260
260
|
#
|
261
261
|
# returns true if we're running, false if we timed out
|
262
|
-
def wait_until_running(timeout=5)
|
262
|
+
def wait_until_running(timeout=5)
|
263
263
|
@mutex.synchronize do
|
264
264
|
return true if @_running
|
265
265
|
@running_cond.wait(timeout)
|
@@ -279,7 +279,7 @@ class CZookeeper
|
|
279
279
|
submit_pending_calls
|
280
280
|
end
|
281
281
|
|
282
|
-
zkrb_iterate_event_loop
|
282
|
+
zkrb_iterate_event_loop
|
283
283
|
iterate_event_delivery
|
284
284
|
end
|
285
285
|
|
@@ -328,7 +328,7 @@ class CZookeeper
|
|
328
328
|
end
|
329
329
|
|
330
330
|
def wake_event_loop!
|
331
|
-
@pipe_write && @pipe_write.write('1')
|
331
|
+
@pipe_write && !@pipe_write.closed? && @pipe_write.write('1')
|
332
332
|
end
|
333
333
|
|
334
334
|
def iterate_event_delivery
|
@@ -345,10 +345,10 @@ class CZookeeper
|
|
345
345
|
end
|
346
346
|
end
|
347
347
|
end
|
348
|
-
|
348
|
+
|
349
349
|
cntn = @reg.in_flight.delete(hash[:req_id])
|
350
350
|
|
351
|
-
if cntn and not cntn.user_callback? # this is one of "our" continuations
|
351
|
+
if cntn and not cntn.user_callback? # this is one of "our" continuations
|
352
352
|
cntn.call(hash) # so we handle delivering it
|
353
353
|
next # and skip handing it to the dispatcher
|
354
354
|
end
|
@@ -374,7 +374,7 @@ class CZookeeper
|
|
374
374
|
def shut_down!
|
375
375
|
logger.debug { "##{__method__}" }
|
376
376
|
|
377
|
-
@mutex.synchronize do
|
377
|
+
@mutex.synchronize do
|
378
378
|
@_shutting_down = true
|
379
379
|
# ollie ollie oxen all home free!
|
380
380
|
@running_cond.broadcast
|
@@ -1,11 +1,11 @@
|
|
1
|
-
--- zkc-3.4.5
|
2
|
-
+++ zkc-3.4.5/c/src/zookeeper.c 2020-
|
1
|
+
--- zkc-3.4.5.orig/c/src/zookeeper.c 2020-08-13 03:04:49.631654715 -0400
|
2
|
+
+++ zkc-3.4.5/c/src/zookeeper.c 2020-08-13 03:03:24.983922697 -0400
|
3
3
|
@@ -3411,7 +3411,7 @@
|
4
|
-
|
4
|
+
|
5
5
|
static const char* format_endpoint_info(const struct sockaddr_storage* ep)
|
6
6
|
{
|
7
7
|
- static char buf[128];
|
8
|
-
+ static char buf[
|
8
|
+
+ static char buf[128+6];
|
9
9
|
char addrstr[128];
|
10
10
|
void *inaddr;
|
11
11
|
#ifdef WIN32
|