mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix build
This commit is contained in:
parent
c153fae0b8
commit
b93f483a0e
@ -25,7 +25,7 @@ std::string LibraryBridge::bridgeName() const
|
|||||||
|
|
||||||
LibraryBridge::HandlerFactoryPtr LibraryBridge::getHandlerFactoryPtr(ContextPtr context) const
|
LibraryBridge::HandlerFactoryPtr LibraryBridge::getHandlerFactoryPtr(ContextPtr context) const
|
||||||
{
|
{
|
||||||
return std::make_shared<LibraryBridgeHandlerFactory>("LibraryRequestHandlerFactory", keep_alive_timeout, context);
|
return std::make_shared<LibraryBridgeHandlerFactory>("LibraryRequestHandlerFactory", context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,10 @@ namespace DB
|
|||||||
{
|
{
|
||||||
LibraryBridgeHandlerFactory::LibraryBridgeHandlerFactory(
|
LibraryBridgeHandlerFactory::LibraryBridgeHandlerFactory(
|
||||||
const std::string & name_,
|
const std::string & name_,
|
||||||
size_t keep_alive_timeout_,
|
|
||||||
ContextPtr context_)
|
ContextPtr context_)
|
||||||
: WithContext(context_)
|
: WithContext(context_)
|
||||||
, log(getLogger(name_))
|
, log(getLogger(name_))
|
||||||
, name(name_)
|
, name(name_)
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,17 +24,17 @@ std::unique_ptr<HTTPRequestHandler> LibraryBridgeHandlerFactory::createRequestHa
|
|||||||
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET)
|
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET)
|
||||||
{
|
{
|
||||||
if (uri.getPath() == "/extdict_ping")
|
if (uri.getPath() == "/extdict_ping")
|
||||||
return std::make_unique<ExternalDictionaryLibraryBridgeExistsHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<ExternalDictionaryLibraryBridgeExistsHandler>(getContext());
|
||||||
else if (uri.getPath() == "/catboost_ping")
|
else if (uri.getPath() == "/catboost_ping")
|
||||||
return std::make_unique<CatBoostLibraryBridgeExistsHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<CatBoostLibraryBridgeExistsHandler>(getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
|
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
|
||||||
{
|
{
|
||||||
if (uri.getPath() == "/extdict_request")
|
if (uri.getPath() == "/extdict_request")
|
||||||
return std::make_unique<ExternalDictionaryLibraryBridgeRequestHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<ExternalDictionaryLibraryBridgeRequestHandler>(getContext());
|
||||||
else if (uri.getPath() == "/catboost_request")
|
else if (uri.getPath() == "/catboost_request")
|
||||||
return std::make_unique<CatBoostLibraryBridgeRequestHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<CatBoostLibraryBridgeRequestHandler>(getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -13,7 +13,6 @@ class LibraryBridgeHandlerFactory : public HTTPRequestHandlerFactory, WithContex
|
|||||||
public:
|
public:
|
||||||
LibraryBridgeHandlerFactory(
|
LibraryBridgeHandlerFactory(
|
||||||
const std::string & name_,
|
const std::string & name_,
|
||||||
size_t keep_alive_timeout_,
|
|
||||||
ContextPtr context_);
|
ContextPtr context_);
|
||||||
|
|
||||||
std::unique_ptr<HTTPRequestHandler> createRequestHandler(const HTTPServerRequest & request) override;
|
std::unique_ptr<HTTPRequestHandler> createRequestHandler(const HTTPServerRequest & request) override;
|
||||||
@ -21,7 +20,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
const std::string name;
|
const std::string name;
|
||||||
const size_t keep_alive_timeout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,10 +86,8 @@ static void writeData(Block data, OutputFormatPtr format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExternalDictionaryLibraryBridgeRequestHandler::ExternalDictionaryLibraryBridgeRequestHandler(size_t keep_alive_timeout_, ContextPtr context_)
|
ExternalDictionaryLibraryBridgeRequestHandler::ExternalDictionaryLibraryBridgeRequestHandler(ContextPtr context_)
|
||||||
: WithContext(context_)
|
: WithContext(context_), log(getLogger("ExternalDictionaryLibraryBridgeRequestHandler"))
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
, log(getLogger("ExternalDictionaryLibraryBridgeRequestHandler"))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +134,7 @@ void ExternalDictionaryLibraryBridgeRequestHandler::handleRequest(HTTPServerRequ
|
|||||||
const String & dictionary_id = params.get("dictionary_id");
|
const String & dictionary_id = params.get("dictionary_id");
|
||||||
|
|
||||||
LOG_TRACE(log, "Library method: '{}', dictionary id: {}", method, dictionary_id);
|
LOG_TRACE(log, "Library method: '{}', dictionary id: {}", method, dictionary_id);
|
||||||
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -410,11 +408,8 @@ void ExternalDictionaryLibraryBridgeExistsHandler::handleRequest(HTTPServerReque
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CatBoostLibraryBridgeRequestHandler::CatBoostLibraryBridgeRequestHandler(
|
CatBoostLibraryBridgeRequestHandler::CatBoostLibraryBridgeRequestHandler(ContextPtr context_)
|
||||||
size_t keep_alive_timeout_, ContextPtr context_)
|
: WithContext(context_), log(getLogger("CatBoostLibraryBridgeRequestHandler"))
|
||||||
: WithContext(context_)
|
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
, log(getLogger("CatBoostLibraryBridgeRequestHandler"))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +448,7 @@ void CatBoostLibraryBridgeRequestHandler::handleRequest(HTTPServerRequest & requ
|
|||||||
const String & method = params.get("method");
|
const String & method = params.get("method");
|
||||||
|
|
||||||
LOG_TRACE(log, "Library method: '{}'", method);
|
LOG_TRACE(log, "Library method: '{}'", method);
|
||||||
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -18,14 +18,13 @@ namespace DB
|
|||||||
class ExternalDictionaryLibraryBridgeRequestHandler : public HTTPRequestHandler, WithContext
|
class ExternalDictionaryLibraryBridgeRequestHandler : public HTTPRequestHandler, WithContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ExternalDictionaryLibraryBridgeRequestHandler(size_t keep_alive_timeout_, ContextPtr context_);
|
ExternalDictionaryLibraryBridgeRequestHandler(ContextPtr context_);
|
||||||
|
|
||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline auto FORMAT = "RowBinary";
|
static constexpr inline auto FORMAT = "RowBinary";
|
||||||
|
|
||||||
const size_t keep_alive_timeout;
|
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,12 +61,11 @@ private:
|
|||||||
class CatBoostLibraryBridgeRequestHandler : public HTTPRequestHandler, WithContext
|
class CatBoostLibraryBridgeRequestHandler : public HTTPRequestHandler, WithContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CatBoostLibraryBridgeRequestHandler(size_t keep_alive_timeout_, ContextPtr context_);
|
CatBoostLibraryBridgeRequestHandler(ContextPtr context_);
|
||||||
|
|
||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const size_t keep_alive_timeout;
|
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -200,10 +200,7 @@ void ODBCColumnsInfoHandler::handleRequest(HTTPServerRequest & request, HTTPServ
|
|||||||
if (columns.empty())
|
if (columns.empty())
|
||||||
throw Exception(ErrorCodes::UNKNOWN_TABLE, "Columns definition was not returned");
|
throw Exception(ErrorCodes::UNKNOWN_TABLE, "Columns definition was not returned");
|
||||||
|
|
||||||
WriteBufferFromHTTPServerResponse out(
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
response,
|
|
||||||
request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD,
|
|
||||||
keep_alive_timeout);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeStringBinary(columns.toString(), out);
|
writeStringBinary(columns.toString(), out);
|
||||||
|
@ -16,18 +16,12 @@ namespace DB
|
|||||||
class ODBCColumnsInfoHandler : public HTTPRequestHandler, WithContext
|
class ODBCColumnsInfoHandler : public HTTPRequestHandler, WithContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCColumnsInfoHandler(size_t keep_alive_timeout_, ContextPtr context_)
|
ODBCColumnsInfoHandler(ContextPtr context_) : WithContext(context_), log(getLogger("ODBCColumnsInfoHandler")) { }
|
||||||
: WithContext(context_)
|
|
||||||
, log(getLogger("ODBCColumnsInfoHandler"))
|
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
size_t keep_alive_timeout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ void IdentifierQuoteHandler::handleRequest(HTTPServerRequest & request, HTTPServ
|
|||||||
|
|
||||||
auto identifier = getIdentifierQuote(std::move(connection));
|
auto identifier = getIdentifierQuote(std::move(connection));
|
||||||
|
|
||||||
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeStringBinary(identifier, out);
|
writeStringBinary(identifier, out);
|
||||||
|
@ -14,18 +14,12 @@ namespace DB
|
|||||||
class IdentifierQuoteHandler : public HTTPRequestHandler, WithContext
|
class IdentifierQuoteHandler : public HTTPRequestHandler, WithContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IdentifierQuoteHandler(size_t keep_alive_timeout_, ContextPtr context_)
|
IdentifierQuoteHandler(ContextPtr context_) : WithContext(context_), log(getLogger("IdentifierQuoteHandler")) { }
|
||||||
: WithContext(context_)
|
|
||||||
, log(getLogger("IdentifierQuoteHandler"))
|
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
size_t keep_alive_timeout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ void ODBCHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -20,12 +20,10 @@ class ODBCHandler : public HTTPRequestHandler, WithContext
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCHandler(
|
ODBCHandler(
|
||||||
size_t keep_alive_timeout_,
|
|
||||||
ContextPtr context_,
|
ContextPtr context_,
|
||||||
const String & mode_)
|
const String & mode_)
|
||||||
: WithContext(context_)
|
: WithContext(context_)
|
||||||
, log(getLogger("ODBCHandler"))
|
, log(getLogger("ODBCHandler"))
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
, mode(mode_)
|
, mode(mode_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -35,7 +33,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
|
|
||||||
size_t keep_alive_timeout;
|
|
||||||
String mode;
|
String mode;
|
||||||
|
|
||||||
static inline std::mutex mutex;
|
static inline std::mutex mutex;
|
||||||
|
@ -30,26 +30,26 @@ std::unique_ptr<HTTPRequestHandler> ODBCBridgeHandlerFactory::createRequestHandl
|
|||||||
|
|
||||||
if (uri.getPath() == "/columns_info")
|
if (uri.getPath() == "/columns_info")
|
||||||
#if USE_ODBC
|
#if USE_ODBC
|
||||||
return std::make_unique<ODBCColumnsInfoHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<ODBCColumnsInfoHandler>(getContext());
|
||||||
#else
|
#else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
else if (uri.getPath() == "/identifier_quote")
|
else if (uri.getPath() == "/identifier_quote")
|
||||||
#if USE_ODBC
|
#if USE_ODBC
|
||||||
return std::make_unique<IdentifierQuoteHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<IdentifierQuoteHandler>(getContext());
|
||||||
#else
|
#else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
else if (uri.getPath() == "/schema_allowed")
|
else if (uri.getPath() == "/schema_allowed")
|
||||||
#if USE_ODBC
|
#if USE_ODBC
|
||||||
return std::make_unique<SchemaAllowedHandler>(keep_alive_timeout, getContext());
|
return std::make_unique<SchemaAllowedHandler>(getContext());
|
||||||
#else
|
#else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
else if (uri.getPath() == "/write")
|
else if (uri.getPath() == "/write")
|
||||||
return std::make_unique<ODBCHandler>(keep_alive_timeout, getContext(), "write");
|
return std::make_unique<ODBCHandler>(getContext(), "write");
|
||||||
else
|
else
|
||||||
return std::make_unique<ODBCHandler>(keep_alive_timeout, getContext(), "read");
|
return std::make_unique<ODBCHandler>(getContext(), "read");
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ void SchemaAllowedHandler::handleRequest(HTTPServerRequest & request, HTTPServer
|
|||||||
|
|
||||||
bool result = isSchemaAllowed(std::move(connection));
|
bool result = isSchemaAllowed(std::move(connection));
|
||||||
|
|
||||||
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
|
WriteBufferFromHTTPServerResponse out(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeBoolText(result, out);
|
writeBoolText(result, out);
|
||||||
|
@ -17,18 +17,12 @@ class Context;
|
|||||||
class SchemaAllowedHandler : public HTTPRequestHandler, WithContext
|
class SchemaAllowedHandler : public HTTPRequestHandler, WithContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SchemaAllowedHandler(size_t keep_alive_timeout_, ContextPtr context_)
|
SchemaAllowedHandler(ContextPtr context_) : WithContext(context_), log(getLogger("SchemaAllowedHandler")) { }
|
||||||
: WithContext(context_)
|
|
||||||
, log(getLogger("SchemaAllowedHandler"))
|
|
||||||
, keep_alive_timeout(keep_alive_timeout_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
size_t keep_alive_timeout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user