/percona/5.0.87-b20-20100217/innodb_misc_patch.patch

https://github.com/knielsen/gentoo-mysql-extra · Patch · 64 lines · 59 code · 5 blank · 0 comment · 0 complexity · f5e5492fa8e2608c29ef781a9448af3e MD5 · raw file

  1. diff -ru mysql-5.0.84_p_orig/innobase/row/row0sel.c mysql-5.0.84/innobase/row/row0sel.c
  2. --- mysql-5.0.84_p_orig/innobase/row/row0sel.c 2009-07-07 21:54:10.000000000 +0900
  3. +++ mysql-5.0.84/innobase/row/row0sel.c 2009-08-28 09:28:56.000000000 +0900
  4. @@ -2988,6 +2988,15 @@
  5. return(SEL_FOUND);
  6. }
  7. +/**********************************************************************
  8. +Returns true if the thread is executing a SELECT statement.
  9. +(Prototype for global functions in ha_innodb.cc) */
  10. +ibool
  11. +thd_is_select(
  12. +/*==========*/
  13. + /* out: true if thd is executing SELECT */
  14. + const void* thd); /* in: thread handle (THD*) */
  15. +
  16. /************************************************************************
  17. Searches for rows in the database. This is used in the interface to
  18. MySQL. This function opens a cursor, and also implements fetch next
  19. @@ -3361,20 +3370,12 @@
  20. if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
  21. && prebuilt->select_lock_type != LOCK_NONE
  22. - && trx->mysql_query_str) {
  23. -
  24. - /* Scan the MySQL query string; check if SELECT is the first
  25. - word there */
  26. - ibool success;
  27. -
  28. - dict_accept(*trx->mysql_query_str, "SELECT", &success);
  29. -
  30. - if (success) {
  31. + && trx->mysql_thd != NULL
  32. + && thd_is_select(trx->mysql_thd)) {
  33. /* It is a plain locking SELECT and the isolation
  34. level is low: do not lock gaps */
  35. set_also_gap_locks = FALSE;
  36. - }
  37. }
  38. /* Note that if the search mode was GE or G, then the cursor
  39. diff -ru mysql-5.0.84_p_orig/sql/ha_innodb.cc mysql-5.0.84/sql/ha_innodb.cc
  40. --- mysql-5.0.84_p_orig/sql/ha_innodb.cc 2009-08-27 16:06:21.000000000 +0900
  41. +++ mysql-5.0.84/sql/ha_innodb.cc 2009-08-28 09:33:38.000000000 +0900
  42. @@ -394,6 +394,18 @@
  43. }
  44. }
  45. +/**********************************************************************
  46. +Returns true if the thread is executing a SELECT statement. */
  47. +extern "C"
  48. +ibool
  49. +thd_is_select(
  50. +/*==========*/
  51. + /* out: true if thd is executing SELECT */
  52. + const void* thd) /* in: thread handle (THD*) */
  53. +{
  54. + return(((const THD*) thd)->lex->sql_command == SQLCOM_SELECT);
  55. +}
  56. +
  57. /************************************************************************
  58. Call this function when mysqld passes control to the client. That is to
  59. avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more