Removed function deprecated in C++ [#CLICKHOUSE-3174].

This commit is contained in:
Alexey Milovidov 2017-09-09 02:31:18 +03:00
parent ed1c0820f0
commit 94b975e7f9
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,5 @@
#include <random>
#include <Common/randomSeed.h>
#include <DataStreams/ConcatBlockInputStream.h>
@ -18,7 +20,8 @@ BlockInputStreams narrowBlockInputStreams(BlockInputStreams & inputs, size_t wid
for (size_t i = 0; i < size; ++i)
distribution[i] = i % width;
std::random_shuffle(distribution.begin(), distribution.end());
std::mt19937 generator(randomSeed());
std::shuffle(distribution.begin(), distribution.end(), generator);
for (size_t i = 0; i < size; ++i)
partitions[distribution[i]].push_back(inputs[i]);

View File

@ -638,7 +638,7 @@ void StorageReplicatedMergeTree::createReplica()
zookeeper->exists(replica_path, &stat);
auto my_create_time = stat.czxid;
std::random_shuffle(replicas.begin(), replicas.end());
std::shuffle(replicas.begin(), replicas.end(), rng);
for (const String & replica : replicas)
{
if (!zookeeper->exists(zookeeper_path + "/replicas/" + replica, &stat))
@ -881,7 +881,7 @@ void StorageReplicatedMergeTree::checkPartAndAddToZooKeeper(
int expected_columns_version = columns_version;
Strings replicas = zookeeper->getChildren(zookeeper_path + "/replicas");
std::random_shuffle(replicas.begin(), replicas.end());
std::shuffle(replicas.begin(), replicas.end(), rng);
String expected_columns_str = part->columns.toString();
for (const String & replica : replicas)
@ -1931,7 +1931,7 @@ String StorageReplicatedMergeTree::findReplicaHavingPart(const String & part_nam
Strings replicas = zookeeper->getChildren(zookeeper_path + "/replicas");
/// Select replicas in uniformly random order.
std::random_shuffle(replicas.begin(), replicas.end());
std::shuffle(replicas.begin(), replicas.end(), rng);
for (const String & replica : replicas)
{
@ -1956,7 +1956,7 @@ String StorageReplicatedMergeTree::findReplicaHavingCoveringPart(const LogEntry
Strings replicas = zookeeper->getChildren(zookeeper_path + "/replicas");
/// Select replicas in uniformly random order.
std::random_shuffle(replicas.begin(), replicas.end());
std::shuffle(replicas.begin(), replicas.end(), rng);
for (const String & replica : replicas)
{

View File

@ -2,6 +2,7 @@
#include <ext/shared_ptr_helper.h>
#include <atomic>
#include <random>
#include <Storages/IStorage.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <Storages/MergeTree/MergeTreeDataMerger.h>
@ -21,6 +22,7 @@
#include <Storages/MergeTree/RemoteQueryExecutor.h>
#include <Storages/MergeTree/RemotePartChecker.h>
#include <DataTypes/DataTypesNumber.h>
#include <Common/randomSeed.h>
#include <Common/ZooKeeper/ZooKeeper.h>
#include <Common/ZooKeeper/LeaderElection.h>
@ -319,6 +321,8 @@ private:
Logger * log;
std::mt19937 rng{randomSeed()};
StorageReplicatedMergeTree(
const String & zookeeper_path_,
const String & replica_name_,