Commit b5dab19e authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-24757 : fix potential null pointer dereference in I_S.thread_pool_queues

With the fix, new connection without THDs will now show NULL in
thread_pool_queues.CONNECTION_ID.
parent e2c571ad
...@@ -31,7 +31,7 @@ Field Type Null Key Default Extra ...@@ -31,7 +31,7 @@ Field Type Null Key Default Extra
GROUP_ID int(6) NO 0 GROUP_ID int(6) NO 0
POSITION int(6) NO 0 POSITION int(6) NO 0
PRIORITY int(1) NO 0 PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) unsigned NO 0 CONNECTION_ID bigint(19) unsigned YES NULL
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0 QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS; DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
Field Type Null Key Default Extra Field Type Null Key Default Extra
......
...@@ -92,7 +92,7 @@ static ST_FIELD_INFO queues_field_info[] = ...@@ -92,7 +92,7 @@ static ST_FIELD_INFO queues_field_info[] =
Column("GROUP_ID", SLong(6), NOT_NULL), Column("GROUP_ID", SLong(6), NOT_NULL),
Column("POSITION", SLong(6), NOT_NULL), Column("POSITION", SLong(6), NOT_NULL),
Column("PRIORITY", SLong(1), NOT_NULL), Column("PRIORITY", SLong(1), NOT_NULL),
Column("CONNECTION_ID", ULonglong(19), NOT_NULL), Column("CONNECTION_ID", ULonglong(19), NULLABLE),
Column("QUEUEING_TIME_MICROSECONDS", SLonglong(19), NOT_NULL), Column("QUEUEING_TIME_MICROSECONDS", SLonglong(19), NOT_NULL),
CEnd() CEnd()
}; };
...@@ -130,7 +130,8 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*) ...@@ -130,7 +130,8 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*)
/* PRIORITY */ /* PRIORITY */
table->field[2]->store(prio, true); table->field[2]->store(prio, true);
/* CONNECTION_ID */ /* CONNECTION_ID */
table->field[3]->store(c->thd->thread_id, true); if (c->thd)
table->field[3]->store(c->thd->thread_id, true);
/* QUEUEING_TIME */ /* QUEUEING_TIME */
table->field[4]->store(now - c->enqueue_time, true); table->field[4]->store(now - c->enqueue_time, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment