diff options
author | Timothy Smith <timothy.smith@sun.com> | 2009-01-12 23:35:05 +0100 |
---|---|---|
committer | Timothy Smith <timothy.smith@sun.com> | 2009-01-12 23:35:05 +0100 |
commit | a2ccdd8b6a7f7bfb3e4fafee47669d0e6005da7a (patch) | |
tree | f1908b2b920a5bc589ad87140dc5c57af6a7017e /storage/innobase/row | |
parent | e26b8a6cfea868b9d5f34ed8fab989c7287f0c09 (diff) | |
download | mariadb-git-a2ccdd8b6a7f7bfb3e4fafee47669d0e6005da7a.tar.gz |
Applying InnoDB snapshot innodb-5.1-ss3603
Detailed description of changes:
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
Diffstat (limited to 'storage/innobase/row')
-rw-r--r-- | storage/innobase/row/row0mysql.c | 1 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.c | 55 |
2 files changed, 7 insertions, 49 deletions
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 1019f33efef..1713863f1fe 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -620,6 +620,7 @@ row_create_prebuilt( prebuilt->ins_node = NULL; prebuilt->ins_upd_rec_buff = NULL; + prebuilt->default_rec = NULL; prebuilt->upd_node = NULL; prebuilt->ins_graph = NULL; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 79f107ce77d..f53dfe8a686 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2597,6 +2597,7 @@ row_sel_store_mysql_rec( ulint i; ut_ad(prebuilt->mysql_template); + ut_ad(prebuilt->default_rec); ut_ad(rec_offs_validate(rec, NULL, offsets)); if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) { @@ -2683,58 +2684,14 @@ row_sel_store_mysql_rec( &= ~(byte) templ->mysql_null_bit_mask; } } else { - /* MySQL seems to assume the field for an SQL NULL - value is set to zero or space. Not taking this into - 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 assumes that the field for an SQL + NULL value is set to the default value. */ mysql_rec[templ->mysql_null_byte_offset] |= (byte) templ->mysql_null_bit_mask; - switch (templ->type) { - case DATA_VARCHAR: - case DATA_BINARY: - 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. */ - data = 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) { - *data++ = 0x00; - *data++ = 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); + memcpy(mysql_rec + templ->mysql_col_offset, + prebuilt->default_rec + templ->mysql_col_offset, + templ->mysql_col_len); } } |