Merge lp:~akopytov/percona-server/bug1170103-5.5 into lp:percona-server/5.5

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 513
Proposed branch: lp:~akopytov/percona-server/bug1170103-5.5
Merge into: lp:percona-server/5.5
Diff against target: 222 lines (+68/-13)
9 files modified
Percona-Server/mysql-test/t/percona_bug1170103.test (+23/-0)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+4/-0)
Percona-Server/storage/innobase/include/srv0srv.h (+5/-0)
Percona-Server/storage/innobase/read/read0read.c (+6/-0)
Percona-Server/storage/innobase/row/row0sel.c (+2/-2)
Percona-Server/storage/innobase/srv/srv0srv.c (+14/-0)
Percona-Server/storage/innobase/trx/trx0sys.c (+2/-0)
Percona-Server/storage/innobase/trx/trx0trx.c (+1/-0)
build/percona-server.spec (+11/-11)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug1170103-5.5
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+161066@code.launchpad.net

Description of the change

Since no GCA merge is possible, the branch is based on release-5.5.30-30.2.

http://jenkins.percona.com/view/PS%205.5/job/percona-server-5.5-param/723/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The code is OK.

I am wondering about testing. I suspect that there should be existing MTR tests that would report this error under Valgrind. But as our awesome Jenkins setup Valgrind builds are broken since February 13th, I am waiting for some local tests to complete. Perhaps you have looked into this already? If there are none, perhaps we should add one?

review: Needs Information
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

I tried to grep the testsuite for any tests that have InnoDB and query cache enabled. I found three, out of which innodb.innodb, innodb.innodb_misc1 are Valgrind-clean with the bug present. innodb.innodb_mysql crashes.

Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

OK, thank you.

review: Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Just noticed that it's "work in progress." Please set to Approved yourself is that was the wrong status, or ping me if a re-review is needed at a later time.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/t/percona_bug1170103.test'
--- Percona-Server/mysql-test/t/percona_bug1170103.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/t/percona_bug1170103.test 2013-04-27 10:07:32 +0000
@@ -0,0 +1,23 @@
1########################################################################
2# Byg #1170103: Memory leak @ read_view_open_now...
3########################################################################
4
5--source include/have_query_cache.inc
6--source include/have_innodb.inc
7
8CREATE TABLE t(a INT) ENGINE=InnoDB;
9INSERT INTO t VALUES (1), (2), (3);
10
11SET @old_query_cache_size=@@query_cache_size;
12SET @old_query_cache_type=@@query_cache_type;
13
14SET GLOBAL query_cache_size=1024*1024;
15SET GLOBAL query_cache_type=1;
16
17SELECT * FROM t;
18SELECT * FROM t;
19
20SET GLOBAL query_cache_size=@old_query_cache_size;
21SET GLOBAL query_cache_type=@old_query_cache_type;
22
23DROP TABLE t;
024
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-04-11 21:03:27 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-04-27 10:07:32 +0000
@@ -865,6 +865,10 @@
865 (char*) &export_vars.innodb_rows_read, SHOW_LONG},865 (char*) &export_vars.innodb_rows_read, SHOW_LONG},
866 {"rows_updated",866 {"rows_updated",
867 (char*) &export_vars.innodb_rows_updated, SHOW_LONG},867 (char*) &export_vars.innodb_rows_updated, SHOW_LONG},
868 {"read_views_memory",
869 (char*) &export_vars.innodb_read_views_memory, SHOW_LONG},
870 {"descriptors_memory",
871 (char*) &export_vars.innodb_descriptors_memory, SHOW_LONG},
868 {"s_lock_os_waits",872 {"s_lock_os_waits",
869 (char*) &export_vars.innodb_s_lock_os_waits, SHOW_LONGLONG},873 (char*) &export_vars.innodb_s_lock_os_waits, SHOW_LONGLONG},
870 {"s_lock_spin_rounds",874 {"s_lock_spin_rounds",
871875
=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
--- Percona-Server/storage/innobase/include/srv0srv.h 2013-04-04 10:50:07 +0000
+++ Percona-Server/storage/innobase/include/srv0srv.h 2013-04-27 10:07:32 +0000
@@ -289,6 +289,9 @@
289extern ulint srv_n_rows_deleted;289extern ulint srv_n_rows_deleted;
290extern ulint srv_n_rows_read;290extern ulint srv_n_rows_read;
291291
292extern ulint srv_read_views_memory;
293extern ulint srv_descriptors_memory;
294
292extern ibool srv_print_innodb_monitor;295extern ibool srv_print_innodb_monitor;
293extern ibool srv_print_innodb_lock_monitor;296extern ibool srv_print_innodb_lock_monitor;
294extern ibool srv_print_innodb_tablespace_monitor;297extern ibool srv_print_innodb_tablespace_monitor;
@@ -893,6 +896,8 @@
893 ulint innodb_rows_updated; /*!< srv_n_rows_updated */896 ulint innodb_rows_updated; /*!< srv_n_rows_updated */
894 ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */897 ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
895 ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */898 ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
899 ulint innodb_read_views_memory; /*!< srv_read_views_memory */
900 ulint innodb_descriptors_memory; /*!< srv_descriptors_memory */
896 ib_int64_t innodb_s_lock_os_waits;901 ib_int64_t innodb_s_lock_os_waits;
897 ib_int64_t innodb_s_lock_spin_rounds;902 ib_int64_t innodb_s_lock_spin_rounds;
898 ib_int64_t innodb_s_lock_spin_waits;903 ib_int64_t innodb_s_lock_spin_waits;
899904
=== modified file 'Percona-Server/storage/innobase/read/read0read.c'
--- Percona-Server/storage/innobase/read/read0read.c 2013-03-25 09:59:39 +0000
+++ Percona-Server/storage/innobase/read/read0read.c 2013-04-27 10:07:32 +0000
@@ -150,6 +150,7 @@
150{150{
151 if (view == NULL) {151 if (view == NULL) {
152 view = ut_malloc(sizeof(read_view_t));152 view = ut_malloc(sizeof(read_view_t));
153 srv_read_views_memory += sizeof(read_view_t);
153 view->max_descr = 0;154 view->max_descr = 0;
154 view->descriptors = NULL;155 view->descriptors = NULL;
155 }156 }
@@ -159,6 +160,8 @@
159 /* avoid frequent re-allocations by extending the array to the160 /* avoid frequent re-allocations by extending the array to the
160 desired size + 10% */161 desired size + 10% */
161162
163 srv_read_views_memory += (n + n / 10 - view->max_descr) *
164 sizeof(trx_id_t);
162 view->max_descr = n + n / 10;165 view->max_descr = n + n / 10;
163 view->descriptors = ut_realloc(view->descriptors,166 view->descriptors = ut_realloc(view->descriptors,
164 view->max_descr *167 view->max_descr *
@@ -370,6 +373,9 @@
370{373{
371 ut_ad(mutex_own(&kernel_mutex));374 ut_ad(mutex_own(&kernel_mutex));
372375
376 srv_read_views_memory -= sizeof(read_view_t) +
377 view->max_descr * sizeof(trx_id_t);
378
373 if (view->descriptors != NULL) {379 if (view->descriptors != NULL) {
374 ut_free(view->descriptors);380 ut_free(view->descriptors);
375 }381 }
376382
=== modified file 'Percona-Server/storage/innobase/row/row0sel.c'
--- Percona-Server/storage/innobase/row/row0sel.c 2013-03-26 01:40:02 +0000
+++ Percona-Server/storage/innobase/row/row0sel.c 2013-04-27 10:07:32 +0000
@@ -4899,8 +4899,8 @@
48994899
4900 trx->read_view =4900 trx->read_view =
4901 read_view_open_now(trx->id,4901 read_view_open_now(trx->id,
4902 NULL, TRUE);4902 trx->prebuilt_view, TRUE);
49034903 trx->prebuilt_view = trx->read_view;
4904 trx->global_read_view = trx->read_view;4904 trx->global_read_view = trx->read_view;
4905 }4905 }
4906 }4906 }
49074907
=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.c'
--- Percona-Server/storage/innobase/srv/srv0srv.c 2013-04-04 10:50:07 +0000
+++ Percona-Server/storage/innobase/srv/srv0srv.c 2013-04-27 10:07:32 +0000
@@ -463,6 +463,9 @@
463UNIV_INTERN ulint srv_n_rows_deleted CACHE_ALIGNED = 0;463UNIV_INTERN ulint srv_n_rows_deleted CACHE_ALIGNED = 0;
464UNIV_INTERN ulint srv_n_rows_read CACHE_ALIGNED = 0;464UNIV_INTERN ulint srv_n_rows_read CACHE_ALIGNED = 0;
465465
466UNIV_INTERN ulint srv_read_views_memory CACHE_ALIGNED = 0;
467UNIV_INTERN ulint srv_descriptors_memory CACHE_ALIGNED = 0;
468
466UNIV_INTERN ulint srv_n_lock_deadlock_count CACHE_ALIGNED = 0;469UNIV_INTERN ulint srv_n_lock_deadlock_count CACHE_ALIGNED = 0;
467UNIV_INTERN ulint srv_n_lock_wait_count CACHE_ALIGNED = 0;470UNIV_INTERN ulint srv_n_lock_wait_count CACHE_ALIGNED = 0;
468UNIV_INTERN ulint srv_n_lock_wait_current_count CACHE_ALIGNED = 0;471UNIV_INTERN ulint srv_n_lock_wait_current_count CACHE_ALIGNED = 0;
@@ -2129,6 +2132,9 @@
2129 "; in additional pool allocated " ULINTPF "\n",2132 "; in additional pool allocated " ULINTPF "\n",
2130 ut_total_allocated_memory,2133 ut_total_allocated_memory,
2131 mem_pool_get_reserved(mem_comm_pool));2134 mem_pool_get_reserved(mem_comm_pool));
2135 fprintf(file,
2136 "Total memory allocated by read views " ULINTPF "\n",
2137 srv_read_views_memory);
2132 /* Calcurate reserved memories */2138 /* Calcurate reserved memories */
2133 if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {2139 if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
2134 btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);2140 btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
@@ -2215,6 +2221,12 @@
2215 fprintf(file, "%lu read views open inside InnoDB\n",2221 fprintf(file, "%lu read views open inside InnoDB\n",
2216 UT_LIST_GET_LEN(trx_sys->view_list));2222 UT_LIST_GET_LEN(trx_sys->view_list));
22172223
2224 fprintf(file, "%lu transactions active inside InnoDB\n",
2225 UT_LIST_GET_LEN(trx_sys->trx_list));
2226
2227 fprintf(file, "%lu out of %lu descriptors used\n",
2228 trx_sys->descr_n_used, trx_sys->descr_n_max);
2229
2218 if (UT_LIST_GET_LEN(trx_sys->view_list)) {2230 if (UT_LIST_GET_LEN(trx_sys->view_list)) {
2219 read_view_t* view = UT_LIST_GET_LAST(trx_sys->view_list);2231 read_view_t* view = UT_LIST_GET_LAST(trx_sys->view_list);
22202232
@@ -2524,6 +2536,8 @@
2524 export_vars.innodb_rows_updated = srv_n_rows_updated;2536 export_vars.innodb_rows_updated = srv_n_rows_updated;
2525 export_vars.innodb_rows_deleted = srv_n_rows_deleted;2537 export_vars.innodb_rows_deleted = srv_n_rows_deleted;
2526 export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;2538 export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
2539 export_vars.innodb_read_views_memory = srv_read_views_memory;
2540 export_vars.innodb_descriptors_memory = srv_descriptors_memory;
25272541
2528#ifdef UNIV_DEBUG2542#ifdef UNIV_DEBUG
2529 if (trx_sys->max_trx_id < purge_sys->done_trx_no) {2543 if (trx_sys->max_trx_id < purge_sys->done_trx_no) {
25302544
=== modified file 'Percona-Server/storage/innobase/trx/trx0sys.c'
--- Percona-Server/storage/innobase/trx/trx0sys.c 2013-03-25 09:59:39 +0000
+++ Percona-Server/storage/innobase/trx/trx0sys.c 2013-04-27 10:07:32 +0000
@@ -1324,6 +1324,8 @@
1324 TRX_DESCR_ARRAY_INITIAL_SIZE);1324 TRX_DESCR_ARRAY_INITIAL_SIZE);
1325 trx_sys->descr_n_max = TRX_DESCR_ARRAY_INITIAL_SIZE;1325 trx_sys->descr_n_max = TRX_DESCR_ARRAY_INITIAL_SIZE;
1326 trx_sys->descr_n_used = 0;1326 trx_sys->descr_n_used = 0;
1327 srv_descriptors_memory = TRX_DESCR_ARRAY_INITIAL_SIZE *
1328 sizeof(trx_id_t);
13271329
1328 sys_header = trx_sysf_get(&mtr);1330 sys_header = trx_sysf_get(&mtr);
13291331
13301332
=== modified file 'Percona-Server/storage/innobase/trx/trx0trx.c'
--- Percona-Server/storage/innobase/trx/trx0trx.c 2013-03-26 01:40:02 +0000
+++ Percona-Server/storage/innobase/trx/trx0trx.c 2013-04-27 10:07:32 +0000
@@ -135,6 +135,7 @@
135 n_max * sizeof(trx_id_t));135 n_max * sizeof(trx_id_t));
136136
137 trx_sys->descr_n_max = n_max;137 trx_sys->descr_n_max = n_max;
138 srv_descriptors_memory = n_max * sizeof(trx_id_t);
138 }139 }
139140
140 descr = trx_sys->descriptors + n_used - 1;141 descr = trx_sys->descriptors + n_used - 1;
141142
=== modified file 'build/percona-server.spec'
--- build/percona-server.spec 2013-04-23 06:02:56 +0000
+++ build/percona-server.spec 2013-04-27 10:07:32 +0000
@@ -725,6 +725,17 @@
725725
726if [ $1 -eq 1 ]; then726if [ $1 -eq 1 ]; then
727# ----------------------------------------------------------------------727# ----------------------------------------------------------------------
728# Create a MySQL user and group. Do not report any problems if it already
729# exists.
730# ----------------------------------------------------------------------
731groupadd -r %{mysqld_group} 2> /dev/null || true
732useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" \
733 -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
734# The user may already exist, make sure it has the proper group nevertheless
735# (BUG#12823)
736usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
737
738# ----------------------------------------------------------------------
728# Create data directory if needed, check whether upgrade or install739# Create data directory if needed, check whether upgrade or install
729# ----------------------------------------------------------------------740# ----------------------------------------------------------------------
730if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi741if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
@@ -760,17 +771,6 @@
760fi771fi
761772
762# ----------------------------------------------------------------------773# ----------------------------------------------------------------------
763# Create a MySQL user and group. Do not report any problems if it already
764# exists.
765# ----------------------------------------------------------------------
766groupadd -r %{mysqld_group} 2> /dev/null || true
767useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" \
768 -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
769# The user may already exist, make sure it has the proper group nevertheless
770# (BUG#12823)
771usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
772
773# ----------------------------------------------------------------------
774# Initiate databases if needed774# Initiate databases if needed
775# ----------------------------------------------------------------------775# ----------------------------------------------------------------------
776# ----------------------------------------------------------------------776# ----------------------------------------------------------------------

Subscribers

People subscribed via source and target branches