From 75930fd508521f2e74785edc2f9927d915b908d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 18 Aug 2010 14:40:02 +0300 Subject: [PATCH 01/60] Merge Bug#55626 fix from mysql-5.1-innodb: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revno: 3545 revision-id: marko.makela@oracle.com-20100818110110-zfs0i1vfrccfb4yw parent: vasil.dimov@oracle.com-20100817193934-1yl7zz2odikxauf8 committer: Marko Mäkelä branch nick: 5.1-innodb timestamp: Wed 2010-08-18 14:01:10 +0300 message: Bug#55626: MIN and MAX reading a delete-marked record from secondary index Remove a bogus debug assertion that triggered the bug. Add assertions precisely where records must not be delete-marked. And a comment to clarify when the record is allowed to be delete-marked. --- storage/innobase/row/row0sel.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 39ab2179740..945eab74924 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2682,7 +2682,6 @@ row_sel_store_mysql_rec( ut_ad(prebuilt->mysql_template); ut_ad(prebuilt->default_rec); ut_ad(rec_offs_validate(rec, NULL, offsets)); - ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) { mem_heap_free(prebuilt->blob_heap); @@ -3603,6 +3602,7 @@ row_search_for_mysql( row_sel_try_search_shortcut_for_mysql(). The latch will not be released until mtr_commit(&mtr). */ + ut_ad(!rec_get_deleted_flag(rec, comp)); if (!row_sel_store_mysql_rec(buf, prebuilt, rec, offsets)) { @@ -4230,7 +4230,7 @@ no_gap_lock: rec = old_vers; } - } else if (!lock_sec_rec_cons_read_sees(rec, trx->read_view)) { + } else { /* We are looking into a non-clustered index, and to get the right version of the record we have to look also into the clustered index: this @@ -4238,8 +4238,12 @@ no_gap_lock: information via the clustered index record. */ ut_ad(index != clust_index); + ut_ad(!dict_index_is_clust(index)); - goto requires_clust_rec; + if (!lock_sec_rec_cons_read_sees( + rec, trx->read_view)) { + goto requires_clust_rec; + } } } @@ -4362,8 +4366,13 @@ requires_clust_rec: ULINT_UNDEFINED, &heap); result_rec = rec; } + + /* result_rec can legitimately be delete-marked + now that it has been established that it points to a + clustered index record that exists in the read view. */ } else { result_rec = rec; + ut_ad(!rec_get_deleted_flag(rec, comp)); } /* We found a qualifying record 'result_rec'. At this point, From 1e9438ebf76e552865769bc9a2bae40da9ee4e8a Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 18 Aug 2010 21:16:47 -0700 Subject: [PATCH 02/60] Bug #48026 Log start and end of InnoDB buffer pool initialization to the error log --- storage/innobase/srv/srv0start.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 4da836672ec..05fa637e7bb 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1334,8 +1334,27 @@ innobase_start_or_create_for_mysql(void) fil_init(srv_file_per_table ? 50000 : 5000, srv_max_n_open_files); + /* Print time to initialize the buffer pool */ + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Initializing buffer pool, size ="); + + if (srv_buf_pool_size >= 1024 * 1024 * 1024) { + fprintf(stderr, + " %.1fG\n", + ((double) srv_buf_pool_size) / (1024 * 1024 * 1024)); + } else { + fprintf(stderr, + " %.1fM\n", + ((double) srv_buf_pool_size) / (1024 * 1024)); + } + err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Completed initialization of buffer pool\n"); + if (err != DB_SUCCESS) { fprintf(stderr, "InnoDB: Fatal error: cannot allocate the memory" From b14708f32626be055a92ad4ddf154ee62e188ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Aug 2010 13:36:37 +0300 Subject: [PATCH 03/60] Bug#56114 Disallow trx->dict_operation_lock_mode==RW_X_LATCH in srv_suspend_mysql_thread() Issue an error message to the error log when trx->dict_operation_lock_mode == RW_X_LATCH in srv_suspend_mysql_thread(). Transactions that modify InnoDB data dictionary tables must be free of lock waits, because they must be holding the data dictionary latch in exclusive mode. The transactions must not be accessing any other tables other than the data dictionary tables. The handling of RW_X_LATCH was accidentally added in the InnoDB Plugin, as a wrong fix of an assertion failure. (Fast index creation was accessing both data dictionary tables and user tables in the same transaction.) --- storage/innobase/srv/srv0srv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index bea8d7f8fdc..ce56a533d5e 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1588,6 +1588,18 @@ srv_suspend_mysql_thread( row_mysql_unfreeze_data_dictionary(trx); break; case RW_X_LATCH: + /* There should never be a lock wait when the + dictionary latch is reserved in X mode. Dictionary + transactions should only acquire locks on dictionary + tables, not other tables. All access to dictionary + tables should be covered by dictionary + transactions. */ + ut_print_timestamp(stderr); + fputs(" InnoDB: Error: dict X latch held in " + "srv_suspend_mysql_thread\n", stderr); + /* This should never occur. This incorrect handling + was added in the early development of + ha_innobase::add_index() in InnoDB Plugin 1.0. */ /* Release fast index creation latch */ row_mysql_unlock_data_dictionary(trx); break; @@ -1607,6 +1619,9 @@ srv_suspend_mysql_thread( row_mysql_freeze_data_dictionary(trx); break; case RW_X_LATCH: + /* This should never occur. This incorrect handling + was added in the early development of + ha_innobase::add_index() in InnoDB Plugin 1.0. */ row_mysql_lock_data_dictionary(trx); break; } From 707aeca30c0e9f7b4cd6ad1df4360df1e8cc428f Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Fri, 20 Aug 2010 12:39:04 -0400 Subject: [PATCH 04/60] When flushing from LRU we try to keep a certain number of pages over and above the general requirement free. We call them BUF_FLUSH_EXTRA_MARGIN. With multiple buffer pools we may end up keeping this amount of pages for each buffer pool. This patch, diagnosed and fixed by Michael, throttles flushing in such cases. rb://435 bug#54346 --- storage/innobase/include/buf0flu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 55814b6bf86..366063ab105 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -228,8 +228,8 @@ make sure that a read-ahead batch can be read efficiently in a single sweep). */ #define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b)) /** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */ -#define BUF_FLUSH_EXTRA_MARGIN(b) (BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \ - + 100) +#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \ + + 100) / srv_buf_pool_instances) #endif /* !UNIV_HOTBACKUP */ #ifndef UNIV_NONINL From 0a7a78a8d54029734d60809869098786d3680e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 24 Aug 2010 11:34:19 +0300 Subject: [PATCH 05/60] =?UTF-8?q?Merge=20Bug#55832=20fix=20from=20mysql-5.?= =?UTF-8?q?1-innodb:=20---------------------------------------------------?= =?UTF-8?q?---------=20revno:=203550=20revision-id:=20marko.makela@oracle.?= =?UTF-8?q?com-20100824081003-v4ecy0tga99cpxw2=20parent:=20marko.makela@or?= =?UTF-8?q?acle.com-20100823102854-t1clrojqis2ley36=20committer:=20Marko?= =?UTF-8?q?=20M=C3=A4kel=C3=A4=20=20branch=20nick?= =?UTF-8?q?:=205.1-innodb=20timestamp:=20Tue=202010-08-24=2011:10:03=20+03?= =?UTF-8?q?00=20message:=20=20=20Bug#55832:=20selects=20crash=20too=20easi?= =?UTF-8?q?ly=20when=20innodb=5Fforce=5Frecovery>3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dict_update_statistics_low(): Create bogus statistics for those indexes that cannot be accessed because of the innodb_force_recovery setting. ha_innobase::info(): Calculate statistics for each index, even if innodb_force_recovery is set. Fill in bogus data for those indexes that are not accessed because of the innodb_force_recovery setting. --- storage/innobase/dict/dict0dict.c | 57 ++++++++++++++++----------- storage/innobase/handler/ha_innodb.cc | 39 +++++++++--------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 802f0bd8b6f..3dba63cc76a 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -4206,7 +4206,6 @@ dict_update_statistics_low( dictionary mutex */ { dict_index_t* index; - ulint size; ulint sum_of_index_sizes = 0; if (table->ibd_file_missing) { @@ -4221,14 +4220,6 @@ dict_update_statistics_low( return; } - /* If we have set a high innodb_force_recovery level, do not calculate - statistics, as a badly corrupted index can cause a crash in it. */ - - if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { - - return; - } - /* Find out the sizes of the indexes and how many different values for the key they approximately have */ @@ -4240,26 +4231,48 @@ dict_update_statistics_low( return; } - while (index) { - size = btr_get_size(index, BTR_TOTAL_SIZE); - index->stat_index_size = size; + do { + if (UNIV_LIKELY + (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE + || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO + && dict_index_is_clust(index)))) { + ulint size; + size = btr_get_size(index, BTR_TOTAL_SIZE); - sum_of_index_sizes += size; + index->stat_index_size = size; - size = btr_get_size(index, BTR_N_LEAF_PAGES); + sum_of_index_sizes += size; - if (size == 0) { - /* The root node of the tree is a leaf */ - size = 1; + size = btr_get_size(index, BTR_N_LEAF_PAGES); + + if (size == 0) { + /* The root node of the tree is a leaf */ + size = 1; + } + + index->stat_n_leaf_pages = size; + + btr_estimate_number_of_different_key_vals(index); + } else { + /* If we have set a high innodb_force_recovery + level, do not calculate statistics, as a badly + corrupted index can cause a crash in it. + Initialize some bogus index cardinality + statistics, so that the data can be queried in + various means, also via secondary indexes. */ + ulint i; + + sum_of_index_sizes++; + index->stat_index_size = index->stat_n_leaf_pages = 1; + + for (i = dict_index_get_n_unique(index); i; ) { + index->stat_n_diff_key_vals[i--] = 1; + } } - index->stat_n_leaf_pages = size; - - btr_estimate_number_of_different_key_vals(index); - index = dict_table_get_next_index(index); - } + } while (index); index = dict_table_get_first_index(table); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a004cba9603..bbf3c5aa3c8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7700,28 +7700,15 @@ ha_innobase::info( dict_index_t* index; ha_rows rec_per_key; ib_int64_t n_rows; - ulong j; - ulong i; char path[FN_REFLEN]; os_file_stat_t stat_info; - DBUG_ENTER("info"); /* If we are forcing recovery at a high level, we will suppress statistics calculation on tables, because that may crash the server if an index is badly corrupted. */ - if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { - - /* We return success (0) instead of HA_ERR_CRASHED, - because we want MySQL to process this query and not - stop, like it would do if it received the error code - HA_ERR_CRASHED. */ - - DBUG_RETURN(0); - } - /* We do not know if MySQL can call this function before calling external_lock(). To be safe, update the thd of the current table handle. */ @@ -7816,12 +7803,18 @@ ha_innobase::info( acquiring latches inside InnoDB, we do not call it if we are asked by MySQL to avoid locking. Another reason to avoid the call is that it uses quite a lot of CPU. - See Bug#38185. - We do not update delete_length if no locking is requested - so the "old" value can remain. delete_length is initialized - to 0 in the ha_statistics' constructor. */ - if (!(flag & HA_STATUS_NO_LOCK)) { - + See Bug#38185. */ + if (flag & HA_STATUS_NO_LOCK) { + /* We do not update delete_length if no + locking is requested so the "old" value can + remain. delete_length is initialized to 0 in + the ha_statistics' constructor. */ + } else if (UNIV_UNLIKELY + (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE)) { + /* Avoid accessing the tablespace if + innodb_crash_recovery is set to a high value. */ + stats.delete_length = 0; + } else { /* lock the data dictionary to avoid races with ibd_file_missing and tablespace_discarded */ row_mysql_lock_data_dictionary(prebuilt->trx); @@ -7866,6 +7859,7 @@ ha_innobase::info( } if (flag & HA_STATUS_CONST) { + ulong i; /* Verify the number of index in InnoDB and MySQL matches up. If prebuilt->clust_index_was_generated holds, InnoDB defines GEN_CLUST_INDEX internally */ @@ -7882,6 +7876,7 @@ ha_innobase::info( } for (i = 0; i < table->s->keys; i++) { + ulong j; /* We could get index quickly through internal index mapping with the index translation table. The identity of index (match up index name with @@ -7947,6 +7942,11 @@ ha_innobase::info( } } + if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + + goto func_exit; + } + if (flag & HA_STATUS_ERRKEY) { const dict_index_t* err_index; @@ -7967,6 +7967,7 @@ ha_innobase::info( stats.auto_increment_value = innobase_peek_autoinc(); } +func_exit: prebuilt->trx->op_info = (char*)""; DBUG_RETURN(0); From 0003925e755a71405e0e585a62113c0881e4c97d Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 25 Aug 2010 00:25:46 -0700 Subject: [PATCH 06/60] Add a space indentation to InnoDB buffer pool size and log sequence number boot up message. --- storage/innobase/srv/srv0start.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 05fa637e7bb..9bf18b8db9e 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1337,7 +1337,7 @@ innobase_start_or_create_for_mysql(void) /* Print time to initialize the buffer pool */ ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Initializing buffer pool, size ="); + " InnoDB: Initializing buffer pool, size ="); if (srv_buf_pool_size >= 1024 * 1024 * 1024) { fprintf(stderr, @@ -1353,7 +1353,7 @@ innobase_start_or_create_for_mysql(void) ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Completed initialization of buffer pool\n"); + " InnoDB: Completed initialization of buffer pool\n"); if (err != DB_SUCCESS) { fprintf(stderr, @@ -1871,7 +1871,7 @@ innobase_start_or_create_for_mysql(void) if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB %s started; " + " InnoDB: %s started; " "log sequence number %llu\n", INNODB_VERSION_STR, srv_start_lsn); } From cda13e7415b32c9eec55a0dac20af76111b7c9e9 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 7 Sep 2010 21:09:50 +0300 Subject: [PATCH 07/60] Fix Bug#56384 Remove two COPYING files from innobase directory Remove non applicable licensing files storage/innobase/COPYING is in the MySQL top level directory and storage/innobase/COPYING.Sun_Microsystems is not applicable anymore now that Oracle and Sun are one company. --- storage/innobase/COPYING | 351 ---------------------- storage/innobase/COPYING.Sun_Microsystems | 31 -- 2 files changed, 382 deletions(-) delete mode 100644 storage/innobase/COPYING delete mode 100644 storage/innobase/COPYING.Sun_Microsystems diff --git a/storage/innobase/COPYING b/storage/innobase/COPYING deleted file mode 100644 index 6b106e18fdb..00000000000 --- a/storage/innobase/COPYING +++ /dev/null @@ -1,351 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble -======== - -The licenses for most software are designed to take away your freedom -to share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have -the freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you -have. You must make sure that they, too, receive or can get the source -code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent -must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains a - notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", - below, refers to any such program or work, and a "work based on - the Program" means either the Program or any derivative work under - copyright law: that is to say, a work containing the Program or a - portion of it, either verbatim or with modifications and/or - translated into another language. (Hereinafter, translation is - included without limitation in the term "modification".) Each - licensee is addressed as "you". - - Activities other than copying, distribution and modification are - not covered by this License; they are outside its scope. The act - of running the Program is not restricted, and the output from the - Program is covered only if its contents constitute a work based on - the Program (independent of having been made by running the - Program). Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's - source code as you receive it, in any medium, provided that you - conspicuously and appropriately publish on each copy an appropriate - copyright notice and disclaimer of warranty; keep intact all the - notices that refer to this License and to the absence of any - warranty; and give any other recipients of the Program a copy of - this License along with the Program. - - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange - for a fee. - - 2. You may modify your copy or copies of the Program or any portion - of it, thus forming a work based on the Program, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a. You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b. You must cause any work that you distribute or publish, that - in whole or in part contains or is derived from the Program - or any part thereof, to be licensed as a whole at no charge - to all third parties under the terms of this License. - - c. If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display - an announcement including an appropriate copyright notice and - a notice that there is no warranty (or else, saying that you - provide a warranty) and that users may redistribute the - program under these conditions, and telling the user how to - view a copy of this License. (Exception: if the Program - itself is interactive but does not normally print such an - announcement, your work based on the Program is not required - to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the - Program, and can be reasonably considered independent and separate - works in themselves, then this License, and its terms, do not - apply to those sections when you distribute them as separate - works. But when you distribute the same sections as part of a - whole which is a work based on the Program, the distribution of - the whole must be on the terms of this License, whose permissions - for other licensees extend to the entire whole, and thus to each - and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or - contest your rights to work written entirely by you; rather, the - intent is to exercise the right to control the distribution of - derivative or collective works based on the Program. - - In addition, mere aggregation of another work not based on the - Program with the Program (or with a work based on the Program) on - a volume of a storage or distribution medium does not bring the - other work under the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms - of Sections 1 and 2 above provided that you also do one of the - following: - - a. Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Sections 1 and 2 above on a medium customarily used for - software interchange; or, - - b. Accompany it with a written offer, valid for at least three - years, to give any third-party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a - medium customarily used for software interchange; or, - - c. Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with - such an offer, in accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete - source code means all the source code for all modules it contains, - plus any associated interface definition files, plus the scripts - used to control compilation and installation of the executable. - However, as a special exception, the source code distributed need - not include anything that is normally distributed (in either - source or binary form) with the major components (compiler, - kernel, and so on) of the operating system on which the executable - runs, unless that component itself accompanies the executable. - - If distribution of executable or object code is made by offering - access to copy from a designated place, then offering equivalent - access to copy the source code from the same place counts as - distribution of the source code, even though third parties are not - compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense or distribute the Program is - void, and will automatically terminate your rights under this - License. However, parties who have received copies, or rights, - from you under this License will not have their licenses - terminated so long as such parties remain in full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify - or distribute the Program or its derivative works. These actions - are prohibited by law if you do not accept this License. - Therefore, by modifying or distributing the Program (or any work - based on the Program), you indicate your acceptance of this - License to do so, and all its terms and conditions for copying, - distributing or modifying the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program - subject to these terms and conditions. You may not impose any - further restrictions on the recipients' exercise of the rights - granted herein. You are not responsible for enforcing compliance - by third parties to this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent - issues), conditions are imposed on you (whether by court order, - agreement or otherwise) that contradict the conditions of this - License, they do not excuse you from the conditions of this - License. If you cannot distribute so as to satisfy simultaneously - your obligations under this License and any other pertinent - obligations, then as a consequence you may not distribute the - Program at all. For example, if a patent license would not permit - royalty-free redistribution of the Program by all those who - receive copies directly or indirectly through you, then the only - way you could satisfy both it and this License would be to refrain - entirely from distribution of the Program. - - If any portion of this section is held invalid or unenforceable - under any particular circumstance, the balance of the section is - intended to apply and the section as a whole is intended to apply - in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of - any such claims; this section has the sole purpose of protecting - the integrity of the free software distribution system, which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is - willing to distribute software through any other system and a - licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed - to be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, - the original copyright holder who places the Program under this - License may add an explicit geographical distribution limitation - excluding those countries, so that distribution is permitted only - in or among countries not thus excluded. In such case, this - License incorporates the limitation as if written in the body of - this License. - - 9. The Free Software Foundation may publish revised and/or new - versions of the General Public License from time to time. Such - new versions will be similar in spirit to the present version, but - may differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the - Program specifies a version number of this License which applies - to it and "any later version", you have the option of following - the terms and conditions either of that version or of any later - version published by the Free Software Foundation. If the Program - does not specify a version number of this License, you may choose - any version ever published by the Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the - author to ask for permission. For software which is copyrighted - by the Free Software Foundation, write to the Free Software - Foundation; we sometimes make exceptions for this. Our decision - will be guided by the two goals of preserving the free status of - all derivatives of our free software and of promoting the sharing - and reuse of software generally. - - NO WARRANTY - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE - LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT - HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT - WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE - QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE - PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY - SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY - MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE - LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, - INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR - INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU - OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY - OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS -How to Apply These Terms to Your New Programs -============================================= - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. - Copyright (C) YYYY NAME OF AUTHOR - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - SIGNATURE OF TY COON, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, -you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use the -GNU Library General Public License instead of this License. diff --git a/storage/innobase/COPYING.Sun_Microsystems b/storage/innobase/COPYING.Sun_Microsystems deleted file mode 100644 index 5a77ef3ab73..00000000000 --- a/storage/innobase/COPYING.Sun_Microsystems +++ /dev/null @@ -1,31 +0,0 @@ -Portions of this software contain modifications contributed by -Sun Microsystems, Inc. These contributions are used with the following -license: - -Copyright (c) 2009, Sun Microsystems, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - * Neither the name of Sun Microsystems, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 32253e458293ecef28285b2c4c1e15ade9085fc5 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 9 Sep 2010 13:06:43 +0300 Subject: [PATCH 08/60] Enable UNIV_DEBUG when WITH_DEBUG is defined --- storage/innobase/CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index e993aa0d96a..587e39dcf3c 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -40,12 +40,10 @@ IF(UNIX) ENDIF() ENDIF() -# Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG[_FULL] is defined -# enable when this bug is resolved: -# Bug#54861 Additional connections not handled properly in mtr --embedded -#IF(WITH_DEBUG) -# ADD_DEFINITIONS("-DUNIV_DEBUG") -#ENDIF() +# Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG is defined +IF(WITH_DEBUG) + ADD_DEFINITIONS("-DUNIV_DEBUG") +ENDIF() IF(NOT MSVC) # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not From 130bfccc93059cbaab35fdc925d238c7cb36901f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 9 Sep 2010 13:44:04 +0300 Subject: [PATCH 09/60] Remove unused constant REC_INFO_BITS. This was replaced with REC_OLD_INFO_BITS in MySQL 5.0.3. --- storage/innobase/include/rem0rec.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 53402e8d3a9..5a3dd609ea5 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -806,8 +806,6 @@ rec_print( dict_index_t* index); /*!< in: record descriptor */ #endif /* UNIV_HOTBACKUP */ -#define REC_INFO_BITS 6 /* This is single byte bit-field */ - /* Maximum lengths for the data in a physical record if the offsets are given in one byte (resp. two byte) format. */ #define REC_1BYTE_OFFS_LIMIT 0x7FUL From 76d68c814bb07e67de0453631ac836ff572dfeeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 9 Sep 2010 13:48:00 +0300 Subject: [PATCH 10/60] ibuf_insert_to_index_page(): Remove bogus code added for delete buffering. In early development of delete buffering, we did allow B-tree pages to become empty as a result of buffered deletes. That caused fundamental problems. The fix was to refuse buffering purge operations unless the page can be guaranteed to be nonempty. Remove an attempt to cope with empty pages when merging inserts. --- storage/innobase/ibuf/ibuf0ibuf.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index a048de0e884..b77390ab038 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -3779,17 +3779,11 @@ ibuf_insert_to_index_page( rec = page_rec_get_next(page_get_infimum_rec(page)); if (page_rec_is_supremum(rec)) { - /* Empty pages can result from buffered delete operations. - The first record from the free list can be used to find the - father node. */ - rec = page_header_get_ptr(page, PAGE_FREE); - if (UNIV_UNLIKELY(rec == NULL)) { - fputs("InnoDB: Trying to insert a record from" - " the insert buffer to an index page\n" - "InnoDB: but the index page is empty!\n", - stderr); - goto dump; - } + fputs("InnoDB: Trying to insert a record from" + " the insert buffer to an index page\n" + "InnoDB: but the index page is empty!\n", + stderr); + goto dump; } if (UNIV_UNLIKELY(rec_get_n_fields(rec, index) From 30fdbe35d48af5066eeed7d9bbddd23310f64ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 9 Sep 2010 13:50:06 +0300 Subject: [PATCH 11/60] Invoke make with -j$(nproc) for better parallelism. --- storage/innobase/compile-innodb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/compile-innodb b/storage/innobase/compile-innodb index 23e7f98e50c..988c862465d 100755 --- a/storage/innobase/compile-innodb +++ b/storage/innobase/compile-innodb @@ -22,4 +22,4 @@ MYSQL_ROOT="$(dirname ${0})/../.." cd ${MYSQL_ROOT} cmake -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON -make -j4 +make -j$(nproc) From 06f41e335b5a659ca297c05928eadb8e7f2b1acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 9 Sep 2010 14:27:52 +0300 Subject: [PATCH 12/60] Remove ut0auxconf.h. It was needed when InnoDB Plugin was distributed independently of MySQL. Approved by Vasil Dimov. --- storage/innobase/Doxyfile | 2 +- storage/innobase/Makefile.am | 1 - storage/innobase/include/univ.i | 13 ---- storage/innobase/include/ut0auxconf.h | 14 ----- .../ut/ut0auxconf_atomic_pthread_t_gcc.c | 43 ------------- .../ut/ut0auxconf_atomic_pthread_t_solaris.c | 54 ---------------- .../innobase/ut/ut0auxconf_have_gcc_atomics.c | 61 ------------------- .../ut/ut0auxconf_have_solaris_atomics.c | 39 ------------ storage/innobase/ut/ut0auxconf_pause.c | 32 ---------- .../innobase/ut/ut0auxconf_sizeof_pthread_t.c | 35 ----------- 10 files changed, 1 insertion(+), 293 deletions(-) delete mode 100644 storage/innobase/include/ut0auxconf.h delete mode 100644 storage/innobase/ut/ut0auxconf_atomic_pthread_t_gcc.c delete mode 100644 storage/innobase/ut/ut0auxconf_atomic_pthread_t_solaris.c delete mode 100644 storage/innobase/ut/ut0auxconf_have_gcc_atomics.c delete mode 100644 storage/innobase/ut/ut0auxconf_have_solaris_atomics.c delete mode 100644 storage/innobase/ut/ut0auxconf_pause.c delete mode 100644 storage/innobase/ut/ut0auxconf_sizeof_pthread_t.c diff --git a/storage/innobase/Doxyfile b/storage/innobase/Doxyfile index 62aa7dd8abc..7cf5048fa52 100644 --- a/storage/innobase/Doxyfile +++ b/storage/innobase/Doxyfile @@ -565,7 +565,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = ut0auxconf_* +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 7a6103d9e79..460abddb11e 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -207,7 +207,6 @@ noinst_HEADERS= \ include/usr0sess.h \ include/usr0sess.ic \ include/usr0types.h \ - include/ut0auxconf.h \ include/ut0byte.h \ include/ut0byte.ic \ include/ut0dbg.h \ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 5a5af76e175..748070efa02 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -78,19 +78,6 @@ the virtual method table (vtable) in GCC 3. */ # define ha_innobase ha_innodb #endif /* MYSQL_DYNAMIC_PLUGIN */ -/* if any of the following macros is defined at this point this means -that the code from the "right" plug.in was executed and we do not -need to include ut0auxconf.h which would either define the same macros -or will be empty */ -#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \ - && !defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \ - && !defined(HAVE_IB_SOLARIS_ATOMICS) \ - && !defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \ - && !defined(SIZEOF_PTHREAD_T) \ - && !defined(HAVE_IB_PAUSE_INSTRUCTION) -# include "ut0auxconf.h" -#endif - #if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__) # undef __WIN__ # define __WIN__ diff --git a/storage/innobase/include/ut0auxconf.h b/storage/innobase/include/ut0auxconf.h deleted file mode 100644 index 16bcc308392..00000000000 --- a/storage/innobase/include/ut0auxconf.h +++ /dev/null @@ -1,14 +0,0 @@ -/* Do not remove this file even though it is empty. -This file is included in univ.i and will cause compilation failure -if not present. -A custom checks have been added in the generated -storage/innobase/Makefile.in that is shipped with the InnoDB Plugin -source archive. These checks eventually define some macros and put -them in this file. -This is a hack that has been developed in order to deploy new compile -time checks without the need to regenerate the ./configure script that is -distributed in the MySQL 5.1 official source archives. -If by any chance Makefile.in and ./configure are regenerated and thus -the hack from Makefile.in wiped away then the "real" checks from plug.in -will take over. -*/ diff --git a/storage/innobase/ut/ut0auxconf_atomic_pthread_t_gcc.c b/storage/innobase/ut/ut0auxconf_atomic_pthread_t_gcc.c deleted file mode 100644 index 30de5aa6f17..00000000000 --- a/storage/innobase/ut/ut0auxconf_atomic_pthread_t_gcc.c +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -If this program compiles, then pthread_t objects can be used as arguments -to GCC atomic builtin functions. - -Created March 5, 2009 Vasil Dimov -*****************************************************************************/ - -#include -#include - -int -main(int argc, char** argv) -{ - pthread_t x1; - pthread_t x2; - pthread_t x3; - - memset(&x1, 0x0, sizeof(x1)); - memset(&x2, 0x0, sizeof(x2)); - memset(&x3, 0x0, sizeof(x3)); - - __sync_bool_compare_and_swap(&x1, x2, x3); - - return(0); -} diff --git a/storage/innobase/ut/ut0auxconf_atomic_pthread_t_solaris.c b/storage/innobase/ut/ut0auxconf_atomic_pthread_t_solaris.c deleted file mode 100644 index 310603c7503..00000000000 --- a/storage/innobase/ut/ut0auxconf_atomic_pthread_t_solaris.c +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -If this program compiles and returns 0, then pthread_t objects can be used as -arguments to Solaris libc atomic functions. - -Created April 18, 2009 Vasil Dimov -*****************************************************************************/ - -#include -#include - -int -main(int argc, char** argv) -{ - pthread_t x1; - pthread_t x2; - pthread_t x3; - - memset(&x1, 0x0, sizeof(x1)); - memset(&x2, 0x0, sizeof(x2)); - memset(&x3, 0x0, sizeof(x3)); - - if (sizeof(pthread_t) == 4) { - - atomic_cas_32(&x1, x2, x3); - - } else if (sizeof(pthread_t) == 8) { - - atomic_cas_64(&x1, x2, x3); - - } else { - - return(1); - } - - return(0); -} diff --git a/storage/innobase/ut/ut0auxconf_have_gcc_atomics.c b/storage/innobase/ut/ut0auxconf_have_gcc_atomics.c deleted file mode 100644 index da5c13d7d79..00000000000 --- a/storage/innobase/ut/ut0auxconf_have_gcc_atomics.c +++ /dev/null @@ -1,61 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -If this program compiles and returns 0, then GCC atomic funcions are available. - -Created September 12, 2009 Vasil Dimov -*****************************************************************************/ - -int -main(int argc, char** argv) -{ - long x; - long y; - long res; - char c; - - x = 10; - y = 123; - res = __sync_bool_compare_and_swap(&x, x, y); - if (!res || x != y) { - return(1); - } - - x = 10; - y = 123; - res = __sync_bool_compare_and_swap(&x, x + 1, y); - if (res || x != 10) { - return(1); - } - - x = 10; - y = 123; - res = __sync_add_and_fetch(&x, y); - if (res != 123 + 10 || x != 123 + 10) { - return(1); - } - - c = 10; - res = __sync_lock_test_and_set(&c, 123); - if (res != 10 || c != 123) { - return(1); - } - - return(0); -} diff --git a/storage/innobase/ut/ut0auxconf_have_solaris_atomics.c b/storage/innobase/ut/ut0auxconf_have_solaris_atomics.c deleted file mode 100644 index 7eb704edd4b..00000000000 --- a/storage/innobase/ut/ut0auxconf_have_solaris_atomics.c +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -If this program compiles, then Solaris libc atomic funcions are available. - -Created April 18, 2009 Vasil Dimov -*****************************************************************************/ -#include - -int -main(int argc, char** argv) -{ - ulong_t ulong = 0; - uint32_t uint32 = 0; - uint64_t uint64 = 0; - - atomic_cas_ulong(&ulong, 0, 1); - atomic_cas_32(&uint32, 0, 1); - atomic_cas_64(&uint64, 0, 1); - atomic_add_long(&ulong, 0); - - return(0); -} diff --git a/storage/innobase/ut/ut0auxconf_pause.c b/storage/innobase/ut/ut0auxconf_pause.c deleted file mode 100644 index 54d63bdd9bc..00000000000 --- a/storage/innobase/ut/ut0auxconf_pause.c +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -If this program compiles and can be run and returns 0, then the pause -instruction is available. - -Created Jul 21, 2009 Vasil Dimov -*****************************************************************************/ - -int -main(int argc, char** argv) -{ - __asm__ __volatile__ ("pause"); - - return(0); -} diff --git a/storage/innobase/ut/ut0auxconf_sizeof_pthread_t.c b/storage/innobase/ut/ut0auxconf_sizeof_pthread_t.c deleted file mode 100644 index 96add4526ef..00000000000 --- a/storage/innobase/ut/ut0auxconf_sizeof_pthread_t.c +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ - -/***************************************************************************** -This program should compile and when run, print a single line like: -#define SIZEOF_PTHREAD_T %d - -Created April 18, 2009 Vasil Dimov -*****************************************************************************/ - -#include -#include - -int -main(int argc, char** argv) -{ - printf("#define SIZEOF_PTHREAD_T %d\n", (int) sizeof(pthread_t)); - - return(0); -} From a962007dae587ca2863e14e45988ae6f14314b06 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 10 Sep 2010 12:32:21 +0300 Subject: [PATCH 13/60] Whitespace fixup on ha_innodb.cc:2567 --- storage/innobase/handler/ha_innodb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bbf3c5aa3c8..39c08d5d152 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2564,7 +2564,7 @@ static int innobase_start_trx_and_assign_read_view( /*====================================*/ - handlerton *hton, /*!< in: Innodb handlerton */ + handlerton *hton, /*!< in: Innodb handlerton */ THD* thd) /*!< in: MySQL thread handle of the user for whom the transaction should be committed */ { From d2af4e3bc32ec89c3de214d41e2e71eee56510b6 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 10 Sep 2010 12:52:14 +0300 Subject: [PATCH 14/60] Whitespace fixup on ha_innodb.cc:9561 --- storage/innobase/handler/ha_innodb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 39c08d5d152..df6032fbd40 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9558,7 +9558,7 @@ ha_innobase::innobase_get_autoinc( } /*******************************************************************//** -This function reads the global auto-inc counter. It doesn't use the +This function reads the global auto-inc counter. It doesn't use the AUTOINC lock even if the lock mode is set to TRADITIONAL. @return the autoinc value */ UNIV_INTERN From 76ea88cdb66e0686888a32d90c3bbb0501898e22 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 16 Sep 2010 19:24:32 -0700 Subject: [PATCH 15/60] Temporarily backout the Information Schema System Table Information Schema interface related change, will put back in once gain approval. --- mysql-test/r/mysqlshow.result | 30 +- .../innodb/r/innodb-system-table-view.result | 110 -- .../t/innodb-system-table-view-master.opt | 3 - .../innodb/t/innodb-system-table-view.test | 94 - storage/innobase/handler/ha_innodb.cc | 10 +- storage/innobase/handler/i_s.cc | 1628 ----------------- storage/innobase/handler/i_s.h | 7 - 7 files changed, 9 insertions(+), 1873 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/innodb-system-table-view.result delete mode 100644 mysql-test/suite/innodb/t/innodb-system-table-view-master.opt delete mode 100644 mysql-test/suite/innodb/t/innodb-system-table-view.test diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result index f7b5869a3e3..4293465df67 100644 --- a/mysql-test/r/mysqlshow.result +++ b/mysql-test/r/mysqlshow.result @@ -109,20 +109,13 @@ Database: information_schema | TRIGGERS | | USER_PRIVILEGES | | VIEWS | -| INNODB_SYS_FIELDS | -| INNODB_TRX | -| INNODB_SYS_INDEXES | -| INNODB_LOCK_WAITS | -| INNODB_SYS_TABLESTATS | -| INNODB_CMP | -| INNODB_SYS_COLUMNS | | INNODB_CMP_RESET | -| INNODB_SYS_FOREIGN_COLS | -| INNODB_LOCKS | +| INNODB_TRX | | INNODB_CMPMEM_RESET | +| INNODB_LOCK_WAITS | | INNODB_CMPMEM | -| INNODB_SYS_FOREIGN | -| INNODB_SYS_TABLES | +| INNODB_CMP | +| INNODB_LOCKS | +---------------------------------------+ Database: INFORMATION_SCHEMA +---------------------------------------+ @@ -158,20 +151,13 @@ Database: INFORMATION_SCHEMA | TRIGGERS | | USER_PRIVILEGES | | VIEWS | -| INNODB_SYS_FIELDS | -| INNODB_TRX | -| INNODB_SYS_INDEXES | -| INNODB_LOCK_WAITS | -| INNODB_SYS_TABLESTATS | -| INNODB_CMP | -| INNODB_SYS_COLUMNS | | INNODB_CMP_RESET | -| INNODB_SYS_FOREIGN_COLS | -| INNODB_LOCKS | +| INNODB_TRX | | INNODB_CMPMEM_RESET | +| INNODB_LOCK_WAITS | | INNODB_CMPMEM | -| INNODB_SYS_FOREIGN | -| INNODB_SYS_TABLES | +| INNODB_CMP | +| INNODB_LOCKS | +---------------------------------------+ Wildcard: inf_rmation_schema +--------------------+ diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result deleted file mode 100644 index ffa57ee32ce..00000000000 --- a/mysql-test/suite/innodb/r/innodb-system-table-view.result +++ /dev/null @@ -1,110 +0,0 @@ -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; -TABLE_ID NAME FLAG N_COLS SPACE -11 SYS_FOREIGN 0 7 0 -12 SYS_FOREIGN_COLS 0 7 0 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; -INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE -11 ID_IND 11 3 1 302 0 -12 FOR_IND 11 0 1 303 0 -13 REF_IND 11 0 1 304 0 -14 ID_IND 12 3 2 305 0 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; -TABLE_ID NAME POS MTYPE PRTYPE LEN -11 ID 0 1 524292 0 -11 FOR_NAME 1 1 524292 0 -11 REF_NAME 2 1 524292 0 -11 N_COLS 3 6 0 4 -12 ID 0 1 524292 0 -12 POS 1 6 0 4 -12 FOR_COL_NAME 2 1 524292 0 -12 REF_COL_NAME 3 1 524292 0 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; -INDEX_ID NAME POS -11 ID 0 -12 FOR_NAME 0 -13 REF_NAME 0 -14 ID 0 -14 POS 1 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; -ID FOR_NAME REF_NAME N_COLS TYPE -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; -ID FOR_COL_NAME REF_COL_NAME POS -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; -TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC MYSQL_HANDLES_OPENED -11 SYS_FOREIGN Uninitialized 0 0 0 0 0 0 -12 SYS_FOREIGN_COLS Uninitialized 0 0 0 0 0 0 -CREATE TABLE parent (id INT NOT NULL, -PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE child (id INT, parent_id INT, -INDEX par_ind (parent_id), -CONSTRAINT constraint_test -FOREIGN KEY (parent_id) REFERENCES parent(id) -ON DELETE CASCADE) ENGINE=INNODB; -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; -ID FOR_NAME REF_NAME N_COLS TYPE -test/constraint_test test/child test/parent 1 1 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; -ID FOR_COL_NAME REF_COL_NAME POS -test/constraint_test parent_id id 0 -INSERT INTO parent VALUES(1); -SELECT name, num_rows, mysql_handles_opened -FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS -WHERE name LIKE "%parent"; -name num_rows mysql_handles_opened -test/parent 1 1 -SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; -NAME FLAG N_COLS SPACE -SYS_FOREIGN 0 7 0 -SYS_FOREIGN_COLS 0 7 0 -test/child 1 5 0 -test/parent 1 4 0 -SELECT name, n_fields -from INFORMATION_SCHEMA.INNODB_SYS_INDEXES -WHERE table_id In (SELECT table_id from -INFORMATION_SCHEMA.INNODB_SYS_TABLES -WHERE name LIKE "%parent%"); -name n_fields -PRIMARY 1 -SELECT name, n_fields -from INFORMATION_SCHEMA.INNODB_SYS_INDEXES -WHERE table_id In (SELECT table_id from -INFORMATION_SCHEMA.INNODB_SYS_TABLES -WHERE name LIKE "%child%"); -name n_fields -GEN_CLUST_INDEX 0 -par_ind 1 -SELECT name, pos, mtype, len -from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS -WHERE table_id In (SELECT table_id from -INFORMATION_SCHEMA.INNODB_SYS_TABLES -WHERE name LIKE "%child%"); -name pos mtype len -id 0 6 4 -parent_id 1 6 4 -DROP TABLE child; -DROP TABLE parent; -CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL, -PRIMARY KEY (id, newid)) ENGINE=INNODB; -CREATE TABLE child (id INT, parent_id INT, -INDEX par_ind (parent_id), -CONSTRAINT constraint_test -FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid) -ON DELETE CASCADE) ENGINE=INNODB; -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; -ID FOR_NAME REF_NAME N_COLS TYPE -test/constraint_test test/child test/parent 2 1 -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; -ID FOR_COL_NAME REF_COL_NAME POS -test/constraint_test id id 0 -test/constraint_test parent_id newid 1 -INSERT INTO parent VALUES(1, 9); -SELECT * FROM parent WHERE id IN (SELECT id FROM parent); -id newid -1 9 -SELECT name, num_rows, mysql_handles_opened -FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS -WHERE name LIKE "%parent"; -name num_rows mysql_handles_opened -test/parent 1 2 -DROP TABLE child; -DROP TABLE parent; diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt b/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt deleted file mode 100644 index 303ec1be1d0..00000000000 --- a/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt +++ /dev/null @@ -1,3 +0,0 @@ ---default-storage-engine=MyISAM ---innodb-strict-mode=0 ---innodb-file-per-table=0 diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test deleted file mode 100644 index e570a33b59d..00000000000 --- a/mysql-test/suite/innodb/t/innodb-system-table-view.test +++ /dev/null @@ -1,94 +0,0 @@ -# This is the test for Information Schema System Table View -# that displays the InnoDB system table content through -# information schema tables. - ---source include/have_innodb.inc - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; - -# Create a foreign key constraint, and verify the information -# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and -# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS -CREATE TABLE parent (id INT NOT NULL, - PRIMARY KEY (id)) ENGINE=INNODB; - -CREATE TABLE child (id INT, parent_id INT, - INDEX par_ind (parent_id), - CONSTRAINT constraint_test - FOREIGN KEY (parent_id) REFERENCES parent(id) - ON DELETE CASCADE) ENGINE=INNODB; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; - -# Insert a row in the table "parent", and see whether that reflected in -# INNODB_SYS_TABLESTATS -INSERT INTO parent VALUES(1); - -SELECT name, num_rows, mysql_handles_opened -FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS -WHERE name LIKE "%parent"; - -SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; - -SELECT name, n_fields -from INFORMATION_SCHEMA.INNODB_SYS_INDEXES -WHERE table_id In (SELECT table_id from - INFORMATION_SCHEMA.INNODB_SYS_TABLES - WHERE name LIKE "%parent%"); - -SELECT name, n_fields -from INFORMATION_SCHEMA.INNODB_SYS_INDEXES -WHERE table_id In (SELECT table_id from - INFORMATION_SCHEMA.INNODB_SYS_TABLES - WHERE name LIKE "%child%"); - -SELECT name, pos, mtype, len -from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS -WHERE table_id In (SELECT table_id from - INFORMATION_SCHEMA.INNODB_SYS_TABLES - WHERE name LIKE "%child%"); - -DROP TABLE child; - -DROP TABLE parent; - -# Create table with 2 columns in the foreign key constraint -CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL, - PRIMARY KEY (id, newid)) ENGINE=INNODB; - -CREATE TABLE child (id INT, parent_id INT, - INDEX par_ind (parent_id), - CONSTRAINT constraint_test - FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid) - ON DELETE CASCADE) ENGINE=INNODB; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; - -SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; - -INSERT INTO parent VALUES(1, 9); - -# Nested query will open the table handle twice -SELECT * FROM parent WHERE id IN (SELECT id FROM parent); - -SELECT name, num_rows, mysql_handles_opened -FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS -WHERE name LIKE "%parent"; - -DROP TABLE child; - -DROP TABLE parent; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index df6032fbd40..7a5608bd95c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -11177,15 +11177,7 @@ i_s_innodb_lock_waits, i_s_innodb_cmp, i_s_innodb_cmp_reset, i_s_innodb_cmpmem, -i_s_innodb_cmpmem_reset, -i_s_innodb_sys_tables, -i_s_innodb_sys_tablestats, -i_s_innodb_sys_indexes, -i_s_innodb_sys_columns, -i_s_innodb_sys_fields, -i_s_innodb_sys_foreign, -i_s_innodb_sys_foreign_cols - +i_s_innodb_cmpmem_reset mysql_declare_plugin_end; /** @brief Initialize the default value of innodb_commit_concurrency. diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 0733a558080..e31d6b3c523 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -36,11 +36,9 @@ Created July 18, 2007 Vasil Dimov #include extern "C" { -#include "btr0pcur.h" /* for file sys_tables related info. */ #include "btr0types.h" #include "buf0buddy.h" /* for i_s_cmpmem */ #include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */ -#include "dict0load.h" /* for file sys_tables related info. */ #include "dict0mem.h" #include "dict0types.h" #include "ha_prototypes.h" /* for innobase_convert_name() */ @@ -1783,1629 +1781,3 @@ i_s_common_deinit( DBUG_RETURN(0); } - -/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLES */ -static ST_FIELD_INFO innodb_sys_tables_fields_info[] = -{ -#define SYS_TABLE_ID 0 - {STRUCT_FLD(field_name, "TABLE_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLE_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLE_FLAG 2 - {STRUCT_FLD(field_name, "FLAG"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLE_NUM_COLUMN 3 - {STRUCT_FLD(field_name, "N_COLS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLE_SPACE 4 - {STRUCT_FLD(field_name, "SPACE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Populate information_schema.innodb_sys_tables table with information -from SYS_TABLES. -@return 0 on success */ -static -int -i_s_dict_fill_sys_tables( -/*=====================*/ - THD* thd, /*!< in: thread */ - dict_table_t* table, /*!< in: table */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_tables"); - - fields = table_to_fill->field; - - OK(fields[SYS_TABLE_ID]->store(longlong(table->id), TRUE)); - - OK(field_store_string(fields[SYS_TABLE_NAME], table->name)); - - OK(fields[SYS_TABLE_FLAG]->store(table->flags)); - - OK(fields[SYS_TABLE_NUM_COLUMN]->store(table->n_cols)); - - OK(fields[SYS_TABLE_SPACE]->store(table->space)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to go through each record in SYS_TABLES table, and fill the -information_schema.innodb_sys_tables table with related table information -@return 0 on success */ -static -int -i_s_sys_tables_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_tables_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&(dict_sys->mutex)); - mtr_start(&mtr); - - rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES); - - while (rec) { - const char* err_msg; - dict_table_t* table_rec; - - /* Create and populate a dict_table_t structure with - information from SYS_TABLES row */ - err_msg = dict_process_sys_tables_rec( - heap, rec, &table_rec, DICT_TABLE_LOAD_FROM_RECORD); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_tables(thd, table_rec, tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - /* Since dict_process_sys_tables_rec() is called with - DICT_TABLE_LOAD_FROM_RECORD, the table_rec is created in - dict_process_sys_tables_rec(), we will need to free it */ - if (table_rec) { - dict_mem_table_free(table_rec); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} - -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_tables -@return 0 on success */ -static -int -innodb_sys_tables_init( -/*===================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_tables_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_tables_fields_info; - schema->fill_table = i_s_sys_tables_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_TABLES"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_TABLES"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_tables_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; - -/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */ -static ST_FIELD_INFO innodb_sys_tablestats_fields_info[] = -{ -#define SYS_TABLESTATS_ID 0 - {STRUCT_FLD(field_name, "TABLE_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_INIT 2 - {STRUCT_FLD(field_name, "STATS_INITIALIZED"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_NROW 3 - {STRUCT_FLD(field_name, "NUM_ROWS"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_CLUST_SIZE 4 - {STRUCT_FLD(field_name, "CLUST_INDEX_SIZE"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_INDEX_SIZE 5 - {STRUCT_FLD(field_name, "OTHER_INDEX_SIZE"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_MODIFIED 6 - {STRUCT_FLD(field_name, "MODIFIED_COUNTER"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_AUTONINC 7 - {STRUCT_FLD(field_name, "AUTOINC"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_TABLESTATS_MYSQL_OPEN_HANDLE 8 - {STRUCT_FLD(field_name, "MYSQL_HANDLES_OPENED"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Populate information_schema.innodb_sys_tablestats table with information -from SYS_TABLES. -@return 0 on success */ -static -int -i_s_dict_fill_sys_tablestats( -/*=========================*/ - THD* thd, /*!< in: thread */ - dict_table_t* table, /*!< in: table */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_tablestats"); - - fields = table_to_fill->field; - - OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); - - OK(field_store_string(fields[SYS_TABLESTATS_NAME], table->name)); - - if (table->stat_initialized) { - OK(field_store_string(fields[SYS_TABLESTATS_INIT], - "Initialized")); - } else { - OK(field_store_string(fields[SYS_TABLESTATS_INIT], - "Uninitialized")); - } - - OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows, TRUE)); - - OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store( - table->stat_clustered_index_size)); - - OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store( - table->stat_sum_of_other_index_sizes)); - - OK(fields[SYS_TABLESTATS_MODIFIED]->store( - table->stat_modified_counter)); - - OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, TRUE)); - - OK(fields[SYS_TABLESTATS_MYSQL_OPEN_HANDLE]->store( - table->n_mysql_handles_opened)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to go through each record in SYS_TABLES table, and fill the -information_schema.innodb_sys_tablestats table with table statistics -related information -@return 0 on success */ -static -int -i_s_sys_tables_fill_table_stats( -/*============================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_tables_fill_table_stats"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES); - - while (rec) { - const char* err_msg; - dict_table_t* table_rec; - - /* Fetch the dict_table_t structure corresponding to - this SYS_TABLES record */ - err_msg = dict_process_sys_tables_rec( - heap, rec, &table_rec, DICT_TABLE_LOAD_FROM_CACHE); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_tablestats(thd, table_rec, - tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} - -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_tablestats -@return 0 on success */ -static -int -innodb_sys_tablestats_init( -/*=======================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_tablestats_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_tablestats_fields_info; - schema->fill_table = i_s_sys_tables_fill_table_stats; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablestats = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_TABLESTATS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_TABLESTATS"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_tablestats_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; - -/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */ -static ST_FIELD_INFO innodb_sysindex_fields_info[] = -{ -#define SYS_INDEX_ID 0 - {STRUCT_FLD(field_name, "INDEX_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_TABLE_ID 2 - {STRUCT_FLD(field_name, "TABLE_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_TYPE 3 - {STRUCT_FLD(field_name, "TYPE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_NUM_FIELDS 4 - {STRUCT_FLD(field_name, "N_FIELDS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_PAGE_NO 5 - {STRUCT_FLD(field_name, "PAGE_NO"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_INDEX_SPACE 6 - {STRUCT_FLD(field_name, "SPACE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Function to populate the information_schema.innodb_sys_indexes table with -collected index information -@return 0 on success */ -static -int -i_s_dict_fill_sys_indexes( -/*======================*/ - THD* thd, /*!< in: thread */ - table_id_t table_id, /*!< in: table id */ - dict_index_t* index, /*!< in: populated dict_index_t - struct with index info */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_indexes"); - - fields = table_to_fill->field; - - OK(fields[SYS_INDEX_ID]->store(longlong(index->id), TRUE)); - - OK(field_store_string(fields[SYS_INDEX_NAME], index->name)); - - OK(fields[SYS_INDEX_TABLE_ID]->store(longlong(table_id), TRUE)); - - OK(fields[SYS_INDEX_TYPE]->store(index->type)); - - OK(fields[SYS_INDEX_NUM_FIELDS]->store(index->n_fields)); - - OK(fields[SYS_INDEX_PAGE_NO]->store(index->page)); - - OK(fields[SYS_INDEX_SPACE]->store(index->space)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to go through each record in SYS_INDEXES table, and fill the -information_schema.innodb_sys_indexes table with related index information -@return 0 on success */ -static -int -i_s_sys_indexes_fill_table( -/*=======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_indexes_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - /* Start scan the SYS_INDEXES table */ - rec = dict_startscan_system(&pcur, &mtr, SYS_INDEXES); - - /* Process each record in the table */ - while (rec) { - const char* err_msg;; - table_id_t table_id; - dict_index_t index_rec; - - /* Populate a dict_index_t structure with information from - a SYS_INDEXES row */ - err_msg = dict_process_sys_indexes_rec(heap, rec, &index_rec, - &table_id); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_indexes(thd, table_id, &index_rec, - tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_indexes -@return 0 on success */ -static -int -innodb_sys_indexes_init( -/*====================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_index_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sysindex_fields_info; - schema->fill_table = i_s_sys_indexes_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_INDEXES"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_INDEXES"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_indexes_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; - -/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_COLUMNS */ -static ST_FIELD_INFO innodb_sys_columns_fields_info[] = -{ -#define SYS_COLUMN_TABLE_ID 0 - {STRUCT_FLD(field_name, "TABLE_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_COLUMN_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_COLUMN_POSITION 2 - {STRUCT_FLD(field_name, "POS"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_COLUMN_MTYPE 3 - {STRUCT_FLD(field_name, "MTYPE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_COLUMN__PRTYPE 4 - {STRUCT_FLD(field_name, "PRTYPE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_COLUMN_COLUMN_LEN 5 - {STRUCT_FLD(field_name, "LEN"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Function to populate the information_schema.innodb_sys_columns with -related column information -@return 0 on success */ -static -int -i_s_dict_fill_sys_columns( -/*======================*/ - THD* thd, /*!< in: thread */ - table_id_t table_id, /*!< in: table ID */ - const char* col_name, /*!< in: column name */ - dict_col_t* column, /*!< in: dict_col_t struct holding - more column information */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_columns"); - - fields = table_to_fill->field; - - OK(fields[SYS_COLUMN_TABLE_ID]->store(longlong(table_id), TRUE)); - - OK(field_store_string(fields[SYS_COLUMN_NAME], col_name)); - - OK(fields[SYS_COLUMN_POSITION]->store(column->ind)); - - OK(fields[SYS_COLUMN_MTYPE]->store(column->mtype)); - - OK(fields[SYS_COLUMN__PRTYPE]->store(column->prtype)); - - OK(fields[SYS_COLUMN_COLUMN_LEN]->store(column->len)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to fill information_schema.innodb_sys_columns with information -collected by scanning SYS_COLUMNS table. -@return 0 on success */ -static -int -i_s_sys_columns_fill_table( -/*=======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - const char* col_name; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_columns_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - rec = dict_startscan_system(&pcur, &mtr, SYS_COLUMNS); - - while (rec) { - const char* err_msg; - dict_col_t column_rec; - table_id_t table_id; - - /* populate a dict_col_t structure with information from - a SYS_COLUMNS row */ - err_msg = dict_process_sys_columns_rec(heap, rec, &column_rec, - &table_id, &col_name); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_columns(thd, table_id, col_name, - &column_rec, - tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_columns -@return 0 on success */ -static -int -innodb_sys_columns_init( -/*====================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_columns_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_columns_fields_info; - schema->fill_table = i_s_sys_columns_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_columns = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_COLUMNS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_COLUMNS"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_columns_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; -/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_fields */ -static ST_FIELD_INFO innodb_sys_fields_fields_info[] = -{ -#define SYS_FIELD_INDEX_ID 0 - {STRUCT_FLD(field_name, "INDEX_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FIELD_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FIELD_POS 2 - {STRUCT_FLD(field_name, "POS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Function to fill information_schema.innodb_sys_fields with information -collected by scanning SYS_FIELDS table. -@return 0 on success */ -static -int -i_s_dict_fill_sys_fields( -/*=====================*/ - THD* thd, /*!< in: thread */ - index_id_t index_id, /*!< in: index id for the field */ - dict_field_t* field, /*!< in: table */ - ulint pos, /*!< in: Field position */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_fields"); - - fields = table_to_fill->field; - - OK(fields[SYS_FIELD_INDEX_ID]->store(longlong(index_id), TRUE)); - - OK(field_store_string(fields[SYS_FIELD_NAME], field->name)); - - OK(fields[SYS_FIELD_POS]->store(pos)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to go through each record in SYS_FIELDS table, and fill the -information_schema.innodb_sys_fields table with related index field -information -@return 0 on success */ -static -int -i_s_sys_fields_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - index_id_t last_id; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_fields_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - /* will save last index id so that we know whether we move to - the next index. This is used to calculate prefix length */ - last_id = 0; - - rec = dict_startscan_system(&pcur, &mtr, SYS_FIELDS); - - while (rec) { - ulint pos; - const char* err_msg; - index_id_t index_id; - dict_field_t field_rec; - - /* Populate a dict_field_t structure with information from - a SYS_FIELDS row */ - err_msg = dict_process_sys_fields_rec(heap, rec, &field_rec, - &pos, &index_id, last_id); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_fields(thd, index_id, &field_rec, - pos, tables->table); - last_id = index_id; - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_fields -@return 0 on success */ -static -int -innodb_sys_fields_init( -/*===================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_field_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_fields_fields_info; - schema->fill_table = i_s_sys_fields_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_fields = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_FIELDS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_FIELDS"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_fields_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; - -/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign */ -static ST_FIELD_INFO innodb_sys_foreign_fields_info[] = -{ -#define SYS_FOREIGN_ID 0 - {STRUCT_FLD(field_name, "ID"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_FOR_NAME 1 - {STRUCT_FLD(field_name, "FOR_NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_REF_NAME 2 - {STRUCT_FLD(field_name, "REF_NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_NUM_COL 3 - {STRUCT_FLD(field_name, "N_COLS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_TYPE 4 - {STRUCT_FLD(field_name, "TYPE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Function to fill information_schema.innodb_sys_foreign with information -collected by scanning SYS_FOREIGN table. -@return 0 on success */ -static -int -i_s_dict_fill_sys_foreign( -/*======================*/ - THD* thd, /*!< in: thread */ - dict_foreign_t* foreign, /*!< in: table */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_foreign"); - - fields = table_to_fill->field; - - OK(field_store_string(fields[SYS_FOREIGN_ID], foreign->id)); - - OK(field_store_string(fields[SYS_FOREIGN_FOR_NAME], - foreign->foreign_table_name)); - - OK(field_store_string(fields[SYS_FOREIGN_REF_NAME], - foreign->referenced_table_name)); - - OK(fields[SYS_FOREIGN_NUM_COL]->store(foreign->n_fields)); - - OK(fields[SYS_FOREIGN_TYPE]->store(foreign->type)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to populate INFORMATION_SCHEMA.innodb_sys_foreign table. Loop -through each record in SYS_FOREIGN, and extract the foreign key -information. -@return 0 on success */ -static -int -i_s_sys_foreign_fill_table( -/*=======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_foreign_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - rec = dict_startscan_system(&pcur, &mtr, SYS_FOREIGN); - - while (rec) { - const char* err_msg; - dict_foreign_t foreign_rec; - - /* Populate a dict_foreign_t structure with information from - a SYS_FOREIGN row */ - err_msg = dict_process_sys_foreign_rec(heap, rec, &foreign_rec); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_foreign(thd, &foreign_rec, - tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mtr_start(&mtr); - mutex_enter(&dict_sys->mutex); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign -@return 0 on success */ -static -int -innodb_sys_foreign_init( -/*====================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_foreign_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_foreign_fields_info; - schema->fill_table = i_s_sys_foreign_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_FOREIGN"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_FOREIGN"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_foreign_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; -/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols */ -static ST_FIELD_INFO innodb_sys_foreign_cols_fields_info[] = -{ -#define SYS_FOREIGN_COL_ID 0 - {STRUCT_FLD(field_name, "ID"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_COL_FOR_NAME 1 - {STRUCT_FLD(field_name, "FOR_COL_NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_COL_REF_NAME 2 - {STRUCT_FLD(field_name, "REF_COL_NAME"), - STRUCT_FLD(field_length, NAME_LEN + 1), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define SYS_FOREIGN_COL_POS 3 - {STRUCT_FLD(field_name, "POS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - - END_OF_ST_FIELD_INFO -}; - -/**********************************************************************//** -Function to fill information_schema.innodb_sys_foreign_cols with information -collected by scanning SYS_FOREIGN_COLS table. -@return 0 on success */ -static -int -i_s_dict_fill_sys_foreign_cols( -/*==========================*/ - THD* thd, /*!< in: thread */ - const char* name, /*!< in: foreign key constraint name */ - const char* for_col_name, /*!< in: referencing column name*/ - const char* ref_col_name, /*!< in: referenced column - name */ - ulint pos, /*!< in: column position */ - TABLE* table_to_fill) /*!< in/out: fill this table */ -{ - Field** fields; - - DBUG_ENTER("i_s_dict_fill_sys_foreign_cols"); - - fields = table_to_fill->field; - - OK(field_store_string(fields[SYS_FOREIGN_COL_ID], name)); - - OK(field_store_string(fields[SYS_FOREIGN_COL_FOR_NAME], for_col_name)); - - OK(field_store_string(fields[SYS_FOREIGN_COL_REF_NAME], ref_col_name)); - - OK(fields[SYS_FOREIGN_COL_POS]->store(pos)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Function to populate INFORMATION_SCHEMA.innodb_sys_foreign_cols table. Loop -through each record in SYS_FOREIGN_COLS, and extract the foreign key column -information and fill the INFORMATION_SCHEMA.innodb_sys_foreign_cols table. -@return 0 on success */ -static -int -i_s_sys_foreign_cols_fill_table( -/*============================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - COND* cond) /*!< in: condition (not used) */ -{ - btr_pcur_t pcur; - const rec_t* rec; - mem_heap_t* heap; - mtr_t mtr; - - DBUG_ENTER("i_s_sys_foreign_cols_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - DBUG_RETURN(0); - } - - heap = mem_heap_create(1000); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - rec = dict_startscan_system(&pcur, &mtr, SYS_FOREIGN_COLS); - - while (rec) { - const char* err_msg; - const char* name; - const char* for_col_name; - const char* ref_col_name; - ulint pos; - - /* Extract necessary information from a SYS_FOREIGN_COLS row */ - err_msg = dict_process_sys_foreign_col_rec( - heap, rec, &name, &for_col_name, &ref_col_name, &pos); - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - - if (!err_msg) { - i_s_dict_fill_sys_foreign_cols( - thd, name, for_col_name, ref_col_name, pos, - tables->table); - } else { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_FIND_SYSTEM_REC, - err_msg); - } - - mem_heap_empty(heap); - - /* Get the next record */ - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - rec = dict_getnext_system(&pcur, &mtr); - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - mem_heap_free(heap); - - DBUG_RETURN(0); -} -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols -@return 0 on success */ -static -int -innodb_sys_foreign_cols_init( -/*========================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("innodb_sys_foreign_cols_init"); - - schema = (ST_SCHEMA_TABLE*) p; - - schema->fields_info = innodb_sys_foreign_cols_fields_info; - schema->fill_table = i_s_sys_foreign_cols_fill_table; - - DBUG_RETURN(0); -} - -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign_cols = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_SYS_FOREIGN_COLS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB SYS_FOREIGN_COLS"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_sys_foreign_cols_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL) -}; - diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h index 69f5ed9dad8..402c88bbedb 100644 --- a/storage/innobase/handler/i_s.h +++ b/storage/innobase/handler/i_s.h @@ -33,12 +33,5 @@ extern struct st_mysql_plugin i_s_innodb_cmp; extern struct st_mysql_plugin i_s_innodb_cmp_reset; extern struct st_mysql_plugin i_s_innodb_cmpmem; extern struct st_mysql_plugin i_s_innodb_cmpmem_reset; -extern struct st_mysql_plugin i_s_innodb_sys_tables; -extern struct st_mysql_plugin i_s_innodb_sys_tablestats; -extern struct st_mysql_plugin i_s_innodb_sys_indexes; -extern struct st_mysql_plugin i_s_innodb_sys_columns; -extern struct st_mysql_plugin i_s_innodb_sys_fields; -extern struct st_mysql_plugin i_s_innodb_sys_foreign; -extern struct st_mysql_plugin i_s_innodb_sys_foreign_cols; #endif /* i_s_h */ From 5cf9dab7650ff077ec754264fab3dfa9fe3bb387 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 15:31:34 +0300 Subject: [PATCH 16/60] Increment InnoDB version from 1.1.2 to 1.1.3 InnoDB 1.1.2 was released with MySQL 5.5.6-rc --- storage/innobase/include/univ.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 748070efa02..1e8e60fea52 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 1 -#define INNODB_VERSION_BUGFIX 2 +#define INNODB_VERSION_BUGFIX 3 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; From bc889d6ef34bcec24aaf6e806c2ed3514b779b62 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 15:50:34 +0300 Subject: [PATCH 17/60] Whitespace fixup on ha_innodb.cc:1274 --- storage/innobase/handler/ha_innodb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7a5608bd95c..bf9056e470f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1271,7 +1271,7 @@ innobase_mysql_tmpfile(void) #ifdef _WIN32 /* Note that on Windows, the integer returned by mysql_tmpfile - has no relation to C runtime file descriptor. Here, we need + has no relation to C runtime file descriptor. Here, we need to call my_get_osfhandle to get the HANDLE and then convert it to C runtime filedescriptor. */ { From 3374d5bb1dac22120790614b5c5097fe9fb2dba9 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 17:14:21 +0300 Subject: [PATCH 18/60] Whitespace fixup on ha_innodb.cc:2612 --- storage/innobase/handler/ha_innodb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bf9056e470f..a55bd4120c7 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2609,7 +2609,7 @@ static int innobase_commit( /*============*/ - handlerton *hton, /*!< in: Innodb handlerton */ + handlerton *hton, /*!< in: Innodb handlerton */ THD* thd, /*!< in: MySQL thread handle of the user for whom the transaction should be committed */ bool all) /*!< in: TRUE - commit transaction From d3c82da63ea08c0156ba6bfbef1e8a2ad4eafb47 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 17:59:59 +0300 Subject: [PATCH 19/60] (btr0btr.c:606) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0btr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index f8638af2e71..5c0f9e4c610 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -603,7 +603,6 @@ btr_page_get_father_node_ptr_func( ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { - page_t* page; dtuple_t* tuple; rec_t* user_rec; rec_t* node_ptr; @@ -621,7 +620,6 @@ btr_page_get_father_node_ptr_func( level = btr_page_get_level(btr_cur_get_page(cursor), mtr); - page = btr_cur_get_page(cursor); user_rec = btr_cur_get_rec(cursor); ut_a(page_rec_is_user_rec(user_rec)); tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level); From c36871e59f2e18491a24b9ef97056d7c21a0962f Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:16:19 +0300 Subject: [PATCH 20/60] (btr0btr.c:1900) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0btr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index 5c0f9e4c610..0ec82a3cc81 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -1897,7 +1897,6 @@ btr_page_split_and_insert( buf_block_t* left_block; buf_block_t* right_block; buf_block_t* insert_block; - page_t* insert_page; page_cur_t* page_cursor; rec_t* first_rec; byte* buf = 0; /* remove warning */ @@ -2155,8 +2154,6 @@ insert_empty: insert_block = right_block; } - insert_page = buf_block_get_frame(insert_block); - /* 7. Reposition the cursor for insert and try insertion */ page_cursor = btr_cur_get_page_cur(cursor); @@ -2168,8 +2165,12 @@ insert_empty: #ifdef UNIV_ZIP_DEBUG { + page_t* insert_page + = buf_block_get_frame(insert_block); + page_zip_des_t* insert_page_zip = buf_block_get_page_zip(insert_block); + ut_a(!insert_page_zip || page_zip_validate(insert_page_zip, insert_page)); } From 88c3af8d9ae262b12a3dbb34556de053e6d33911 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:31:58 +0300 Subject: [PATCH 21/60] (btr0btr.c:2566) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0btr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index 0ec82a3cc81..06cfdf5a798 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -2563,7 +2563,6 @@ btr_compress( ulint n_recs; ulint max_ins_size; ulint max_ins_size_reorg; - ulint level; block = btr_cur_get_block(cursor); page = btr_cur_get_page(cursor); @@ -2573,7 +2572,6 @@ btr_compress( ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); - level = btr_page_get_level(page, mtr); space = dict_index_get_space(index); zip_size = dict_table_zip_size(index->table); From 318b075cace04fb094b274f0cccf4799555651d3 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:33:39 +0300 Subject: [PATCH 22/60] (btr0cur.c:1957) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0cur.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 2549589b0c7..fa71a0b12fa 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -1954,7 +1954,6 @@ btr_cur_optimistic_update( page_t* page; page_zip_des_t* page_zip; rec_t* rec; - rec_t* orig_rec; ulint max_size; ulint new_rec_size; ulint old_rec_size; @@ -1968,7 +1967,7 @@ btr_cur_optimistic_update( block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); - orig_rec = rec = btr_cur_get_rec(cursor); + rec = btr_cur_get_rec(cursor); index = cursor->index; ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); From 38c61d65a4fe8bbda448fddbdb49f30b8d4430d1 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:38:43 +0300 Subject: [PATCH 23/60] (btr0cur.c:4559) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0cur.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index fa71a0b12fa..8955c483f6e 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -4556,17 +4556,20 @@ btr_free_externally_stored_field( } for (;;) { +#ifdef UNIV_SYNC_DEBUG buf_block_t* rec_block; +#endif /* UNIV_SYNC_DEBUG */ buf_block_t* ext_block; mtr_start(&mtr); - rec_block = buf_page_get(page_get_space_id( - page_align(field_ref)), - rec_zip_size, - page_get_page_no( - page_align(field_ref)), - RW_X_LATCH, &mtr); +#ifdef UNIV_SYNC_DEBUG + rec_block = +#endif /* UNIV_SYNC_DEBUG */ + buf_page_get(page_get_space_id(page_align(field_ref)), + rec_zip_size, + page_get_page_no(page_align(field_ref)), + RW_X_LATCH, &mtr); buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK); page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO); From 63072c7324617f33c56b06b58419160f46c49251 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:42:13 +0300 Subject: [PATCH 24/60] (btr0pcur.c:455) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0pcur.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index 658901208ef..056896c7927 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -452,7 +452,6 @@ btr_pcur_move_backward_from_page( mtr_t* mtr) /*!< in: mtr */ { ulint prev_page_no; - ulint space; page_t* page; buf_block_t* prev_block; ulint latch_mode; @@ -488,7 +487,6 @@ btr_pcur_move_backward_from_page( page = btr_pcur_get_page(cursor); prev_page_no = btr_page_get_prev(page, mtr); - space = buf_block_get_space(btr_pcur_get_block(cursor)); if (prev_page_no == FIL_NULL) { } else if (btr_pcur_is_before_first_on_page(cursor)) { From 31d79a481ec5ecc60d38eda2d8febc0468ff4879 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:43:15 +0300 Subject: [PATCH 25/60] (btr0sea.c:1510) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/btr/btr0sea.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c index fb667bcae82..8f5f9b839b5 100644 --- a/storage/innobase/btr/btr0sea.c +++ b/storage/innobase/btr/btr0sea.c @@ -1507,7 +1507,6 @@ btr_search_update_hash_on_delete( rec_t* rec; ulint fold; index_id_t index_id; - ibool found; ulint offsets_[REC_OFFS_NORMAL_SIZE]; mem_heap_t* heap = NULL; rec_offs_init(offsets_); @@ -1540,7 +1539,7 @@ btr_search_update_hash_on_delete( } rw_lock_x_lock(&btr_search_latch); - found = ha_search_and_delete_if_found(table, fold, rec); + ha_search_and_delete_if_found(table, fold, rec); rw_lock_x_unlock(&btr_search_latch); } From 2460ca43d99ea344f7f24bf1d0a72fc4f0366862 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:45:40 +0300 Subject: [PATCH 26/60] (buf0flu.c:136) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/buf/buf0flu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c index 7b51fc60fcc..70ed3efaf4a 100644 --- a/storage/innobase/buf/buf0flu.c +++ b/storage/innobase/buf/buf0flu.c @@ -133,12 +133,18 @@ buf_flush_delete_from_flush_rbt( /*============================*/ buf_page_t* bpage) /*!< in: bpage to be removed. */ { +#ifdef UNIV_DEBUG ibool ret = FALSE; +#endif /* UNIV_DEBUG */ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); ut_ad(buf_flush_list_mutex_own(buf_pool)); - ret = rbt_delete(buf_pool->flush_rbt, &bpage); +#ifdef UNIV_DEBUG + ret = +#endif /* UNIV_DEBUG */ + rbt_delete(buf_pool->flush_rbt, &bpage); + ut_ad(ret); } From 977d0e0524da66cc4ff1f2030724e4df3e56be19 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:46:24 +0300 Subject: [PATCH 27/60] (dict0crea.c:630) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/dict/dict0crea.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c index 6824d0fa9f9..1a332ea9329 100644 --- a/storage/innobase/dict/dict0crea.c +++ b/storage/innobase/dict/dict0crea.c @@ -627,7 +627,6 @@ dict_create_index_tree_step( { dict_index_t* index; dict_table_t* sys_indexes; - dict_table_t* table; dtuple_t* search_tuple; ulint zip_size; btr_pcur_t pcur; @@ -636,7 +635,6 @@ dict_create_index_tree_step( ut_ad(mutex_own(&(dict_sys->mutex))); index = node->index; - table = node->table; sys_indexes = dict_sys->sys_indexes; From 72a65da579d7d73dbe40c0403ee3269ba2e384f7 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:47:15 +0300 Subject: [PATCH 28/60] (dict0dict.c:4458) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/dict/dict0dict.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 3dba63cc76a..2512f199875 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -4455,7 +4455,6 @@ dict_index_print_low( { ib_int64_t n_vals; ulint i; - const char* type_string; ut_ad(mutex_own(&(dict_sys->mutex))); @@ -4470,14 +4469,6 @@ dict_index_print_low( dict_index_stat_mutex_exit(index); - if (dict_index_is_clust(index)) { - type_string = "clustered index"; - } else if (dict_index_is_unique(index)) { - type_string = "unique index"; - } else { - type_string = "secondary index"; - } - fprintf(stderr, " INDEX: name %s, id %llu, fields %lu/%lu," " uniq %lu, type %lu\n" From 10ec98ca0eab931d357b81b42fc8c546020404fb Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:47:51 +0300 Subject: [PATCH 29/60] (eval0eval.c:388) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/eval/eval0eval.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/eval/eval0eval.c b/storage/innobase/eval/eval0eval.c index 589b0fa1576..2aad7951535 100644 --- a/storage/innobase/eval/eval0eval.c +++ b/storage/innobase/eval/eval0eval.c @@ -385,13 +385,11 @@ eval_notfound( func_node_t* func_node) /*!< in: function node */ { que_node_t* arg1; - que_node_t* arg2; sym_node_t* cursor; sel_node_t* sel_node; ibool ibool_val; arg1 = func_node->args; - arg2 = que_node_get_next(arg1); ut_ad(func_node->func == PARS_NOTFOUND_TOKEN); From d9d20d93c6fb7cff583a2345d679e834076107d3 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:48:38 +0300 Subject: [PATCH 30/60] Remove redundant variable --- storage/innobase/eval/eval0eval.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/storage/innobase/eval/eval0eval.c b/storage/innobase/eval/eval0eval.c index 2aad7951535..dcd416adeee 100644 --- a/storage/innobase/eval/eval0eval.c +++ b/storage/innobase/eval/eval0eval.c @@ -384,16 +384,13 @@ eval_notfound( /*==========*/ func_node_t* func_node) /*!< in: function node */ { - que_node_t* arg1; sym_node_t* cursor; sel_node_t* sel_node; ibool ibool_val; - arg1 = func_node->args; - ut_ad(func_node->func == PARS_NOTFOUND_TOKEN); - cursor = arg1; + cursor = func_node->args; ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL); From 4cce243414dd5f278d067ced985f434329526d84 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:51:11 +0300 Subject: [PATCH 31/60] (ibuf0ibuf.c:1300) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/ibuf/ibuf0ibuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index b77390ab038..d560f936cb9 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1297,12 +1297,11 @@ ibuf_rec_get_op_type( const rec_t* rec) /*!< in: ibuf record */ { ulint len; - const byte* field; ut_ad(ibuf_inside()); ut_ad(rec_get_n_fields_old(rec) > 2); - field = rec_get_nth_field_old(rec, 1, &len); + (void) rec_get_nth_field_old(rec, 1, &len); if (len > 1) { /* This is a < 4.1.x format record */ From e2b4074d821122d70c6d78f28f2f2cda468110ff Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:51:51 +0300 Subject: [PATCH 32/60] (log0recv.c:572) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/log/log0recv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index f983c4fb974..dce0f2f8eb6 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -569,10 +569,8 @@ recv_synchronize_groups( ib_uint64_t start_lsn; ib_uint64_t end_lsn; ib_uint64_t recovered_lsn; - ib_uint64_t limit_lsn; recovered_lsn = recv_sys->recovered_lsn; - limit_lsn = recv_sys->limit_lsn; /* Read the last recovered log block to the recovery system buffer: the block is always incomplete */ From 07427cd8fb7b5b544dde8c14df1e10bd7ba7bcd0 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:53:07 +0300 Subject: [PATCH 33/60] (log0recv.c:1660) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/log/log0recv.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index dce0f2f8eb6..f6d90e4e330 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -1657,12 +1657,8 @@ recv_recover_page_func( #ifndef UNIV_HOTBACKUP if (modification_to_page) { - buf_pool_t* buf_pool; - ut_a(block); - buf_pool = buf_pool_from_block(block); - log_flush_order_mutex_enter(); buf_flush_recv_note_modification(block, start_lsn, end_lsn); log_flush_order_mutex_exit(); From fb1338558d70cda7d595ce276e01131a796a3a17 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:55:54 +0300 Subject: [PATCH 34/60] (log0recv.c:2905) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/log/log0recv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index f6d90e4e330..5d5caf1b48a 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -2902,7 +2902,9 @@ recv_recovery_from_checkpoint_start_func( ib_uint64_t old_scanned_lsn; ib_uint64_t group_scanned_lsn; ib_uint64_t contiguous_lsn; +#ifdef UNIV_LOG_ARCHIVE ib_uint64_t archived_lsn; +#endif /* UNIV_LOG_ARCHIVE */ byte* buf; byte log_hdr_buf[LOG_FILE_HDR_SIZE]; ulint err; @@ -2957,7 +2959,9 @@ recv_recovery_from_checkpoint_start_func( checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN); checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO); +#ifdef UNIV_LOG_ARCHIVE archived_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN); +#endif /* UNIV_LOG_ARCHIVE */ /* Read the first log file header to print a note if this is a recovery from a restored InnoDB Hot Backup */ From 4883683668dedb228e96b9b09889516ef16451b4 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 18:57:36 +0300 Subject: [PATCH 35/60] (os0file.c:1486) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/os/os0file.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 65c5d65f860..a57e10182dd 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1483,7 +1483,6 @@ try_again: ibool retry; const char* mode_str = NULL; const char* type_str = NULL; - const char* purpose_str = NULL; try_again: ut_a(name); @@ -1511,18 +1510,8 @@ try_again: ut_error; } - if (purpose == OS_FILE_AIO) { - purpose_str = "AIO"; - } else if (purpose == OS_FILE_NORMAL) { - purpose_str = "NORMAL"; - } else { - ut_error; - } + ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL); -#if 0 - fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n", - name, mode_str, type_str, purpose_str); -#endif #ifdef O_SYNC /* We let O_SYNC only affect log files; note that we map O_DSYNC to O_SYNC because the datasync options seemed to corrupt files in 2001 From 16215b6c1deea146aec3f2d24b38d930fcd37111 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:00:28 +0300 Subject: [PATCH 36/60] (os0file.c:1485) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/os/os0file.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index a57e10182dd..6c17ded0073 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1482,7 +1482,6 @@ try_again: int create_flag; ibool retry; const char* mode_str = NULL; - const char* type_str = NULL; try_again: ut_a(name); @@ -1502,14 +1501,7 @@ try_again: ut_error; } - if (type == OS_LOG_FILE) { - type_str = "LOG"; - } else if (type == OS_DATA_FILE) { - type_str = "DATA"; - } else { - ut_error; - } - + ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE); ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL); #ifdef O_SYNC From 1bcb1d2da3e8c0a0828287451752d3a503ba34a5 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:01:14 +0300 Subject: [PATCH 37/60] (que0que.c:1286) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/que/que0que.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c index 3dcb9e89565..384fb490b86 100644 --- a/storage/innobase/que/que0que.c +++ b/storage/innobase/que/que0que.c @@ -1283,18 +1283,13 @@ que_run_threads_low( que_thr_t* thr) /*!< in: query thread */ { que_thr_t* next_thr; - ulint cumul_resource; ulint loop_count; ut_ad(thr->state == QUE_THR_RUNNING); ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_ad(!mutex_own(&kernel_mutex)); - /* cumul_resource counts how much resources the OS thread (NOT the - query thread) has spent in this function */ - loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK; - cumul_resource = 0; loop: /* Check that there is enough space in the log to accommodate possible log entries by this query step; if the operation can touch From 8fe3d04e6c74f33e1e5ca77d1b7ebe780f0a2275 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:03:05 +0300 Subject: [PATCH 38/60] (ha_innodb.cc:7202) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/handler/ha_innodb.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a55bd4120c7..8b185ecca28 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7199,7 +7199,6 @@ innobase_drop_database( ulint len = 0; trx_t* trx; char* ptr; - int error; char* namebuf; THD* thd = current_thd; @@ -7242,7 +7241,7 @@ innobase_drop_database( #else trx = innobase_trx_allocate(thd); #endif - error = row_drop_database_for_mysql(namebuf, trx); + row_drop_database_for_mysql(namebuf, trx); my_free(namebuf); /* Flush the log to reduce probability that the .frm files and From 5f5bc71fcb0417b6972e5e717d4af6d723c5a43f Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:04:14 +0300 Subject: [PATCH 39/60] (ha_innodb.cc:9037) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/handler/ha_innodb.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 8b185ecca28..e3b20f79464 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9034,12 +9034,9 @@ innodb_show_status( mutex_exit(&srv_monitor_file_mutex); - bool result = FALSE; + stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name), + STRING_WITH_LEN(""), str, flen); - if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name), - STRING_WITH_LEN(""), str, flen)) { - result= TRUE; - } my_free(str); DBUG_RETURN(FALSE); From c07b437ffe1043866ca0fa350402d0f94333a0b4 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:07:54 +0300 Subject: [PATCH 40/60] (i_s.cc:1111) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/handler/i_s.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index e31d6b3c523..2ec37a5365f 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1193,6 +1193,7 @@ trx_i_s_common_fill_table( see http://bugs.mysql.com/29900 ; when that bug is resolved we can enable the DBUG_RETURN(ret) above */ DBUG_RETURN(0); + ret++; // silence a gcc46 warning #endif } From 60cd54f3ec02b0d3a7ad87bdad84355b938e08c6 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:09:30 +0300 Subject: [PATCH 41/60] (row0purge.c:789) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/row/row0purge.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c index fe7a3e0236e..031b5258e98 100644 --- a/storage/innobase/row/row0purge.c +++ b/storage/innobase/row/row0purge.c @@ -786,7 +786,9 @@ row_purge_step( que_thr_t* thr) /*!< in: query thread */ { purge_node_t* node; +#ifdef UNIV_DEBUG ulint err; +#endif /* UNIV_DEBUG */ ut_ad(thr); @@ -794,7 +796,10 @@ row_purge_step( ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); - err = row_purge(node, thr); +#ifdef UNIV_DEBUG + err = +#endif /* UNIV_DEBUG */ + row_purge(node, thr); ut_ad(err == DB_SUCCESS); From 7f1ffcfbb388ce75b132d9c02d64f78f7c0cbc20 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:10:33 +0300 Subject: [PATCH 42/60] (row0umod.c:117) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/row/row0umod.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index aebff0764c8..aef653b3150 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -114,12 +114,17 @@ row_undo_mod_clust_low( btr_pcur_t* pcur; btr_cur_t* btr_cur; ulint err; +#ifdef UNIV_DEBUG ibool success; +#endif /* UNIV_DEBUG */ pcur = &(node->pcur); btr_cur = btr_pcur_get_btr_cur(pcur); - success = btr_pcur_restore_position(mode, pcur, mtr); +#ifdef UNIV_DEBUG + success = +#endif /* UNIV_DEBUG */ + btr_pcur_restore_position(mode, pcur, mtr); ut_ad(success); From 6f082344d53cd62408e3ad06e7d2c0176c3453f1 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:17:20 +0300 Subject: [PATCH 43/60] (row0vers.c:74) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/row/row0vers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/storage/innobase/row/row0vers.c b/storage/innobase/row/row0vers.c index 3e6fc3f18b6..2e12361312c 100644 --- a/storage/innobase/row/row0vers.c +++ b/storage/innobase/row/row0vers.c @@ -71,7 +71,9 @@ row_vers_impl_x_locked_off_kernel( warning */ trx_t* trx; ulint rec_del; +#ifdef UNIV_DEBUG ulint err; +#endif /* UNIV_DEBUG */ mtr_t mtr; ulint comp; @@ -169,9 +171,12 @@ row_vers_impl_x_locked_off_kernel( heap2 = heap; heap = mem_heap_create(1024); - err = trx_undo_prev_version_build(clust_rec, &mtr, version, - clust_index, clust_offsets, - heap, &prev_version); +#ifdef UNIV_DEBUG + err = +#endif /* UNIV_DEBUG */ + trx_undo_prev_version_build(clust_rec, &mtr, version, + clust_index, clust_offsets, + heap, &prev_version); mem_heap_free(heap2); /* free version and clust_offsets */ if (prev_version == NULL) { From 78d7f7b19a12c4ac51203c0abf55f4fb249a3f90 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:30:44 +0300 Subject: [PATCH 44/60] (trx0purge.c:318) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0purge.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index e17ed547050..80fe6847261 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -315,7 +315,6 @@ trx_purge_add_update_undo_to_history( trx_rsegf_t* rseg_header; trx_usegf_t* seg_header; trx_ulogf_t* undo_header; - trx_upagef_t* page_header; ulint hist_size; undo = trx->update_undo; @@ -331,7 +330,6 @@ trx_purge_add_update_undo_to_history( undo_header = undo_page + undo->hdr_offset; seg_header = undo_page + TRX_UNDO_SEG_HDR; - page_header = undo_page + TRX_UNDO_PAGE_HDR; if (undo->state != TRX_UNDO_CACHED) { /* The undo log segment will not be reused */ From 0babdaf233ee397f898f096161899da88cd0af37 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:32:35 +0300 Subject: [PATCH 45/60] (trx0purge.c:316) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0purge.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index 80fe6847261..cad3fb093e3 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -313,7 +313,9 @@ trx_purge_add_update_undo_to_history( trx_undo_t* undo; trx_rseg_t* rseg; trx_rsegf_t* rseg_header; +#ifdef UNIV_DEBUG trx_usegf_t* seg_header; +#endif /* UNIV_DEBUG */ trx_ulogf_t* undo_header; ulint hist_size; @@ -329,7 +331,9 @@ trx_purge_add_update_undo_to_history( rseg->page_no, mtr); undo_header = undo_page + undo->hdr_offset; +#ifdef UNIV_DEBUG seg_header = undo_page + TRX_UNDO_SEG_HDR; +#endif /* UNIV_DEBUG */ if (undo->state != TRX_UNDO_CACHED) { /* The undo log segment will not be reused */ From 202cebad7cd66dae7b9cc5a64481c83806c8acca Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:33:38 +0300 Subject: [PATCH 46/60] (trx0purge.c:674) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0purge.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index cad3fb093e3..05c0ee58a5f 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -671,7 +671,6 @@ trx_purge_rseg_get_next_history_log( { page_t* undo_page; trx_ulogf_t* log_hdr; - trx_usegf_t* seg_hdr; fil_addr_t prev_log_addr; trx_id_t trx_no; ibool del_marks; @@ -692,7 +691,6 @@ trx_purge_rseg_get_next_history_log( undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size, rseg->last_page_no, &mtr); log_hdr = undo_page + rseg->last_offset; - seg_hdr = undo_page + TRX_UNDO_SEG_HDR; /* Increase the purge page count by one for every handled log */ From 19a4c1429f24ea895fde5485399b6c9b11d3a6d3 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:34:39 +0300 Subject: [PATCH 47/60] (trx0purge.c:1082) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0purge.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index 05c0ee58a5f..4c787579a03 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -1079,12 +1079,8 @@ trx_purge_rec_release( /*==================*/ trx_undo_inf_t* cell) /*!< in: storage cell */ { - trx_undo_arr_t* arr; - mutex_enter(&(purge_sys->mutex)); - arr = purge_sys->arr; - trx_purge_arr_remove_info(cell); mutex_exit(&(purge_sys->mutex)); From c2fc573435d0ab6dc2fc6f650d0f4ebe6a12ee52 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:35:13 +0300 Subject: [PATCH 48/60] (trx0roll.c:747) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0roll.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/trx/trx0roll.c b/storage/innobase/trx/trx0roll.c index 42b8a8685ad..c9e3a3850d3 100644 --- a/storage/innobase/trx/trx0roll.c +++ b/storage/innobase/trx/trx0roll.c @@ -744,11 +744,9 @@ trx_undo_arr_remove_info( { trx_undo_inf_t* cell; ulint n_used; - ulint n; ulint i; n_used = arr->n_used; - n = 0; for (i = 0;; i++) { cell = trx_undo_arr_get_nth_info(arr, i); From 53be9a8204127ce3ba735cbca9c11e4917bce9c5 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:36:08 +0300 Subject: [PATCH 49/60] (trx0roll.c:746) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0roll.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/storage/innobase/trx/trx0roll.c b/storage/innobase/trx/trx0roll.c index c9e3a3850d3..876a00fb935 100644 --- a/storage/innobase/trx/trx0roll.c +++ b/storage/innobase/trx/trx0roll.c @@ -743,11 +743,8 @@ trx_undo_arr_remove_info( undo_no_t undo_no)/*!< in: undo number */ { trx_undo_inf_t* cell; - ulint n_used; ulint i; - n_used = arr->n_used; - for (i = 0;; i++) { cell = trx_undo_arr_get_nth_info(arr, i); From f5d1b4787a574c917c0c40e50b037137c859c067 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:37:53 +0300 Subject: [PATCH 50/60] (trx0sys.c:252) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0sys.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c index 640412c4572..26498a1b712 100644 --- a/storage/innobase/trx/trx0sys.c +++ b/storage/innobase/trx/trx0sys.c @@ -249,7 +249,9 @@ trx_sys_create_doublewrite_buf(void) { buf_block_t* block; buf_block_t* block2; +#ifdef UNIV_SYNC_DEBUG buf_block_t* new_block; +#endif /* UNIV_SYNC_DEBUG */ byte* doublewrite; byte* fseg_header; ulint page_no; @@ -352,8 +354,11 @@ start_again: the page position in the tablespace, then the page has not been written to in doublewrite. */ - new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no, - RW_X_LATCH, &mtr); +#ifdef UNIV_SYNC_DEBUG + new_block = +#endif /* UNIV_SYNC_DEBUG */ + buf_page_get(TRX_SYS_SPACE, 0, page_no, + RW_X_LATCH, &mtr); buf_block_dbg_add_level(new_block, SYNC_NO_ORDER_CHECK); From 862caf5d5cb052a369e327826cedb248f21d7633 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:39:35 +0300 Subject: [PATCH 51/60] (trx0trx.c:1801) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0trx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c index 19e3eb26421..6ef47a8dc16 100644 --- a/storage/innobase/trx/trx0trx.c +++ b/storage/innobase/trx/trx0trx.c @@ -1798,7 +1798,6 @@ trx_prepare_off_kernel( /*===================*/ trx_t* trx) /*!< in: transaction */ { - page_t* update_hdr_page; trx_rseg_t* rseg; ib_uint64_t lsn = 0; mtr_t mtr; @@ -1831,7 +1830,7 @@ trx_prepare_off_kernel( } if (trx->update_undo) { - update_hdr_page = trx_undo_set_state_at_prepare( + trx_undo_set_state_at_prepare( trx, trx->update_undo, &mtr); } From a5975d43040c7481c22903b2e2fd469277a0d210 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:40:13 +0300 Subject: [PATCH 52/60] (trx0undo.c:1075) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0undo.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index 90fc98f419d..59f00d198d6 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1072,14 +1072,11 @@ trx_undo_truncate_end( ulint last_page_no; trx_undo_rec_t* rec; trx_undo_rec_t* trunc_here; - trx_rseg_t* rseg; mtr_t mtr; ut_ad(mutex_own(&(trx->undo_mutex))); ut_ad(mutex_own(&(trx->rseg->mutex))); - rseg = trx->rseg; - for (;;) { mtr_start(&mtr); From 32e9abebd560dd22e4669e7a0245524f6e4dc8dd Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:40:44 +0300 Subject: [PATCH 53/60] (trx0undo.c:1873) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/trx/trx0undo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index 59f00d198d6..9162c82e423 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1870,7 +1870,6 @@ trx_undo_set_state_at_prepare( mtr_t* mtr) /*!< in: mtr */ { trx_usegf_t* seg_hdr; - trx_upagef_t* page_hdr; trx_ulogf_t* undo_header; page_t* undo_page; ulint offset; @@ -1888,7 +1887,6 @@ trx_undo_set_state_at_prepare( undo->hdr_page_no, mtr); seg_hdr = undo_page + TRX_UNDO_SEG_HDR; - page_hdr = undo_page + TRX_UNDO_PAGE_HDR; /*------------------------------*/ undo->state = TRX_UNDO_PREPARED; From 5af0e024aeea7a252b52695afcb3abe34e0e5b52 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 20 Sep 2010 19:41:58 +0300 Subject: [PATCH 54/60] (ut0rnd.ic:88) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 --- storage/innobase/include/ut0rnd.ic | 3 --- 1 file changed, 3 deletions(-) diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic index a6ba4ec2ba2..df99c384bbe 100644 --- a/storage/innobase/include/ut0rnd.ic +++ b/storage/innobase/include/ut0rnd.ic @@ -85,9 +85,6 @@ ut_rnd_gen_ulint(void) /*==================*/ { ulint rnd; - ulint n_bits; - - n_bits = 8 * sizeof(ulint); ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2; From 693f13463f5af815b8b21eb6bce7d8154ddf74d2 Mon Sep 17 00:00:00 2001 From: Mark Leith Date: Thu, 23 Sep 2010 09:12:09 +0100 Subject: [PATCH 55/60] Bug#56922 SHOW ENGINE INNODB STATUS truncation limit is too strict and not instrumented rb://459 approved by Jimmuy / Inaam --- storage/innobase/handler/ha_innodb.cc | 5 ++++- storage/innobase/include/srv0srv.h | 5 ++++- storage/innobase/srv/srv0srv.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e3b20f79464..6bcca31cfcc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -674,6 +674,8 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_rows_read, SHOW_LONG}, {"rows_updated", (char*) &export_vars.innodb_rows_updated, SHOW_LONG}, + {"truncated_status_writes", + (char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG}, {NullS, NullS, SHOW_LONG} }; @@ -8969,7 +8971,7 @@ innodb_show_status( { trx_t* trx; static const char truncated_msg[] = "... truncated...\n"; - const long MAX_STATUS_SIZE = 64000; + const long MAX_STATUS_SIZE = 1048576; ulint trx_list_start = ULINT_UNDEFINED; ulint trx_list_end = ULINT_UNDEFINED; @@ -8999,6 +9001,7 @@ innodb_show_status( if (flen > MAX_STATUS_SIZE) { usable_len = MAX_STATUS_SIZE; + srv_truncated_status_writes++; } else { usable_len = flen; } diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index d78c8113aee..5d2fb808dc9 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -225,6 +225,8 @@ extern ulong srv_thread_sleep_delay; extern ulong srv_spin_wait_delay; extern ibool srv_priority_boost; +extern ulint srv_truncated_status_writes; + extern ulint srv_mem_pool_size; extern ulint srv_lock_table_size; @@ -710,11 +712,12 @@ struct export_var_struct{ ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */ ulint innodb_rows_updated; /*!< srv_n_rows_updated */ ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */ + ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */ }; /** Thread slot in the thread table */ typedef struct srv_slot_struct srv_slot_t; - + /** Thread table is an array of slots */ typedef srv_slot_t srv_table_t; diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 714b0355506..72b095c7ad4 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -424,6 +424,7 @@ UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0; UNIV_INTERN ulint srv_n_lock_max_wait_time = 0; +UNIV_INTERN ulint srv_truncated_status_writes = 0; /* Set the following to 0 if you want InnoDB to write messages on @@ -2032,6 +2033,7 @@ srv_export_innodb_status(void) export_vars.innodb_rows_inserted = srv_n_rows_inserted; export_vars.innodb_rows_updated = srv_n_rows_updated; export_vars.innodb_rows_deleted = srv_n_rows_deleted; + export_vars.innodb_truncated_status_writes = srv_truncated_status_writes; mutex_exit(&srv_innodb_monitor_mutex); } From ae1f1a6798bf78924f8c6c60e427dbbde5325080 Mon Sep 17 00:00:00 2001 From: Sunny Bains Date: Fri, 24 Sep 2010 08:37:09 +1000 Subject: [PATCH 56/60] This patch comes from Michael: See bug#56933. --- storage/innobase/srv/srv0srv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 72b095c7ad4..83355bd1322 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -2639,7 +2639,9 @@ loop: when there is database activity */ srv_last_log_flush_time = time(NULL); - next_itr_time = ut_time_ms(); + + /* Sleep for 1 second on entrying the for loop below the first time. */ + next_itr_time = ut_time_ms() + 1000; for (i = 0; i < 10; i++) { ulint cur_time = ut_time_ms(); From f661c09dd4f1fbe1efdd712644c8172024d5c996 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 27 Sep 2010 20:08:12 +0300 Subject: [PATCH 57/60] Use C-style comment instead of C++ in a C header. Spotted by: Davi Arnaut --- storage/innobase/include/ut0rbt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/ut0rbt.h b/storage/innobase/include/ut0rbt.h index 7902dc91f09..e26b637ae13 100644 --- a/storage/innobase/include/ut0rbt.h +++ b/storage/innobase/include/ut0rbt.h @@ -53,7 +53,7 @@ Created 2007-03-20 Sunny Bains /* Red black tree typedefs */ typedef struct ib_rbt_struct ib_rbt_t; typedef struct ib_rbt_node_struct ib_rbt_node_t; -// FIXME: Iterator is a better name than _bound_ +/* FIXME: Iterator is a better name than _bound_ */ typedef struct ib_rbt_bound_struct ib_rbt_bound_t; typedef void (*ib_rbt_print_node)(const ib_rbt_node_t* node); typedef int (*ib_rbt_compare)(const void* p1, const void* p2); From 64ef6416bf32b21ede768e4c4cd65c40ea33509e Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 28 Sep 2010 11:14:42 +0300 Subject: [PATCH 58/60] Manually merge a GCC warning fix from 5.1 to 5.5: ------------------------------------------------------------ revno: 3615 revision-id: vasil.dimov@oracle.com-20100928081234-22qbm6cwht521484 parent: vasil.dimov@oracle.com-20100928063833-snn6cjwgksa6gk3b committer: Vasil Dimov branch nick: mysql-5.1-innodb timestamp: Tue 2010-09-28 11:12:34 +0300 message: Silence a GCC warning about reaching the end of non-void func Spotted by: Marko --- storage/innobase/handler/i_s.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 2ec37a5365f..9f0e465a4d9 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1192,8 +1192,8 @@ trx_i_s_common_fill_table( deadlock occurs between the mysqld server and mysql client, see http://bugs.mysql.com/29900 ; when that bug is resolved we can enable the DBUG_RETURN(ret) above */ - DBUG_RETURN(0); ret++; // silence a gcc46 warning + DBUG_RETURN(0); #endif } From 314d795bb0ec6392a3fc87b46ae025392725fee0 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 1 Oct 2010 10:34:21 +0300 Subject: [PATCH 59/60] Fix Bug#56340 innodb updates index stats too frequently after non-index updates This is a manual merge from mysql-5.1-innodb of: revno: 3618 revision-id: vasil.dimov@oracle.com-20100930124844-yglojy7c3vaji6dx parent: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h committer: Vasil Dimov branch nick: mysql-5.1-innodb timestamp: Thu 2010-09-30 15:48:44 +0300 message: Fix Bug#56340 innodb updates index stats too frequently after non-index updates This is a simple optimization issue. All stats are related to only indexed columns, index size or number of rows in the whole table. UPDATEs that touch only non-indexed columns cannot affect stats and we can avoid calling the function row_update_statistics_if_needed() which may result in unnecessary I/O. Approved by: Marko (rb://466) In addition to the above message: we know that row_update_cascade_for_mysql() (the other place where row_update_statistics_if_needed is called) always updates indexed columns (FK-related), so there is no need to add this cond there. --- storage/innobase/row/row0mysql.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 1262ac71e98..29c1f919ed2 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1481,7 +1481,12 @@ run_again: srv_n_rows_updated++; } - row_update_statistics_if_needed(prebuilt->table); + /* We update table statistics only if it is a DELETE or UPDATE + that changes indexed columns, UPDATEs that change only non-indexed + columns would not affect statistics. */ + if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { + row_update_statistics_if_needed(prebuilt->table); + } trx->op_info = ""; From f7b01a39b55c7242dcf2af73006310225663fcc8 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 1 Oct 2010 14:51:00 +0300 Subject: [PATCH 60/60] Fix a potential bug when using __sync_lock_test_and_set() This is a manual merge from mysql-5.1-innodb of: revision-id: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h committer: Vasil Dimov timestamp: Thu 2010-09-30 13:26:18 +0300 message: Fix a potential bug when using __sync_lock_test_and_set() TYPE __sync_lock_test_and_set (TYPE *ptr, TYPE value, ...) it is not documented what happens if the two arguments are of different type like it was before: the first one was lock_word_t (byte) and the second one was 1 or 0 (int). Approved by: Marko (via IRC) --- storage/innobase/include/os0sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h index 0b600c80ce3..ec5ccee3e27 100644 --- a/storage/innobase/include/os0sync.h +++ b/storage/innobase/include/os0sync.h @@ -289,7 +289,7 @@ amount of increment. */ Returns the old value of *ptr, atomically sets *ptr to new_val */ # define os_atomic_test_and_set_byte(ptr, new_val) \ - __sync_lock_test_and_set(ptr, new_val) + __sync_lock_test_and_set(ptr, (byte) new_val) #elif defined(HAVE_IB_SOLARIS_ATOMICS)