mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
Fix tests
This commit is contained in:
parent
dd596121b8
commit
7627f831cd
@ -6,7 +6,7 @@
|
|||||||
#include <Common/logger_useful.h>
|
#include <Common/logger_useful.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When ClickHouse has frozen data on remote storage it requred 'smart' data removing during UNFREEZE.
|
* When ClickHouse has frozen data on remote storage it required 'smart' data removing during UNFREEZE.
|
||||||
* For remote storage actually frozen not remote data but local metadata with referrers on remote data.
|
* For remote storage actually frozen not remote data but local metadata with referrers on remote data.
|
||||||
* So remote data can be referred from working and frozen data sets (or two frozen) at same time.
|
* So remote data can be referred from working and frozen data sets (or two frozen) at same time.
|
||||||
* In this case during UNFREEZE ClickHouse should remove only local metadata and keep remote data.
|
* In this case during UNFREEZE ClickHouse should remove only local metadata and keep remote data.
|
||||||
@ -20,10 +20,6 @@
|
|||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
namespace ErrorCodes
|
|
||||||
{
|
|
||||||
extern const int INVALID_PARTITION_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FreezeMetaData::fill(const StorageReplicatedMergeTree & storage)
|
void FreezeMetaData::fill(const StorageReplicatedMergeTree & storage)
|
||||||
{
|
{
|
||||||
@ -114,6 +110,17 @@ String FreezeMetaData::getFileName(const String & path)
|
|||||||
return fs::path(path) / "frozen_metadata.txt";
|
return fs::path(path) / "frozen_metadata.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unfreezer::Unfreezer(ContextPtr context) : local_context(context), zookeeper()
|
||||||
|
{
|
||||||
|
const auto & config = local_context->getConfigRef();
|
||||||
|
static constexpr auto config_key = "enable_system_unfreeze";
|
||||||
|
if (!config.getBool(config_key, false)) {
|
||||||
|
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Support for SYSTEM UNFREEZE query is disabled. You can enable it via '{}' server setting", config_key);
|
||||||
|
}
|
||||||
|
if (local_context->hasZooKeeper())
|
||||||
|
zookeeper = local_context->getZooKeeper();
|
||||||
|
}
|
||||||
|
|
||||||
BlockIO Unfreezer::unfreeze(const String & backup_name)
|
BlockIO Unfreezer::unfreeze(const String & backup_name)
|
||||||
{
|
{
|
||||||
LOG_DEBUG(log, "Unfreezing backup {}", escapeForFileName(backup_name));
|
LOG_DEBUG(log, "Unfreezing backup {}", escapeForFileName(backup_name));
|
||||||
|
@ -36,14 +36,7 @@ public:
|
|||||||
class Unfreezer
|
class Unfreezer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Unfreezer(ContextPtr context) : local_context(context), zookeeper() {
|
Unfreezer(ContextPtr context);
|
||||||
const auto & config = local_context->getConfigRef();
|
|
||||||
static constexpr auto config_key = "enable_system_unfreeze";
|
|
||||||
if (!config.getBool(config_key, false)) {
|
|
||||||
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Support for SYSTEM UNFREEZE query is disabled. You can enable it via '{}' server setting", config_key);
|
|
||||||
}
|
|
||||||
zookeeper = this->local_context->getZooKeeper();
|
|
||||||
}
|
|
||||||
PartitionCommandsResultInfo unfreezePartitionsFromTableDirectory(MergeTreeData::MatcherFn matcher, const String & backup_name, const Disks & disks, const fs::path & table_directory);
|
PartitionCommandsResultInfo unfreezePartitionsFromTableDirectory(MergeTreeData::MatcherFn matcher, const String & backup_name, const Disks & disks, const fs::path & table_directory);
|
||||||
BlockIO unfreeze(const String & backup_name);
|
BlockIO unfreeze(const String & backup_name);
|
||||||
private:
|
private:
|
||||||
@ -51,7 +44,7 @@ private:
|
|||||||
zkutil::ZooKeeperPtr zookeeper;
|
zkutil::ZooKeeperPtr zookeeper;
|
||||||
Poco::Logger * log = &Poco::Logger::get("Unfreezer");
|
Poco::Logger * log = &Poco::Logger::get("Unfreezer");
|
||||||
static constexpr std::string_view backup_directory_prefix = "shadow";
|
static constexpr std::string_view backup_directory_prefix = "shadow";
|
||||||
static bool removeFreezedPart(DiskPtr disk, const String & path, const String & part_name, ContextPtr local_context, zkutil::ZooKeeperPtr zookeeper);
|
static bool removeFreezedPart(DiskPtr disk, const String & path, const String & part_name, ContextPtr local_context, zkutil::ZooKeeperPtr zookeeper);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user