summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@oracle.com>2011-06-30 13:23:34 +0300
committerMarko Mäkelä <marko.makela@oracle.com>2011-06-30 13:23:34 +0300
commiteaa2a0a9c05cb76572baa5987dd3e8058aa6147c (patch)
treeb73a8374821004c2ec78ceeb8ec827770d2bd8c1 /storage
parent88eb572c25eb81492d0861d266a85a2d1f571abb (diff)
parenteeb028bbc1695b8727ee9e58c173c85f1abcb29c (diff)
downloadmariadb-git-eaa2a0a9c05cb76572baa5987dd3e8058aa6147c.tar.gz
Merge mysql-5.1 to mysql-5.5.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/row/row0row.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/storage/innobase/row/row0row.c b/storage/innobase/row/row0row.c
index 8e2e38e335a..74bc96b8191 100644
--- a/storage/innobase/row/row0row.c
+++ b/storage/innobase/row/row0row.c
@@ -101,12 +101,27 @@ row_build_index_entry(
dfield_copy(dfield, dfield2);
- if (dfield_is_null(dfield) || ind_field->prefix_len == 0) {
+ if (dfield_is_null(dfield)) {
continue;
}
- /* If a column prefix index, take only the prefix.
- Prefix-indexed columns may be externally stored. */
+ if (ind_field->prefix_len == 0
+ && (!dfield_is_ext(dfield)
+ || dict_index_is_clust(index))) {
+ /* The dfield_copy() above suffices for
+ columns that are stored in-page, or for
+ clustered index record columns that are not
+ part of a column prefix in the PRIMARY KEY. */
+ continue;
+ }
+
+ /* If the column is stored externally (off-page) in
+ the clustered index, it must be an ordering field in
+ the secondary index. In the Antelope format, only
+ prefix-indexed columns may be stored off-page in the
+ clustered index record. In the Barracuda format, also
+ fully indexed long CHAR or VARCHAR columns may be
+ stored off-page. */
ut_ad(col->ord_part);
if (UNIV_LIKELY_NULL(ext)) {
@@ -119,11 +134,32 @@ row_build_index_entry(
}
dfield_set_data(dfield, buf, len);
}
+
+ if (ind_field->prefix_len == 0) {
+ /* In the Barracuda format
+ (ROW_FORMAT=DYNAMIC or
+ ROW_FORMAT=COMPRESSED), we can have a
+ secondary index on an entire column
+ that is stored off-page in the
+ clustered index. As this is not a
+ prefix index (prefix_len == 0),
+ include the entire off-page column in
+ the secondary index record. */
+ continue;
+ }
} else if (dfield_is_ext(dfield)) {
+ /* This table should be in Antelope format
+ (ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT).
+ In that format, the maximum column prefix
+ index length is 767 bytes, and the clustered
+ index record contains a 768-byte prefix of
+ each off-page column. */
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
len -= BTR_EXTERN_FIELD_REF_SIZE;
}
+ /* If a column prefix index, take only the prefix. */
+ ut_ad(ind_field->prefix_len);
len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminmaxlen,
ind_field->prefix_len, len, dfield_get_data(dfield));