@@ -29,6 +29,11 @@ namespace Setting
29
29
extern const SettingsUInt64 max_query_size;
30
30
}
31
31
32
+ namespace ErrorCodes
33
+ {
34
+ extern const int SYNTAX_ERROR;
35
+ }
36
+
32
37
enum class Status : uint8_t
33
38
{
34
39
INACTIVE,
@@ -62,7 +67,7 @@ ColumnsDescription StorageSystemDDLWorkerQueue::getColumnsDescription()
62
67
{" entry_version" , std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt8>()), " Version of the entry." },
63
68
{" initiator_host" , std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>()), " Host that initiated the DDL operation." },
64
69
{" initiator_port" , std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt16>()), " Port used by the initiator." },
65
- {" cluster" , std::make_shared<DataTypeString>(), " Cluster name." },
70
+ {" cluster" , std::make_shared<DataTypeString>(), " Cluster name, empty if not determined ." },
66
71
{" query" , std::make_shared<DataTypeString>(), " Query executed." },
67
72
{" settings" , std::make_shared<DataTypeMap>(std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()), " Settings used in the DDL operation." },
68
73
{" query_create_time" , std::make_shared<DataTypeDateTime>(), " Query created time." },
@@ -85,8 +90,23 @@ static String clusterNameFromDDLQuery(ContextPtr context, const DDLTask & task)
85
90
86
91
String description = fmt::format (" from {}" , task.entry_path );
87
92
ParserQuery parser_query (end, settings[Setting::allow_settings_after_format_in_insert]);
88
- ASTPtr query = parseQuery (
89
- parser_query, begin, end, description, settings[Setting::max_query_size], settings[Setting::max_parser_depth], settings[Setting::max_parser_backtracks]);
93
+ ASTPtr query;
94
+
95
+ try
96
+ {
97
+ query = parseQuery (
98
+ parser_query, begin, end, description, settings[Setting::max_query_size], settings[Setting::max_parser_depth], settings[Setting::max_parser_backtracks]);
99
+ }
100
+ catch (const Exception & e)
101
+ {
102
+ LOG_INFO (getLogger (" StorageSystemDDLWorkerQueue" ), " Failed to determine cluster" );
103
+ if (e.code () == ErrorCodes::SYNTAX_ERROR)
104
+ {
105
+ // / ignore parse error and present available information
106
+ return " " ;
107
+ }
108
+ throw ;
109
+ }
90
110
91
111
String cluster_name;
92
112
if (const auto * query_on_cluster = dynamic_cast <const ASTQueryWithOnCluster *>(query.get ()))
0 commit comments