zk 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +4 -4
- data/Gemfile +1 -0
- data/RELEASES.markdown +5 -0
- data/lib/zk.rb +1 -5
- data/lib/zk/client/threaded.rb +1 -1
- data/lib/zk/election.rb +1 -1
- data/lib/zk/event_handler.rb +1 -1
- data/lib/zk/event_handler_subscription/base.rb +1 -1
- data/lib/zk/fork_hook.rb +6 -1
- data/lib/zk/locker/locker_base.rb +1 -1
- data/lib/zk/logger.rb +34 -0
- data/lib/zk/node_deletion_watcher.rb +1 -1
- data/lib/zk/pool.rb +1 -1
- data/lib/zk/subscription.rb +1 -1
- data/lib/zk/threaded_callback.rb +1 -1
- data/lib/zk/threadpool.rb +1 -1
- data/lib/zk/version.rb +1 -1
- data/spec/logging_progress_bar_formatter.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/bogus_mongoid.rb +1 -1
- data/spec/support/client_forker.rb +1 -1
- data/spec/support/event_catcher.rb +1 -1
- data/spec/support/logging.rb +15 -47
- data/zk.gemspec +0 -1
- metadata +4 -18
- data/lib/zk/logging.rb +0 -36
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWUxMzk1MjRkMmFhZjEyMDg2OTA1ODQ3NTQxYjBiNWNjODc4OGQ3ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjViMTA4YTA1YTUxYTA4ZWJiMTA4Y2JiNDIxMGMyZDVkZjY5ZmMyMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2UwYzk3YTMxY2M1ZGFiNGU4ZjgwMmEyYjVjNTQ2MzIxNWRhZWNiNmUzMjIz
|
10
|
+
ZjVhZTZmNTkyMmE3MDRhMTFlODY4MTM0MDBkMWY3MWQxNDRlNjA1OTVkOGQy
|
11
|
+
NjU2YTU2ODIwZGEzY2Y2YTg4MjlkY2FjNGY3NTgzYWNjOTI1ZTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjY5YTA0MzRkMDEwMTQzYzAxYjRjODZiOTlkNGMwZmQ0MTI4MzhlOGJiODgx
|
14
|
+
ZGVhODY2YWQzM2I5NzJkZDgwNzMwZDBkMTZmMmU5N2IxY2VlYTg4M2ExMzcx
|
15
|
+
NGZjM2QwMjhhMzRkYWY2OTA4OWI5YTA2YTdkMmJiNDllODM2ZmQ=
|
data/.travis.yml
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# This should kick us over to the docker system
|
2
|
+
sudo: false
|
3
|
+
|
2
4
|
notifications:
|
3
5
|
email:
|
4
6
|
- slyphon@gmail.com
|
@@ -9,6 +11,7 @@ env:
|
|
9
11
|
|
10
12
|
# pull in releaseops submodule
|
11
13
|
before_install:
|
14
|
+
- gem update bundler
|
12
15
|
- git submodule update --init --recursive
|
13
16
|
|
14
17
|
rvm:
|
@@ -19,9 +22,6 @@ rvm:
|
|
19
22
|
- 2.0.0
|
20
23
|
- 2.1.0
|
21
24
|
- 2.2.0
|
22
|
-
matrix:
|
23
|
-
allow_failures:
|
24
|
-
- rvm: 2.2.0
|
25
25
|
|
26
26
|
# jruby specs are too intesive for travis
|
27
27
|
# - jruby-18mode
|
data/Gemfile
CHANGED
data/RELEASES.markdown
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
This file notes feature differences and bugfixes contained between releases.
|
2
2
|
|
3
|
+
### v1.9.6 ###
|
4
|
+
|
5
|
+
* Fixes from @rickypai for ruby 2.2 (#89)
|
6
|
+
* Remove dependency on logging gem #90 (h/t: @eric)
|
7
|
+
|
3
8
|
### v1.9.5 ###
|
4
9
|
|
5
10
|
* Really clear hooks when clear! is called #83 (h/t: Liam Stewart)
|
data/lib/zk.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
require 'logging'
|
4
3
|
require 'zookeeper'
|
5
4
|
|
6
5
|
# XXX: after 1.0 we'll need this
|
@@ -23,7 +22,7 @@ end
|
|
23
22
|
require 'zk/core_ext'
|
24
23
|
require 'zk/exceptions'
|
25
24
|
require 'zk/extensions'
|
26
|
-
require 'zk/
|
25
|
+
require 'zk/logger'
|
27
26
|
require 'zk/event'
|
28
27
|
require 'zk/stat'
|
29
28
|
require 'zk/subscription'
|
@@ -307,6 +306,3 @@ module ZK
|
|
307
306
|
cnx_str # the possibly-modified connection string (with chroot info)
|
308
307
|
end
|
309
308
|
end
|
310
|
-
|
311
|
-
ZK::Logging.set_default
|
312
|
-
|
data/lib/zk/client/threaded.rb
CHANGED
data/lib/zk/election.rb
CHANGED
data/lib/zk/event_handler.rb
CHANGED
data/lib/zk/fork_hook.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module ZK
|
2
2
|
module ForkHook
|
3
|
-
include ZK::
|
3
|
+
include ZK::Logger
|
4
4
|
extend self
|
5
5
|
|
6
6
|
@mutex = Mutex.new unless @mutex
|
@@ -94,6 +94,10 @@ module ZK
|
|
94
94
|
register(:after_child, callable || blk)
|
95
95
|
end
|
96
96
|
|
97
|
+
def self.logger
|
98
|
+
@logger ||= ::ZK.logger || Zookeeper::Logger::ForwardingLogger.for(::ZK::Logger.wrapped_logger, _zk_logger_name)
|
99
|
+
end
|
100
|
+
|
97
101
|
class ForkSubscription < Subscription::Base
|
98
102
|
attr_reader :hook_type
|
99
103
|
|
@@ -108,4 +112,5 @@ module ZK
|
|
108
112
|
def self.install_fork_hook
|
109
113
|
require 'zk/install_fork_hooks'
|
110
114
|
end
|
115
|
+
|
111
116
|
end # ZK
|
data/lib/zk/logger.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module ZK
|
2
|
+
# use the ZK.logger if non-nil (to allow users to override the logger)
|
3
|
+
# otherwise, use a Loggging logger based on the class name
|
4
|
+
module Logger
|
5
|
+
def self.wrapped_logger
|
6
|
+
if defined?(@@wrapped_logger)
|
7
|
+
@@wrapped_logger
|
8
|
+
else
|
9
|
+
@@wrapped_logger = ::Logger.new(STDERR).tap { |l| l.level = ::Logger::FATAL }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.wrapped_logger=(log)
|
14
|
+
@@wrapped_logger = log
|
15
|
+
end
|
16
|
+
|
17
|
+
# @private
|
18
|
+
module ClassMethods
|
19
|
+
def logger
|
20
|
+
::ZK.logger || Zookeeper::Logger::ForwardingLogger.for(::ZK::Logger.wrapped_logger, _zk_logger_name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.included(base)
|
25
|
+
# return false if base < self # avoid infinite recursion
|
26
|
+
base.extend(ClassMethods)
|
27
|
+
end
|
28
|
+
|
29
|
+
def logger
|
30
|
+
@logger ||= (::ZK.logger || self.class.logger)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
data/lib/zk/pool.rb
CHANGED
data/lib/zk/subscription.rb
CHANGED
data/lib/zk/threaded_callback.rb
CHANGED
data/lib/zk/threadpool.rb
CHANGED
data/lib/zk/version.rb
CHANGED
@@ -5,7 +5,7 @@ require 'rspec/core/formatters/progress_formatter'
|
|
5
5
|
# easier to match up tests with the SQL they produce
|
6
6
|
class LoggingProgressBarFormatter < RSpec::Core::Formatters::ProgressFormatter
|
7
7
|
def example_started(example)
|
8
|
-
|
8
|
+
SpecGlobalLogger.logger << yellow("\n=====<([ #{example.full_description} ])>=====\n")
|
9
9
|
super
|
10
10
|
end
|
11
11
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -49,7 +49,7 @@ RSpec.configure do |config|
|
|
49
49
|
require 'zk-server'
|
50
50
|
|
51
51
|
config.before(:suite) do
|
52
|
-
|
52
|
+
SpecGlobalLogger.logger.debug { "Starting zookeeper service" }
|
53
53
|
ZK::Server.run do |c|
|
54
54
|
c.client_port = ZK.test_port
|
55
55
|
c.force_sync = false
|
@@ -58,7 +58,7 @@ RSpec.configure do |config|
|
|
58
58
|
end
|
59
59
|
|
60
60
|
config.after(:suite) do
|
61
|
-
|
61
|
+
SpecGlobalLogger.logger.debug { "stopping zookeeper service" }
|
62
62
|
ZK::Server.shutdown
|
63
63
|
end
|
64
64
|
end
|
data/spec/support/logging.rb
CHANGED
@@ -1,68 +1,36 @@
|
|
1
1
|
module ZK
|
2
2
|
TEST_LOG_PATH = File.join(ZK::ZK_ROOT, 'test.log')
|
3
3
|
|
4
|
-
def self.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
layout = ::Logging.layouts.pattern(layout_opts)
|
12
|
-
|
13
|
-
appender = ENV['ZK_DEBUG'] ? ::Logging.appenders.stderr : ::Logging.appenders.file(ZK::TEST_LOG_PATH)
|
14
|
-
appender.layout = layout
|
15
|
-
# appender.immediate_at = "debug,info,warn,error,fatal"
|
16
|
-
# appender.auto_flushing = true
|
17
|
-
appender.auto_flushing = 25
|
18
|
-
appender.flush_period = 5
|
19
|
-
|
20
|
-
%w[ZK ClientForker spec Zookeeper].each do |name|
|
21
|
-
::Logging.logger[name].tap do |log|
|
22
|
-
log.appenders = [appender]
|
23
|
-
log.level = :debug
|
4
|
+
def self.setup_test_logger
|
5
|
+
log =
|
6
|
+
if ENV['ZK_DEBUG']
|
7
|
+
::Logger.new(STDERR)
|
8
|
+
else
|
9
|
+
::Logger.new(TEST_LOG_PATH)
|
24
10
|
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# this logger is kinda noisy
|
28
|
-
::Logging.logger['ZK::EventHandler'].level = :info
|
29
|
-
|
30
|
-
Zookeeper.logger = ::Logging.logger['Zookeeper']
|
31
|
-
Zookeeper.logger.level = ENV['ZOOKEEPER_DEBUG'] ? :debug : :warn
|
32
|
-
|
33
|
-
ZK::ForkHook.after_fork_in_child { ::Logging.reopen }
|
34
|
-
end
|
35
11
|
|
12
|
+
log.level = ::Logger::DEBUG
|
36
13
|
|
37
|
-
|
38
|
-
require 'logger'
|
39
|
-
log = ::Logger.new($stderr).tap {|l| l.level = ::Logger::DEBUG }
|
40
|
-
ZK.logger = log
|
41
|
-
Zookeeper.logger = log
|
14
|
+
ZK::Logger.wrapped_logger = log
|
42
15
|
end
|
43
16
|
end
|
44
17
|
|
45
|
-
ZK.
|
46
|
-
# ZK.stdlib_logger_setup
|
47
|
-
|
48
|
-
# Zookeeper.logger = ZK.logger.clone_new_log(:progname => 'zoo')
|
49
|
-
# Zookeeper.logger = ZK.logger
|
50
|
-
# Zookeeper.set_debug_level(4)
|
18
|
+
ZK.setup_test_logger
|
51
19
|
|
52
20
|
module SpecGlobalLogger
|
21
|
+
extend self
|
22
|
+
|
53
23
|
def logger
|
54
|
-
@spec_global_logger ||= ::
|
24
|
+
@spec_global_logger ||= Zookeeper::Logger::ForwardingLogger.for(ZK::Logger.wrapped_logger, 'spec')
|
55
25
|
end
|
56
26
|
|
57
27
|
# sets the log level to FATAL for the duration of the block
|
58
28
|
def mute_logger
|
59
|
-
zk_log =
|
60
|
-
|
61
|
-
|
29
|
+
zk_log = ZK::Logger.wrapped_logger
|
30
|
+
|
31
|
+
orig_level, zk_log.level = zk_log.level, ::Logger::FATAL
|
62
32
|
yield
|
63
33
|
ensure
|
64
34
|
zk_log.level = orig_level
|
65
|
-
Zookeeper.debug_level = orig_zoo_level
|
66
35
|
end
|
67
36
|
end
|
68
|
-
|
data/zk.gemspec
CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = s.summary + "\n"
|
14
14
|
|
15
15
|
s.add_runtime_dependency 'zookeeper', '~> 1.4.0'
|
16
|
-
s.add_runtime_dependency 'logging', '~> 1.8.2'
|
17
16
|
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan D. Simms
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: zookeeper
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.4.0
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: logging
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.8.2
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 1.8.2
|
42
28
|
description: ! 'A high-level wrapper around the zookeeper driver
|
43
29
|
|
44
30
|
'
|
@@ -91,7 +77,7 @@ files:
|
|
91
77
|
- lib/zk/locker/locker_base.rb
|
92
78
|
- lib/zk/locker/semaphore.rb
|
93
79
|
- lib/zk/locker/shared_locker.rb
|
94
|
-
- lib/zk/
|
80
|
+
- lib/zk/logger.rb
|
95
81
|
- lib/zk/message_queue.rb
|
96
82
|
- lib/zk/mongoid.rb
|
97
83
|
- lib/zk/node_deletion_watcher.rb
|
@@ -167,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
153
|
version: '0'
|
168
154
|
requirements: []
|
169
155
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.2.2
|
171
157
|
signing_key:
|
172
158
|
specification_version: 4
|
173
159
|
summary: A high-level wrapper around the zookeeper driver
|
data/lib/zk/logging.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module ZK
|
2
|
-
# use the ZK.logger if non-nil (to allow users to override the logger)
|
3
|
-
# otherwise, use a Loggging logger based on the class name
|
4
|
-
module Logging
|
5
|
-
extend ZK::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
def self.logger
|
9
|
-
::ZK.logger || ::Logging.logger[logger_name]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.set_default
|
14
|
-
::Logging.logger['ZK'].tap do |ch_root|
|
15
|
-
::Logging.appenders.stderr.tap do |serr|
|
16
|
-
serr.layout = ::Logging.layouts.pattern(
|
17
|
-
:pattern => '%.1l, [%d #p] %c30.30{2}: %m\n',
|
18
|
-
:date_pattern => '%Y-%m-%d %H:%M:%S.%6N'
|
19
|
-
)
|
20
|
-
|
21
|
-
serr.auto_flushing = 25
|
22
|
-
serr.flush_period = 5
|
23
|
-
|
24
|
-
ch_root.add_appenders(serr)
|
25
|
-
end
|
26
|
-
|
27
|
-
ch_root.level = ENV['ZK_DEBUG'] ? :debug : :off
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def logger
|
32
|
-
self.class.logger
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|