ClickHouse/src/Storages/StorageLogSettings.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
835 B
C++
Raw Normal View History

#include "StorageLogSettings.h"
#include <Disks/StoragePolicy.h>
#include <Interpreters/Context.h>
#include <Parsers/ASTCreateQuery.h>
#include <Parsers/ASTSetQuery.h>
namespace DB
{
String getDiskName(ASTStorage & storage_def, ContextPtr context)
{
if (storage_def.settings)
{
SettingsChanges changes = storage_def.settings->changes;
2020-03-09 01:22:33 +00:00
for (const auto & change : changes)
{
/// How about both disk and storage_policy are specified?
2020-03-09 01:22:33 +00:00
if (change.name == "disk")
return change.value.safeGet<String>();
if (change.name == "storage_policy")
{
auto policy = context->getStoragePolicy(change.value.safeGet<String>());
return policy->getAnyDisk()->getName();
}
}
}
return "default";
}
}