From 57f7a9f0058f123b6879ab1f4fd4096672e31a9c Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Fri, 10 Aug 2018 13:58:54 +0200 Subject: [PATCH] osd: make random shuffle comply with C++17 random_shuffle is depriacted in C++14 and removed in C++17 on FreeBSD (As per the standard) So this code does not compile on FreeBSD with Clang 6 Signed-off-by: Willem Jan Withagen --- src/osd/OSDMap.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 2fa444351f727..59cbcc78e9451 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -19,6 +19,7 @@ #include "OSDMap.h" #include +#include #include "common/config.h" #include "common/errno.h" #include "common/Formatter.h" @@ -5198,7 +5199,9 @@ void OSDMap::get_random_up_osds_by_subtree(int n, // whoami return; vector subtrees; crush->get_subtree_of_type(subtree_type, &subtrees); - std::random_shuffle(subtrees.begin(), subtrees.end()); + std::random_device rd; + std::default_random_engine rng{rd()}; + std::shuffle(subtrees.begin(), subtrees.end(), rng); for (auto s : subtrees) { if (limit <= 0) break; -- 2.39.5