mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 04:22:03 +00:00
Explicitly forbid allocations in OvercommitTracker
This commit is contained in:
parent
e10f079bd3
commit
099055c183
@ -28,11 +28,21 @@ OvercommitTracker::OvercommitTracker(std::mutex & global_mutex_)
|
|||||||
#define LOG_DEBUG_SAFE(...) \
|
#define LOG_DEBUG_SAFE(...) \
|
||||||
do { \
|
do { \
|
||||||
OvercommitTrackerBlockerInThread blocker; \
|
OvercommitTrackerBlockerInThread blocker; \
|
||||||
|
try \
|
||||||
|
{ \
|
||||||
|
ALLOW_ALLOCATIONS_IN_SCOPE; \
|
||||||
LOG_DEBUG(__VA_ARGS__); \
|
LOG_DEBUG(__VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
catch (std::bad_alloc const &) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, "Allocation failed during writing to log in OvercommitTracker\n"); \
|
||||||
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
OvercommitResult OvercommitTracker::needToStopQuery(MemoryTracker * tracker, Int64 amount)
|
OvercommitResult OvercommitTracker::needToStopQuery(MemoryTracker * tracker, Int64 amount)
|
||||||
{
|
{
|
||||||
|
DENY_ALLOCATIONS_IN_SCOPE;
|
||||||
|
|
||||||
if (OvercommitTrackerBlockerInThread::isBlocked())
|
if (OvercommitTrackerBlockerInThread::isBlocked())
|
||||||
return OvercommitResult::NONE;
|
return OvercommitResult::NONE;
|
||||||
// NOTE: Do not change the order of locks
|
// NOTE: Do not change the order of locks
|
||||||
@ -108,6 +118,8 @@ OvercommitResult OvercommitTracker::needToStopQuery(MemoryTracker * tracker, Int
|
|||||||
|
|
||||||
void OvercommitTracker::tryContinueQueryExecutionAfterFree(Int64 amount)
|
void OvercommitTracker::tryContinueQueryExecutionAfterFree(Int64 amount)
|
||||||
{
|
{
|
||||||
|
DENY_ALLOCATIONS_IN_SCOPE;
|
||||||
|
|
||||||
if (OvercommitTrackerBlockerInThread::isBlocked())
|
if (OvercommitTrackerBlockerInThread::isBlocked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -122,6 +134,8 @@ void OvercommitTracker::tryContinueQueryExecutionAfterFree(Int64 amount)
|
|||||||
|
|
||||||
void OvercommitTracker::onQueryStop(MemoryTracker * tracker)
|
void OvercommitTracker::onQueryStop(MemoryTracker * tracker)
|
||||||
{
|
{
|
||||||
|
DENY_ALLOCATIONS_IN_SCOPE;
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lk(overcommit_m);
|
std::unique_lock<std::mutex> lk(overcommit_m);
|
||||||
if (picked_tracker == tracker)
|
if (picked_tracker == tracker)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user