summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-03-02 17:34:50 +0300
committerAlexander Nozdrin <alik@sun.com>2010-03-02 17:34:50 +0300
commitd3755291caa9c93f7aca42c09db9aeb1df0ef84f (patch)
treeb41651212156dfd684f8a54791bdf3b7cfc85c25 /storage
parentb184d466acee921247541fd0a42eb62d23b07dec (diff)
parent64b91b2698603d24e8ffde46fc9421a6d2442a35 (diff)
downloadmariadb-git-d3755291caa9c93f7aca42c09db9aeb1df0ef84f.tar.gz
Manual merge from mysql-next-mr.
Conflicts: - sql/sql_base.cc
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/ha_archive.cc21
-rw-r--r--storage/csv/ha_tina.cc16
-rw-r--r--storage/heap/ha_heap.cc2
-rw-r--r--storage/myisam/ft_boolean_search.c12
-rw-r--r--storage/myisam/ha_myisam.cc2
-rw-r--r--storage/myisam/mi_dynrec.c8
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/ndb/src/common/util/Makefile.am2
8 files changed, 50 insertions, 15 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index d902a4557dc..f95a7252f2f 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -384,6 +384,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
*/
if (!(azopen(&archive_tmp, share->data_file_name, O_RDONLY|O_BINARY)))
{
+ *rc= my_errno ? my_errno : -1;
+ mysql_mutex_unlock(&archive_mutex);
+ my_free(share, MYF(0));
DBUG_RETURN(NULL);
}
stats.auto_increment_value= archive_tmp.auto_increment + 1;
@@ -533,16 +536,18 @@ int ha_archive::open(const char *name, int mode, uint open_options)
For now we have to refuse to open such table to avoid
potential data loss.
*/
- if ((rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
- || rc == HA_ERR_TABLE_NEEDS_UPGRADE)
+ switch (rc)
{
- /* purecov: begin inspected */
+ case 0:
+ break;
+ case HA_ERR_CRASHED_ON_USAGE:
+ if (open_options & HA_OPEN_FOR_REPAIR)
+ break;
+ /* fall through */
+ case HA_ERR_TABLE_NEEDS_UPGRADE:
free_share();
- DBUG_RETURN(rc);
- /* purecov: end */
- }
- else if (rc == HA_ERR_OUT_OF_MEM)
- {
+ /* fall through */
+ default:
DBUG_RETURN(rc);
}
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 52462ca9c90..cefb1577b16 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -784,9 +784,21 @@ int ha_tina::find_current_row(uchar *buf)
if (read_all || bitmap_is_set(table->read_set, (*field)->field_index))
{
+ bool is_enum= ((*field)->real_type() == MYSQL_TYPE_ENUM);
+ /*
+ Here CHECK_FIELD_WARN checks that all values in the csv file are valid
+ which is normally the case, if they were written by
+ INSERT -> ha_tina::write_row. '0' values on ENUM fields are considered
+ invalid by Field_enum::store() but it can store them on INSERT anyway.
+ Thus, for enums we silence the warning, as it doesn't really mean
+ an invalid value.
+ */
if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
- CHECK_FIELD_WARN))
- goto err;
+ is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))
+ {
+ if (!is_enum)
+ goto err;
+ }
if ((*field)->flags & BLOB_FLAG)
{
Field_blob *blob= *(Field_blob**) field;
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 8d07d21c6ae..4d01b9fd1c9 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -689,7 +689,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
if (field->flags & (ENUM_FLAG | SET_FLAG))
seg->charset= &my_charset_bin;
else
- seg->charset= field->charset();
+ seg->charset= field->charset_for_protocol();
if (field->null_ptr)
{
seg->null_bit= field->null_bit;
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 492261c5efc..52ad6b11aa1 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
return 0;
}
- /* going up to the first-level tree to continue search there */
+ /*
+ Going up to the first-level tree to continue search there.
+ Only done when performing prefix search.
+
+ Key buffer data pointer as well as docid[0] may be smaller
+ than values we got while searching first-level tree. Thus
+ they must be restored to original values to avoid dead-loop,
+ when subsequent search for a bigger value eventually ends up
+ in this same second-level tree.
+ */
_mi_dpointer(info, (uchar*) (lastkey_buf+HA_FT_WLEN), ftbw->key_root);
+ ftbw->docid[0]= ftbw->key_root;
ftbw->key_root=info->s->state.key_root[ftb->keynr];
ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
ftbw->off=0;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 77b94947ba6..13f042ba904 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -274,7 +274,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
keydef[i].seg[j].bit_start= keydef[i].seg[j].bit_end=
keydef[i].seg[j].bit_length= 0;
keydef[i].seg[j].bit_pos= 0;
- keydef[i].seg[j].language= field->charset()->number;
+ keydef[i].seg[j].language= field->charset_for_protocol()->number;
if (field->null_ptr)
{
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 4c681eeff5f..3830763c673 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -936,8 +936,16 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
}
if (block_info.next_filepos != HA_OFFSET_ERROR)
+ {
+ /*
+ delete_dynamic_record() may change data file position.
+ IO cache must be notified as it may still have cached
+ data, which has to be flushed later.
+ */
+ info->rec_cache.seek_not_done= 1;
if (delete_dynamic_record(info,block_info.next_filepos,1))
goto err;
+ }
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index bfe79f51e4e..065f18965d1 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -325,8 +325,8 @@ void mi_update_status(void* param)
(long) info->s->state.state.data_file_length));
#endif
info->s->state.state= *info->state;
- info->state= &info->s->state.state;
}
+ info->state= &info->s->state.state;
info->append_insert_at_end= 0;
/*
diff --git a/storage/ndb/src/common/util/Makefile.am b/storage/ndb/src/common/util/Makefile.am
index 5379a425c49..5cf02fed12f 100644
--- a/storage/ndb/src/common/util/Makefile.am
+++ b/storage/ndb/src/common/util/Makefile.am
@@ -37,7 +37,7 @@ testBitmask_LDFLAGS = @ndb_bin_am_ldflags@ \
testBitmask.cpp : Bitmask.cpp
rm -f testBitmask.cpp
- @LN_CP_F@ Bitmask.cpp testBitmask.cpp
+ @LN_CP_F@ $(srcdir)/Bitmask.cpp testBitmask.cpp
testBitmask.o: $(testBitmask_SOURCES)
$(CXXCOMPILE) -c $(INCLUDES) -D__TEST_BITMASK__ $<