Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Seibert
xtreemfs_client
Commits
252bbe5a
Commit
252bbe5a
authored
Dec 21, 2018
by
Felix Seibert
Browse files
fix error in lpt rebalancing
parent
9aa64579
Changes
1
Show whitespace changes
Inline
Side-by-side
xtreemfs_client/dataDistribution.py
View file @
252bbe5a
...
@@ -190,14 +190,17 @@ class DataDistribution(object):
...
@@ -190,14 +190,17 @@ class DataDistribution(object):
return
maximum_osd
,
maximum_processing_time
return
maximum_osd
,
maximum_processing_time
def
get_lower_bound_on_makespan
(
self
):
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
()
total_remaining_file_size
=
self
.
get_total_folder_size
()
artificial_data_distribution
=
copy
.
deepcopy
(
self
)
relaxed_assignment
=
copy
.
deepcopy
(
self
)
for
tmp_osd
in
artificial_data_distribution
.
OSDs
.
values
():
for
tmp_osd
in
relaxed_assignment
.
OSDs
.
values
():
for
a_folder
in
list
(
tmp_osd
.
folders
.
keys
()):
for
a_folder
in
list
(
tmp_osd
.
folders
.
keys
()):
tmp_osd
.
remove_folder
(
a_folder
)
tmp_osd
.
remove_folder
(
a_folder
)
while
total_remaining_file_size
>
0
:
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
)))
total_bandwidth
=
sum
(
list
(
map
(
lambda
x
:
x
.
bandwidth
,
free_OSDs
)))
assigned_file_size
=
0
assigned_file_size
=
0
for
free_OSD
in
free_OSDs
:
for
free_OSD
in
free_OSDs
:
...
@@ -207,7 +210,7 @@ class DataDistribution(object):
...
@@ -207,7 +210,7 @@ class DataDistribution(object):
assigned_file_size
+=
assignable_share
assigned_file_size
+=
assignable_share
total_remaining_file_size
-=
assigned_file_size
total_remaining_file_size
-=
assigned_file_size
return
artificial_data_distribution
.
get_maximum_processing_time
()[
1
]
return
relaxed_assignment
def
add_folders
(
self
,
folders
,
def
add_folders
(
self
,
folders
,
ignore_osd_capacities
=
True
,
ignore_osd_capacities
=
True
,
...
@@ -315,10 +318,12 @@ class DataDistribution(object):
...
@@ -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
# for each OSD, remove the smallest folder until its total_folder_size does not exceed the reassignment_limit
# unrolling
# unrolling
relaxed_assignment
=
self
.
compute_relaxed_assignment
()
for
osd
in
self
.
OSDs
.
values
():
for
osd
in
self
.
OSDs
.
values
():
# self.get_total_folder_size / self.get_total_bandwidth() is the optimal processing time for each OSD:
# 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
# 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
:
while
osd
.
get_processing_time
()
>
reassignment_limit
:
folder_id
,
folder_size
=
osd
.
get_smallest_folder
()
folder_id
,
folder_size
=
osd
.
get_smallest_folder
()
folders_to_be_reassigned
.
append
(
folder
.
Folder
(
folder_id
,
folder_size
,
None
))
folders_to_be_reassigned
.
append
(
folder
.
Folder
(
folder_id
,
folder_size
,
None
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment