1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Backport of revno: 2617.68.13

Introduce a counter for protection against global read lock on thread level.

The functions for protection against global read lock sometimes need a local
variable to signal when the protection is set, and hence need to be released.
It would be better to control this behaviour via a counter on the THD struct,
telling how many times the protection has been claimed by the current thread.
A side-effect of the fix is that if protection is claimed twice for a thread,
only a simple increment is required for the second claim, instead of a
mutex-protected increment of the global variable protect_against_global_read_lock.


sql/lock.cc:
  Count how many times that we have claimed protection against global read lock.
  Assert that we really have the protection when releasing it.
  Added comments to all functions operating on global_read_lock.
sql/sql_class.cc:
  Added the counter variable global_read_lock_protection.
sql/sql_class.h:
  Added the counter variable global_read_lock_protection.
sql/sql_parse.cc:
  Replaced test on local variable need_start_waiting with test on
  thd->global_read_lock_protection.
sql/sql_table.cc:
  Replaced test on local variable need_start_waiting with test on
  thd->global_read_lock_protection.
sql/sql_trigger.cc:
  Inserted test on thd->global_read_lock_protection.
This commit is contained in:
Jon Olav Hauglid
2009-12-09 15:25:48 +01:00
parent 832ad46641
commit f3e9b392ac
6 changed files with 115 additions and 32 deletions

View File

@ -1874,6 +1874,7 @@ public:
ulong rand_saved_seed1, rand_saved_seed2;
pthread_t real_id; /* For debugging */
my_thread_id thread_id;
uint global_read_lock_protection;// GRL protection count
uint tmp_table, global_read_lock;
uint server_status,open_options;
enum enum_thread_type system_thread;