mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Reload stacktrace cache.
This commit is contained in:
parent
ba80e1c8cd
commit
e6a1124ebe
@ -417,11 +417,7 @@ void StackTrace::toStringEveryLine(std::function<void(const std::string &)> call
|
|||||||
|
|
||||||
std::string StackTrace::toString() const
|
std::string StackTrace::toString() const
|
||||||
{
|
{
|
||||||
/// Calculation of stack trace text is extremely slow.
|
return toStringStatic(frame_pointers, offset, size);
|
||||||
/// We use simple cache because otherwise the server could be overloaded by trash queries.
|
|
||||||
|
|
||||||
static SimpleCache<decltype(toStringImpl), &toStringImpl> func_cached;
|
|
||||||
return func_cached(frame_pointers, offset, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StackTrace::toString(void ** frame_pointers_, size_t offset, size_t size)
|
std::string StackTrace::toString(void ** frame_pointers_, size_t offset, size_t size)
|
||||||
@ -432,6 +428,19 @@ std::string StackTrace::toString(void ** frame_pointers_, size_t offset, size_t
|
|||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
frame_pointers_copy[i] = frame_pointers_[i];
|
frame_pointers_copy[i] = frame_pointers_[i];
|
||||||
|
|
||||||
static SimpleCache<decltype(toStringImpl), &toStringImpl> func_cached;
|
return toStringStatic(frame_pointers_copy, offset, size);
|
||||||
return func_cached(frame_pointers_copy, offset, size);
|
}
|
||||||
|
|
||||||
|
std::string StackTrace::toStringStatic(const StackTrace::FramePointers & frame_pointers, size_t offset, size_t size, bool reload)
|
||||||
|
{
|
||||||
|
/// Calculation of stack trace text is extremely slow.
|
||||||
|
/// We use simple cache because otherwise the server could be overloaded by trash queries.
|
||||||
|
static SimpleCache<decltype(toStringImpl), &toStringImpl> func_cached;
|
||||||
|
/// Reload cached stacktrace instead.
|
||||||
|
if (reload)
|
||||||
|
{
|
||||||
|
func_cached.drop();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return func_cached(frame_pointers, offset, size);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
static std::string toString(void ** frame_pointers, size_t offset, size_t size);
|
static std::string toString(void ** frame_pointers, size_t offset, size_t size);
|
||||||
|
static std::string toStringStatic(const FramePointers & frame_pointers, size_t offset, size_t size, bool reload = false);
|
||||||
static void symbolize(const FramePointers & frame_pointers, size_t offset, size_t size, StackTrace::Frames & frames);
|
static void symbolize(const FramePointers & frame_pointers, size_t offset, size_t size, StackTrace::Frames & frames);
|
||||||
|
|
||||||
void toStringEveryLine(std::function<void(const std::string &)> callback) const;
|
void toStringEveryLine(std::function<void(const std::string &)> callback) const;
|
||||||
|
@ -466,7 +466,11 @@ MultiVersion<SymbolIndex>::Version SymbolIndex::instance(bool reload)
|
|||||||
{
|
{
|
||||||
static MultiVersion<SymbolIndex> instance(std::unique_ptr<SymbolIndex>(new SymbolIndex));
|
static MultiVersion<SymbolIndex> instance(std::unique_ptr<SymbolIndex>(new SymbolIndex));
|
||||||
if (reload)
|
if (reload)
|
||||||
|
{
|
||||||
instance.set(std::unique_ptr<SymbolIndex>(new SymbolIndex));
|
instance.set(std::unique_ptr<SymbolIndex>(new SymbolIndex));
|
||||||
|
/// Also reload stacktrace cache.
|
||||||
|
StackTrace::toStringStatic({}, 0, 0, true);
|
||||||
|
}
|
||||||
return instance.get();
|
return instance.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user