summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2012-04-26 20:18:30 +0300
committerSeppo Jaakola <seppo.jaakola@codership.com>2012-04-26 20:18:30 +0300
commit609388fcfd912c9c2cb03a92251469a25a781893 (patch)
tree9135fdc6e31e1e784fbdbcc35ae63003d0600824 /storage
parente0015163515d1fe5d3747c6f859461a30c2ecfd6 (diff)
downloadmariadb-git-609388fcfd912c9c2cb03a92251469a25a781893.tar.gz
Merged changes from lp:codership-mysql up to rev 3743
-r3725..3737 -r3738..3740 -r3741..3743
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
-rw-r--r--storage/innobase/rem/rem0rec.c26
-rw-r--r--storage/xtradb/handler/ha_innodb.cc5
-rw-r--r--storage/xtradb/rem/rem0rec.c26
4 files changed, 32 insertions, 30 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index c9d4a28868d..050ebf7d505 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -6945,11 +6945,6 @@ wsrep_append_foreign_key(
byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1];
ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH;
- if (!dict_index_is_clust(clust_index)) {
- WSREP_ERROR("clustered index not passed for FK append");
- return DB_ERROR;
- }
-
key[0] = '\0';
rcode = wsrep_rec_get_primary_key(
&key[1], &len, clust_rec, clust_index);
diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c
index 9ba1c646d9d..dbfc41881ce 100644
--- a/storage/innobase/rem/rem0rec.c
+++ b/storage/innobase/rem/rem0rec.c
@@ -1790,25 +1790,23 @@ wsrep_rec_get_primary_key(
uint key_parts;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ const ulint* offsets;
ut_ad(index);
- key_parts = dict_index_get_n_unique_in_tree(index);
- *offsets_ = (sizeof offsets_) / sizeof *offsets_;
- rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap);
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
+ rec_offs_init(offsets_);
+ offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap);
- ut_ad(rec_offs_validate(rec, NULL, offsets_));
+ ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(rec);
+ key_parts = dict_index_get_n_unique_in_tree(index);
for (i = 0; i < key_parts; i++) {
- dict_field_t* field = dict_index_get_nth_field(index, i);
+ dict_field_t* field = dict_index_get_nth_field(index, i);
const dict_col_t* col = dict_field_get_col(field);
- data = rec_get_nth_field(rec, offsets_, i, &len);
+ data = rec_get_nth_field(rec, offsets, i, &len);
if (key_len + len > ((col->prtype & DATA_NOT_NULL) ?
*buf_len : *buf_len - 1)) {
fprintf (stderr,
@@ -1836,11 +1834,19 @@ wsrep_rec_get_primary_key(
}
}
- rec_validate(rec, offsets_);
+ rec_validate(rec, offsets);
+
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
*buf_len = key_len;
return DB_SUCCESS;
err_out:
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
return DB_ERROR;
}
#endif // WITH_WSREP
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 9e10cbc5d34..a1119fc3d47 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -7589,11 +7589,6 @@ wsrep_append_foreign_key(
byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1];
ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH;
- if (!dict_index_is_clust(clust_index)) {
- WSREP_ERROR("clustered index not passed for FK append");
- return DB_ERROR;
- }
-
key[0] = '\0';
rcode = wsrep_rec_get_primary_key(
&key[1], &len, clust_rec, clust_index);
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c
index 9ba1c646d9d..dbfc41881ce 100644
--- a/storage/xtradb/rem/rem0rec.c
+++ b/storage/xtradb/rem/rem0rec.c
@@ -1790,25 +1790,23 @@ wsrep_rec_get_primary_key(
uint key_parts;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ const ulint* offsets;
ut_ad(index);
- key_parts = dict_index_get_n_unique_in_tree(index);
- *offsets_ = (sizeof offsets_) / sizeof *offsets_;
- rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap);
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
+ rec_offs_init(offsets_);
+ offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap);
- ut_ad(rec_offs_validate(rec, NULL, offsets_));
+ ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(rec);
+ key_parts = dict_index_get_n_unique_in_tree(index);
for (i = 0; i < key_parts; i++) {
- dict_field_t* field = dict_index_get_nth_field(index, i);
+ dict_field_t* field = dict_index_get_nth_field(index, i);
const dict_col_t* col = dict_field_get_col(field);
- data = rec_get_nth_field(rec, offsets_, i, &len);
+ data = rec_get_nth_field(rec, offsets, i, &len);
if (key_len + len > ((col->prtype & DATA_NOT_NULL) ?
*buf_len : *buf_len - 1)) {
fprintf (stderr,
@@ -1836,11 +1834,19 @@ wsrep_rec_get_primary_key(
}
}
- rec_validate(rec, offsets_);
+ rec_validate(rec, offsets);
+
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
*buf_len = key_len;
return DB_SUCCESS;
err_out:
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
return DB_ERROR;
}
#endif // WITH_WSREP