summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-01-10 12:32:54 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-01-10 12:32:54 +0200
commit94e18e2987183e251849838a38ddc588dfefa58a (patch)
tree7e68f99bfd6ecd6bed5a41b1b1633e45f84731f8 /storage/perfschema/pfs.cc
parent682d4849ff6faa5089579c9b34563e3a85e6ff06 (diff)
parentc33db2cdc0ab70a874060d58710895f6dac3dea3 (diff)
downloadmariadb-git-94e18e2987183e251849838a38ddc588dfefa58a.tar.gz
Merge remote-tracking branch 'merge/merge-perfschema-5.6' into 10.0
Diffstat (limited to 'storage/perfschema/pfs.cc')
-rw-r--r--storage/perfschema/pfs.cc34
1 files changed, 27 insertions, 7 deletions
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index dd61df5f861..ad3faeea618 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2560,10 +2560,7 @@ start_table_io_wait_v1(PSI_table_locker_state *state,
if (! pfs_table->m_io_enabled)
return NULL;
- PFS_thread *pfs_thread= pfs_table->m_thread_owner;
-
- DBUG_ASSERT(pfs_thread ==
- my_pthread_getspecific_ptr(PFS_thread*, THR_PFS));
+ PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
register uint flags;
ulonglong timer_start= 0;
@@ -2666,7 +2663,7 @@ start_table_lock_wait_v1(PSI_table_locker_state *state,
if (! pfs_table->m_lock_enabled)
return NULL;
- PFS_thread *pfs_thread= pfs_table->m_thread_owner;
+ PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
PFS_TL_LOCK_TYPE lock_type;
@@ -3068,7 +3065,12 @@ start_socket_wait_v1(PSI_socket_locker_state *state,
if (flag_thread_instrumentation)
{
- PFS_thread *pfs_thread= pfs_socket->m_thread_owner;
+ /*
+ Do not use pfs_socket->m_thread_owner here,
+ as different threads may use concurrently the same socket,
+ for example during a KILL.
+ */
+ PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(pfs_thread == NULL))
return NULL;
@@ -3436,6 +3438,8 @@ static void end_idle_wait_v1(PSI_idle_locker* locker)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
@@ -3517,6 +3521,8 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
}
@@ -3596,6 +3602,8 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
}
@@ -3668,6 +3676,8 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
}
@@ -3732,6 +3742,8 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
}
@@ -3826,6 +3838,8 @@ static void end_table_io_wait_v1(PSI_table_locker* locker)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
@@ -3895,6 +3909,8 @@ static void end_table_lock_wait_v1(PSI_table_locker* locker)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
@@ -4143,6 +4159,8 @@ static void end_file_wait_v1(PSI_file_locker *locker,
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}
}
@@ -5070,6 +5088,8 @@ static void end_socket_wait_v1(PSI_socket_locker *locker, size_t byte_count)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
thread->m_events_waits_current--;
+
+ DBUG_ASSERT(wait == thread->m_events_waits_current);
}
}