Skip to content

Commit 8748a27

Browse files
Merge pull request ClickHouse#80303 from ClickHouse/revert-79836-sync-system-error_log-and-system-errors
Revert "Sync system.error_log and system.errors"
2 parents caa3b07 + 854b1a1 commit 8748a27

File tree

15 files changed

+115
-304
lines changed

15 files changed

+115
-304
lines changed

docs/en/operations/server-configuration-parameters/_server_settings_outside_source.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ To manually turn on error history collection [`system.error_log`](../../operatio
244244
<reserved_size_rows>8192</reserved_size_rows>
245245
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
246246
<flush_on_crash>false</flush_on_crash>
247-
<symbolize>true</symbolize>
248247
</error_log>
249248
</clickhouse>
250249
```

docs/en/operations/system-tables/error_log.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,8 @@ Columns:
1818
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Event time.
1919
- `code` ([Int32](../../sql-reference/data-types/int-uint.md)) — Code number of the error.
2020
- `error` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) - Name of the error.
21-
- `last_error_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The time when the last error happened.
22-
- `last_error_message` ([String](../../sql-reference/data-types/string.md)) — Message for the last error.
2321
- `value` ([UInt64](../../sql-reference/data-types/int-uint.md)) — The number of times this error happened.
2422
- `remote` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Remote exception (i.e. received during one of the distributed queries).
25-
- `last_error_query_id` ([String](../../sql-reference/data-types/string.md)) — Id of a query that caused the last error (if available).
26-
- `last_error_trace` ([Array(UInt64)](../../sql-reference/data-types/array.md)) — A stack trace that represents a list of physical addresses where the called methods are stored.
27-
- `last_error_symbols` ([Array(LowCardinality(String))](../../sql-reference/data-types/array.md)), If the symbolization is enabled, contains demangled symbol names, corresponding to the `last_error_trace`.
28-
- `last_error_lines` ([Array(LowCardinality(String))](../../sql-reference/data-types/array.md)), If the symbolization is enabled, contains strings with file names with line numbers, corresponding to the `last_error_trace`.
29-
30-
The symbolization can be enabled or disabled in the `symbolize` under `error_log` in the server's configuration file.
3123

3224
**Example**
3325

docs/en/operations/system-tables/errors.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ Columns:
2121
- `last_error_message` ([String](../../sql-reference/data-types/string.md)) — message for the last error.
2222
- `last_error_trace` ([Array(UInt64)](../../sql-reference/data-types/array.md)) — A [stack trace](https://en.wikipedia.org/wiki/Stack_trace) that represents a list of physical addresses where the called methods are stored.
2323
- `remote` ([UInt8](../../sql-reference/data-types/int-uint.md)) — remote exception (i.e. received during one of the distributed queries).
24-
- `last_error_query_id` ([String](../../sql-reference/data-types/string.md)) — Id of a query that caused the last error (if available).
25-
- `last_error_symbols` ([Array(LowCardinality(String))](../../sql-reference/data-types/array.md)) — Contains demangled symbol names, corresponding to the `last_error_trace`.
26-
- `last_error_lines` ([Array(LowCardinality(String))](../../sql-reference/data-types/array.md)) — Contains strings with file names with line numbers, corresponding to the `last_error_trace`.
2724

2825
:::note
2926
Counters for some errors may increase during successful query execution. It's not recommended to use this table for server monitoring purposes unless you are sure that corresponding error can not be a false positive.

src/Common/AddressToLineCache.cpp

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/Common/AddressToLineCache.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Common/SymbolsHelper.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/Common/SymbolsHelper.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Interpreters/ErrorLog.cpp

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
#include <Interpreters/ErrorLog.h>
1111
#include <Parsers/ExpressionElementParsers.h>
1212
#include <Parsers/parseQuery.h>
13-
#include <Common/SymbolsHelper.h>
1413

14+
#include <vector>
1515

1616
namespace DB
1717
{
1818

1919
ColumnsDescription ErrorLogElement::getColumnsDescription()
2020
{
2121
ParserCodec codec_parser;
22-
DataTypePtr symbolized_type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>()));
2322
return ColumnsDescription {
2423
{
2524
"hostname",
@@ -51,18 +50,6 @@ ColumnsDescription ErrorLogElement::getColumnsDescription()
5150
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
5251
"Error name."
5352
},
54-
{
55-
"last_error_time",
56-
std::make_shared<DataTypeDateTime>(),
57-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
58-
"The time when the last error happened."
59-
},
60-
{
61-
"last_error_message",
62-
std::make_shared<DataTypeString>(),
63-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
64-
"Message for the last error."
65-
},
6653
{
6754
"value",
6855
std::make_shared<DataTypeUInt64>(),
@@ -74,30 +61,6 @@ ColumnsDescription ErrorLogElement::getColumnsDescription()
7461
std::make_shared<DataTypeUInt8>(),
7562
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
7663
"Remote exception (i.e. received during one of the distributed queries)."
77-
},
78-
{
79-
"last_error_query_id",
80-
std::make_shared<DataTypeString>(),
81-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
82-
"Id of a query that caused the last error (if available)."
83-
},
84-
{
85-
"last_error_trace",
86-
std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt64>()),
87-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
88-
"A stack trace that represents a list of physical addresses where the called methods are stored."
89-
},
90-
{
91-
"symbols",
92-
symbolized_type,
93-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
94-
"If the symbolization is enabled, contains demangled symbol names, corresponding to the `trace`."
95-
},
96-
{
97-
"lines",
98-
symbolized_type,
99-
parseQuery(codec_parser, "(ZSTD(1))", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS),
100-
"If the symbolization is enabled, contains strings with file names with line numbers, corresponding to the `trace`."
10164
}
10265
};
10366
}
@@ -111,33 +74,8 @@ void ErrorLogElement::appendToBlock(MutableColumns & columns) const
11174
columns[column_idx++]->insert(event_time);
11275
columns[column_idx++]->insert(code);
11376
columns[column_idx++]->insert(ErrorCodes::getName(code));
114-
columns[column_idx++]->insert(error_time_ms / 1000);
115-
columns[column_idx++]->insert(error_message);
11677
columns[column_idx++]->insert(value);
11778
columns[column_idx++]->insert(remote);
118-
columns[column_idx++]->insert(query_id);
119-
120-
std::vector<UInt64> error_trace_array;
121-
error_trace_array.reserve(error_trace.size());
122-
for (auto * ptr : error_trace)
123-
error_trace_array.emplace_back(reinterpret_cast<UInt64>(ptr));
124-
125-
columns[column_idx++]->insert(Array(error_trace_array.begin(), error_trace_array.end()));
126-
127-
#if defined(__ELF__) && !defined(OS_FREEBSD)
128-
if (symbolize)
129-
{
130-
auto [symbols, lines] = generateArraysSymbolsLines(error_trace_array);
131-
132-
columns[column_idx++]->insert(symbols);
133-
columns[column_idx++]->insert(lines);
134-
}
135-
else
136-
#endif
137-
{
138-
columns[column_idx++]->insertDefault();
139-
columns[column_idx++]->insertDefault();
140-
}
14179
}
14280

14381
struct ValuePair
@@ -161,13 +99,8 @@ void ErrorLog::stepFunction(TimePoint current_time)
16199
ErrorLogElement local_elem {
162100
.event_time=event_time,
163101
.code=code,
164-
.error_time_ms=error.local.error_time_ms,
165-
.error_message=error.local.message,
166102
.value=error.local.count - previous_values.at(code).local,
167-
.remote=false,
168-
.query_id=error.local.query_id,
169-
.error_trace=error.local.trace,
170-
.symbolize=symbolize
103+
.remote=false
171104
};
172105
this->add(std::move(local_elem));
173106
previous_values[code].local = error.local.count;
@@ -177,13 +110,8 @@ void ErrorLog::stepFunction(TimePoint current_time)
177110
ErrorLogElement remote_elem {
178111
.event_time=event_time,
179112
.code=code,
180-
.error_time_ms=error.remote.error_time_ms,
181-
.error_message=error.remote.message,
182113
.value=error.remote.count - previous_values.at(code).remote,
183-
.remote=true,
184-
.query_id=error.remote.query_id,
185-
.error_trace=error.remote.trace,
186-
.symbolize=symbolize
114+
.remote=true
187115
};
188116
add(std::move(remote_elem));
189117
previous_values[code].remote = error.remote.count;

src/Interpreters/ErrorLog.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
#include <Common/ErrorCodes.h>
55
#include <Core/NamesAndTypes.h>
66
#include <Core/NamesAndAliases.h>
7-
#include <DataTypes/DataTypeArray.h>
87
#include <Storages/ColumnsDescription.h>
98

10-
#include <vector>
11-
129

1310
namespace DB
1411
{
@@ -20,13 +17,8 @@ struct ErrorLogElement
2017
{
2118
time_t event_time{};
2219
ErrorCodes::ErrorCode code{};
23-
UInt64 error_time_ms = 0;
24-
std::string error_message{};
2520
ErrorCodes::Value value{};
2621
bool remote{};
27-
std::string query_id;
28-
std::vector<void *> error_trace{};
29-
bool symbolize = false;
3022

3123
static std::string name() { return "ErrorLog"; }
3224
static ColumnsDescription getColumnsDescription();
@@ -39,20 +31,8 @@ class ErrorLog : public PeriodicLog<ErrorLogElement>
3931
{
4032
using PeriodicLog<ErrorLogElement>::PeriodicLog;
4133

42-
public:
43-
ErrorLog(ContextPtr context_,
44-
const SystemLogSettings & settings_,
45-
std::shared_ptr<SystemLogQueue<ErrorLogElement>> queue_ = nullptr)
46-
: PeriodicLog<ErrorLogElement>(context_, settings_, queue_),
47-
symbolize(settings_.symbolize_traces)
48-
{
49-
}
50-
5134
protected:
5235
void stepFunction(TimePoint current_time) override;
53-
54-
private:
55-
bool symbolize;
5636
};
5737

5838
}

src/Interpreters/SystemLog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <Interpreters/Context.h>
1515
#include <Interpreters/CrashLog.h>
1616
#include <Interpreters/DatabaseCatalog.h>
17+
#include <Interpreters/ErrorLog.h>
1718
#include <Interpreters/FilesystemCacheLog.h>
1819
#include <Interpreters/FilesystemReadPrefetchesLog.h>
1920
#include <Interpreters/InterpreterCreateQuery.h>
@@ -33,7 +34,6 @@
3334
#include <Interpreters/SessionLog.h>
3435
#include <Interpreters/TextLog.h>
3536
#include <Interpreters/TraceLog.h>
36-
#include <Interpreters/ErrorLog.h>
3737
#include <Interpreters/TransactionsInfoLog.h>
3838
#include <Interpreters/ZooKeeperLog.h>
3939
#include <IO/WriteHelpers.h>
@@ -279,7 +279,7 @@ std::shared_ptr<TSystemLog> createSystemLog(
279279
log_settings.queue_settings.notify_flush_on_crash = config.getBool(config_prefix + ".flush_on_crash",
280280
TSystemLog::shouldNotifyFlushOnCrash());
281281

282-
if constexpr (std::is_same_v<TSystemLog, TraceLog> || std::is_same_v<TSystemLog, ErrorLog>)
282+
if constexpr (std::is_same_v<TSystemLog, TraceLog>)
283283
log_settings.symbolize_traces = config.getBool(config_prefix + ".symbolize", false);
284284

285285
log_settings.queue_settings.turn_off_logger = TSystemLog::shouldTurnOffLogger();

0 commit comments

Comments
 (0)