From: Mayank Prasad Date: December 19 2011 9:55am Subject: bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3402 to 3403) WL#5767 List-Archive: http://lists.mysql.com/commits/142175 Message-Id: <201112190955.pBJ9tX5w015564@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3403 Mayank Prasad 2011-12-19 [merge] WL#5767 : Statement Digest, Performance Schema Details: - Merge from mysql-trunk modified: storage/innobase/buf/buf0buddy.cc storage/innobase/buf/buf0buf.cc storage/innobase/buf/buf0flu.cc storage/innobase/buf/buf0lru.cc storage/innobase/dict/dict0dict.cc storage/innobase/dict/dict0mem.cc storage/innobase/dyn/dyn0dyn.cc storage/innobase/fil/fil0fil.cc storage/innobase/include/dict0mem.h storage/innobase/include/lock0lock.h storage/innobase/include/lock0priv.h storage/innobase/include/lock0types.h storage/innobase/include/mem0mem.ic storage/innobase/include/sync0sync.h storage/innobase/include/trx0roll.h storage/innobase/include/trx0trx.h storage/innobase/include/usr0sess.h storage/innobase/include/ut0lst.h storage/innobase/lock/lock0iter.cc storage/innobase/lock/lock0lock.cc storage/innobase/log/log0log.cc storage/innobase/log/log0recv.cc storage/innobase/mem/mem0mem.cc storage/innobase/mem/mem0pool.cc storage/innobase/os/os0sync.cc storage/innobase/pars/pars0opt.cc storage/innobase/pars/pars0pars.cc storage/innobase/pars/pars0sym.cc storage/innobase/que/que0que.cc storage/innobase/read/read0read.cc storage/innobase/row/row0ftsort.cc storage/innobase/row/row0ins.cc storage/innobase/row/row0merge.cc storage/innobase/row/row0mysql.cc storage/innobase/srv/srv0mon.cc storage/innobase/srv/srv0srv.cc storage/innobase/sync/sync0rw.cc storage/innobase/sync/sync0sync.cc storage/innobase/trx/trx0roll.cc storage/innobase/trx/trx0rseg.cc storage/innobase/trx/trx0sys.cc storage/innobase/trx/trx0trx.cc storage/innobase/trx/trx0undo.cc storage/innobase/usr/usr0sess.cc storage/innobase/ut/ut0mem.cc 3402 Mayank Prasad 2011-12-19 [merge] WL#5767: statement digest, performance schema. details: -merge frm latest trunk added: mysql-test/suite/perfschema/r/start_server_disable_idle.result mysql-test/suite/perfschema/r/start_server_disable_stages.result mysql-test/suite/perfschema/r/start_server_disable_statements.result mysql-test/suite/perfschema/r/start_server_disable_waits.result mysql-test/suite/perfschema/t/start_server_disable_idle-master.opt mysql-test/suite/perfschema/t/start_server_disable_idle.test mysql-test/suite/perfschema/t/start_server_disable_stages-master.opt mysql-test/suite/perfschema/t/start_server_disable_stages.test mysql-test/suite/perfschema/t/start_server_disable_statements-master.opt mysql-test/suite/perfschema/t/start_server_disable_statements.test mysql-test/suite/perfschema/t/start_server_disable_waits-master.opt mysql-test/suite/perfschema/t/start_server_disable_waits.test sql/sql_executor.cc sql/sql_executor.h sql/sql_join_buffer.h sql/sql_optimizer.cc sql/sql_optimizer.h sql/sql_planner.cc sql/sql_planner.h sql/sql_resolver.cc sql/sql_resolver.h sql/sql_tmp_table.cc sql/sql_tmp_table.h renamed: sql/sql_join_cache.cc => sql/sql_join_buffer.cc modified: client/mysqlbinlog.cc cmake/install_macros.cmake mysql-test/collections/default.push mysql-test/include/range.inc mysql-test/include/select.inc mysql-test/include/subquery_sj.inc mysql-test/r/func_in_all.result mysql-test/r/innodb_explain_non_select_all.result mysql-test/r/innodb_explain_non_select_none.result mysql-test/r/innodb_mrr_all.result mysql-test/r/innodb_mrr_cost_all.result mysql-test/r/multi_update.result mysql-test/r/myisam_mrr_all.result mysql-test/r/myisam_mrr_cost_all.result mysql-test/r/mysqlbinlog.result mysql-test/r/mysqlbinlog2.result mysql-test/r/mysqld--help-win.result mysql-test/r/partition_explicit_prune.result mysql-test/r/partition_hash.result mysql-test/r/partition_mgm.result mysql-test/r/range_all.result mysql-test/r/range_icp.result mysql-test/r/range_icp_mrr.result mysql-test/r/range_mrr.result mysql-test/r/range_mrr_cost.result mysql-test/r/range_none.result mysql-test/r/select_all.result mysql-test/r/select_icp_mrr.result mysql-test/r/select_icp_mrr_bka.result mysql-test/r/select_icp_mrr_bka_nixbnl.result mysql-test/r/select_none.result mysql-test/r/select_none_bka.result mysql-test/r/select_none_bka_nixbnl.result mysql-test/r/sp.result mysql-test/r/subquery_all.result mysql-test/r/subquery_all_bka.result mysql-test/r/subquery_all_bka_nixbnl.result mysql-test/r/subquery_sj_all.result mysql-test/r/subquery_sj_all_bka.result mysql-test/r/subquery_sj_all_bka_nixbnl.result mysql-test/r/subquery_sj_all_bkaunique.result mysql-test/r/subquery_sj_dupsweed.result mysql-test/r/subquery_sj_dupsweed_bka.result mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result mysql-test/r/subquery_sj_dupsweed_bkaunique.result mysql-test/r/subquery_sj_firstmatch.result mysql-test/r/subquery_sj_firstmatch_bka.result mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result mysql-test/r/subquery_sj_firstmatch_bkaunique.result mysql-test/r/subquery_sj_loosescan.result mysql-test/r/subquery_sj_loosescan_bka.result mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result mysql-test/r/subquery_sj_loosescan_bkaunique.result mysql-test/r/subquery_sj_mat.result mysql-test/r/subquery_sj_mat_bka.result mysql-test/r/subquery_sj_mat_bka_nixbnl.result mysql-test/r/subquery_sj_mat_bkaunique.result mysql-test/r/subquery_sj_mat_nosj.result mysql-test/r/subquery_sj_none.result mysql-test/r/subquery_sj_none_bka.result mysql-test/r/subquery_sj_none_bka_nixbnl.result mysql-test/r/subquery_sj_none_bkaunique.result mysql-test/r/type_temporal_fractional.result mysql-test/r/update.result mysql-test/suite/binlog/r/binlog_hexdump.result mysql-test/suite/binlog/r/binlog_mysqlbinlog_filter.result mysql-test/suite/binlog/t/binlog_index.test mysql-test/suite/binlog/t/binlog_mysqlbinlog_filter.test mysql-test/suite/innodb/r/innodb.result mysql-test/suite/innodb/t/innodb.test mysql-test/suite/innodb/t/innodb_bug34053.test mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test mysql-test/suite/rpl/r/rpl_row_img_sanity.result mysql-test/suite/rpl/t/rpl_binlog_errors.test mysql-test/suite/rpl/t/rpl_empty_master_host.test mysql-test/suite/rpl/t/rpl_row_img_sanity.test mysql-test/suite/rpl/t/rpl_server_id_ignore.test mysql-test/t/multi_update.test mysql-test/t/partition_hash.test mysql-test/t/partition_mgm.test mysql-test/t/sp.test mysql-test/t/type_temporal_fractional.test mysql-test/t/update.test scripts/mysql_system_tables.sql sql/CMakeLists.txt sql/field.cc sql/ha_partition.cc sql/ha_partition.h sql/item.cc sql/item_cmpfunc.cc sql/item_strfunc.cc sql/item_subselect.cc sql/item_sum.cc sql/item_timefunc.cc sql/mysqld.cc sql/nt_servc.cc sql/nt_servc.h sql/opt_explain.cc sql/opt_explain.h sql/opt_range.cc sql/opt_range.h sql/records.cc sql/records.h sql/rpl_utility.cc sql/sp_rcontext.cc sql/sql_base.cc sql/sql_class.cc sql/sql_class.h sql/sql_cursor.cc sql/sql_delete.cc sql/sql_derived.cc sql/sql_insert.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_partition.cc sql/sql_select.cc sql/sql_select.h sql/sql_show.cc sql/sql_table.cc sql/sql_test.cc sql/sql_union.cc sql/sql_update.cc sql/sql_yacc.yy storage/innobase/buf/buf0buddy.cc storage/innobase/buf/buf0buf.cc storage/innobase/buf/buf0flu.cc storage/innobase/buf/buf0lru.cc storage/innobase/dict/dict0dict.cc storage/innobase/dict/dict0mem.cc storage/innobase/dict/dict0stats.cc storage/innobase/dyn/dyn0dyn.cc storage/innobase/fil/fil0fil.cc storage/innobase/fts/fts0fts.cc storage/innobase/fts/fts0opt.cc storage/innobase/handler/ha_innodb.cc storage/innobase/handler/handler0alter.cc storage/innobase/include/dict0mem.h storage/innobase/include/fts0fts.h storage/innobase/include/lock0lock.h storage/innobase/include/lock0priv.h storage/innobase/include/lock0types.h storage/innobase/include/mem0mem.ic storage/innobase/include/page0page.h storage/innobase/include/sync0sync.h storage/innobase/include/trx0roll.h storage/innobase/include/trx0trx.h storage/innobase/include/usr0sess.h storage/innobase/include/ut0lst.h storage/innobase/lock/lock0iter.cc storage/innobase/lock/lock0lock.cc storage/innobase/log/log0log.cc storage/innobase/log/log0recv.cc storage/innobase/mem/mem0mem.cc storage/innobase/mem/mem0pool.cc storage/innobase/os/os0sync.cc storage/innobase/page/page0page.cc storage/innobase/pars/pars0opt.cc storage/innobase/pars/pars0pars.cc storage/innobase/pars/pars0sym.cc storage/innobase/que/que0que.cc storage/innobase/read/read0read.cc storage/innobase/row/row0ftsort.cc storage/innobase/row/row0ins.cc storage/innobase/row/row0merge.cc storage/innobase/row/row0mysql.cc storage/innobase/srv/srv0mon.cc storage/innobase/srv/srv0srv.cc storage/innobase/sync/sync0rw.cc storage/innobase/sync/sync0sync.cc storage/innobase/trx/trx0roll.cc storage/innobase/trx/trx0rseg.cc storage/innobase/trx/trx0sys.cc storage/innobase/trx/trx0trx.cc storage/innobase/trx/trx0undo.cc storage/innobase/usr/usr0sess.cc storage/innobase/ut/ut0mem.cc storage/perfschema/pfs.cc sql/sql_join_buffer.cc === modified file 'storage/innobase/buf/buf0buddy.cc' --- a/storage/innobase/buf/buf0buddy.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/buf/buf0buddy.cc 2011-12-19 08:43:28 +0000 @@ -67,7 +67,7 @@ struct CheckZipFree { }; #define BUF_BUDDY_LIST_VALIDATE(bp, i) \ - UT_LIST_VALIDATE(bp->zip_free[i], CheckZipFree()) + UT_LIST_VALIDATE(list, buf_page_t, bp->zip_free[i], CheckZipFree()) /**********************************************************************//** Add a block to the head of the appropriate buddy free list. */ @@ -83,7 +83,7 @@ buf_buddy_add_to_free( ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE); ut_ad(buf_pool->zip_free[i].start != bpage); - UT_LIST_ADD_FIRST(buf_pool->zip_free[i], bpage); + UT_LIST_ADD_FIRST(list, buf_pool->zip_free[i], bpage); } /**********************************************************************//** @@ -107,7 +107,7 @@ buf_buddy_remove_from_free( ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE); - UT_LIST_REMOVE(buf_pool->zip_free[i], bpage); + UT_LIST_REMOVE(list, buf_pool->zip_free[i], bpage); } /**********************************************************************//** === modified file 'storage/innobase/buf/buf0buf.cc' --- a/storage/innobase/buf/buf0buf.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/buf/buf0buf.cc 2011-12-19 08:43:28 +0000 @@ -1047,7 +1047,7 @@ buf_chunk_init( memset(block->frame, '\0', UNIV_PAGE_SIZE); #endif /* Add the block to the free list */ - UT_LIST_ADD_LAST(buf_pool->free, &block->page); + UT_LIST_ADD_LAST(list, buf_pool->free, (&block->page)); ut_d(block->page.in_free_list = TRUE); ut_ad(buf_pool_from_block(block) == buf_pool); @@ -1221,19 +1221,7 @@ buf_pool_init_instance( buf_pool->chunks = chunk = (buf_chunk_t*) mem_zalloc(sizeof *chunk); - UT_LIST_INIT(buf_pool->LRU, &buf_page_t::LRU); - UT_LIST_INIT(buf_pool->free, &buf_page_t::list); - UT_LIST_INIT(buf_pool->flush_list, &buf_page_t::list); - UT_LIST_INIT(buf_pool->unzip_LRU, &buf_block_t::unzip_LRU); - -#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG - UT_LIST_INIT(buf_pool->zip_clean, &buf_page_t::list); -#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ - - for (i = 0; i < UT_ARR_SIZE(buf_pool->zip_free); ++i) { - UT_LIST_INIT( - buf_pool->zip_free[i], &buf_page_t::list); - } + UT_LIST_INIT(buf_pool->free); if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) { mem_free(chunk); @@ -1493,12 +1481,12 @@ buf_relocate( /* relocate buf_pool->LRU */ b = UT_LIST_GET_PREV(LRU, bpage); - UT_LIST_REMOVE(buf_pool->LRU, bpage); + UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage); if (b) { - UT_LIST_INSERT_AFTER(buf_pool->LRU, b, dpage); + UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, b, dpage); } else { - UT_LIST_ADD_FIRST(buf_pool->LRU, dpage); + UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, dpage); } if (UNIV_UNLIKELY(buf_pool->LRU_old == bpage)) { @@ -1518,7 +1506,8 @@ buf_relocate( #endif /* UNIV_LRU_DEBUG */ } - ut_d(UT_LIST_VALIDATE(buf_pool->LRU, CheckInLRUList())); + ut_d(UT_LIST_VALIDATE( + LRU, buf_page_t, buf_pool->LRU, CheckInLRUList())); /* relocate buf_pool->page_hash */ HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage); @@ -2650,7 +2639,8 @@ wait_until_unfixed: if (buf_page_get_state(&block->page) == BUF_BLOCK_ZIP_PAGE) { #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG - UT_LIST_REMOVE(buf_pool->zip_clean, &block->page); + UT_LIST_REMOVE(list, buf_pool->zip_clean, + &block->page); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ ut_ad(!block->page.in_flush_list); } else { === modified file 'storage/innobase/buf/buf0flu.cc' --- a/storage/innobase/buf/buf0flu.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/buf/buf0flu.cc 2011-12-19 08:43:28 +0000 @@ -336,8 +336,7 @@ buf_flush_insert_into_flush_list( ut_d(block->page.in_flush_list = TRUE); block->page.oldest_modification = lsn; - - UT_LIST_ADD_FIRST(buf_pool->flush_list, &block->page); + UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page); #ifdef UNIV_DEBUG_VALGRIND { @@ -436,9 +435,10 @@ buf_flush_insert_sorted_into_flush_list( } if (prev_b == NULL) { - UT_LIST_ADD_FIRST(buf_pool->flush_list, &block->page); + UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page); } else { - UT_LIST_INSERT_AFTER(buf_pool->flush_list, prev_b, &block->page); + UT_LIST_INSERT_AFTER(list, buf_pool->flush_list, + prev_b, &block->page); } MONITOR_INC(MONITOR_PAGE_INFLUSH); @@ -561,13 +561,13 @@ buf_flush_remove( return; case BUF_BLOCK_ZIP_DIRTY: buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE); - UT_LIST_REMOVE(buf_pool->flush_list, bpage); + UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG buf_LRU_insert_zip_clean(bpage); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ break; case BUF_BLOCK_FILE_PAGE: - UT_LIST_REMOVE(buf_pool->flush_list, bpage); + UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); break; } @@ -643,13 +643,19 @@ buf_flush_relocate_on_flush_list( ut_d(bpage->in_flush_list = FALSE); prev = UT_LIST_GET_PREV(list, bpage); - UT_LIST_REMOVE(buf_pool->flush_list, bpage); + UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); if (prev) { ut_ad(prev->in_flush_list); - UT_LIST_INSERT_AFTER( buf_pool->flush_list, prev, dpage); + UT_LIST_INSERT_AFTER( + list, + buf_pool->flush_list, + prev, dpage); } else { - UT_LIST_ADD_FIRST(buf_pool->flush_list, dpage); + UT_LIST_ADD_FIRST( + list, + buf_pool->flush_list, + dpage); } /* Just an extra check. Previous in flush_list @@ -2903,7 +2909,7 @@ buf_flush_validate_low( ut_ad(buf_flush_list_mutex_own(buf_pool)); - UT_LIST_VALIDATE(buf_pool->flush_list, Check()); + UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list, Check()); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); === modified file 'storage/innobase/buf/buf0lru.cc' --- a/storage/innobase/buf/buf0lru.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/buf/buf0lru.cc 2011-12-19 08:43:28 +0000 @@ -526,9 +526,9 @@ buf_LRU_insert_zip_clean( } if (b) { - UT_LIST_INSERT_AFTER(buf_pool->zip_clean, b, bpage); + UT_LIST_INSERT_AFTER(list, buf_pool->zip_clean, b, bpage); } else { - UT_LIST_ADD_FIRST(buf_pool->zip_clean, bpage); + UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, bpage); } } #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ @@ -547,7 +547,7 @@ buf_LRU_free_from_unzip_LRU_list( srv_LRU_scan_depth / 2 blocks. */ { buf_block_t* block; - ibool freed; + ibool freed; ulint scanned; ut_ad(buf_pool_mutex_own(buf_pool)); @@ -710,7 +710,7 @@ buf_LRU_get_free_only( ut_ad(!block->page.in_flush_list); ut_ad(!block->page.in_LRU_list); ut_a(!buf_page_in_file(&block->page)); - UT_LIST_REMOVE(buf_pool->free, &block->page); + UT_LIST_REMOVE(list, buf_pool->free, (&block->page)); mutex_enter(&block->mutex); @@ -1093,7 +1093,7 @@ buf_unzip_LRU_remove_block_if_needed( ut_ad(block->in_unzip_LRU_list); ut_d(block->in_unzip_LRU_list = FALSE); - UT_LIST_REMOVE(buf_pool->unzip_LRU, block); + UT_LIST_REMOVE(unzip_LRU, buf_pool->unzip_LRU, block); } } @@ -1138,7 +1138,7 @@ buf_LRU_remove_block( } /* Remove the block from the LRU list */ - UT_LIST_REMOVE(buf_pool->LRU, bpage); + UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage); ut_d(bpage->in_LRU_list = FALSE); buf_unzip_LRU_remove_block_if_needed(bpage); @@ -1194,9 +1194,9 @@ buf_unzip_LRU_add_block( ut_d(block->in_unzip_LRU_list = TRUE); if (old) { - UT_LIST_ADD_LAST(buf_pool->unzip_LRU, block); + UT_LIST_ADD_LAST(unzip_LRU, buf_pool->unzip_LRU, block); } else { - UT_LIST_ADD_FIRST(buf_pool->unzip_LRU, block); + UT_LIST_ADD_FIRST(unzip_LRU, buf_pool->unzip_LRU, block); } } @@ -1217,7 +1217,7 @@ buf_LRU_add_block_to_end_low( ut_a(buf_page_in_file(bpage)); ut_ad(!bpage->in_LRU_list); - UT_LIST_ADD_LAST(buf_pool->LRU, bpage); + UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage); ut_d(bpage->in_LRU_list = TRUE); if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { @@ -1270,7 +1270,7 @@ buf_LRU_add_block_low( if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) { - UT_LIST_ADD_FIRST(buf_pool->LRU, bpage); + UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, bpage); bpage->freed_page_clock = buf_pool->freed_page_clock; } else { @@ -1283,9 +1283,8 @@ buf_LRU_add_block_low( ut_a(!UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old) || UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)->old); #endif /* UNIV_LRU_DEBUG */ - UT_LIST_INSERT_AFTER(buf_pool->LRU, buf_pool->LRU_old, - bpage); - + UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old, + bpage); buf_pool->LRU_old_len++; } @@ -1537,7 +1536,8 @@ func_exit: uninitialized pad bytes. */ UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b); #endif - UT_LIST_INSERT_AFTER(buf_pool->LRU, prev_b, b); + UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, + prev_b, b); if (buf_page_is_old(b)) { buf_pool->LRU_old_len++; @@ -1710,7 +1710,7 @@ buf_LRU_block_free_non_file_page( page_zip_set_size(&block->page.zip, 0); } - UT_LIST_ADD_FIRST(buf_pool->free, &block->page); + UT_LIST_ADD_FIRST(list, buf_pool->free, (&block->page)); ut_d(block->page.in_free_list = TRUE); UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE); @@ -1882,7 +1882,7 @@ buf_LRU_block_remove_hashed_page( ut_a(buf_page_get_zip_size(bpage)); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG - UT_LIST_REMOVE(buf_pool->zip_clean, bpage); + UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ mutex_exit(&buf_pool->zip_mutex); @@ -2155,7 +2155,7 @@ buf_LRU_validate_instance( ut_a(old_len <= new_len + BUF_LRU_OLD_TOLERANCE); } - UT_LIST_VALIDATE(buf_pool->LRU, CheckInLRUList()); + UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU, CheckInLRUList()); old_len = 0; @@ -2197,7 +2197,7 @@ buf_LRU_validate_instance( ut_a(buf_pool->LRU_old_len == old_len); - UT_LIST_VALIDATE(buf_pool->free, CheckInFreeList()); + UT_LIST_VALIDATE(list, buf_page_t, buf_pool->free, CheckInFreeList()); for (bpage = UT_LIST_GET_FIRST(buf_pool->free); bpage != NULL; @@ -2206,7 +2206,9 @@ buf_LRU_validate_instance( ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED); } - UT_LIST_VALIDATE(buf_pool->unzip_LRU, CheckUnzipLRUAndLRUList()); + UT_LIST_VALIDATE( + unzip_LRU, buf_block_t, buf_pool->unzip_LRU, + CheckUnzipLRUAndLRUList()); for (block = UT_LIST_GET_FIRST(buf_pool->unzip_LRU); block; === modified file 'storage/innobase/dict/dict0dict.cc' --- a/storage/innobase/dict/dict0dict.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/dict/dict0dict.cc 2011-12-19 08:43:28 +0000 @@ -803,9 +803,6 @@ dict_init(void) dict_sys = static_cast(mem_zalloc(sizeof(*dict_sys))); - UT_LIST_INIT(dict_sys->table_LRU, &dict_table_t::table_LRU); - UT_LIST_INIT(dict_sys->table_non_LRU, &dict_table_t::table_LRU); - mutex_create(dict_sys_mutex_key, &dict_sys->mutex, SYNC_DICT); dict_sys->table_hash = hash_create(buf_pool_get_curr_size() @@ -843,9 +840,9 @@ dict_move_to_mru( ut_a(table->can_be_evicted); - UT_LIST_REMOVE(dict_sys->table_LRU, table); + UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); - UT_LIST_ADD_FIRST(dict_sys->table_LRU, table); + UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); ut_ad(dict_lru_validate()); } @@ -1113,9 +1110,9 @@ dict_table_add_to_cache( table->can_be_evicted = can_be_evicted; if (table->can_be_evicted) { - UT_LIST_ADD_FIRST(dict_sys->table_LRU, table); + UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); } else { - UT_LIST_ADD_FIRST(dict_sys->table_non_LRU, table); + UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_non_LRU, table); } ut_ad(dict_lru_validate()); @@ -1260,9 +1257,9 @@ dict_table_move_from_lru_to_non_lru( ut_a(table->can_be_evicted); - UT_LIST_REMOVE(dict_sys->table_LRU, table); + UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); - UT_LIST_ADD_LAST(dict_sys->table_non_LRU, table); + UT_LIST_ADD_LAST(table_LRU, dict_sys->table_non_LRU, table); table->can_be_evicted = FALSE; } @@ -1280,9 +1277,9 @@ dict_table_move_from_non_lru_to_lru( ut_a(!table->can_be_evicted); - UT_LIST_REMOVE(dict_sys->table_non_LRU, table); + UT_LIST_REMOVE(table_LRU, dict_sys->table_non_LRU, table); - UT_LIST_ADD_LAST(dict_sys->table_LRU, table); + UT_LIST_ADD_LAST(table_LRU, dict_sys->table_LRU, table); table->can_be_evicted = TRUE; } @@ -1490,9 +1487,7 @@ dict_table_rename_in_cache( /* Make the list of referencing constraints empty */ - UT_LIST_INIT( - table->referenced_list, - &dict_foreign_t::referenced_list); + UT_LIST_INIT(table->referenced_list); return(TRUE); } @@ -1688,10 +1683,10 @@ dict_table_remove_from_cache_low( /* Remove table from LRU or non-LRU list. */ if (table->can_be_evicted) { ut_ad(dict_lru_find_table(table)); - UT_LIST_REMOVE(dict_sys->table_LRU, table); + UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); } else { ut_ad(dict_non_lru_find_table(table)); - UT_LIST_REMOVE(dict_sys->table_non_LRU, table); + UT_LIST_REMOVE(table_LRU, dict_sys->table_non_LRU, table); } ut_ad(dict_lru_validate()); @@ -2175,7 +2170,7 @@ undo_size_ok: /* Add the new index as the last index for the table */ - UT_LIST_ADD_LAST(table->indexes, new_index); + UT_LIST_ADD_LAST(indexes, table->indexes, new_index); new_index->table = table; new_index->table_name = table->name; @@ -2295,7 +2290,7 @@ dict_index_remove_from_cache_low( rw_lock_free(&index->lock); /* Remove the index from the list of indexes of the table */ - UT_LIST_REMOVE(table->indexes, index); + UT_LIST_REMOVE(indexes, table->indexes, index); size = mem_heap_get_size(index->heap); @@ -2912,12 +2907,15 @@ dict_foreign_remove_from_cache( ut_a(foreign); if (foreign->referenced_table) { - UT_LIST_REMOVE(foreign->referenced_table->referenced_list, + UT_LIST_REMOVE(referenced_list, + foreign->referenced_table->referenced_list, foreign); } if (foreign->foreign_table) { - UT_LIST_REMOVE(foreign->foreign_table->foreign_list, foreign); + UT_LIST_REMOVE(foreign_list, + foreign->foreign_table->foreign_list, + foreign); } dict_foreign_free(foreign); @@ -3245,7 +3243,9 @@ dict_foreign_add_to_cache( for_in_cache->referenced_table = ref_table; for_in_cache->referenced_index = index; - UT_LIST_ADD_LAST(ref_table->referenced_list, for_in_cache); + UT_LIST_ADD_LAST(referenced_list, + ref_table->referenced_list, + for_in_cache); added_to_referenced_list = TRUE; } @@ -3274,6 +3274,7 @@ dict_foreign_add_to_cache( if (for_in_cache == foreign) { if (added_to_referenced_list) { UT_LIST_REMOVE( + referenced_list, ref_table->referenced_list, for_in_cache); } @@ -3286,7 +3287,9 @@ dict_foreign_add_to_cache( for_in_cache->foreign_table = for_table; for_in_cache->foreign_index = index; - UT_LIST_ADD_LAST(for_table->foreign_list, for_in_cache); + UT_LIST_ADD_LAST(foreign_list, + for_table->foreign_list, + for_in_cache); } /* We need to move the table to the non-LRU end of the table LRU @@ -4431,10 +4434,12 @@ try_find_index: /* We found an ok constraint definition: add to the lists */ - UT_LIST_ADD_LAST(table->foreign_list, foreign); + UT_LIST_ADD_LAST(foreign_list, table->foreign_list, foreign); if (referenced_table) { - UT_LIST_ADD_LAST(referenced_table->referenced_list, foreign); + UT_LIST_ADD_LAST(referenced_list, + referenced_table->referenced_list, + foreign); } goto loop; === modified file 'storage/innobase/dict/dict0mem.cc' --- a/storage/innobase/dict/dict0mem.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/dict/dict0mem.cc 2011-12-19 08:43:28 +0000 @@ -79,12 +79,6 @@ dict_mem_table_create( table = static_cast( mem_heap_zalloc(heap, sizeof(dict_table_t))); - lock_table_lock_list_init(&table->locks); - - UT_LIST_INIT(table->indexes, &dict_index_t::indexes); - UT_LIST_INIT(table->foreign_list, &dict_foreign_t::foreign_list); - UT_LIST_INIT(table->referenced_list, &dict_foreign_t::referenced_list); - table->heap = heap; table->flags = (unsigned int) flags; === modified file 'storage/innobase/dyn/dyn0dyn.cc' --- a/storage/innobase/dyn/dyn0dyn.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/dyn/dyn0dyn.cc 2011-12-19 08:43:28 +0000 @@ -44,8 +44,8 @@ dyn_array_add_block( ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); if (arr->heap == NULL) { - UT_LIST_INIT(arr->base, &dyn_array_t::list); - UT_LIST_ADD_FIRST(arr->base, arr); + UT_LIST_INIT(arr->base); + UT_LIST_ADD_FIRST(list, arr->base, arr); arr->heap = mem_heap_create(sizeof(dyn_block_t)); } @@ -60,7 +60,7 @@ dyn_array_add_block( block->used = 0; - UT_LIST_ADD_LAST(arr->base, block); + UT_LIST_ADD_LAST(list, arr->base, block); return(block); } === modified file 'storage/innobase/fil/fil0fil.cc' --- a/storage/innobase/fil/fil0fil.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/fil/fil0fil.cc 2011-12-19 08:43:28 +0000 @@ -666,7 +666,7 @@ fil_node_create( node->space = space; - UT_LIST_ADD_LAST(space->chain, node); + UT_LIST_ADD_LAST(chain, space->chain, node); if (id < SRV_LOG_SPACE_FIRST_ID && fil_system->max_assigned_id < id) { @@ -866,7 +866,7 @@ add_size: if (fil_space_belongs_in_lru(space)) { /* Put the node to the LRU list */ - UT_LIST_ADD_FIRST(system->LRU, node); + UT_LIST_ADD_FIRST(LRU, system->LRU, node); } } @@ -907,7 +907,7 @@ fil_node_close_file( ut_a(UT_LIST_GET_LEN(system->LRU) > 0); /* The node is in the LRU list, remove it */ - UT_LIST_REMOVE(system->LRU, node); + UT_LIST_REMOVE(LRU, system->LRU, node); } } @@ -1125,7 +1125,9 @@ fil_node_free( space->is_in_unflushed_spaces = FALSE; - UT_LIST_REMOVE(system->unflushed_spaces, space); + UT_LIST_REMOVE(unflushed_spaces, + system->unflushed_spaces, + space); } fil_node_close_file(node, system); @@ -1133,7 +1135,7 @@ fil_node_free( space->size -= node->size; - UT_LIST_REMOVE(space->chain, node); + UT_LIST_REMOVE(chain, space->chain, node); mem_free(node->name); mem_free(node); @@ -1278,14 +1280,12 @@ try_again: space->name = mem_strdup(name); space->id = id; - UT_LIST_INIT(space->chain, &fil_node_t::chain); - fil_system->tablespace_version++; space->tablespace_version = fil_system->tablespace_version; space->mark = FALSE; - if (purpose == FIL_TABLESPACE && !recv_recovery_on - && id > fil_system->max_assigned_id) { + if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on) + && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) { if (!fil_system->space_id_reuse_warned) { fil_system->space_id_reuse_warned = TRUE; @@ -1313,7 +1313,7 @@ try_again: ut_fold_string(name), space); space->is_in_unflushed_spaces = FALSE; - UT_LIST_ADD_LAST(fil_system->space_list, space); + UT_LIST_ADD_LAST(space_list, fil_system->space_list, space); mutex_exit(&fil_system->mutex); @@ -1424,10 +1424,11 @@ fil_space_free( if (space->is_in_unflushed_spaces) { space->is_in_unflushed_spaces = FALSE; - UT_LIST_REMOVE(fil_system->unflushed_spaces, space); + UT_LIST_REMOVE(unflushed_spaces, fil_system->unflushed_spaces, + space); } - UT_LIST_REMOVE(fil_system->space_list, space); + UT_LIST_REMOVE(space_list, fil_system->space_list, space); ut_a(space->magic_n == FIL_SPACE_MAGIC_N); ut_a(0 == space->n_pending_flushes); @@ -1609,7 +1610,8 @@ fil_init( ut_a(hash_size > 0); ut_a(max_n_open > 0); - fil_system = static_cast(mem_zalloc(sizeof(*fil_system))); + fil_system = static_cast( + mem_zalloc(sizeof(fil_system_t))); mutex_create(fil_system_mutex_key, &fil_system->mutex, SYNC_ANY_LATCH); @@ -1617,11 +1619,7 @@ fil_init( fil_system->spaces = hash_create(hash_size); fil_system->name_hash = hash_create(hash_size); - UT_LIST_INIT(fil_system->LRU, &fil_node_t::LRU); - UT_LIST_INIT(fil_system->space_list, &fil_space_t::space_list); - - UT_LIST_INIT(fil_system->unflushed_spaces, - &fil_space_t::unflushed_spaces); + UT_LIST_INIT(fil_system->LRU); fil_system->max_n_open = max_n_open; } @@ -4283,7 +4281,7 @@ fil_node_prepare_for_io( ut_a(UT_LIST_GET_LEN(system->LRU) > 0); - UT_LIST_REMOVE(system->LRU, node); + UT_LIST_REMOVE(LRU, system->LRU, node); } node->n_pending++; @@ -4317,15 +4315,16 @@ fil_node_complete_io( if (!node->space->is_in_unflushed_spaces) { node->space->is_in_unflushed_spaces = TRUE; - UT_LIST_ADD_FIRST( - system->unflushed_spaces, node->space); + UT_LIST_ADD_FIRST(unflushed_spaces, + system->unflushed_spaces, + node->space); } } if (node->n_pending == 0 && fil_space_belongs_in_lru(node->space)) { /* The node must be put back to the LRU list */ - UT_LIST_ADD_FIRST(system->LRU, node); + UT_LIST_ADD_FIRST(LRU, system->LRU, node); } } @@ -4752,6 +4751,7 @@ skip_flush: space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE( + unflushed_spaces, fil_system->unflushed_spaces, space); } @@ -4857,9 +4857,10 @@ fil_validate(void) HASH_GET_FIRST(fil_system->spaces, i)); space != 0; space = static_cast( - HASH_GET_NEXT(hash, space))) { + HASH_GET_NEXT(hash, space))) { - UT_LIST_VALIDATE(space->chain, Check()); + UT_LIST_VALIDATE( + chain, fil_node_t, space->chain, Check()); for (fil_node = UT_LIST_GET_FIRST(space->chain); fil_node != 0; @@ -4878,7 +4879,7 @@ fil_validate(void) ut_a(fil_system->n_open == n_open); - UT_LIST_CHECK(fil_system->LRU); + UT_LIST_CHECK(LRU, fil_node_t, fil_system->LRU); for (fil_node = UT_LIST_GET_FIRST(fil_system->LRU); fil_node != 0; === modified file 'storage/innobase/include/dict0mem.h' --- a/storage/innobase/include/dict0mem.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/dict0mem.h 2011-12-19 08:43:28 +0000 @@ -581,11 +581,6 @@ a foreign key constraint is enforced, th #define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 /*!< ON UPDATE NO ACTION */ /* @} */ -/** List of locks that different transactions have acquired on a table. This -list has a list node that is embedded in a nested union/structure. We have to -generate a specific template for it. */ -typedef ut_list_base lock_table_t::*> - table_lock_list_t; /** Data structure for a database table. Most fields will be initialized to 0, NULL or FALSE in dict_mem_table_create(). */ @@ -719,7 +714,7 @@ struct dict_table_struct{ lock we keep a pointer to the transaction here in the autoinc_trx variable. This is to avoid acquiring the lock_sys_t::mutex and - scanning the vector in trx_t. + scanning the vector in trx_t. When an AUTOINC lock has to wait, the corresponding lock instance is created on @@ -766,7 +761,7 @@ struct dict_table_struct{ NOT allowed until this count gets to zero; MySQL does NOT itself check the number of open handles at drop */ - table_lock_list_t + UT_LIST_BASE_NODE_T(lock_t) locks; /*!< list of locks on the table; protected by lock_sys->mutex */ #endif /* !UNIV_HOTBACKUP */ === modified file 'storage/innobase/include/lock0lock.h' --- a/storage/innobase/include/lock0lock.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/lock0lock.h 2011-12-19 08:43:28 +0000 @@ -794,24 +794,6 @@ lock_table_get_n_locks( /*===================*/ const dict_table_t* table) /*!< in: table */ __attribute__((nonnull)); -/*******************************************************************//** -Initialise the table lock list. */ -UNIV_INTERN -void -lock_table_lock_list_init( -/*======================*/ - table_lock_list_t* locks) /*!< List to initialise */ - __attribute__((nonnull)); - -/*******************************************************************//** -Initialise the trx lock list. */ -UNIV_INTERN -void -lock_trx_lock_list_init( -/*====================*/ - trx_lock_list_t* lock_list) /*!< List to initialise */ - __attribute__((nonnull)); - /** Lock modes and types */ /* @{ */ #define LOCK_MODE_MASK 0xFUL /*!< mask used to extract mode from the === modified file 'storage/innobase/include/lock0priv.h' --- a/storage/innobase/include/lock0priv.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/lock0priv.h 2011-12-19 08:43:28 +0000 @@ -41,7 +41,6 @@ those functions in lock/ */ /** A table lock */ typedef struct lock_table_struct lock_table_t; - /** A table lock */ struct lock_table_struct { dict_table_t* table; /*!< database table in dictionary === modified file 'storage/innobase/include/lock0types.h' --- a/storage/innobase/include/lock0types.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/lock0types.h 2011-12-19 08:43:28 +0000 @@ -30,9 +30,6 @@ Created 5/7/1996 Heikki Tuuri typedef struct lock_struct lock_t; typedef struct lock_sys_struct lock_sys_t; -/** A table lock */ -typedef struct lock_table_struct lock_table_t; - /* Basic lock modes */ enum lock_mode { LOCK_IS = 0, /* intention shared */ @@ -46,6 +43,5 @@ enum lock_mode { LOCK_NONE_UNSET = 255 }; -typedef UT_LIST_BASE_NODE_T(lock_t) trx_lock_list_t; #endif === modified file 'storage/innobase/include/mem0mem.ic' --- a/storage/innobase/include/mem0mem.ic 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/mem0mem.ic 2011-12-19 08:43:28 +0000 @@ -447,13 +447,15 @@ mem_heap_create_func( return(NULL); } - UT_LIST_INIT(block->base, &mem_block_t::list); + UT_LIST_INIT(block->base); /* Add the created block itself as the first block in the list */ - UT_LIST_ADD_FIRST(block->base, block); + UT_LIST_ADD_FIRST(list, block->base, block); #ifdef UNIV_MEM_DEBUG + mem_hash_insert(block, file_name, line); + #endif return(block); === modified file 'storage/innobase/include/sync0sync.h' --- a/storage/innobase/include/sync0sync.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/sync0sync.h 2011-12-19 08:43:28 +0000 @@ -799,10 +799,9 @@ extern ibool sync_order_checks_on; extern ibool sync_initialized; /** Global list of database mutexes (not OS mutexes) created. */ -typedef UT_LIST_BASE_NODE_T(mutex_t) mutex_list_t; - +typedef UT_LIST_BASE_NODE_T(mutex_t) ut_list_base_node_t; /** Global list of database mutexes (not OS mutexes) created. */ -extern mutex_list_t mutex_list; +extern ut_list_base_node_t mutex_list; /** Mutex protecting the mutex_list variable */ extern mutex_t mutex_list_mutex; === modified file 'storage/innobase/include/trx0roll.h' --- a/storage/innobase/include/trx0roll.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/trx0roll.h 2011-12-19 08:43:28 +0000 @@ -254,7 +254,7 @@ enum roll_node_state { ROLL_NODE_SEND, /*!< about to send a rollback signal to the transaction */ ROLL_NODE_WAIT /*!< rollback signal sent to the - transaction, waiting for completion */ + transaction, waiting for completion */ }; /** Rollback command node in a query graph */ === modified file 'storage/innobase/include/trx0trx.h' --- a/storage/innobase/include/trx0trx.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/trx0trx.h 2011-12-19 08:43:28 +0000 @@ -552,7 +552,9 @@ struct trx_lock_struct { mem_heap_t* lock_heap; /*!< memory heap for trx_locks; protected by lock_sys->mutex */ - trx_lock_list_t trx_locks; /*!< locks requested by the transaction; + UT_LIST_BASE_NODE_T(lock_t) + trx_locks; /*!< locks requested + by the transaction; insertions are protected by trx->mutex and lock_sys->mutex; removals are protected by lock_sys->mutex */ === modified file 'storage/innobase/include/usr0sess.h' --- a/storage/innobase/include/usr0sess.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/usr0sess.h 2011-12-19 08:43:28 +0000 @@ -60,6 +60,9 @@ struct sess_struct{ transaction instance designated by the trx id changes, but the memory structure is preserved */ + UT_LIST_BASE_NODE_T(que_t) + graphs; /*!< query graphs belonging to this + session */ }; /* Session states */ === modified file 'storage/innobase/include/ut0lst.h' --- a/storage/innobase/include/ut0lst.h 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/include/ut0lst.h 2011-12-19 08:43:28 +0000 @@ -21,7 +21,6 @@ this program; if not, write to the Free List utilities Created 9/10/1995 Heikki Tuuri -Rewritten by Sunny Bains Dec 2011. ***********************************************************************/ #ifndef ut0lst_h @@ -29,109 +28,116 @@ Rewritten by Sunny Bains Dec 2011. #include "univ.i" -/* This module implements the two-way linear list. Note that a single -list node may belong to two or more lists, but is only on one list -at a time. */ - -/*******************************************************************//** -The two way list node. -@param TYPE the list node type name */ -template -struct ut_list_node { - Type* prev; /*!< pointer to the previous - node, NULL if start of list */ - Type* next; /*!< pointer to next node, - NULL if end of list */ -}; - -/** Macro used for legacy reasons */ -#define UT_LIST_NODE_T(t) ut_list_node - /*******************************************************************//** -The two-way list base node. The base node contains pointers to both ends -of the list and a count of nodes in the list (excluding the base node -from the count). We also store a pointer to the member field so that it -doesn't have to be specified when doing list operations. -@param Type the type of the list element -@param NodePtr field member pointer that points to the list node */ -template Type::*> +Return offset of F in POD T. +@param T - POD pointer +@param F - Field in T */ +#define IB_OFFSETOF(T, F) \ + (reinterpret_cast(&(T)->F) - reinterpret_cast(T)) + +/* This module implements the two-way linear list which should be used +if a list is used in the database. Note that a single struct may belong +to two or more lists, provided that the list are given different names. +An example of the usage of the lists can be found in fil0fil.cc. */ + +/*******************************************************************//** +This macro expands to the unnamed type definition of a struct which acts +as the two-way list base node. The base node contains pointers +to both ends of the list and a count of nodes in the list (excluding +the base node from the count). +@param TYPE the name of the list node data type */ +template struct ut_list_base { - typedef Type elem_type; - typedef NodePtr node_ptr; - typedef ut_list_node node_type; - - ulint count; /*!< count of nodes in list */ - elem_type* start; /*!< pointer to list start, - NULL if empty */ - elem_type* end; /*!< pointer to list end, - NULL if empty */ - node_ptr node; /*!< Pointer to member field - that is used as a link node */ + typedef TYPE elem_type; + + ulint count; /*!< count of nodes in list */ + TYPE* start; /*!< pointer to list start, NULL if empty */ + TYPE* end; /*!< pointer to list end, NULL if empty */ }; -#define UT_LIST_BASE_NODE_T(t) ut_list_base +#define UT_LIST_BASE_NODE_T(TYPE) ut_list_base /*******************************************************************//** -Note: This is really the list constructor. We should be able to use -placement new here. -Initializes the base node of a two-way list. -@param b the list base node -@param pmf point to member field that will be used as the link node */ -#define UT_LIST_INIT(b, pmf) \ -{ \ - (b).count = 0; \ - (b).start = 0; \ - (b).end = 0; \ - (b).node = pmf; \ +This macro expands to the unnamed type definition of a struct which +should be embedded in the nodes of the list, the node type must be a struct. +This struct contains the pointers to next and previous nodes in the list. +The name of the field in the node struct should be the name given +to the list. +@param TYPE the list node type name */ +/* Example: +typedef struct LRU_node_struct LRU_node_t; +struct LRU_node_struct { + UT_LIST_NODE_T(LRU_node_t) LRU_list; + ... } +The example implements an LRU list of name LRU_list. Its nodes are of type +LRU_node_t. */ -/** Functor for accessing the embedded node within a list element. This is -required because some lists can have the node emebedded inside a nested -struct/union. See lock0priv.h (table locks) for an example. It provides a -specialised functor to grant access to the list node. */ -template -struct GenericGetNode { +template +struct ut_list_node { + TYPE* prev; /*!< pointer to the previous node, + NULL if start of list */ + TYPE* next; /*!< pointer to next node, NULL if end of list */ +}; - typedef ut_list_node node_type; +#define UT_LIST_NODE_T(TYPE) ut_list_node - GenericGetNode(node_type Type::* node) : m_node(node) {} +/*******************************************************************//** +Get the list node at offset. +@param elem - list element +@param offset - offset within element. +@return reference to list node. */ +template +ut_list_node& +ut_elem_get_node(Type& elem, size_t offset) +{ + ut_a(offset < sizeof(elem)); - node_type& operator() (Type& elem) - { - return(elem.*m_node); - } + return(*reinterpret_cast*>( + reinterpret_cast(&elem) + offset)); +} - node_type Type::*m_node; -}; +/*******************************************************************//** +Initializes the base node of a two-way list. +@param BASE the list base node +*/ +#define UT_LIST_INIT(BASE)\ +{\ + (BASE).count = 0;\ + (BASE).start = NULL;\ + (BASE).end = NULL;\ +}\ /*******************************************************************//** Adds the node as the first element in a two-way linked list. @param list the base node (not a pointer to it) -@param elem the element to add */ -template +@param elem the element to add +@param offset offset of list node in elem. */ +template void ut_list_prepend( - List& list, - typename List::elem_type* elem) + List& list, + Type& elem, + size_t offset) { - typename List::node_type& elem_node = elem->*list.node; + ut_list_node& elem_node = ut_elem_get_node(elem, offset); - elem_node.prev = 0; - elem_node.next = list.start; + elem_node.prev = 0; + elem_node.next = list.start; if (list.start != 0) { - typename List::node_type& base_node = - list.start->*list.node; + ut_list_node& base_node = + ut_elem_get_node(*list.start, offset); - ut_ad(list.start != elem); + ut_ad(list.start != &elem); - base_node.prev = elem; + base_node.prev = &elem; } - list.start = elem; + list.start = &elem; if (list.end == 0) { - list.end = elem; + list.end = &elem; } ++list.count; @@ -139,39 +145,42 @@ ut_list_prepend( /*******************************************************************//** Adds the node as the first element in a two-way linked list. +@param NAME list name @param LIST the base node (not a pointer to it) @param ELEM the element to add */ -#define UT_LIST_ADD_FIRST(LIST, ELEM) ut_list_prepend(LIST, ELEM) +#define UT_LIST_ADD_FIRST(NAME, LIST, ELEM) \ + ut_list_prepend(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) /*******************************************************************//** Adds the node as the last element in a two-way linked list. @param list list @param elem the element to add -@param get_node to get the list node for that element */ -template +@param offset offset of list node in elem */ +template void ut_list_append( - List& list, - typename List::elem_type* elem, - Functor get_node) + List& list, + Type& elem, + size_t offset) { - typename List::node_type& node = get_node(*elem); + ut_list_node& elem_node = ut_elem_get_node(elem, offset); - node.next = 0; - node.prev = list.end; + elem_node.next = 0; + elem_node.prev = list.end; if (list.end != 0) { - typename List::node_type& base_node = get_node(*list.end); + ut_list_node& base_node = + ut_elem_get_node(*list.end, offset); - ut_ad(list.end != elem); + ut_ad(list.end != &elem); - base_node.next = elem; + base_node.next = &elem; } - list.end = elem; + list.end = &elem; if (list.start == 0) { - list.start = elem; + list.start = &elem; } ++list.count; @@ -179,56 +188,45 @@ ut_list_append( /*******************************************************************//** Adds the node as the last element in a two-way linked list. -@param list list -@param elem the element to add */ -template -void -ut_list_append( - List& list, - typename List::elem_type* elem) -{ - ut_list_append( - list, elem, - GenericGetNode(list.node)); -} - -/*******************************************************************//** -Adds the node as the last element in a two-way linked list. -@param LIST list base node (not a pointer to it) +@param NAME list name +@param LIST list @param ELEM the element to add */ -#define UT_LIST_ADD_LAST(LIST, ELEM) ut_list_append(LIST, ELEM) +#define UT_LIST_ADD_LAST(NAME, LIST, ELEM)\ + ut_list_append(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) /*******************************************************************//** Inserts a ELEM2 after ELEM1 in a list. @param list the base node @param elem1 node after which ELEM2 is inserted -@param elem2 node being inserted after ELEM1 */ -template +@param elem2 node being inserted after NODE1 +@param offset offset of list node in elem1 and elem2 */ +template void ut_list_insert( - List& list, - typename List::elem_type* elem1, - typename List::elem_type* elem2) + List& list, + Type& elem1, + Type& elem2, + size_t offset) { - ut_ad(elem1 != elem2); + ut_ad(&elem1 != &elem2); - typename List::node_type& elem1_node = elem1->*list.node; - typename List::node_type& elem2_node = elem2->*list.node; + ut_list_node& elem1_node = ut_elem_get_node(elem1, offset); + ut_list_node& elem2_node = ut_elem_get_node(elem2, offset); - elem2_node.prev = elem1; + elem2_node.prev = &elem1; elem2_node.next = elem1_node.next; if (elem1_node.next != NULL) { - typename List::node_type& next_node = - elem1_node.next->*list.node; + ut_list_node& next_node = + ut_elem_get_node(*elem1_node.next, offset); - next_node.prev = elem2; + next_node.prev = &elem2; } - elem1_node.next = elem2; + elem1_node.next = &elem2; - if (list.end == elem1) { - list.end = elem2; + if (list.end == &elem1) { + list.end = &elem2; } ++list.count; @@ -236,148 +234,132 @@ ut_list_insert( /*******************************************************************//** Inserts a ELEM2 after ELEM1 in a list. -@param LIST list base node (not a pointer to it) +@param NAME list name +@param LIST the base node @param ELEM1 node after which ELEM2 is inserted @param ELEM2 node being inserted after ELEM1 */ -#define UT_LIST_INSERT_AFTER(LIST, ELEM1, ELEM2) \ - ut_list_insert(LIST, ELEM1, ELEM2) +#define UT_LIST_INSERT_AFTER(NAME, LIST, ELEM1, ELEM2)\ + ut_list_insert(LIST, *ELEM1, *ELEM2, IB_OFFSETOF(ELEM1, NAME)) #ifdef UNIV_LIST_DEBUG -/** Invalidate the pointers in a list node. Note: We expect "Type" to exist -in the lexical scope. Since this is internal debug code, it is OK. -@param n pointer to the node that was removed */ -# define UT_LIST_REMOVE_CLEAR(n) \ - (n).next = (Type*) -1; \ - (n).prev = (n).next +/** Invalidate the pointers in a list node. +@param NAME list name +@param N pointer to the node that was removed */ +# define UT_LIST_REMOVE_CLEAR(N) \ + (N).next = (Type*) -1; \ + (N).prev = (N).next #else /** Invalidate the pointers in a list node. -@param n pointer to the node that was removed */ -# define UT_LIST_REMOVE_CLEAR(n) +@param NAME list name +@param N pointer to the node that was removed */ +# define UT_LIST_REMOVE_CLEAR(N) #endif /* UNIV_LIST_DEBUG */ /*******************************************************************//** Removes a node from a two-way linked list. @param list the base node (not a pointer to it) -@param node member node within list element that is to be removed -@param get_node functor to get the list node from elem */ -template +@param elem node to be removed from the list +@param offset offset of list node within elem */ +template void ut_list_remove( - List& list, - typename List::node_type& node, - Functor get_node) + List& list, + Type& elem, + size_t offset) { + ut_list_node& elem_node = ut_elem_get_node(elem, offset); + ut_a(list.count > 0); - if (node.next != NULL) { - typename List::node_type& next_node = - get_node(*node.next); + if (elem_node.next != NULL) { + ut_list_node& next_node = + ut_elem_get_node(*elem_node.next, offset); - next_node.prev = node.prev; + next_node.prev = elem_node.prev; } else { - list.end = node.prev; + list.end = elem_node.prev; } - if (node.prev != NULL) { - typename List::node_type& prev_node = - get_node(*node.prev); + if (elem_node.prev != NULL) { + ut_list_node& prev_node = + ut_elem_get_node(*elem_node.prev, offset); - prev_node.next = node.next; + prev_node.next = elem_node.next; } else { - list.start = node.next; + list.start = elem_node.next; } - UT_LIST_REMOVE_CLEAR(node); + UT_LIST_REMOVE_CLEAR(elem_node); --list.count; } /*******************************************************************//** Removes a node from a two-way linked list. -@param list the base node (not a pointer to it) -@param elem element to be removed from the list -@param get_node functor to get the list node from elem */ -template -void -ut_list_remove( - List& list, - typename List::elem_type* elem, - Functor get_node) -{ - ut_list_remove(list, get_node(*elem), get_node); -} - -/*******************************************************************//** -Removes a node from a two-way linked list. -@param list the base node (not a pointer to it) -@param elem element to be removed from the list */ -template -void -ut_list_remove( - List& list, - typename List::elem_type* elem) -{ - ut_list_remove( - list, elem->*list.node, - GenericGetNode(list.node)); -} - -/*******************************************************************//** -Removes a node from a two-way linked list. + aram NAME list name @param LIST the base node (not a pointer to it) @param ELEM node to be removed from the list */ -#define UT_LIST_REMOVE(LIST, ELEM) ut_list_remove(LIST, ELEM) +#define UT_LIST_REMOVE(NAME, LIST, ELEM) \ + ut_list_remove(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) /********************************************************************//** Gets the next node in a two-way list. @param NAME list name @param N pointer to a node @return the successor of N in NAME, or NULL */ -#define UT_LIST_GET_NEXT(NAME, N) (((N)->NAME).next) +#define UT_LIST_GET_NEXT(NAME, N)\ + (((N)->NAME).next) /********************************************************************//** Gets the previous node in a two-way list. @param NAME list name @param N pointer to a node @return the predecessor of N in NAME, or NULL */ -#define UT_LIST_GET_PREV(NAME, N) (((N)->NAME).prev) +#define UT_LIST_GET_PREV(NAME, N)\ + (((N)->NAME).prev) /********************************************************************//** Alternative macro to get the number of nodes in a two-way list, i.e., its length. @param BASE the base node (not a pointer to it). @return the number of nodes in the list */ -#define UT_LIST_GET_LEN(BASE) (BASE).count +#define UT_LIST_GET_LEN(BASE)\ + (BASE).count /********************************************************************//** Gets the first node in a two-way list. @param BASE the base node (not a pointer to it) @return first node, or NULL if the list is empty */ -#define UT_LIST_GET_FIRST(BASE) (BASE).start +#define UT_LIST_GET_FIRST(BASE)\ + (BASE).start /********************************************************************//** Gets the last node in a two-way list. @param BASE the base node (not a pointer to it) @return last node, or NULL if the list is empty */ -#define UT_LIST_GET_LAST(BASE) (BASE).end +#define UT_LIST_GET_LAST(BASE)\ + (BASE).end struct NullValidate { void operator()(const void* elem) { } }; /********************************************************************//** Iterate over all the elements and call the functor for each element. @param list base node (not a pointer to it) -@param functor Functor that is called for each element in the list */ +@param functor Functor that is called for each element in the list +@parm node pointer to member node within list element */ template void ut_list_map( List& list, + ut_list_node + List::elem_type::*node, Functor functor) { ulint count = 0; for (typename List::elem_type* elem = list.start; elem != 0; - elem = (elem->*list.node).next, ++count) { + elem = (elem->*node).next, ++count) { functor(elem); } @@ -388,20 +370,23 @@ ut_list_map( /********************************************************************//** Checks the consistency of a two-way list. @param list base node (not a pointer to it) -@param functor Functor that is called for each element in the list */ +@param functor Functor that is called for each element in the list +@parm node pointer to member node within list element */ template void ut_list_validate( List& list, + ut_list_node + List::elem_type::*node, Functor functor = NullValidate()) { - ut_list_map(list, functor); + ut_list_map(list, node, functor); ulint count = 0; for (typename List::elem_type* elem = list.end; elem != 0; - elem = (elem->*list.node).prev, ++count) { + elem = (elem->*node).prev, ++count) { functor(elem); } @@ -411,14 +396,14 @@ ut_list_validate( /********************************************************************//** Checks the consistency of a two-way list. +@param NAME the name of the list +@param TYPE node type @param LIST base node (not a pointer to it) @param FUNCTOR called for each list element */ -#define UT_LIST_VALIDATE(LIST, FUNCTOR) ut_list_validate(LIST, FUNCTOR) +#define UT_LIST_VALIDATE(NAME, TYPE, LIST, FUNCTOR) \ + ut_list_validate(LIST, &TYPE::NAME, FUNCTOR) -/********************************************************************//** -Checks the consistency of a two-way list. -@param LIST base node (not a pointer to it) */ -#define UT_LIST_CHECK(LIST) \ - ut_list_validate(LIST, NullValidate()) +#define UT_LIST_CHECK(NAME, TYPE, LIST) \ + ut_list_validate(LIST, &TYPE::NAME, NullValidate()) #endif /* ut0lst.h */ === modified file 'storage/innobase/lock/lock0iter.cc' --- a/storage/innobase/lock/lock0iter.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/lock/lock0iter.cc 2011-12-19 08:43:28 +0000 @@ -27,7 +27,6 @@ Created July 16, 2007 Vasil Dimov #define LOCK_MODULE_IMPLEMENTATION #include "univ.i" -#include "dict0mem.h" #include "lock0iter.h" #include "lock0lock.h" #include "lock0priv.h" === modified file 'storage/innobase/lock/lock0lock.cc' --- a/storage/innobase/lock/lock0lock.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/lock/lock0lock.cc 2011-12-19 08:43:28 +0000 @@ -25,7 +25,6 @@ Created 5/7/1996 Heikki Tuuri #define LOCK_MODULE_IMPLEMENTATION -#include "dict0mem.h" #include "lock0lock.h" #include "lock0priv.h" @@ -37,6 +36,7 @@ Created 5/7/1996 Heikki Tuuri #include "ha_prototypes.h" #include "usr0sess.h" #include "trx0purge.h" +#include "dict0mem.h" #include "trx0sys.h" #include "pars0pars.h" /* pars_complete_graph_for_exec() */ #include "que0que.h" /* que_node_get_parent() */ @@ -1813,7 +1813,7 @@ lock_rec_create( lock_set_lock_and_trx_wait(lock, trx); } - UT_LIST_ADD_LAST(trx->lock.trx_locks, lock); + UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); if (!caller_owns_trx_mutex) { trx_mutex_exit(trx); @@ -2424,7 +2424,7 @@ lock_rec_dequeue_from_page( HASH_DELETE(lock_t, hash, lock_sys->rec_hash, lock_rec_fold(space, page_no), in_lock); - UT_LIST_REMOVE(trx_lock->trx_locks, in_lock); + UT_LIST_REMOVE(trx_locks, trx_lock->trx_locks, in_lock); MONITOR_INC(MONITOR_RECLOCK_REMOVED); MONITOR_DEC(MONITOR_NUM_RECLOCK); @@ -2474,7 +2474,7 @@ lock_rec_discard( HASH_DELETE(lock_t, hash, lock_sys->rec_hash, lock_rec_fold(space, page_no), in_lock); - UT_LIST_REMOVE(trx_lock->trx_locks, in_lock); + UT_LIST_REMOVE(trx_locks, trx_lock->trx_locks, in_lock); MONITOR_INC(MONITOR_RECLOCK_REMOVED); MONITOR_DEC(MONITOR_NUM_RECLOCK); @@ -2711,13 +2711,13 @@ lock_move_reorganize_page( bitmaps in the original locks; chain the copies of the locks using the trx_locks field in them. */ - UT_LIST_INIT(old_locks, &lock_t::trx_locks); + UT_LIST_INIT(old_locks); do { /* Make a copy of the lock */ lock_t* old_lock = lock_rec_copy(lock, heap); - UT_LIST_ADD_LAST(old_locks, old_lock); + UT_LIST_ADD_LAST(trx_locks, old_locks, old_lock); /* Reset bitmap of lock */ lock_rec_bitmap_reset(lock); @@ -3992,14 +3992,6 @@ lock_deadlock_check_and_resolve( /*========================= TABLE LOCKS ==============================*/ -/** Functor for accessing the embedded node within a table lock. */ -struct TableLockGetNode { - ut_list_node& operator() (lock_t& elem) - { - return(elem.un_member.tab_lock.locks); - } -}; - /*********************************************************************//** Creates a table lock object and adds it as the last in the lock queue of the table. Does NOT check for deadlocks or lock compatibility. @@ -4050,9 +4042,8 @@ lock_table_create( ut_ad(table->n_ref_count > 0 || !table->can_be_evicted); - UT_LIST_ADD_LAST(trx->lock.trx_locks, lock); - - ut_list_append(table->locks, lock, TableLockGetNode()); + UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); + UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { @@ -4191,8 +4182,8 @@ lock_table_remove_low( table->n_waiting_or_granted_auto_inc_locks--; } - UT_LIST_REMOVE(trx->lock.trx_locks, lock); - ut_list_remove(table->locks, lock, TableLockGetNode()); + UT_LIST_REMOVE(trx_locks, trx->lock.trx_locks, lock); + UT_LIST_REMOVE(un_member.tab_lock.locks, table->locks, lock); MONITOR_INC(MONITOR_TABLELOCK_REMOVED); MONITOR_DEC(MONITOR_NUM_TABLELOCK); @@ -6789,25 +6780,3 @@ lock_table_has_locks( return(has_locks); } - -/*******************************************************************//** -Initialise the table lock list. */ -UNIV_INTERN -void -lock_table_lock_list_init( -/*======================*/ - table_lock_list_t* lock_list) /*!< List to initialise */ -{ - UT_LIST_INIT(*lock_list, &lock_table_t::locks); -} - -/*******************************************************************//** -Initialise the trx lock list. */ -UNIV_INTERN -void -lock_trx_lock_list_init( -/*====================*/ - trx_lock_list_t* lock_list) /*!< List to initialise */ -{ - UT_LIST_INIT(*lock_list, &lock_t::trx_locks); -} === modified file 'storage/innobase/log/log0log.cc' --- a/storage/innobase/log/log0log.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/log/log0log.cc 2011-12-19 08:43:28 +0000 @@ -764,7 +764,7 @@ log_init(void) log_sys->max_buf_free = log_sys->buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; log_sys->check_flush_or_checkpoint = TRUE; - UT_LIST_INIT(log_sys->log_groups, &log_group_t::log_groups); + UT_LIST_INIT(log_sys->log_groups); log_sys->n_log_ios = 0; @@ -938,7 +938,7 @@ log_group_init( group->checkpoint_buf = static_cast( ut_align(group->checkpoint_buf_ptr,OS_FILE_LOG_BLOCK_SIZE)); - UT_LIST_ADD_LAST(log_sys->log_groups, group); + UT_LIST_ADD_LAST(log_groups, log_sys->log_groups, group); ut_a(log_calc_max_ages()); } @@ -3577,8 +3577,7 @@ log_shutdown(void) log_group_t* prev_group = group; group = UT_LIST_GET_NEXT(log_groups, group); - - UT_LIST_REMOVE(log_sys->log_groups, prev_group); + UT_LIST_REMOVE(log_groups, log_sys->log_groups, prev_group); log_group_close(prev_group); } === modified file 'storage/innobase/log/log0recv.cc' --- a/storage/innobase/log/log0recv.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/log/log0recv.cc 2011-12-19 08:43:28 +0000 @@ -1374,7 +1374,7 @@ recv_add_to_hash_table( recv_addr->page_no = page_no; recv_addr->state = RECV_NOT_PROCESSED; - UT_LIST_INIT(recv_addr->rec_list, &recv_t::rec_list); + UT_LIST_INIT(recv_addr->rec_list); HASH_INSERT(recv_addr_t, addr_hash, recv_sys->addr_hash, recv_fold(space, page_no), recv_addr); @@ -1385,7 +1385,7 @@ recv_add_to_hash_table( #endif } - UT_LIST_ADD_LAST(recv_addr->rec_list, recv); + UT_LIST_ADD_LAST(rec_list, recv_addr->rec_list, recv); prev_field = &(recv->data); === modified file 'storage/innobase/mem/mem0mem.cc' --- a/storage/innobase/mem/mem0mem.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/mem/mem0mem.cc 2011-12-19 08:43:28 +0000 @@ -453,7 +453,7 @@ mem_heap_add_block( /* Add the new block as the last block */ - UT_LIST_INSERT_AFTER(heap->base, block, new_block); + UT_LIST_INSERT_AFTER(list, heap->base, block, new_block); return(new_block); } @@ -479,12 +479,12 @@ mem_heap_block_free( mem_analyze_corruption(block); } - UT_LIST_REMOVE(heap->base, block); + UT_LIST_REMOVE(list, heap->base, block); #ifdef MEM_PERIODIC_CHECK mutex_enter(&(mem_comm_pool->mutex)); - UT_LIST_REMOVE(mem_block_list, block); + UT_LIST_REMOVE(mem_block_list, mem_block_list, block); mutex_exit(&(mem_comm_pool->mutex)); #endif === modified file 'storage/innobase/mem/mem0pool.cc' --- a/storage/innobase/mem/mem0pool.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/mem/mem0pool.cc 2011-12-19 08:43:28 +0000 @@ -241,7 +241,7 @@ mem_pool_create( for (i = 0; i < 64; i++) { - UT_LIST_INIT(pool->free_list[i], &mem_area_t::free_list); + UT_LIST_INIT(pool->free_list[i]); } used = 0; @@ -264,7 +264,7 @@ mem_pool_create( UNIV_MEM_FREE(MEM_AREA_EXTRA_SIZE + (byte*) area, ut_2_exp(i) - MEM_AREA_EXTRA_SIZE); - UT_LIST_ADD_FIRST(pool->free_list[i], area); + UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area); used = used + ut_2_exp(i); } @@ -342,7 +342,7 @@ mem_pool_fill_free_list( ut_error; } - UT_LIST_REMOVE(pool->free_list[i + 1], area); + UT_LIST_REMOVE(free_list, pool->free_list[i + 1], area); area2 = (mem_area_t*)(((byte*) area) + ut_2_exp(i)); UNIV_MEM_ALLOC(area2, MEM_AREA_EXTRA_SIZE); @@ -350,11 +350,11 @@ mem_pool_fill_free_list( mem_area_set_size(area2, ut_2_exp(i)); mem_area_set_free(area2, TRUE); - UT_LIST_ADD_FIRST(pool->free_list[i], area2); + UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area2); mem_area_set_size(area, ut_2_exp(i)); - UT_LIST_ADD_FIRST(pool->free_list[i], area); + UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area); return(TRUE); } @@ -448,7 +448,7 @@ mem_area_alloc( mem_area_set_free(area, FALSE); - UT_LIST_REMOVE(pool->free_list[n], area); + UT_LIST_REMOVE(free_list, pool->free_list[n], area); pool->reserved += mem_area_get_size(area); @@ -606,7 +606,7 @@ mem_area_free( /* Remove the buddy from its free list and merge it to area */ - UT_LIST_REMOVE(pool->free_list[n], buddy); + UT_LIST_REMOVE(free_list, pool->free_list[n], buddy); pool->reserved += ut_2_exp(n); @@ -617,7 +617,7 @@ mem_area_free( return; } else { - UT_LIST_ADD_FIRST(pool->free_list[n], area); + UT_LIST_ADD_FIRST(free_list, pool->free_list[n], area); mem_area_set_free(area, TRUE); @@ -652,7 +652,7 @@ mem_pool_validate( for (i = 0; i < 64; i++) { - UT_LIST_CHECK(pool->free_list[i]); + UT_LIST_CHECK(free_list, mem_area_t, pool->free_list[i]); for (area = UT_LIST_GET_FIRST(pool->free_list[i]); area != 0; === modified file 'storage/innobase/os/os0sync.cc' --- a/storage/innobase/os/os0sync.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/os/os0sync.cc 2011-12-19 08:43:28 +0000 @@ -307,8 +307,8 @@ void os_sync_init(void) /*==============*/ { - UT_LIST_INIT(os_mutex_list, &os_mutex_str_t::os_mutex_list); - UT_LIST_INIT(os_event_list, &os_event_struct::os_event_list); + UT_LIST_INIT(os_event_list); + UT_LIST_INIT(os_mutex_list); os_sync_mutex = NULL; os_sync_mutex_inited = FALSE; @@ -422,7 +422,7 @@ os_event_create( } /* Put to the list of events */ - UT_LIST_ADD_FIRST(os_event_list, event); + UT_LIST_ADD_FIRST(os_event_list, os_event_list, event); os_event_count++; @@ -526,7 +526,7 @@ os_event_free_internal( } /* Remove from the list of events */ - UT_LIST_REMOVE(os_event_list, event); + UT_LIST_REMOVE(os_event_list, os_event_list, event); os_event_count--; @@ -557,7 +557,7 @@ os_event_free( /* Remove from the list of events */ os_mutex_enter(os_sync_mutex); - UT_LIST_REMOVE(os_event_list, event); + UT_LIST_REMOVE(os_event_list, os_event_list, event); os_event_count--; @@ -766,7 +766,7 @@ os_mutex_create(void) os_mutex_enter(os_sync_mutex); } - UT_LIST_ADD_FIRST(os_mutex_list, mutex_str); + UT_LIST_ADD_FIRST(os_mutex_list, os_mutex_list, mutex_str); os_mutex_count++; @@ -818,15 +818,15 @@ os_mutex_free( { ut_a(mutex); - if (!os_sync_free_called) { + if (UNIV_LIKELY(!os_sync_free_called)) { os_event_free_internal(mutex->event); } - if (os_sync_mutex_inited) { + if (UNIV_LIKELY(os_sync_mutex_inited)) { os_mutex_enter(os_sync_mutex); } - UT_LIST_REMOVE(os_mutex_list, mutex); + UT_LIST_REMOVE(os_mutex_list, os_mutex_list, mutex); os_mutex_count--; === modified file 'storage/innobase/pars/pars0opt.cc' --- a/storage/innobase/pars/pars0opt.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/pars/pars0opt.cc 2011-12-19 08:43:28 +0000 @@ -774,10 +774,10 @@ opt_find_test_conds( fclass = opt_classify_comparison(sel_node, i, cond); if (fclass == OPT_END_COND) { - UT_LIST_ADD_LAST(plan->end_conds, cond); + UT_LIST_ADD_LAST(cond_list, plan->end_conds, cond); } else if (fclass == OPT_TEST_COND) { - UT_LIST_ADD_LAST(plan->other_conds, cond); + UT_LIST_ADD_LAST(cond_list, plan->other_conds, cond); } } @@ -839,8 +839,8 @@ opt_determine_and_normalize_test_conds( plan = sel_node_get_nth_plan(sel_node, i); - UT_LIST_INIT(plan->end_conds, &func_node_t::cond_list); - UT_LIST_INIT(plan->other_conds, &func_node_t::cond_list); + UT_LIST_INIT(plan->end_conds); + UT_LIST_INIT(plan->other_conds); /* Recursively go through the conjuncts and classify them */ @@ -941,7 +941,7 @@ opt_find_all_cols( /* The same column did not occur in the list: add it */ - UT_LIST_ADD_LAST(*col_list, sym_node); + UT_LIST_ADD_LAST(col_var_list, *col_list, sym_node); sym_node->copy_val = copy_val; @@ -1035,7 +1035,7 @@ opt_classify_cols( plan->must_get_clust = FALSE; - UT_LIST_INIT(plan->columns, &sym_node_t::col_var_list); + UT_LIST_INIT(plan->columns); /* All select list columns should be copied: therefore TRUE as the first argument */ === modified file 'storage/innobase/pars/pars0pars.cc' --- a/storage/innobase/pars/pars0pars.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/pars/pars0pars.cc 2011-12-19 08:43:28 +0000 @@ -256,8 +256,8 @@ pars_func_low( node->args = arg; - UT_LIST_ADD_LAST(pars_sym_tab_global->func_node_list, node); - + UT_LIST_ADD_LAST(func_node_list, pars_sym_tab_global->func_node_list, + node); return(node); } @@ -715,7 +715,8 @@ pars_resolve_exp_variables_and_types( sym_node->indirection = node; if (select_node) { - UT_LIST_ADD_LAST(select_node->copy_variables, sym_node); + UT_LIST_ADD_LAST(col_var_list, select_node->copy_variables, + sym_node); } dfield_set_type(que_node_get_val(sym_node), @@ -1027,7 +1028,7 @@ pars_select_statement( == que_node_list_get_len(select_node->select_list)); } - UT_LIST_INIT(select_node->copy_variables, &sym_node_t::col_var_list); + UT_LIST_INIT(select_node->copy_variables); pars_resolve_exp_list_columns(table_list, select_node->select_list); pars_resolve_exp_list_variables_and_types(select_node, @@ -1278,7 +1279,7 @@ pars_update_statement( pars_retrieve_table_def(table_sym); node->table = table_sym->table; - UT_LIST_INIT(node->columns, &sym_node_t::col_var_list); + UT_LIST_INIT(node->columns); /* Make the single table node into a list of table nodes of length 1 */ === modified file 'storage/innobase/pars/pars0sym.cc' --- a/storage/innobase/pars/pars0sym.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/pars/pars0sym.cc 2011-12-19 08:43:28 +0000 @@ -52,8 +52,8 @@ sym_tab_create( sym_tab = static_cast( mem_heap_alloc(heap, sizeof(sym_tab_t))); - UT_LIST_INIT(sym_tab->sym_list, &sym_node_t::sym_list); - UT_LIST_INIT(sym_tab->func_node_list, &func_node_t::func_node_list); + UT_LIST_INIT(sym_tab->sym_list); + UT_LIST_INIT(sym_tab->func_node_list); sym_tab->heap = heap; @@ -145,7 +145,7 @@ sym_tab_add_int_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); node->like_node = NULL; @@ -184,7 +184,7 @@ sym_tab_add_str_lit( DATA_VARCHAR, DATA_ENGLISH, 0); data = (len) ? static_cast(mem_heap_dup(sym_tab->heap, str, len)) - : NULL; + : NULL; dfield_set_data(&(node->common.val), data, len); @@ -192,7 +192,7 @@ sym_tab_add_str_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); node->like_node = NULL; @@ -273,7 +273,7 @@ sym_tab_add_bound_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); blit->node = node; node->like_node = NULL; @@ -356,7 +356,7 @@ sym_tab_add_null_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); node->like_node = NULL; @@ -386,7 +386,7 @@ sym_tab_add_id( node->name = mem_heap_strdupl(sym_tab->heap, (char*) name, len); node->name_len = len; - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); dfield_set_null(&node->common.val); @@ -424,7 +424,7 @@ sym_tab_add_bound_id( node->name = mem_heap_strdup(sym_tab->heap, bid->id); node->name_len = strlen(node->name); - UT_LIST_ADD_LAST(sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); dfield_set_null(&node->common.val); === modified file 'storage/innobase/que/que0que.cc' --- a/storage/innobase/que/que0que.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/que/que0que.cc 2011-12-19 08:43:28 +0000 @@ -153,8 +153,6 @@ que_fork_create( fork->graph = (graph != NULL) ? graph : fork; - UT_LIST_INIT(fork->thrs, &que_thr_t::thrs); - return(fork); } @@ -186,7 +184,7 @@ que_thr_create( thr->lock_state = QUE_THR_LOCK_NOLOCK; - UT_LIST_ADD_LAST(parent->thrs, thr); + UT_LIST_ADD_LAST(thrs, parent->thrs, thr); return(thr); } @@ -202,7 +200,7 @@ que_thr_t* que_thr_end_lock_wait( /*==================*/ trx_t* trx) /*!< in: transaction with que_state in - QUE_THR_LOCK_WAIT */ + QUE_THR_LOCK_WAIT */ { que_thr_t* thr; ibool was_active; === modified file 'storage/innobase/read/read0read.cc' --- a/storage/innobase/read/read0read.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/read/read0read.cc 2011-12-19 08:43:28 +0000 @@ -221,7 +221,7 @@ read_view_list_validate(void) { ut_ad(mutex_own(&trx_sys->mutex)); - ut_list_map(trx_sys->view_list, Check()); + ut_list_map(trx_sys->view_list, &read_view_t::view_list, Check()); return(TRUE); } @@ -317,9 +317,10 @@ read_view_add( } if (prev_elem == NULL) { - UT_LIST_ADD_FIRST(trx_sys->view_list, view); + UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view); } else { - UT_LIST_INSERT_AFTER(trx_sys->view_list, prev_elem, view); + UT_LIST_INSERT_AFTER( + view_list, trx_sys->view_list, prev_elem, view); } ut_ad(read_view_list_validate()); @@ -403,7 +404,7 @@ read_view_open_now_low( /* No active transaction should be visible, except cr_trx */ - ut_list_map(trx_sys->rw_trx_list, CreateView(view)); + ut_list_map(trx_sys->rw_trx_list, &trx_t::trx_list, CreateView(view)); if (view->n_trx_ids > 0) { /* The last active transaction has the smallest id: */ @@ -540,7 +541,7 @@ read_view_remove( ut_ad(read_view_validate(view)); - UT_LIST_REMOVE(trx_sys->view_list, view); + UT_LIST_REMOVE(view_list, trx_sys->view_list, view); ut_ad(read_view_list_validate()); @@ -654,7 +655,7 @@ read_cursor_view_create_for_mysql( /* No active transaction should be visible */ - ut_list_map(trx_sys->rw_trx_list, CreateView(view)); + ut_list_map(trx_sys->rw_trx_list, &trx_t::trx_list, CreateView(view)); view->creator_trx_id = cr_trx->id; === modified file 'storage/innobase/row/row0ftsort.cc' --- a/storage/innobase/row/row0ftsort.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/row/row0ftsort.cc 2011-12-19 08:43:28 +0000 @@ -228,8 +228,7 @@ row_fts_psort_info_init( a particular "FTS index partition" */ for (j = 0; j < fts_sort_pll_degree; j++) { - UT_LIST_INIT( - psort_info[j].fts_doc_list, &fts_doc_item_t::doc_list); + UT_LIST_INIT(psort_info[j].fts_doc_list); for (i = 0; i < FTS_NUM_AUX_INDEX; i++) { === modified file 'storage/innobase/row/row0ins.cc' --- a/storage/innobase/row/row0ins.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/row/row0ins.cc 2011-12-19 08:43:28 +0000 @@ -109,7 +109,7 @@ ins_node_create_entry_list( ut_ad(node->entry_sys_heap); - UT_LIST_INIT(node->entry_list, &dtuple_t::tuple_list); + UT_LIST_INIT(node->entry_list); /* We will include all indexes (include those corrupted secondary indexes) in the entry list. Filteration of @@ -122,7 +122,7 @@ ins_node_create_entry_list( entry = row_build_index_entry( node->row, NULL, index, node->entry_sys_heap); - UT_LIST_ADD_LAST(node->entry_list, entry); + UT_LIST_ADD_LAST(tuple_list, node->entry_list, entry); } } @@ -1687,8 +1687,7 @@ row_ins_check_foreign_constraints( if (foreign->referenced_table == NULL) { ref_table = dict_table_open_on_name( - foreign->referenced_table_name_lookup, - FALSE); + foreign->referenced_table_name_lookup, FALSE); } if (0 == trx->dict_operation_lock_mode) { === modified file 'storage/innobase/row/row0merge.cc' --- a/storage/innobase/row/row0merge.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/row/row0merge.cc 2011-12-19 08:43:28 +0000 @@ -385,9 +385,9 @@ row_merge_buf_add( bucket = *doc_id % fts_sort_pll_degree; UT_LIST_ADD_LAST( + doc_list, psort_info[bucket].fts_doc_list, doc_item); - n_row_added = 1; continue; } === modified file 'storage/innobase/row/row0mysql.cc' --- a/storage/innobase/row/row0mysql.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/row/row0mysql.cc 2011-12-19 08:43:28 +0000 @@ -1420,8 +1420,7 @@ row_create_update_node_for_mysql( node->update_n_fields = dict_table_get_n_cols(table); - UT_LIST_INIT(node->columns, &sym_node_t::col_var_list); - + UT_LIST_INIT(node->columns); node->has_clust_rec_x_lock = TRUE; node->cmpl_info = 0; @@ -2507,7 +2506,7 @@ loop: already_dropped: mutex_enter(&row_drop_list_mutex); - UT_LIST_REMOVE(row_mysql_drop_list, drop); + UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop); MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE); @@ -2585,7 +2584,7 @@ row_add_table_to_background_drop_list( drop->table_name = mem_strdup(name); - UT_LIST_ADD_LAST(row_mysql_drop_list, drop); + UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop); MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE); @@ -4713,11 +4712,9 @@ row_mysql_init(void) { mutex_create( row_drop_list_mutex_key, - &row_drop_list_mutex, SYNC_NO_ORDER_CHECK); + &row_drop_list_mutex, SYNC_NO_ORDER_CHECK); - UT_LIST_INIT( - row_mysql_drop_list, - &row_mysql_drop_t::row_mysql_drop_list); + UT_LIST_INIT(row_mysql_drop_list); row_mysql_drop_list_inited = TRUE; } === modified file 'storage/innobase/srv/srv0mon.cc' --- a/storage/innobase/srv/srv0mon.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/srv/srv0mon.cc 2011-12-19 08:43:28 +0000 @@ -31,7 +31,6 @@ Created 12/9/2009 Jimmy Yang #include "buf0buf.h" #include "trx0sys.h" #include "trx0rseg.h" -#include "dict0mem.h" #include "lock0lock.h" #include "ibuf0ibuf.h" #ifdef UNIV_NONINL === modified file 'storage/innobase/srv/srv0srv.cc' --- a/storage/innobase/srv/srv0srv.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/srv/srv0srv.cc 2011-12-19 08:43:28 +0000 @@ -936,7 +936,7 @@ srv_init(void) srv_buf_dump_event = os_event_create("buf_dump_event"); - UT_LIST_INIT(srv_sys->tasks, &que_thr_t::queue); + UT_LIST_INIT(srv_sys->tasks); /* Create dummy indexes for infimum and supremum records */ @@ -2364,7 +2364,7 @@ srv_task_execute(void) ut_a(que_node_get_type(thr->child) == QUE_NODE_PURGE); - UT_LIST_REMOVE(srv_sys->tasks, thr); + UT_LIST_REMOVE(queue, srv_sys->tasks, thr); } mutex_exit(&srv_sys->tasks_mutex); @@ -2625,7 +2625,7 @@ srv_que_task_enqueue_low( { mutex_enter(&srv_sys->tasks_mutex); - UT_LIST_ADD_LAST(srv_sys->tasks, thr); + UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr); mutex_exit(&srv_sys->tasks_mutex); === modified file 'storage/innobase/sync/sync0rw.cc' --- a/storage/innobase/sync/sync0rw.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/sync/sync0rw.cc 2011-12-19 08:43:28 +0000 @@ -277,7 +277,7 @@ rw_lock_create_func( UNIV_MEM_INVALID(&lock->writer_thread, sizeof lock->writer_thread); #ifdef UNIV_SYNC_DEBUG - UT_LIST_INIT(lock->debug_list, &rw_lock_debug_t::list); + UT_LIST_INIT(lock->debug_list); lock->level = level; #endif /* UNIV_SYNC_DEBUG */ @@ -300,7 +300,7 @@ rw_lock_create_func( ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N); - UT_LIST_ADD_FIRST(rw_lock_list, lock); + UT_LIST_ADD_FIRST(list, rw_lock_list, lock); mutex_exit(&rw_lock_list_mutex); } @@ -337,7 +337,7 @@ rw_lock_free_func( ut_ad(UT_LIST_GET_NEXT(list, lock) == NULL || UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N); - UT_LIST_REMOVE(rw_lock_list, lock); + UT_LIST_REMOVE(list, rw_lock_list, lock); mutex_exit(&rw_lock_list_mutex); @@ -795,7 +795,7 @@ rw_lock_add_debug_info( info->thread_id = os_thread_get_curr_id(); info->pass = pass; - UT_LIST_ADD_FIRST(lock->debug_list, info); + UT_LIST_ADD_FIRST(list, lock->debug_list, info); rw_lock_debug_mutex_exit(); @@ -836,8 +836,7 @@ rw_lock_remove_debug_info( && (info->lock_type == lock_type)) { /* Found! */ - UT_LIST_REMOVE(lock->debug_list, info); - + UT_LIST_REMOVE(list, lock->debug_list, info); rw_lock_debug_mutex_exit(); rw_lock_debug_free(info); === modified file 'storage/innobase/sync/sync0sync.cc' --- a/storage/innobase/sync/sync0sync.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/sync/sync0sync.cc 2011-12-19 08:43:28 +0000 @@ -205,7 +205,7 @@ UNIV_INTERN mysql_pfs_key_t sync_thread_ #endif /* UNIV_SYNC_DEBUG */ /** Global list of database mutexes (not OS mutexes) created. */ -UNIV_INTERN mutex_list_t mutex_list; +UNIV_INTERN ut_list_base_node_t mutex_list; /** Mutex protecting the mutex_list variable */ UNIV_INTERN mutex_t mutex_list_mutex; @@ -323,7 +323,7 @@ mutex_create_func( ut_ad(UT_LIST_GET_LEN(mutex_list) == 0 || UT_LIST_GET_FIRST(mutex_list)->magic_n == MUTEX_MAGIC_N); - UT_LIST_ADD_FIRST(mutex_list, mutex); + UT_LIST_ADD_FIRST(list, mutex_list, mutex); mutex_exit(&mutex_list_mutex); } @@ -367,7 +367,7 @@ mutex_free_func( || UT_LIST_GET_NEXT(list, mutex)->magic_n == MUTEX_MAGIC_N); - UT_LIST_REMOVE(mutex_list, mutex); + UT_LIST_REMOVE(list, mutex_list, mutex); mutex_exit(&mutex_list_mutex); } @@ -1493,7 +1493,7 @@ sync_init(void) #endif /* UNIV_SYNC_DEBUG */ /* Init the mutex list and create the mutex to protect it. */ - UT_LIST_INIT(mutex_list, &mutex_t::list); + UT_LIST_INIT(mutex_list); mutex_create(mutex_list_mutex_key, &mutex_list_mutex, SYNC_NO_ORDER_CHECK); #ifdef UNIV_SYNC_DEBUG @@ -1503,7 +1503,7 @@ sync_init(void) /* Init the rw-lock list and create the mutex to protect it. */ - UT_LIST_INIT(rw_lock_list, &rw_lock_t::list); + UT_LIST_INIT(rw_lock_list); mutex_create(rw_lock_list_mutex_key, &rw_lock_list_mutex, SYNC_NO_ORDER_CHECK); === modified file 'storage/innobase/trx/trx0roll.cc' --- a/storage/innobase/trx/trx0roll.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/trx/trx0roll.cc 2011-12-19 08:43:28 +0000 @@ -309,8 +309,7 @@ trx_roll_savepoint_free( trx_t* trx, /*!< in: transaction handle */ trx_named_savept_t* savep) /*!< in: savepoint to free */ { - UT_LIST_REMOVE(trx->trx_savepoints, savep); - + UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep); mem_free(savep->name); mem_free(savep); } @@ -469,7 +468,7 @@ trx_savepoint_for_mysql( if (savep) { /* There is a savepoint with the same name: free that */ - UT_LIST_REMOVE(trx->trx_savepoints, savep); + UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep); mem_free(savep->name); mem_free(savep); @@ -485,7 +484,7 @@ trx_savepoint_for_mysql( savep->mysql_binlog_cache_pos = binlog_cache_pos; - UT_LIST_ADD_LAST(trx->trx_savepoints, savep); + UT_LIST_ADD_LAST(trx_savepoints, trx->trx_savepoints, savep); return(DB_SUCCESS); } === modified file 'storage/innobase/trx/trx0rseg.cc' --- a/storage/innobase/trx/trx0rseg.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/trx/trx0rseg.cc 2011-12-19 08:43:28 +0000 @@ -131,7 +131,7 @@ trx_rseg_mem_free( next_undo = UT_LIST_GET_NEXT(undo_list, undo); - UT_LIST_REMOVE(rseg->update_undo_cached, undo); + UT_LIST_REMOVE(undo_list, rseg->update_undo_cached, undo); MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED); @@ -144,7 +144,7 @@ trx_rseg_mem_free( next_undo = UT_LIST_GET_NEXT(undo_list, undo); - UT_LIST_REMOVE(rseg->insert_undo_cached, undo); + UT_LIST_REMOVE(undo_list, rseg->insert_undo_cached, undo); MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED); === modified file 'storage/innobase/trx/trx0sys.cc' --- a/storage/innobase/trx/trx0sys.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/trx/trx0sys.cc 2011-12-19 08:43:28 +0000 @@ -1072,7 +1072,7 @@ trx_sys_init_at_db_start(void) + TRX_SYS_TRX_ID_STORE), TRX_SYS_TRX_ID_WRITE_MARGIN); - UT_LIST_INIT(trx_sys->mysql_trx_list, &trx_t::mysql_trx_list); + UT_LIST_INIT(trx_sys->mysql_trx_list); trx_dummy_sess = sess_open(); @@ -1119,7 +1119,7 @@ trx_sys_init_at_db_start(void) mutex_exit(&trx_sys->mutex); - UT_LIST_INIT(trx_sys->view_list, &read_view_t::view_list); + UT_LIST_INIT(trx_sys->view_list); mtr_commit(&mtr); @@ -1784,7 +1784,7 @@ trx_sys_close(void) /* Views are allocated from the trx_sys->global_read_view_heap. So, we simply remove the element here. */ - UT_LIST_REMOVE(trx_sys->view_list, prev_view); + UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); } ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); === modified file 'storage/innobase/trx/trx0trx.cc' --- a/storage/innobase/trx/trx0trx.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/trx/trx0trx.cc 2011-12-19 08:43:28 +0000 @@ -150,9 +150,6 @@ trx_create(void) Set the time here for new transactions. */ trx->start_time = ut_time(); - lock_trx_lock_list_init(&trx->lock.trx_locks); - UT_LIST_INIT(trx->trx_savepoints, &trx_named_savept_t::trx_savepoints); - return(trx); } @@ -190,7 +187,7 @@ trx_allocate_for_mysql(void) trx_sys->n_mysql_trx++; ut_d(trx->in_mysql_trx_list = TRUE); - UT_LIST_ADD_FIRST(trx_sys->mysql_trx_list, trx); + UT_LIST_ADD_FIRST(mysql_trx_list, trx_sys->mysql_trx_list, trx); mutex_exit(&trx_sys->mutex); @@ -307,7 +304,7 @@ trx_free_prepared( ut_a(!trx->read_only); - UT_LIST_REMOVE(trx_sys->rw_trx_list, trx); + UT_LIST_REMOVE(trx_list, trx_sys->rw_trx_list, trx); ut_d(trx->in_rw_trx_list = FALSE); trx_free(trx); @@ -325,7 +322,7 @@ trx_free_for_mysql( ut_ad(trx->in_mysql_trx_list); ut_d(trx->in_mysql_trx_list = FALSE); - UT_LIST_REMOVE(trx_sys->mysql_trx_list, trx); + UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx); ut_ad(trx_sys_validate_trx_list()); @@ -374,12 +371,13 @@ trx_list_rw_insert_ordered( trx2 = UT_LIST_GET_PREV(trx_list, trx2); if (trx2 == NULL) { - UT_LIST_ADD_FIRST(trx_sys->rw_trx_list, trx); + UT_LIST_ADD_FIRST(trx_list, trx_sys->rw_trx_list, trx); } else { - UT_LIST_INSERT_AFTER(trx_sys->rw_trx_list, trx2, trx); + UT_LIST_INSERT_AFTER( + trx_list, trx_sys->rw_trx_list, trx2, trx); } } else { - UT_LIST_ADD_LAST(trx_sys->rw_trx_list, trx); + UT_LIST_ADD_LAST(trx_list, trx_sys->rw_trx_list, trx); } ut_ad(!trx->in_rw_trx_list); @@ -564,8 +562,8 @@ trx_lists_init_at_db_start(void) ut_a(srv_is_being_started); - UT_LIST_INIT(trx_sys->ro_trx_list, &trx_t::trx_list); - UT_LIST_INIT(trx_sys->rw_trx_list, &trx_t::trx_list); + UT_LIST_INIT(trx_sys->ro_trx_list); + UT_LIST_INIT(trx_sys->rw_trx_list); /* Look from the rollback segments if there exist undo logs for transactions */ @@ -736,13 +734,13 @@ trx_start_low( doesn't need a list wide lock to increase concurrency. */ if (!trx_is_autocommit_non_locking(trx)) { - UT_LIST_ADD_FIRST(trx_sys->ro_trx_list, trx); + UT_LIST_ADD_FIRST(trx_list, trx_sys->ro_trx_list, trx); ut_d(trx->in_ro_trx_list = TRUE); } } else { ut_ad(trx->rseg != NULL); ut_ad(!trx_is_autocommit_non_locking(trx)); - UT_LIST_ADD_FIRST(trx_sys->rw_trx_list, trx); + UT_LIST_ADD_FIRST(trx_list, trx_sys->rw_trx_list, trx); ut_d(trx->in_rw_trx_list = TRUE); } @@ -1050,14 +1048,11 @@ trx_commit( if (trx->read_only) { ut_ad(trx->rseg == NULL); - - UT_LIST_REMOVE(trx_sys->ro_trx_list, trx); - + UT_LIST_REMOVE(trx_list, trx_sys->ro_trx_list, trx); ut_d(trx->in_ro_trx_list = FALSE); MONITOR_INC(MONITOR_TRX_RO_COMMIT); } else { - UT_LIST_REMOVE(trx_sys->rw_trx_list, trx); - + UT_LIST_REMOVE(trx_list, trx_sys->rw_trx_list, trx); ut_d(trx->in_rw_trx_list = FALSE); MONITOR_INC(MONITOR_TRX_RW_COMMIT); } @@ -1198,7 +1193,7 @@ trx_cleanup_at_db_startup( ut_a(!trx->read_only); - UT_LIST_REMOVE(trx_sys->rw_trx_list, trx); + UT_LIST_REMOVE(trx_list, trx_sys->rw_trx_list, trx); assert_trx_in_rw_list(trx); ut_d(trx->in_rw_trx_list = FALSE); === modified file 'storage/innobase/trx/trx0undo.cc' --- a/storage/innobase/trx/trx0undo.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/trx/trx0undo.cc 2011-12-19 08:43:28 +0000 @@ -1352,23 +1352,21 @@ trx_undo_mem_create_at_db_start( add_to_list: if (type == TRX_UNDO_INSERT) { if (state != TRX_UNDO_CACHED) { - - UT_LIST_ADD_LAST(rseg->insert_undo_list, undo); + UT_LIST_ADD_LAST(undo_list, rseg->insert_undo_list, + undo); } else { - - UT_LIST_ADD_LAST(rseg->insert_undo_cached, undo); - + UT_LIST_ADD_LAST(undo_list, rseg->insert_undo_cached, + undo); MONITOR_INC(MONITOR_NUM_UNDO_SLOT_CACHED); } } else { ut_ad(type == TRX_UNDO_UPDATE); if (state != TRX_UNDO_CACHED) { - - UT_LIST_ADD_LAST(rseg->update_undo_list, undo); + UT_LIST_ADD_LAST(undo_list, rseg->update_undo_list, + undo); } else { - - UT_LIST_ADD_LAST(rseg->update_undo_cached, undo); - + UT_LIST_ADD_LAST(undo_list, rseg->update_undo_cached, + undo); MONITOR_INC(MONITOR_NUM_UNDO_SLOT_CACHED); } } @@ -1392,10 +1390,10 @@ trx_undo_lists_init( ulint i; mtr_t mtr; - UT_LIST_INIT(rseg->update_undo_list, &trx_undo_t::undo_list); - UT_LIST_INIT(rseg->update_undo_cached, &trx_undo_t::undo_list); - UT_LIST_INIT(rseg->insert_undo_list, &trx_undo_t::undo_list); - UT_LIST_INIT(rseg->insert_undo_cached, &trx_undo_t::undo_list); + UT_LIST_INIT(rseg->update_undo_list); + UT_LIST_INIT(rseg->update_undo_cached); + UT_LIST_INIT(rseg->insert_undo_list); + UT_LIST_INIT(rseg->insert_undo_cached); mtr_start(&mtr); @@ -1650,7 +1648,7 @@ trx_undo_reuse_cached( return(NULL); } - UT_LIST_REMOVE(rseg->insert_undo_cached, undo); + UT_LIST_REMOVE(undo_list, rseg->insert_undo_cached, undo); MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED); } else { @@ -1662,7 +1660,7 @@ trx_undo_reuse_cached( return(NULL); } - UT_LIST_REMOVE(rseg->update_undo_cached, undo); + UT_LIST_REMOVE(undo_list, rseg->update_undo_cached, undo); MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED); } @@ -1786,14 +1784,11 @@ trx_undo_assign_undo( } if (type == TRX_UNDO_INSERT) { - - UT_LIST_ADD_FIRST(rseg->insert_undo_list, undo); - + UT_LIST_ADD_FIRST(undo_list, rseg->insert_undo_list, undo); ut_ad(trx->insert_undo == NULL); trx->insert_undo = undo; } else { - UT_LIST_ADD_FIRST(rseg->update_undo_list, undo); - + UT_LIST_ADD_FIRST(undo_list, rseg->update_undo_list, undo); ut_ad(trx->update_undo == NULL); trx->update_undo = undo; } @@ -1929,13 +1924,13 @@ trx_undo_update_cleanup( trx_purge_add_update_undo_to_history(trx, undo_page, mtr); - UT_LIST_REMOVE(rseg->update_undo_list, undo); + UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo); trx->update_undo = NULL; if (undo->state == TRX_UNDO_CACHED) { - UT_LIST_ADD_FIRST(rseg->update_undo_cached, undo); + UT_LIST_ADD_FIRST(undo_list, rseg->update_undo_cached, undo); MONITOR_INC(MONITOR_NUM_UNDO_SLOT_CACHED); } else { @@ -1965,13 +1960,12 @@ trx_undo_insert_cleanup( mutex_enter(&(rseg->mutex)); - UT_LIST_REMOVE(rseg->insert_undo_list, undo); - + UT_LIST_REMOVE(undo_list, rseg->insert_undo_list, undo); trx->insert_undo = NULL; if (undo->state == TRX_UNDO_CACHED) { - UT_LIST_ADD_FIRST(rseg->insert_undo_cached, undo); + UT_LIST_ADD_FIRST(undo_list, rseg->insert_undo_cached, undo); MONITOR_INC(MONITOR_NUM_UNDO_SLOT_CACHED); } else { @@ -2007,16 +2001,14 @@ trx_undo_free_prepared( if (trx->update_undo) { ut_a(trx->update_undo->state == TRX_UNDO_PREPARED); - - UT_LIST_REMOVE(trx->rseg->update_undo_list, trx->update_undo); - + UT_LIST_REMOVE(undo_list, trx->rseg->update_undo_list, + trx->update_undo); trx_undo_mem_free(trx->update_undo); } if (trx->insert_undo) { ut_a(trx->insert_undo->state == TRX_UNDO_PREPARED); - - UT_LIST_REMOVE(trx->rseg->insert_undo_list, trx->insert_undo); - + UT_LIST_REMOVE(undo_list, trx->rseg->insert_undo_list, + trx->insert_undo); trx_undo_mem_free(trx->insert_undo); } } === modified file 'storage/innobase/usr/usr0sess.cc' --- a/storage/innobase/usr/usr0sess.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/usr/usr0sess.cc 2011-12-19 08:43:28 +0000 @@ -48,6 +48,8 @@ sess_open(void) sess->trx = trx_allocate_for_background(); sess->trx->sess = sess; + UT_LIST_INIT(sess->graphs); + return(sess); } @@ -59,6 +61,8 @@ sess_close( /*=======*/ sess_t* sess) /*!< in, own: session object */ { + ut_a(UT_LIST_GET_LEN(sess->graphs) == 0); + trx_free_for_background(sess->trx); mem_free(sess); } === modified file 'storage/innobase/ut/ut0mem.cc' --- a/storage/innobase/ut/ut0mem.cc 2011-12-19 05:55:35 +0000 +++ b/storage/innobase/ut/ut0mem.cc 2011-12-19 08:43:28 +0000 @@ -83,7 +83,7 @@ ut_mem_init(void) { ut_a(!ut_mem_block_list_inited); os_fast_mutex_init(ut_list_mutex_key, &ut_list_mutex); - UT_LIST_INIT(ut_mem_block_list, &ut_mem_block_t::mem_block_list); + UT_LIST_INIT(ut_mem_block_list); ut_mem_block_list_inited = TRUE; } #endif /* !UNIV_HOTBACKUP */ @@ -211,8 +211,8 @@ retry: ut_total_allocated_memory += n + sizeof(ut_mem_block_t); - UT_LIST_ADD_FIRST(ut_mem_block_list, ((ut_mem_block_t*) ret)); - + UT_LIST_ADD_FIRST(mem_block_list, ut_mem_block_list, + ((ut_mem_block_t*) ret)); os_fast_mutex_unlock(&ut_list_mutex); return((void*)((byte*) ret + sizeof(ut_mem_block_t))); @@ -317,8 +317,7 @@ ut_free( ut_total_allocated_memory -= block->size; - UT_LIST_REMOVE(ut_mem_block_list, block); - + UT_LIST_REMOVE(mem_block_list, ut_mem_block_list, block); free(block); os_fast_mutex_unlock(&ut_list_mutex); @@ -427,8 +426,7 @@ ut_free_all_mem(void) ut_total_allocated_memory -= block->size; - UT_LIST_REMOVE(ut_mem_block_list, block); - + UT_LIST_REMOVE(mem_block_list, ut_mem_block_list, block); free(block); } No bundle (reason: useless for push emails).