Add support for stale_worker_timeout option

... which was added during this cycle.

Depends-on: https://review.opendev.org/789035
Change-Id: I3a73d316169d0e78cf03669cd0e6d0e0595385d9
This commit is contained in:
Takashi Kajinami 2025-02-24 19:08:37 +09:00
parent 4c95be36b4
commit fa28c1cd58
5 changed files with 52 additions and 28 deletions

View File

@ -132,6 +132,11 @@
# (optional) The headers whose values will only be shown to swift_owners.
# Defaults to $facts['os_service_default'].
#
# [*stale_worker_timeout*]
# (optional) The grace period (in seconds) after which the reloaded server
# will issue SIGKILLs to remaining stale workers.
# Defaults to $facts['os_service_default'].
#
# [*client_timeout*]
# (optional) Configures client_timeout for swift proxy-server.
# Defaults to $facts['os_service_default'].
@ -236,6 +241,7 @@ class swift::proxy(
$write_affinity_node_count = $facts['os_service_default'],
$write_affinity_handoff_delete_count = $facts['os_service_default'],
$swift_owner_headers = $facts['os_service_default'],
$stale_worker_timeout = $facts['os_service_default'],
$client_timeout = $facts['os_service_default'],
$keepalive_timeout = $facts['os_service_default'],
$node_timeout = $facts['os_service_default'],
@ -320,6 +326,7 @@ class swift::proxy(
'app:proxy-server/timing_expiry': value => $timing_expiry;
'app:proxy-server/request_node_count': value => $request_node_count;
'app:proxy-server/swift_owner_headers': value => join(any2array($swift_owner_headers), ',');
'app:proxy-server/stale_worker_timeout': value => $stale_worker_timeout;
'app:proxy-server/node_timeout': value => $node_timeout;
'app:proxy-server/recoverable_node_timeout': value => $recoverable_node_timeout;
'app:proxy-server/allow_open_expired': value => $allow_open_expired;

View File

@ -79,6 +79,11 @@
# all times. This option affects only <type>-server processes.
# Defaults to $facts['os_service_default'].
#
# [*stale_worker_timeout*]
# (optional) The grace period (in seconds) after which the reloaded server
# will issue SIGKILLs to remaining stale workers.
# Defaults to $facts['os_service_default'].
#
# [*db_preallocation*]
# (optional) Preallocate disk space with SQLite database to decrease
# fragmentation.
@ -305,6 +310,7 @@ define swift::storage::server(
$disable_fallocate = $facts['os_service_default'],
$fallocate_reserve = $facts['os_service_default'],
$server_fallocate_reserve = $facts['os_service_default'],
$stale_worker_timeout = $facts['os_service_default'],
$db_preallocation = $facts['os_service_default'],
$servers_per_port = $facts['os_service_default'],
$user = undef,
@ -432,38 +438,39 @@ define swift::storage::server(
# common settings
$common_opts = {
'DEFAULT/devices' => {'value' => $devices},
'DEFAULT/bind_ip' => {'value' => $storage_local_net_ip},
'DEFAULT/bind_port' => {'value' => $bind_port},
'DEFAULT/mount_check' => {'value' => $mount_check},
'DEFAULT/disable_fallocate' => {'value' => $disable_fallocate},
'DEFAULT/fallocate_reserve' => {'value' => $fallocate_reserve},
'DEFAULT/user' => {'value' => $user_real},
'DEFAULT/workers' => {'value' => $workers},
'DEFAULT/conn_timeout' => {'value' => $conn_timeout},
'DEFAULT/node_timeout' => {'value' => $node_timeout},
'DEFAULT/log_name' => {'value' => $log_name},
'DEFAULT/log_facility' => {'value' => $log_facility},
'DEFAULT/log_level' => {'value' => $log_level},
'DEFAULT/log_address' => {'value' => $log_address},
'DEFAULT/log_udp_host' => {'value' => $log_udp_host},
'DEFAULT/log_udp_port' => {'value' => $log_udp_port},
'DEFAULT/log_max_line_length' => {'value' => $log_max_line_length},
'DEFAULT/devices' => {'value' => $devices},
'DEFAULT/bind_ip' => {'value' => $storage_local_net_ip},
'DEFAULT/bind_port' => {'value' => $bind_port},
'DEFAULT/mount_check' => {'value' => $mount_check},
'DEFAULT/disable_fallocate' => {'value' => $disable_fallocate},
'DEFAULT/fallocate_reserve' => {'value' => $fallocate_reserve},
'DEFAULT/user' => {'value' => $user_real},
'DEFAULT/workers' => {'value' => $workers},
'DEFAULT/conn_timeout' => {'value' => $conn_timeout},
'DEFAULT/node_timeout' => {'value' => $node_timeout},
'DEFAULT/log_name' => {'value' => $log_name},
'DEFAULT/log_facility' => {'value' => $log_facility},
'DEFAULT/log_level' => {'value' => $log_level},
'DEFAULT/log_address' => {'value' => $log_address},
'DEFAULT/log_udp_host' => {'value' => $log_udp_host},
'DEFAULT/log_udp_port' => {'value' => $log_udp_port},
'DEFAULT/log_max_line_length' => {'value' => $log_max_line_length},
# pipeline
'pipeline:main/pipeline' => {'value' => join($pipeline, ' ')},
'pipeline:main/pipeline' => {'value' => join($pipeline, ' ')},
# server
"app:${type}-server/use" => {'value' => "egg:swift#${type}"},
"app:${type}-server/set log_name" => {'value' => $log_name},
"app:${type}-server/set log_facility" => {'value' => $log_facility},
"app:${type}-server/set log_level" => {'value' => $log_level},
"app:${type}-server/set log_requests" => {'value' => $log_requests},
"app:${type}-server/set log_address" => {'value' => $log_address},
"app:${type}-server/fallocate_reserve" => {'value' => $server_fallocate_reserve},
"app:${type}-server/use" => {'value' => "egg:swift#${type}"},
"app:${type}-server/set log_name" => {'value' => $log_name},
"app:${type}-server/set log_facility" => {'value' => $log_facility},
"app:${type}-server/set log_level" => {'value' => $log_level},
"app:${type}-server/set log_requests" => {'value' => $log_requests},
"app:${type}-server/set log_address" => {'value' => $log_address},
"app:${type}-server/fallocate_reserve" => {'value' => $server_fallocate_reserve},
"app:${type}-server/stale_worker_timeout" => {'value' => $stale_worker_timeout},
# auditor
"${type}-auditor/" => {'ensure' => present},
"${type}-auditor/" => {'ensure' => present},
# replicator
"${type}-replicator/" => {'ensure' => present},
"${type}-replicator/rsync_module" => {'value' => $rsync_module},
"${type}-replicator/" => {'ensure' => present},
"${type}-replicator/rsync_module" => {'value' => $rsync_module},
}
Anchor['swift::config::begin']

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``stale_worker_timeout`` parameter has been added.

View File

@ -91,6 +91,7 @@ describe 'swift::proxy' do
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_handoff_delete_count').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/swift_owner_headers').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/stale_worker_timeout').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('<SERVICE DEFAULT>') }
it { should contain_swift_proxy_config('app:proxy-server/allow_open_expired').with_value('<SERVICE DEFAULT>') }
@ -158,6 +159,7 @@ describe 'swift::proxy' do
:write_affinity_node_count => '2 * replicas',
:write_affinity_handoff_delete_count => 'auto',
:swift_owner_headers => ['x-container-read', 'x-container-write'],
:stale_worker_timeout => 86400,
:client_timeout => '120',
:keepalive_timeout => '121',
:node_timeout => '20',
@ -203,6 +205,7 @@ describe 'swift::proxy' do
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas') }
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_handoff_delete_count').with_value('auto') }
it { should contain_swift_proxy_config('app:proxy-server/swift_owner_headers').with_value('x-container-read,x-container-write') }
it { should contain_swift_proxy_config('app:proxy-server/stale_worker_timeout').with_value(86400) }
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20') }
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('15') }
it { should contain_swift_proxy_config('app:proxy-server/allow_open_expired').with_value(false) }

View File

@ -92,6 +92,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_account_config('app:account-server/set log_requests').with_value(true)
is_expected.to contain_swift_account_config('app:account-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_account_config('app:account-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('app:account-server/stale_worker_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')
@ -283,6 +284,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_container_config('app:container-server/set log_requests').with_value(true)
is_expected.to contain_swift_container_config('app:container-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_container_config('app:container-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('app:container-server/stale_worker_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')
@ -479,6 +481,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_object_config('app:object-server/set log_requests').with_value(true)
is_expected.to contain_swift_object_config('app:object-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_object_config('app:object-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('app:object-server/stale_worker_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')