Skip to content

Commit b9b98b3

Browse files
committed
WL#13821 REFACTORING: DEADLOCK WITH PLUGIN INSTALL
Post push fix. In sql/sql_plugin.cc, in is_regular_call(), use the THD object passed with the system variable call. Approved by: Chris Powers <chris.powers@oracle.com>
1 parent fee5357 commit b9b98b3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sql/sql_plugin.cc

+8-9
Original file line numberDiff line numberDiff line change
@@ -3403,8 +3403,7 @@ void alloc_and_copy_thd_dynamic_variables(THD *thd) {
34033403
mysql_mutex_unlock(&LOCK_system_variables_hash);
34043404
}
34053405

3406-
static bool is_regular_call() {
3407-
THD *thd = current_thd;
3406+
static bool is_regular_call(THD *thd) {
34083407
if (thd == nullptr) {
34093408
return true;
34103409
}
@@ -3424,7 +3423,7 @@ static bool is_regular_call() {
34243423

34253424
static bool *mysql_sys_var_bool(THD *thd, int offset) {
34263425
bool *result;
3427-
if (is_regular_call()) {
3426+
if (is_regular_call(thd)) {
34283427
mysql_mutex_lock(&LOCK_global_system_variables);
34293428
result = (bool *)intern_sys_var_ptr(thd, offset);
34303429
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3436,7 +3435,7 @@ static bool *mysql_sys_var_bool(THD *thd, int offset) {
34363435

34373436
static int *mysql_sys_var_int(THD *thd, int offset) {
34383437
int *result;
3439-
if (is_regular_call()) {
3438+
if (is_regular_call(thd)) {
34403439
mysql_mutex_lock(&LOCK_global_system_variables);
34413440
result = (int *)intern_sys_var_ptr(thd, offset);
34423441
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3448,7 +3447,7 @@ static int *mysql_sys_var_int(THD *thd, int offset) {
34483447

34493448
static unsigned int *mysql_sys_var_uint(THD *thd, int offset) {
34503449
unsigned int *result;
3451-
if (is_regular_call()) {
3450+
if (is_regular_call(thd)) {
34523451
mysql_mutex_lock(&LOCK_global_system_variables);
34533452
result = (unsigned int *)intern_sys_var_ptr(thd, offset);
34543453
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3460,7 +3459,7 @@ static unsigned int *mysql_sys_var_uint(THD *thd, int offset) {
34603459

34613460
static unsigned long *mysql_sys_var_ulong(THD *thd, int offset) {
34623461
unsigned long *result;
3463-
if (is_regular_call()) {
3462+
if (is_regular_call(thd)) {
34643463
mysql_mutex_lock(&LOCK_global_system_variables);
34653464
result = (unsigned long *)intern_sys_var_ptr(thd, offset);
34663465
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3472,7 +3471,7 @@ static unsigned long *mysql_sys_var_ulong(THD *thd, int offset) {
34723471

34733472
static unsigned long long *mysql_sys_var_ulonglong(THD *thd, int offset) {
34743473
unsigned long long *result;
3475-
if (is_regular_call()) {
3474+
if (is_regular_call(thd)) {
34763475
mysql_mutex_lock(&LOCK_global_system_variables);
34773476
result = (unsigned long long *)intern_sys_var_ptr(thd, offset);
34783477
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3484,7 +3483,7 @@ static unsigned long long *mysql_sys_var_ulonglong(THD *thd, int offset) {
34843483

34853484
static char **mysql_sys_var_str(THD *thd, int offset) {
34863485
char **result;
3487-
if (is_regular_call()) {
3486+
if (is_regular_call(thd)) {
34883487
mysql_mutex_lock(&LOCK_global_system_variables);
34893488
result = (char **)intern_sys_var_ptr(thd, offset);
34903489
mysql_mutex_unlock(&LOCK_global_system_variables);
@@ -3496,7 +3495,7 @@ static char **mysql_sys_var_str(THD *thd, int offset) {
34963495

34973496
static double *mysql_sys_var_double(THD *thd, int offset) {
34983497
double *result;
3499-
if (is_regular_call()) {
3498+
if (is_regular_call(thd)) {
35003499
mysql_mutex_lock(&LOCK_global_system_variables);
35013500
result = (double *)intern_sys_var_ptr(thd, offset);
35023501
mysql_mutex_unlock(&LOCK_global_system_variables);

0 commit comments

Comments
 (0)