3758 Marko Mäkelä 2012-04-30
Non-functional changes (formatting and data type cleanup)
modified:
storage/innobase/api/api0api.cc
storage/innobase/dict/dict0load.cc
storage/innobase/handler/ha_innodb.cc
3757 Marko Mäkelä 2012-04-30
Bug#14017795 DROP, ADD INDEX ON VARCHAR FAILS
innobase_find_equiv_index(): Subtract the length_bytes
from the pack_length() of MYSQL_TYPE_VARCHAR.
modified:
mysql-test/suite/innodb/r/innodb_bug13867871.result
mysql-test/suite/innodb/t/innodb_bug13867871.test
storage/innobase/handler/handler0alter.cc
3756 Tor Didriksen 2012-04-30
Bug#13988413 CRASH/ASSERTION AFTER INVALID MEMORY READ IN MY_USECONDS_TO_STR
Item_func_if::fix_length_and_dec() failed to calculate number of decimals
for time arguments.
@ sql-common/my_time.c
The '*' field width specifier to printf takes an int argument.
@ sql/item_cmpfunc.cc
In Item_func_if::fix_length_and_dec() call count_string_result_length()
to calculate length and number of decimals.
@ sql/sql_test.cc
Re-balance gcov comment.
modified:
mysql-test/r/func_time.result
mysql-test/t/func_time.test
sql-common/my_time.c
sql/item_cmpfunc.cc
sql/sql_test.cc
=== modified file 'mysql-test/suite/innodb/r/innodb_bug13867871.result'
--- a/mysql-test/suite/innodb/r/innodb_bug13867871.result revid:tor.didriksen@stripped430124256-wozwp9p9t99ggegf
+++ b/mysql-test/suite/innodb/r/innodb_bug13867871.result revid:marko.makela@stripped-20120430133952-zm14yt1vf6nfptxz
@@ -20,9 +20,6 @@ INSERT INTO ibtest11c VALUES (1, 5, 'khD
SET DEBUG_SYNC='foreign_constraint_check_for_update WAIT_FOR drop_done';
UPDATE ibtest11a SET A=2;
ALTER TABLE ibtest11c ADD INDEX idx_2(B, C), DROP INDEX idx, ALGORITHM=INPLACE;
-ERROR HY000: Cannot drop index 'idx': needed in a foreign key constraint
-CREATE INDEX idx_2 ON ibtest11c(B, C);
-DROP INDEX idx ON ibtest11c;
SET DEBUG_SYNC='now SIGNAL drop_done';
SELECT * FROM ibtest11c;
A D B C
=== modified file 'mysql-test/suite/innodb/t/innodb_bug13867871.test'
--- a/mysql-test/suite/innodb/t/innodb_bug13867871.test revid:tor.didriksen@stripped
+++ b/mysql-test/suite/innodb/t/innodb_bug13867871.test revid:marko.makela@strippedxz
@@ -58,14 +58,11 @@ SET DEBUG_SYNC='foreign_constraint_check
UPDATE ibtest11a SET A=2;
# drop the original FK index "idx" on table ibtest11a while above
-# insert blcoked in dict_foreign_replace_index()
+# insert blocked in dict_foreign_replace_index()
connection default;
---error ER_DROP_INDEX_FK
ALTER TABLE ibtest11c ADD INDEX idx_2(B, C), DROP INDEX idx, ALGORITHM=INPLACE;
-CREATE INDEX idx_2 ON ibtest11c(B, C);
-DROP INDEX idx ON ibtest11c;
SET DEBUG_SYNC='now SIGNAL drop_done';
connection con1;
=== modified file 'storage/innobase/api/api0api.cc'
--- a/storage/innobase/api/api0api.cc revid:tor.didriksen@stripped
+++ b/storage/innobase/api/api0api.cc revid:marko.makela@strippedom-20120430133952-zm14yt1vf6nfptxz
@@ -1144,7 +1144,7 @@ ib_cursor_open_index_using_name(
{
dict_table_t* table;
dict_index_t* index;
- ib_id_u64_t index_id = 0;
+ index_id_t index_id = 0;
ib_err_t err = DB_TABLE_NOT_FOUND;
ib_cursor_t* cursor = (ib_cursor_t*) ib_open_crsr;
@@ -2000,7 +2000,7 @@ ib_cursor_delete_row(
if (rec && !rec_get_deleted_flag(rec, page_format)) {
err = ib_delete_row(cursor, pcur, rec);
- } else{
+ } else {
err = DB_RECORD_NOT_FOUND;
}
} else {
=== modified file 'storage/innobase/dict/dict0load.cc'
--- a/storage/innobase/dict/dict0load.cc revid:tor.didriksen@oracle.com-20120430124256-wozwp9p9t99ggegf
+++ b/storage/innobase/dict/dict0load.cc revid:marko.makela@stripped0133952-zm14yt1vf6nfptxz
@@ -2029,6 +2029,7 @@ dict_load_table_on_id(
sys_table_ids = dict_table_get_next_index(
dict_table_get_first_index(sys_tables));
ut_ad(!dict_table_is_comp(sys_tables));
+ ut_ad(!dict_index_is_clust(sys_table_ids));
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
@@ -2424,6 +2425,7 @@ dict_load_foreigns(
sec_index = dict_table_get_next_index(
dict_table_get_first_index(sys_foreign));
+ ut_ad(!dict_index_is_clust(sec_index));
start_load:
tuple = dtuple_create_from_mem(tuple_buf, sizeof(tuple_buf), 1);
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc revid:tor.didriksen@stripped
+++ b/storage/innobase/handler/ha_innodb.cc revid:marko.makela@oracle.com-20120430133952-zm14yt1vf6nfptxz
@@ -5883,6 +5883,10 @@ ha_innobase::build_template(
prebuilt->need_to_access_clustered = (index == clust_index);
+ /* Either prebuilt->index should be a secondary index, or it
+ should be the clustered index. */
+ ut_ad(dict_index_is_clust(index) == (index == clust_index));
+
/* Below we check column by column if we need to access
the clustered index. */
@@ -9815,10 +9819,10 @@ ha_rows
ha_innobase::estimate_rows_upper_bound()
/*====================================*/
{
- dict_index_t* index;
- ulonglong estimate;
- ulonglong local_data_file_length;
- ulint stat_n_leaf_pages;
+ const dict_index_t* index;
+ ulonglong estimate;
+ ulonglong local_data_file_length;
+ ulint stat_n_leaf_pages;
DBUG_ENTER("estimate_rows_upper_bound");
@@ -9828,8 +9832,7 @@ ha_innobase::estimate_rows_upper_bound()
update_thd(ha_thd());
- prebuilt->trx->op_info = (char*)
- "calculating upper bound for table rows";
+ prebuilt->trx->op_info = "calculating upper bound for table rows";
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -9845,16 +9848,15 @@ ha_innobase::estimate_rows_upper_bound()
local_data_file_length =
((ulonglong) stat_n_leaf_pages) * UNIV_PAGE_SIZE;
-
/* Calculate a minimum length for a clustered index record and from
that an upper bound for the number of rows. Since we only calculate
new statistics in row0mysql.cc when a table has grown by a threshold
factor, we must add a safety factor 2 in front of the formula below. */
- estimate = 2 * local_data_file_length /
- dict_index_calc_min_rec_len(index);
+ estimate = 2 * local_data_file_length
+ / dict_index_calc_min_rec_len(index);
- prebuilt->trx->op_info = (char*)"";
+ prebuilt->trx->op_info = "";
DBUG_RETURN((ha_rows) estimate);
}
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc revid:tor.didriksen@stripped56-wozwp9p9t99ggegf
+++ b/storage/innobase/handler/handler0alter.cc revid:marko.makela@strippedm14yt1vf6nfptxz
@@ -1215,7 +1215,18 @@ no_match:
for (uint j = 0; j < n_cols; j++) {
const KEY_PART_INFO& key_part = key->key_part[j];
- if (key_part.length < key_part.field->pack_length()) {
+ uint32 col_len
+ = key_part.field->pack_length();
+
+ /* The MySQL pack length contains 1 or 2 bytes
+ length field for a true VARCHAR. */
+
+ if (key_part.field->type() == MYSQL_TYPE_VARCHAR) {
+ col_len -= static_cast<const Field_varstring*>(
+ key_part.field)->length_bytes;
+ }
+
+ if (key_part.length < col_len) {
/* Column prefix indexes cannot be
used for FOREIGN KEY constraints. */
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk branch (marko.makela:3756 to 3758) | marko.makela | 2 May |