Skip to content

Commit

Permalink
support minSessionTimeout, specs for redhat-openstack#25
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Jun 4, 2015
1 parent 09fc5da commit 2617a4e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ This is a workaround for a a [Facter issue](https://tickets.puppetlabs.com/brows
- `log_dir`
- `purge_interval` - automatically will delete zookeeper logs (available since 3.4.0)
- `snap_retain_count` - number of snapshots that will be kept after purging (since 3.4.0)
- `min_session_timeout` - the minimum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 2 times the **tickTime** (since 3.3.0)
- `max_session_timeout` - the maximum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 20 times the **tickTime** (since 3.3.0)

and many others, see the `init.pp` file for more details.

Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
$init_limit = 10,
$sync_limit = 5,
$leader = true,
$min_session_timeout = undef,
$max_session_timeout = undef,
) {
require zookeeper::install
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
$repo = undef,
$install_java = false,
$java_package = undef,
$min_session_timeout = undef,
$max_session_timeout = undef,
) {

Expand Down Expand Up @@ -103,6 +104,7 @@
tracefile_threshold => $tracefile_threshold,
max_allowed_connections => $max_allowed_connections,
peer_type => $peer_type,
min_session_timeout => $min_session_timeout,
max_session_timeout => $max_session_timeout,
}->
class { 'zookeeper::service':
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,24 @@
).with_content(/server.5=192.168.1.5:2888:3888:observer/) }
end

context 'setting minSessionTimeout' do
let(:params) {{
:min_session_timeout => 5000
}}

it { should contain_file(
'/etc/zookeeper/conf/zoo.cfg'
).with_content(/minSessionTimeout=5000/) }
end

context 'setting maxSessionTimeout' do
let(:params) {{
:max_session_timeout => 50000
}}

it { should contain_file(
'/etc/zookeeper/conf/zoo.cfg'
).with_content(/maxSessionTimeout=50000/) }
end

end
18 changes: 18 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,23 @@
it { should contain_exec('initialize_datastore') }
end

context 'setting minSessionTimeout' do
let(:params) {{
:min_session_timeout => 3000
}}

it { should contain_file(
'/etc/zookeeper/conf/zoo.cfg'
).with_content(/minSessionTimeout=3000/) }
end

context 'setting maxSessionTimeout' do
let(:params) {{
:max_session_timeout => 60000
}}

it { should contain_file(
'/etc/zookeeper/conf/zoo.cfg'
).with_content(/maxSessionTimeout=60000/) }
end
end
6 changes: 6 additions & 0 deletions templates/conf/zoo.cfg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ maxClientCnxns=<%= @max_allowed_connections %>
peerType=<%= @peer_type %>
<% end -%>

# The minimum session timeout in milliseconds that the server will allow the # client to negotiate. Defaults to 2 times the tickTime.
<% if @min_session_timeout -%>
minSessionTimeout=<%= @min_session_timeout %>
<% end -%>

# The maximum session timeout in milliseconds that the server will allow the # client to negotiate. Defaults to 20 times the tickTime.
<% if @max_session_timeout -%>
maxSessionTimeout=<%= @max_session_timeout %>
<% end -%>

0 comments on commit 2617a4e

Please sign in to comment.