mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Remove unimplemented RAID1 support
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
c95591f294
commit
da974585f1
@ -10,8 +10,6 @@ namespace DB
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int NO_ELEMENTS_IN_CONFIG;
|
||||
extern const int INCONSISTENT_RESERVATIONS;
|
||||
extern const int NO_RESERVATIONS_PROVIDED;
|
||||
}
|
||||
|
||||
IVolume::IVolume(
|
||||
@ -45,43 +43,4 @@ UInt64 IVolume::getMaxUnreservedFreeSpace() const
|
||||
return res;
|
||||
}
|
||||
|
||||
MultiDiskReservation::MultiDiskReservation(Reservations & reservations_, UInt64 size_)
|
||||
: reservations(std::move(reservations_))
|
||||
, size(size_)
|
||||
{
|
||||
if (reservations.empty())
|
||||
{
|
||||
throw Exception("At least one reservation must be provided to MultiDiskReservation", ErrorCodes::NO_RESERVATIONS_PROVIDED);
|
||||
}
|
||||
|
||||
for (auto & reservation : reservations)
|
||||
{
|
||||
if (reservation->getSize() != size_)
|
||||
{
|
||||
throw Exception("Reservations must have same size", ErrorCodes::INCONSISTENT_RESERVATIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Disks MultiDiskReservation::getDisks() const
|
||||
{
|
||||
Disks res;
|
||||
res.reserve(reservations.size());
|
||||
for (const auto & reservation : reservations)
|
||||
{
|
||||
res.push_back(reservation->getDisk());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void MultiDiskReservation::update(UInt64 new_size)
|
||||
{
|
||||
for (auto & reservation : reservations)
|
||||
{
|
||||
reservation->update(new_size);
|
||||
}
|
||||
size = new_size;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -81,22 +81,4 @@ public:
|
||||
bool perform_ttl_move_on_insert = true;
|
||||
};
|
||||
|
||||
/// Reservation for multiple disks at once. Can be used in RAID1 implementation.
|
||||
class MultiDiskReservation : public IReservation
|
||||
{
|
||||
public:
|
||||
MultiDiskReservation(Reservations & reservations, UInt64 size);
|
||||
|
||||
UInt64 getSize() const override { return size; }
|
||||
|
||||
DiskPtr getDisk(size_t i) const override { return reservations[i]->getDisk(); }
|
||||
|
||||
Disks getDisks() const override;
|
||||
|
||||
void update(UInt64 new_size) override;
|
||||
private:
|
||||
Reservations reservations;
|
||||
UInt64 size;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "StoragePolicy.h"
|
||||
#include "DiskFactory.h"
|
||||
#include "DiskLocal.h"
|
||||
#include "createVolume.h"
|
||||
|
||||
#include <Interpreters/Context.h>
|
||||
#include <Common/escapeForFileName.h>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <Disks/IDisk.h>
|
||||
#include <Disks/IVolume.h>
|
||||
#include <Disks/VolumeJBOD.h>
|
||||
#include <Disks/VolumeRAID1.h>
|
||||
#include <Disks/SingleDiskVolume.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Common/CurrentMetrics.h>
|
||||
|
@ -1,29 +0,0 @@
|
||||
#include "VolumeRAID1.h"
|
||||
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <Common/quoteString.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
ReservationPtr VolumeRAID1::reserve(UInt64 bytes)
|
||||
{
|
||||
/// This volume can not store data which size is greater than `max_data_part_size`
|
||||
/// to ensure that parts of size greater than that go to another volume(s).
|
||||
|
||||
if (max_data_part_size != 0 && bytes > max_data_part_size)
|
||||
return {};
|
||||
|
||||
Reservations res(disks.size());
|
||||
for (size_t i = 0; i < disks.size(); ++i)
|
||||
{
|
||||
res[i] = disks[i]->reserve(bytes);
|
||||
|
||||
if (!res[i])
|
||||
return {};
|
||||
}
|
||||
|
||||
return std::make_unique<MultiDiskReservation>(res, bytes);
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Disks/createVolume.h>
|
||||
#include <Disks/VolumeJBOD.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class VolumeRAID1;
|
||||
|
||||
using VolumeRAID1Ptr = std::shared_ptr<VolumeRAID1>;
|
||||
|
||||
/// Volume which reserves space on each underlying disk.
|
||||
///
|
||||
/// NOTE: Just interface implementation, doesn't used in codebase,
|
||||
/// also not available for user.
|
||||
class VolumeRAID1 : public VolumeJBOD
|
||||
{
|
||||
public:
|
||||
VolumeRAID1(String name_, Disks disks_, UInt64 max_data_part_size_, bool are_merges_avoided_in_config_)
|
||||
: VolumeJBOD(name_, disks_, max_data_part_size_, are_merges_avoided_in_config_)
|
||||
{
|
||||
}
|
||||
|
||||
VolumeRAID1(
|
||||
String name_,
|
||||
const Poco::Util::AbstractConfiguration & config,
|
||||
const String & config_prefix,
|
||||
DiskSelectorPtr disk_selector)
|
||||
: VolumeJBOD(name_, config, config_prefix, disk_selector)
|
||||
{
|
||||
}
|
||||
|
||||
VolumeRAID1(
|
||||
VolumeRAID1 & volume_raid1,
|
||||
const Poco::Util::AbstractConfiguration & config,
|
||||
const String & config_prefix,
|
||||
DiskSelectorPtr disk_selector)
|
||||
: VolumeJBOD(volume_raid1, config, config_prefix, disk_selector)
|
||||
{
|
||||
}
|
||||
|
||||
VolumeType getType() const override { return VolumeType::RAID1; }
|
||||
|
||||
ReservationPtr reserve(UInt64 bytes) override;
|
||||
};
|
||||
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <Disks/SingleDiskVolume.h>
|
||||
#include <Disks/VolumeJBOD.h>
|
||||
#include <Disks/VolumeRAID1.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@ -23,11 +22,6 @@ VolumePtr createVolumeFromReservation(const ReservationPtr & reservation, Volume
|
||||
/// for such type of reservation will be with one disk.
|
||||
return std::make_shared<SingleDiskVolume>(other_volume->getName(), reservation->getDisk(), other_volume->max_data_part_size);
|
||||
}
|
||||
if (other_volume->getType() == VolumeType::RAID1)
|
||||
{
|
||||
auto volume = std::dynamic_pointer_cast<VolumeRAID1>(other_volume);
|
||||
return std::make_shared<VolumeRAID1>(volume->getName(), reservation->getDisks(), volume->max_data_part_size, volume->are_merges_avoided);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <IO/Operators.h>
|
||||
#include <IO/ConnectionTimeouts.h>
|
||||
#include <IO/ConnectionTimeoutsContext.h>
|
||||
#include <Disks/createVolume.h>
|
||||
|
||||
#include <Interpreters/InterpreterAlterQuery.h>
|
||||
#include <Interpreters/PartLog.h>
|
||||
|
Loading…
Reference in New Issue
Block a user