Commit 4602b34f authored by Andrea Manzi's avatar Andrea Manzi

MGM: reshuffle fs only for the placement operations

parent de266a26
Pipeline #506883 passed with stages
in 72 minutes and 36 seconds
......@@ -1260,6 +1260,29 @@ XrdMgmOfsFile::open(const char* inpath,
}
retc = Quota::FilePlacement(&plctargs);
// reshuffle the selectedfs by returning as first entry the lowest if the sum of the fsid is odd
// the highest if the sum is even
if (selectedfs.size() > 0) {
std::vector<unsigned int> newselectedfs;
auto result = std::minmax_element(selectedfs.begin(), selectedfs.end());
int sum = std::accumulate(selectedfs.begin(), selectedfs.end(), 0);
if ((sum % 2) == 0) {
newselectedfs.push_back(*result.second);
} else {
newselectedfs.push_back(*result.first);
}
for (const auto& i : selectedfs) {
if (i != newselectedfs.front()) {
newselectedfs.push_back(i);
}
}
//do the swap
selectedfs.swap(newselectedfs);
}
} else {
// Access existing file - fill the vector with the existing locations
for (unsigned int i = 0; i < fmd->getNumLocation(); i++) {
......@@ -1388,29 +1411,6 @@ XrdMgmOfsFile::open(const char* inpath,
}
}
// reshuffle the selectedfs by returning as first entry the lowest if the sum of the fsid is odd
// the highest if the sum is even
if (selectedfs.size() > 0) {
std::vector<unsigned int> newselectedfs;
auto result = std::minmax_element(selectedfs.begin(), selectedfs.end());
int sum = std::accumulate(selectedfs.begin(), selectedfs.end(), 0);
if ((sum % 2) == 0) {
newselectedfs.push_back(*result.second);
} else {
newselectedfs.push_back(*result.first);
}
for (const auto& i : selectedfs) {
if (i != newselectedfs.front()) {
newselectedfs.push_back(i);
}
}
//do the swap
selectedfs.swap(newselectedfs);
}
/// ###############
eos::common::Logging& g_logging = eos::common::Logging::GetInstance();
......
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