mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip: Merge revisions 3479:3598 from branches/5.1:
------------------------------------------------------------------------ r3588 | inaam | 2008-12-18 14:26:54 +0200 (Thu, 18 Dec 2008) | 8 lines branches/5.1 It is a bug in unused code. If we don't calculate the hash value when calculating the mutex number then two pages which map to same hash value can get two different mutex numbers. Approved by: Marko ------------------------------------------------------------------------ r3590 | marko | 2008-12-18 15:33:36 +0200 (Thu, 18 Dec 2008) | 11 lines branches/5.1: When converting a record to MySQL format, copy the default column values for columns that are SQL NULL. This addresses failures in row-based replication (Bug #39648). row_prebuilt_t: Add default_rec, for the default values of the columns in MySQL format. row_sel_store_mysql_rec(): Use prebuilt->default_rec instead of padding columns. rb://64 approved by Heikki Tuuri ------------------------------------------------------------------------ r3598 | marko | 2008-12-22 15:28:03 +0200 (Mon, 22 Dec 2008) | 6 lines branches/5.1: ibuf_delete_rec(): When the record cannot be found and the tablespace has been dropped, commit the mini-transaction, so that InnoDB will not hold the insert buffer tree latch in exclusive mode, causing a potential deadlock. This bug was introduced in the fix of Bug #27276 in r2924. ------------------------------------------------------------------------
This commit is contained in:
parent
5697b755e6
commit
d1b5613fa0
5 changed files with 14 additions and 51 deletions
|
@ -2984,6 +2984,8 @@ retry:
|
||||||
prebuilt = row_create_prebuilt(ib_table);
|
prebuilt = row_create_prebuilt(ib_table);
|
||||||
|
|
||||||
prebuilt->mysql_row_len = table->s->reclength;
|
prebuilt->mysql_row_len = table->s->reclength;
|
||||||
|
prebuilt->default_rec = table->s->default_values;
|
||||||
|
ut_ad(prebuilt->default_rec);
|
||||||
|
|
||||||
/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
|
/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
|
||||||
|
|
||||||
|
|
|
@ -2984,7 +2984,7 @@ ibuf_delete_rec(
|
||||||
/* The tablespace has been dropped. It is possible
|
/* The tablespace has been dropped. It is possible
|
||||||
that another thread has deleted the insert buffer
|
that another thread has deleted the insert buffer
|
||||||
entry. Do not complain. */
|
entry. Do not complain. */
|
||||||
goto func_exit;
|
goto commit_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -3027,6 +3027,7 @@ ibuf_delete_rec(
|
||||||
#endif
|
#endif
|
||||||
ibuf_size_update(root, mtr);
|
ibuf_size_update(root, mtr);
|
||||||
|
|
||||||
|
commit_and_exit:
|
||||||
btr_pcur_commit_specify_mtr(pcur, mtr);
|
btr_pcur_commit_specify_mtr(pcur, mtr);
|
||||||
|
|
||||||
func_exit:
|
func_exit:
|
||||||
|
|
|
@ -71,7 +71,8 @@ hash_get_mutex_no(
|
||||||
ulint fold) /* in: fold */
|
ulint fold) /* in: fold */
|
||||||
{
|
{
|
||||||
ut_ad(ut_is_2pow(table->n_mutexes));
|
ut_ad(ut_is_2pow(table->n_mutexes));
|
||||||
return(ut_2pow_remainder(fold, table->n_mutexes));
|
return(ut_2pow_remainder(hash_calc_hash(fold, table),
|
||||||
|
table->n_mutexes));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
|
|
|
@ -617,6 +617,8 @@ struct row_prebuilt_struct {
|
||||||
byte* ins_upd_rec_buff;/* buffer for storing data converted
|
byte* ins_upd_rec_buff;/* buffer for storing data converted
|
||||||
to the Innobase format from the MySQL
|
to the Innobase format from the MySQL
|
||||||
format */
|
format */
|
||||||
|
const byte* default_rec; /* the default values of all columns
|
||||||
|
(a "default row") in MySQL format */
|
||||||
ulint hint_need_to_fetch_extra_cols;
|
ulint hint_need_to_fetch_extra_cols;
|
||||||
/* normally this is set to 0; if this
|
/* normally this is set to 0; if this
|
||||||
is set to ROW_RETRIEVE_PRIMARY_KEY,
|
is set to ROW_RETRIEVE_PRIMARY_KEY,
|
||||||
|
|
|
@ -2670,6 +2670,7 @@ row_sel_store_mysql_rec(
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(prebuilt->mysql_template);
|
ut_ad(prebuilt->mysql_template);
|
||||||
|
ut_ad(prebuilt->default_rec);
|
||||||
ut_ad(rec_offs_validate(rec, NULL, offsets));
|
ut_ad(rec_offs_validate(rec, NULL, offsets));
|
||||||
|
|
||||||
if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
|
if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
|
||||||
|
@ -2757,58 +2758,14 @@ row_sel_store_mysql_rec(
|
||||||
&= ~(byte) templ->mysql_null_bit_mask;
|
&= ~(byte) templ->mysql_null_bit_mask;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* MySQL seems to assume the field for an SQL NULL
|
/* MySQL assumes that the field for an SQL
|
||||||
value is set to zero or space. Not taking this into
|
NULL value is set to the default value. */
|
||||||
account caused seg faults with NULL BLOB fields, and
|
|
||||||
bug number 154 in the MySQL bug database: GROUP BY
|
|
||||||
and DISTINCT could treat NULL values inequal. */
|
|
||||||
int pad_char;
|
|
||||||
|
|
||||||
mysql_rec[templ->mysql_null_byte_offset]
|
mysql_rec[templ->mysql_null_byte_offset]
|
||||||
|= (byte) templ->mysql_null_bit_mask;
|
|= (byte) templ->mysql_null_bit_mask;
|
||||||
switch (templ->type) {
|
memcpy(mysql_rec + templ->mysql_col_offset,
|
||||||
case DATA_VARCHAR:
|
prebuilt->default_rec + templ->mysql_col_offset,
|
||||||
case DATA_BINARY:
|
templ->mysql_col_len);
|
||||||
case DATA_VARMYSQL:
|
|
||||||
if (templ->mysql_type
|
|
||||||
== DATA_MYSQL_TRUE_VARCHAR) {
|
|
||||||
/* This is a >= 5.0.3 type
|
|
||||||
true VARCHAR. Zero the field. */
|
|
||||||
pad_char = 0x00;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Fall through */
|
|
||||||
case DATA_CHAR:
|
|
||||||
case DATA_FIXBINARY:
|
|
||||||
case DATA_MYSQL:
|
|
||||||
/* MySQL pads all string types (except
|
|
||||||
BLOB, TEXT and true VARCHAR) with space. */
|
|
||||||
if (UNIV_UNLIKELY(templ->mbminlen == 2)) {
|
|
||||||
/* Treat UCS2 as a special case. */
|
|
||||||
byte* d = mysql_rec
|
|
||||||
+ templ->mysql_col_offset;
|
|
||||||
len = templ->mysql_col_len;
|
|
||||||
/* There are two UCS2 bytes per char,
|
|
||||||
so the length has to be even. */
|
|
||||||
ut_a(!(len & 1));
|
|
||||||
/* Pad with 0x0020. */
|
|
||||||
while (len) {
|
|
||||||
*d++ = 0x00;
|
|
||||||
*d++ = 0x20;
|
|
||||||
len -= 2;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pad_char = 0x20;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pad_char = 0x00;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_ad(!pad_char || templ->mbminlen == 1);
|
|
||||||
memset(mysql_rec + templ->mysql_col_offset,
|
|
||||||
pad_char, templ->mysql_col_len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue