Commit 252bbe5a authored by Felix Seibert's avatar Felix Seibert
Browse files

fix error in lpt rebalancing

parent 9aa64579
......@@ -190,14 +190,17 @@ class DataDistribution(object):
return maximum_osd, maximum_processing_time
def get_lower_bound_on_makespan(self):
return self.compute_relaxed_assignment().get_maximum_processing_time()[1]
def compute_relaxed_assignment(self):
total_remaining_file_size = self.get_total_folder_size()
artificial_data_distribution = copy.deepcopy(self)
for tmp_osd in artificial_data_distribution.OSDs.values():
relaxed_assignment = copy.deepcopy(self)
for tmp_osd in relaxed_assignment.OSDs.values():
for a_folder in list(tmp_osd.folders.keys()):
tmp_osd.remove_folder(a_folder)
while total_remaining_file_size > 0:
free_OSDs = list(filter(lambda x: x.get_free_capacity() > 0, artificial_data_distribution.OSDs.values()))
free_OSDs = list(filter(lambda x: x.get_free_capacity() > 0, relaxed_assignment.OSDs.values()))
total_bandwidth = sum(list(map(lambda x: x.bandwidth, free_OSDs)))
assigned_file_size = 0
for free_OSD in free_OSDs:
......@@ -207,7 +210,7 @@ class DataDistribution(object):
assigned_file_size += assignable_share
total_remaining_file_size -= assigned_file_size
return artificial_data_distribution.get_maximum_processing_time()[1]
return relaxed_assignment
def add_folders(self, folders,
ignore_osd_capacities=True,
......@@ -315,10 +318,12 @@ class DataDistribution(object):
# for each OSD, remove the smallest folder until its total_folder_size does not exceed the reassignment_limit
# unrolling
relaxed_assignment = self.compute_relaxed_assignment()
for osd in self.OSDs.values():
# self.get_total_folder_size / self.get_total_bandwidth() is the optimal processing time for each OSD:
# this value is a lower bound for the makespan
reassignment_limit = self.get_rebalance_limit(rebalance_factor, total_folder_size)
# reassignment_limit = self.get_rebalance_limit(rebalance_factor, total_folder_size)
reassignment_limit = relaxed_assignment.OSDs[osd.uuid].get_processing_time() * rebalance_factor
while osd.get_processing_time() > reassignment_limit:
folder_id, folder_size = osd.get_smallest_folder()
folders_to_be_reassigned.append(folder.Folder(folder_id, folder_size, None))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment