summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/csv.result47
-rw-r--r--mysql-test/t/csv.test37
-rw-r--r--ndb/src/ndbapi/NdbImpl.hpp10
-rw-r--r--ndb/src/ndbapi/NdbRecAttr.cpp4
-rw-r--r--sql/examples/ha_tina.cc22
-rw-r--r--sql/field.cc13
-rw-r--r--support-files/mysql.spec.sh1
7 files changed, 116 insertions, 18 deletions
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index ea0d34271b5..2e3d11ad461 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -4929,3 +4929,50 @@ Warnings:
Note 1051 Unknown table 't2'
Note 1051 Unknown table 't3'
Note 1051 Unknown table 't4'
+DROP TABLE IF EXISTS bug13894;
+CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
+INSERT INTO bug13894 VALUES (5);
+INSERT INTO bug13894 VALUES (10);
+INSERT INTO bug13894 VALUES (11);
+INSERT INTO bug13894 VALUES (10);
+SELECT * FROM bug13894;
+val
+5
+10
+11
+10
+UPDATE bug13894 SET val=6 WHERE val=10;
+SELECT * FROM bug13894;
+val
+5
+11
+6
+6
+DROP TABLE bug13894;
+DROP TABLE IF EXISTS bug14672;
+CREATE TABLE bug14672 (c1 integer) engine = CSV;
+INSERT INTO bug14672 VALUES (1), (2), (3);
+SELECT * FROM bug14672;
+c1
+1
+2
+3
+DELETE FROM bug14672 WHERE c1 = 2;
+SELECT * FROM bug14672;
+c1
+1
+3
+INSERT INTO bug14672 VALUES (4);
+SELECT * FROM bug14672;
+c1
+1
+3
+4
+INSERT INTO bug14672 VALUES (5);
+SELECT * FROM bug14672;
+c1
+1
+3
+4
+5
+DROP TABLE bug14672;
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 2ac46d75f9a..5b693335a43 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1314,4 +1314,41 @@ select period from t1;
drop table if exists t1,t2,t3,t4;
+#
+# Bug #13894 Server crashes on update of CSV table
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS bug13894;
+--enable_warnings
+
+CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
+INSERT INTO bug13894 VALUES (5);
+INSERT INTO bug13894 VALUES (10);
+INSERT INTO bug13894 VALUES (11);
+INSERT INTO bug13894 VALUES (10);
+SELECT * FROM bug13894;
+UPDATE bug13894 SET val=6 WHERE val=10;
+SELECT * FROM bug13894;
+DROP TABLE bug13894;
+
+#
+# Bug #14672 Bug in deletion
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS bug14672;
+--enable_warnings
+
+CREATE TABLE bug14672 (c1 integer) engine = CSV;
+INSERT INTO bug14672 VALUES (1), (2), (3);
+SELECT * FROM bug14672;
+DELETE FROM bug14672 WHERE c1 = 2;
+SELECT * FROM bug14672;
+INSERT INTO bug14672 VALUES (4);
+SELECT * FROM bug14672;
+INSERT INTO bug14672 VALUES (5);
+SELECT * FROM bug14672;
+DROP TABLE bug14672;
+
# End of 4.1 tests
diff --git a/ndb/src/ndbapi/NdbImpl.hpp b/ndb/src/ndbapi/NdbImpl.hpp
index d50f1fa84fe..c668533457d 100644
--- a/ndb/src/ndbapi/NdbImpl.hpp
+++ b/ndb/src/ndbapi/NdbImpl.hpp
@@ -89,11 +89,9 @@ public:
/**
* NOTE free lists must be _after_ theNdbObjectIdMap take
* assure that destructors are run in correct order
+ * NOTE these has to be in this specific order to make destructor run in
+ * correct order
*/
- Ndb_free_list_t<NdbTransaction> theConIdleList;
- Ndb_free_list_t<NdbOperation> theOpIdleList;
- Ndb_free_list_t<NdbIndexScanOperation> theScanOpIdleList;
- Ndb_free_list_t<NdbIndexOperation> theIndexOpIdleList;
Ndb_free_list_t<NdbRecAttr> theRecAttrIdleList;
Ndb_free_list_t<NdbApiSignal> theSignalIdleList;
Ndb_free_list_t<NdbLabel> theLabelList;
@@ -102,6 +100,10 @@ public:
Ndb_free_list_t<NdbCall> theCallList;
Ndb_free_list_t<NdbBlob> theNdbBlobIdleList;
Ndb_free_list_t<NdbReceiver> theScanList;
+ Ndb_free_list_t<NdbIndexScanOperation> theScanOpIdleList;
+ Ndb_free_list_t<NdbOperation> theOpIdleList;
+ Ndb_free_list_t<NdbIndexOperation> theIndexOpIdleList;
+ Ndb_free_list_t<NdbTransaction> theConIdleList;
};
#ifdef VM_TRACE
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp
index 2245707bf65..771da56523c 100644
--- a/ndb/src/ndbapi/NdbRecAttr.cpp
+++ b/ndb/src/ndbapi/NdbRecAttr.cpp
@@ -24,6 +24,7 @@
NdbRecAttr::NdbRecAttr(Ndb*)
{
+ theStorageX = 0;
init();
}
@@ -53,6 +54,9 @@ NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue)
theNULLind = 0;
m_nullable = anAttrInfo->m_nullable;
+ if (theStorageX)
+ delete[] theStorageX;
+
// check alignment to signal data
// a future version could check alignment per data type as well
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 541e91f4b46..e00657c66ba 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -82,12 +82,16 @@ handlerton tina_hton= {
** TINA tables
*****************************************************************************/
-/*
- Used for sorting chains.
+/*
+ Used for sorting chains with qsort().
*/
int sort_set (tina_set *a, tina_set *b)
{
- return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
+ /*
+ We assume that intervals do not intersect. So, it is enought to compare
+ any two points. Here we take start of intervals for comparison.
+ */
+ return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) );
}
static byte* tina_get_key(TINA_SHARE *share,uint *length,
@@ -186,7 +190,8 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
- if ((share->data_file= my_open(data_file_name, O_RDWR, MYF(0))) == -1)
+ if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND,
+ MYF(0))) == -1)
goto error2;
/* We only use share->data_file for writing, so we scan to the end to append */
@@ -797,13 +802,8 @@ int ha_tina::rnd_end()
qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set);
for (ptr= chain; ptr < chain_ptr; ptr++)
{
- /* We peek a head to see if this is the last chain */
- if (ptr+1 == chain_ptr)
- memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
- length - (size_t)ptr->end);
- else
- memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end,
- (size_t)((ptr++)->begin - ptr->end));
+ memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
+ length - (size_t)ptr->end);
length= length - (size_t)(ptr->end - ptr->begin);
}
diff --git a/sql/field.cc b/sql/field.cc
index 18ef77230f2..381a13c3263 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -6202,9 +6202,16 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table)
This is done to ensure that ALTER TABLE will convert old VARCHAR fields
to now VARCHAR fields.
*/
- return new Field_varstring(field_length, maybe_null(),
- field_name, new_table,
- charset());
+ Field *new_field= new Field_varstring(field_length, maybe_null(),
+ field_name, new_table,
+ charset());
+ /*
+ delayed_insert::get_local_table() needs a ptr copied from old table.
+ This is what other new_field() methods do too. The above method of
+ Field_varstring sets ptr to NULL.
+ */
+ new_field->ptr= ptr;
+ return new_field;
}
/****************************************************************************
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 1b74ce50328..7b2eee5f821 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -259,6 +259,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
--includedir=%{_includedir} \
--mandir=%{_mandir} \
--enable-thread-safe-client \
+ --with-zlib-dir=bundled \
--with-readline ; \
# Add this for more debugging support
# --with-debug