Skip to content

Commit 2b11500

Browse files
aperiodicDan Lidral-Porter
authored andcommitted
(PDB-3060) Add concurrent-writes parameter.
Add a parameter to govern the command-processing config section's `concurrent-writes` setting.
1 parent a33da5f commit 2b11500

6 files changed

Lines changed: 51 additions & 12 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,11 @@ If `true`, puppet will manage your iptables rules for PuppetDB via the
664664
The number of command processing threads to use. Defaults to `undef`, using the
665665
PuppetDB built-in default.
666666

667+
####`concurrent_writes`
668+
669+
The number of threads allowed to write to disk at any one time. Defaults to
670+
`undef`, which uses the PuppetDB built-in default.
671+
667672
####`store_usage`
668673

669674
The amount of disk space (in MB) to allow for persistent message storage.

manifests/init.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
$merge_default_java_args = $puppetdb::params::merge_default_java_args,
6767
$max_threads = $puppetdb::params::max_threads,
6868
$command_threads = $puppetdb::params::command_threads,
69+
$concurrent_writes = $puppetdb::params::concurrent_writes,
6970
$store_usage = $puppetdb::params::store_usage,
7071
$temp_usage = $puppetdb::params::temp_usage,
7172
$certificate_whitelist_file = $puppetdb::params::certificate_whitelist_file,
@@ -136,6 +137,7 @@
136137
puppetdb_group => $puppetdb_group,
137138
manage_firewall => $manage_firewall,
138139
command_threads => $command_threads,
140+
concurrent_writes => $concurrent_writes,
139141
store_usage => $store_usage,
140142
temp_usage => $temp_usage,
141143
certificate_whitelist_file => $certificate_whitelist_file,

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
$puppetdb_service_status = 'running'
159159

160160
$command_threads = undef
161+
$concurrent_writes = undef
161162
$store_usage = undef
162163
$temp_usage = undef
163164

manifests/server.pp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
$merge_default_java_args = $puppetdb::params::merge_default_java_args,
6262
$max_threads = $puppetdb::params::max_threads,
6363
$command_threads = $puppetdb::params::command_threads,
64+
$concurrent_writes = $puppetdb::params::concurrent_writes,
6465
$store_usage = $puppetdb::params::store_usage,
6566
$temp_usage = $puppetdb::params::temp_usage,
6667
$certificate_whitelist_file = $puppetdb::params::certificate_whitelist_file,
@@ -147,11 +148,12 @@
147148
}
148149

149150
class { 'puppetdb::server::command_processing':
150-
command_threads => $command_threads,
151-
store_usage => $store_usage,
152-
temp_usage => $temp_usage,
153-
confdir => $confdir,
154-
notify => Service[$puppetdb_service],
151+
command_threads => $command_threads,
152+
concurrent_writes => $concurrent_writes,
153+
store_usage => $store_usage,
154+
temp_usage => $temp_usage,
155+
confdir => $confdir,
156+
notify => Service[$puppetdb_service],
155157
}
156158

157159
class { 'puppetdb::server::database':

manifests/server/command_processing.pp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# PRIVATE CLASS - do not use directly
22
class puppetdb::server::command_processing (
3-
$command_threads = $puppetdb::params::command_threads,
4-
$store_usage = $puppetdb::params::store_usage,
5-
$temp_usage = $puppetdb::params::temp_usage,
6-
$confdir = $puppetdb::params::confdir,
3+
$command_threads = $puppetdb::params::command_threads,
4+
$concurrent_writes = $puppetdb::params::concurrent_writes,
5+
$store_usage = $puppetdb::params::store_usage,
6+
$temp_usage = $puppetdb::params::temp_usage,
7+
$confdir = $puppetdb::params::confdir,
78
) inherits puppetdb::params {
89

910
$config_ini = "${confdir}/config.ini"
@@ -28,6 +29,18 @@
2829
}
2930
}
3031

32+
if $concurrent_writes {
33+
ini_setting { 'puppetdb_command_processing_concurrent_writes':
34+
setting => 'concurrent-writes',
35+
value => $concurrent_writes,
36+
}
37+
} else {
38+
ini_setting { 'puppetdb_command_processing_concurrent_writes':
39+
ensure => 'absent',
40+
setting => 'concurrent-writes',
41+
}
42+
}
43+
3144
if $store_usage {
3245
ini_setting { 'puppetdb_command_processing_store_usage':
3346
setting => 'store-usage',

spec/unit/classes/server/command_processing_spec.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
'section' => 'command-processing',
2020
'setting' => 'threads'
2121
)}
22+
it { should contain_ini_setting('puppetdb_command_processing_concurrent_writes').
23+
with(
24+
'ensure' => 'absent',
25+
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
26+
'section' => 'command-processing',
27+
'setting' => 'concurrent-writes'
28+
)}
2229
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
2330
with(
2431
'ensure' => 'absent',
@@ -63,9 +70,10 @@
6370
describe 'when using custom values' do
6471
let(:params) do
6572
{
66-
'command_threads' => 10,
67-
'store_usage' => 4000,
68-
'temp_usage' => 2000,
73+
'command_threads' => 10,
74+
'concurrent_writes' => 3,
75+
'store_usage' => 4000,
76+
'temp_usage' => 2000,
6977
}
7078
end
7179
it { should contain_ini_setting('puppetdb_command_processing_threads').
@@ -76,6 +84,14 @@
7684
'setting' => 'threads',
7785
'value' => '10'
7886
)}
87+
it { should contain_ini_setting('puppetdb_command_processing_concurrent_writes').
88+
with(
89+
'ensure' => 'present',
90+
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
91+
'section' => 'command-processing',
92+
'setting' => 'concurrent-writes',
93+
'value' => '3'
94+
)}
7995
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
8096
with(
8197
'ensure' => 'present',

0 commit comments

Comments
 (0)