summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-02-11 04:28:22 +0200
committerMichael Widenius <monty@askmonty.org>2011-02-11 04:28:22 +0200
commit55c55d85bd8fab635d038d77550f93fc996d47eb (patch)
tree8b3083f5be550cc65701fba04a171fa92e817110 /sql/ha_partition.cc
parent7e497abcfb3e761ba5a368316192ae930fb58f6b (diff)
downloadmariadb-git-55c55d85bd8fab635d038d77550f93fc996d47eb.tar.gz
Fixed bug in federatedx patch that caused partition tests to fail.
Fixed that connection string is returned for partitioned federated tables. mysql-test/r/partition_federated.result: Fixed error message mysql-test/suite/federated/federated_partition.result: Added test to show that connection string is returned in 'show create'. sql/ha_partition.cc: Fixed a set of bugs introduced by the last federated patch: - We can't allocate m_ordered_rec_buffer in memroot as it has to survive call to clear_handler_file() sql/partition_element.h: Ensure that connect_string is properly initialized. (This caused crashed in partition tests) sql/sql_partition.cc: Print CONNECTION option for federated partitioned tables
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 286cb94c830..0f6f52014ac 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -289,6 +289,7 @@ ha_partition::~ha_partition()
for (i= 0; i < m_tot_parts; i++)
delete m_file[i];
}
+ my_free(m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR));
clear_handler_file();
@@ -2234,9 +2235,10 @@ bool ha_partition::create_handler_file(const char *name)
part_elem= part_it++;
uint length = part_elem->connect_string.length;
int4store(buffer, length);
- my_write(file, buffer, 4, MYF(MY_WME | MY_NABP));
- my_write(file, (uchar *) part_elem->connect_string.str, length,
- MYF(MY_WME | MY_NABP));
+ if (my_write(file, buffer, 4, MYF(MY_WME | MY_NABP)) ||
+ my_write(file, (uchar *) part_elem->connect_string.str, length,
+ MYF(MY_WME | MY_NABP)))
+ result= TRUE;
}
VOID(my_close(file, MYF(0)));
}
@@ -2264,7 +2266,6 @@ void ha_partition::clear_handler_file()
m_file_buffer= NULL;
m_engine_array= NULL;
m_connect_string= NULL;
- m_ordered_rec_buffer= NULL;
}
/*
@@ -2568,7 +2569,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
alloc_len+= table_share->max_key_length;
if (!m_ordered_rec_buffer)
{
- if (!(m_ordered_rec_buffer= (uchar*) alloc_root(&m_mem_root, alloc_len)))
+ if (!(m_ordered_rec_buffer= (uchar*) (uchar*)my_malloc(alloc_len,
+ MYF(MY_WME))))
{
DBUG_RETURN(1);
}