mirror of https://github.com/ByConity/ByConity
Merge 'enable_catalog_dev' into 'cnch-dev'
feat(clickhousech@m-5371474647): enable cnch external catalog by default. See merge request: !25825
This commit is contained in:
parent
2e3a9f1bcb
commit
e181b2a622
|
@ -1490,15 +1490,10 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
|||
throw;
|
||||
}
|
||||
|
||||
// Note:: just for test.
|
||||
{
|
||||
// WARNING: There is a undesired restriction on FDB. Each process could only init one fdb client otherwise it will panic.
|
||||
// so if we use fdb as the kv storage, the config for external and internal catalog must be the same.
|
||||
if (global_context->getCnchConfigRef().has(ExternalCatalog::Mgr::configPrefix()))
|
||||
{
|
||||
ExternalCatalog::Mgr::init(*global_context, global_context->getCnchConfigRef());
|
||||
}
|
||||
}
|
||||
// WARNING: There is a undesired restriction on FDB. Each process could only init one fdb client otherwise it will panic.
|
||||
// so if we use fdb as the kv storage, the config for external and internal catalog must be the same.
|
||||
ExternalCatalog::Mgr::init(*global_context, global_context->getConfigRef());
|
||||
|
||||
/// Check sanity of MergeTreeSettings on server startup
|
||||
global_context->getMergeTreeSettings().sanityCheck(settings);
|
||||
global_context->getReplicatedMergeTreeSettings().sanityCheck(settings);
|
||||
|
|
|
@ -21,12 +21,12 @@ extern const int UNKNOWN_CATALOG;
|
|||
|
||||
namespace DB::ExternalCatalog
|
||||
{
|
||||
CnchExternalCatalogMgr::CnchExternalCatalogMgr(Context & _context, const Poco::Util::AbstractConfiguration & mgr_conf)
|
||||
: context(_context), metastore_conf(mgr_conf, Mgr::configPrefix())
|
||||
CnchExternalCatalogMgr::CnchExternalCatalogMgr(Context & _context, const Poco::Util::AbstractConfiguration & mgr_conf, const String & config_prefix)
|
||||
: context(_context), metastore_conf(mgr_conf, config_prefix)
|
||||
{
|
||||
// TODO(ExterncalCatalog):: check whether to set FLAGS_consul_agent_addr here.
|
||||
meta_proxy = std::make_shared<Catalog::MetastoreProxy>(metastore_conf, mgr_conf.getBool("enable_cnch_write_remote_catalog", true));
|
||||
name_space = mgr_conf.getString(Mgr::configPrefix() + ".name_space", "default");
|
||||
name_space = mgr_conf.getString("catalog.name_space", "default");
|
||||
}
|
||||
bool CnchExternalCatalogMgr::createCatalog(const std::string & catalog_name, PlainConfigs * catalog_meta, const TxnTimestamp & ts)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace DB::ExternalCatalog
|
|||
class CnchExternalCatalogMgr : public IExternalCatalogMgr
|
||||
{
|
||||
public:
|
||||
CnchExternalCatalogMgr(Context & context, const Poco::Util::AbstractConfiguration & conf);
|
||||
CnchExternalCatalogMgr(Context & context, const Poco::Util::AbstractConfiguration & conf, const String & config_prefix);
|
||||
~CnchExternalCatalogMgr() override = default;
|
||||
|
||||
bool createCatalog(const std::string & catalog_name, PlainConfigs * catalog_meta, const TxnTimestamp & ts) override;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include <memory>
|
||||
|
||||
#include "Common/Config/MetastoreConfig.h"
|
||||
#include <Common/Exception.h>
|
||||
#include <common/logger_useful.h>
|
||||
#include <ExternalCatalog/CnchExternalCatalogMgr.h>
|
||||
#include <ExternalCatalog/IExternalCatalogMgr.h>
|
||||
#include <ExternalCatalog/InMemoryExternalCatalogMgr.h>
|
||||
|
@ -19,7 +22,8 @@ namespace Mgr
|
|||
void init(Context & _context, [[maybe_unused]] const Poco::Util::AbstractConfiguration & conf)
|
||||
{
|
||||
//TODO(renming):: add more implementation
|
||||
auto key_mgr_type = configPrefix() + ".type";
|
||||
auto prefix = conf.has(configPrefix()) ? configPrefix() : CATALOG_SERVICE_CONFIGURE;
|
||||
auto key_mgr_type = prefix + ".type";
|
||||
auto log = getLogger("ExternalCatalogMgr");
|
||||
if (!conf.has(key_mgr_type))
|
||||
{
|
||||
|
@ -35,7 +39,7 @@ namespace Mgr
|
|||
{
|
||||
// this will created an catalog mgr backed by fdb/bytekv and etc.
|
||||
LOG_DEBUG(log, "Use kv-backed external catalog manager");
|
||||
mgr_ptr = std::make_unique<CnchExternalCatalogMgr>(_context, conf);
|
||||
mgr_ptr = std::make_unique<CnchExternalCatalogMgr>(_context, conf, prefix);
|
||||
}
|
||||
|
||||
assert(mgr_ptr != nullptr);
|
||||
|
|
|
@ -51,10 +51,9 @@ Block InterpreterShowCreateQuery::getSampleBlock()
|
|||
BlockInputStreamPtr InterpreterShowCreateQuery::executeForExternalImpl()
|
||||
{
|
||||
auto catalog_name = query_ptr->as<ASTShowCreateExternalCatalogQuery>()->catalog;
|
||||
auto create_query = ExternalCatalog::Mgr::instance().getCatalogCreateQuery(catalog_name);
|
||||
if (create_query->empty())
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "catalog {} does not exist", catalog_name);
|
||||
auto create_query =ExternalCatalog::Mgr::instance().getCatalogCreateQuery(catalog_name);
|
||||
if(!create_query.has_value() || create_query->empty()){
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "catalog {} does not exist",catalog_name);
|
||||
}
|
||||
MutableColumnPtr column = ColumnString::create();
|
||||
column->insert(create_query.value());
|
||||
|
|
Loading…
Reference in New Issue