Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix#18543 maxSize and segment max cache size is not pass (right now is using the default value) #245

Closed
wants to merge 12 commits into from
Closed
4 changes: 2 additions & 2 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
default['redborder']['manager']['hd_services'] = [
{ 'name': 'kafka', 'count': 5, 'prefered': 'aggregate' },
{ 'name': 'zookeeper', 'count': 1, 'prefered': 'aggregate' },
{ 'name': 'riak', 'count': 50, 'prefered': 'raw' },
{ 'name': 'druid_historical', 'count': 50, 'prefered': 'raw' },
{ 'name': 's3', 'count': 50, 'prefered': 'raw' },
{ 'name': 'druid-historical', 'count': 50, 'prefered': 'raw' },
]

default['redborder']['manager']['hd_services_current'] = {}
Expand Down
77 changes: 14 additions & 63 deletions resources/libraries/harddisk_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,24 @@ module RbManager
module Helpers
def harddisk_services
hd_services = {}

root_dev = node['redborder']['manager']['data_dev']['root']
raw_dev = node['redborder']['manager']['data_dev']['raw']
aggregate_dev = node['redborder']['manager']['data_dev']['aggregate']

root_dev = node['filesystem'].keys.first if node['filesystem'][root_dev].nil?
if node['filesystem'][raw_dev].nil? && node['filesystem'][aggregate_dev].nil?
raw_dev = root_dev
aggregate_dev = root_dev
elsif node['filesystem'][raw_dev].nil?
raw_dev = aggregate_dev
elsif node['filesystem'][aggregate_dev].nil?
aggregate_dev = raw_dev
end

hd_services_dev = {}
hd_services_dev['root'] = root_dev
hd_services_dev['raw'] = raw_dev
hd_services_dev['aggregate'] = aggregate_dev

hd_services_size = {}
hd_services_size[root_dev] = 0
hd_services_size[raw_dev] = 0
hd_services_size[aggregate_dev] = 0

hd_services_size_total = {}
hd_services_size_total[root_dev] = 0
hd_services_size_total[raw_dev] = 0
hd_services_size_total[aggregate_dev] = 0

maxsize = {}
hd_services_dev.each do |type, device|
maxsize[type] = if node['filesystem'][device].nil?
300_000_000_000
else
filesystem_data = node['filesystem'][device]
root_device = hd_services_dev['root']
size_kb = filesystem_data['kb_size'] || node['filesystem'][root_device]['kb_size']
size_bytes = size_kb.to_i * 1024
size_bytes -= 7 * 1024 * 1024 * 1024 if device == root_device
[size_bytes, 0].max
end
end
node['redborder']['manager']['hd_services'].each do |s|
if node['redborder']['services'][s[:name]]
hd_services_size[hd_services_dev[s[:prefered]]] += s[:count]
end
hd_services_size_total[hd_services_dev[s[:prefered]]] += s[:count]
root_dev_kb = node['filesystem']['by_mountpoint']['/']['kb_size']
size_bytes = root_dev_kb.to_i * 1024
size_bytes -= 7 * 1024 * 1024 * 1024
maxsize = size_bytes

hd_services_dev = node['redborder']['manager']['hd_services'].map do |service|
{
name: service[:name],
count: node['redborder']['services'][service[:name]] ? service[:count] + 1 : service[:count],
}
end

node['redborder']['manager']['hd_services'].each do |service|
preferred_device = hd_services_dev[service[:prefered]]
preferred_size = hd_services_size[preferred_device]
total_size = hd_services_size_total[preferred_device]

size = if preferred_size > 0
preferred_size
else
total_size > 0 ? total_size : 1
end

service_count = service[:count].to_i
max_preferred_size = maxsize[service[:prefered]].to_i
hd_services[service[:name]] = ((service_count * max_preferred_size * 0.90) / size.to_f) / (1024 * 1024)
hd_services_dev.each do |service|
service_count = service[:count].to_f / 100
hd_services[service[:name]] = service_count * maxsize * 0.90
end

hd_services
hd_services # hard disk services sizes are pased in bytes
end
end
end
1 change: 1 addition & 0 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
name node['hostname']
ipaddress node['ipaddress_sync']
memory_kb node['redborder']['memory_services']['druid-historical']['memory']
maxsize node['redborder']['manager']['hd_services_current']['druid_historical']
action [:add, :register]
else
action [:remove, :deregister]
Expand Down
Loading