Below is the list of changes that have just been committed into a local
5.1 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-06-14 16:19:47+05:00, svoj@stripped +2 -0
Merge mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.1-engines
MERGE: 1.1810.2944.43
mysql-test/r/merge.result@stripped, 2007-06-14 16:19:44+05:00, svoj@stripped +0 -0
Auto merged
MERGE: 1.43.1.19
storage/myisammrg/ha_myisammrg.cc@stripped, 2007-06-14 16:19:44+05:00, svoj@stripped
+0 -0
Auto merged
MERGE: 1.59.17.2
storage/myisammrg/ha_myisammrg.cc@stripped, 2007-06-14 16:19:44+05:00,
svoj@stripped +0 -0
Merge rename: sql/ha_myisammrg.cc -> storage/myisammrg/ha_myisammrg.cc
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: svoj
# Host: june.mysql.com
# Root: /home/svoj/devel/mysql/BUG26976/mysql-5.1-engines/RESYNC
--- 1.59.17.1/sql/ha_myisammrg.cc 2007-06-14 16:18:00 +05:00
+++ 1.123/storage/myisammrg/ha_myisammrg.cc 2007-06-14 16:19:44 +05:00
@@ -18,48 +18,28 @@
#pragma implementation // gcc: Class implementation
#endif
+#define MYSQL_SERVER 1
#include "mysql_priv.h"
+#include <mysql/plugin.h>
#include <m_ctype.h>
#include "ha_myisammrg.h"
-#ifndef MASTER
-#include "../srclib/myisammrg/myrg_def.h"
-#else
-#include "../myisammrg/myrg_def.h"
-#endif
+#include "myrg_def.h"
+
/*****************************************************************************
** MyISAM MERGE tables
*****************************************************************************/
-/* MyISAM MERGE handlerton */
-
-handlerton myisammrg_hton= {
- "MRG_MYISAM",
- SHOW_OPTION_YES,
- "Collection of identical MyISAM tables",
- DB_TYPE_MRG_MYISAM,
- NULL,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- HTON_CAN_RECREATE
-};
+static handler *myisammrg_create_handler(handlerton *hton,
+ TABLE_SHARE *table,
+ MEM_ROOT *mem_root)
+{
+ return new (mem_root) ha_myisammrg(hton, table);
+}
-ha_myisammrg::ha_myisammrg(TABLE *table_arg)
- :handler(&myisammrg_hton, table_arg), file(0)
+ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
+ :handler(hton, table_arg), file(0)
{}
static const char *ha_myisammrg_exts[] = {
@@ -120,13 +100,14 @@ int ha_myisammrg::open(const char *name,
char name_buff[FN_REFLEN];
DBUG_PRINT("info", ("ha_myisammrg::open"));
- if (!(file=myrg_open(fn_format(name_buff,name,"","",2 | 4), mode,
- test_if_locked)))
+ if (!(file=myrg_open(fn_format(name_buff,name,"","",
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
+ mode, test_if_locked)))
{
DBUG_PRINT("info", ("ha_myisammrg::open exit %d", my_errno));
return (my_errno ? my_errno : -1);
}
- DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."))
+ DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."));
myrg_extrafunc(file, query_cache_invalidate_by_MyISAM_filename_ref);
if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
@@ -135,10 +116,10 @@ int ha_myisammrg::open(const char *name,
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
myrg_extra(file,HA_EXTRA_WAIT_LOCK,0);
- if (table->s->reclength != mean_rec_length && mean_rec_length)
+ if (table->s->reclength != stats.mean_rec_length &&
stats.mean_rec_length)
{
DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu",
- table->s->reclength, mean_rec_length));
+ table->s->reclength, stats.mean_rec_length));
if (test_if_locked & HA_OPEN_FOR_REPAIR)
myrg_print_wrong_table(file->open_tables->table->filename);
error= HA_ERR_WRONG_MRG_TABLE_DEF;
@@ -164,12 +145,12 @@ int ha_myisammrg::open(const char *name,
myrg_print_wrong_table(u_table->table->filename);
else
{
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
goto err;
}
}
}
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
if (error == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
@@ -192,9 +173,9 @@ int ha_myisammrg::close(void)
return myrg_close(file);
}
-int ha_myisammrg::write_row(byte * buf)
+int ha_myisammrg::write_row(uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (file->merge_insert_method == MERGE_INSERT_DISABLED || !file->tables)
return (HA_ERR_TABLE_READONLY);
@@ -210,121 +191,117 @@ int ha_myisammrg::write_row(byte * buf)
return myrg_write(file,buf);
}
-int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
+int ha_myisammrg::update_row(const uchar * old_data, uchar * new_data)
{
- statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return myrg_update(file,old_data,new_data);
}
-int ha_myisammrg::delete_row(const byte * buf)
+int ha_myisammrg::delete_row(const uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
return myrg_delete(file,buf);
}
-int ha_myisammrg::index_read(byte * buf, const byte * key,
- uint key_len, enum ha_rkey_function find_flag)
+int ha_myisammrg::index_read(uchar * buf, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
- int error=myrg_rkey(file,buf,active_index, key, key_len, find_flag);
+ ha_statistic_increment(&SSV::ha_read_key_count);
+ int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
- uint key_len, enum ha_rkey_function find_flag)
+int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
- int error=myrg_rkey(file,buf,index, key, key_len, find_flag);
+ ha_statistic_increment(&SSV::ha_read_key_count);
+ int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_read_last(byte * buf, const byte * key, uint key_len)
+int ha_myisammrg::index_read_last(uchar * buf, const uchar * key,
+ key_part_map keypart_map)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
- int error=myrg_rkey(file,buf,active_index, key, key_len,
+ ha_statistic_increment(&SSV::ha_read_key_count);
+ int error=myrg_rkey(file,buf,active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_next(byte * buf)
+int ha_myisammrg::index_next(uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_prev(byte * buf)
+int ha_myisammrg::index_prev(uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
int error=myrg_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_first(byte * buf)
+int ha_myisammrg::index_first(uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
int error=myrg_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_last(byte * buf)
+int ha_myisammrg::index_last(uchar * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_last_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
int error=myrg_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::index_next_same(byte * buf,
- const byte *key __attribute__((unused)),
+int ha_myisammrg::index_next_same(uchar * buf,
+ const uchar *key __attribute__((unused)),
uint length __attribute__((unused)))
{
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
+
int ha_myisammrg::rnd_init(bool scan)
{
- return myrg_extra(file,HA_EXTRA_RESET,0);
+ return myrg_reset(file);
}
-int ha_myisammrg::rnd_next(byte *buf)
+
+int ha_myisammrg::rnd_next(uchar *buf)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
+
+int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
-void ha_myisammrg::position(const byte *record)
+void ha_myisammrg::position(const uchar *record)
{
ulonglong row_position= myrg_position(file);
my_store_ptr(ref, ref_length, (my_off_t) row_position);
@@ -346,19 +323,17 @@ int ha_myisammrg::info(uint flag)
The following fails if one has not compiled MySQL with -DBIG_TABLES
and one has more than 2^32 rows in the merge tables.
*/
- records = (ha_rows) mrg_info.records;
- deleted = (ha_rows) mrg_info.deleted;
+ stats.records = (ha_rows) mrg_info.records;
+ stats.deleted = (ha_rows) mrg_info.deleted;
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
if ((mrg_info.records >= (ulonglong) 1 << 32) ||
(mrg_info.deleted >= (ulonglong) 1 << 32))
table->s->crashed= 1;
#endif
- data_file_length=mrg_info.data_file_length;
- errkey = mrg_info.errkey;
+ stats.data_file_length= mrg_info.data_file_length;
+ errkey= mrg_info.errkey;
table->s->keys_in_use.set_prefix(table->s->keys);
- table->s->db_options_in_use= mrg_info.options;
- table->s->is_view= 1;
- mean_rec_length= mrg_info.reclength;
+ stats.mean_rec_length= mrg_info.reclength;
/*
The handler::block_size is used all over the code in index scan cost
@@ -376,11 +351,11 @@ int ha_myisammrg::info(uint flag)
TODO: In 5.2 index scan cost calculation will be factored out into a
virtual function in class handler and we'll be able to remove this hack.
*/
- block_size= 0;
+ stats.block_size= 0;
if (file->tables)
- block_size= myisam_block_size / file->tables;
+ stats.block_size= myisam_block_size / file->tables;
- update_time=0;
+ stats.update_time= 0;
#if SIZEOF_OFF_T > 4
ref_length=6; // Should be big enough
#else
@@ -420,6 +395,10 @@ int ha_myisammrg::extra(enum ha_extra_fu
return myrg_extra(file,operation,0);
}
+int ha_myisammrg::reset(void)
+{
+ return myrg_reset(file);
+}
/* To be used with WRITE_CACHE, EXTRA_CACHE and BULK_INSERT_BEGIN */
@@ -501,6 +480,7 @@ void ha_myisammrg::update_create_info(HA
{
TABLE_LIST *ptr;
LEX_STRING db, name;
+ LINT_INIT(db.str);
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
goto err;
@@ -511,8 +491,8 @@ void ha_myisammrg::update_create_info(HA
goto err;
create_info->merge_list.elements++;
- (*create_info->merge_list.next) = (byte*) ptr;
- create_info->merge_list.next= (byte**) &ptr->next_local;
+ (*create_info->merge_list.next) = (uchar*) ptr;
+ create_info->merge_list.next= (uchar**) &ptr->next_local;
}
*create_info->merge_list.next=0;
}
@@ -545,9 +525,9 @@ int ha_myisammrg::create(const char *nam
for (pos= table_names; tables; tables= tables->next_local)
{
const char *table_name;
- TABLE **tbl= 0;
+ TABLE *tbl= 0;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
- tbl= find_temporary_table(thd, tables->db, tables->table_name);
+ tbl= find_temporary_table(thd, tables);
if (!tbl)
{
/*
@@ -561,8 +541,8 @@ int ha_myisammrg::create(const char *nam
This means that it might not be possible to move the DATADIR of
an embedded server without changing the paths in the .MRG file.
*/
- uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home,
- tables->db, tables->table_name);
+ uint length= build_table_filename(buff, sizeof(buff),
+ tables->db, tables->table_name, "", 0);
/*
If a MyISAM table is in the same directory as the MERGE table,
we use the table name without a path. This means that the
@@ -576,11 +556,13 @@ int ha_myisammrg::create(const char *nam
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
else
- table_name= (*tbl)->s->path;
+ table_name= tbl->s->path.str;
*pos++= table_name;
}
*pos=0;
- DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
+ DBUG_RETURN(myrg_create(fn_format(buff,name,"","",
+ MY_RESOLVE_SYMLINKS|
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
table_names,
create_info->merge_insert_method,
(my_bool) 0));
@@ -592,6 +574,7 @@ void ha_myisammrg::append_create_info(St
const char *current_db;
uint db_length;
THD *thd= current_thd;
+ MYRG_TABLE *open_table, *first;
if (file->merge_insert_method != MERGE_INSERT_DISABLED)
{
@@ -599,16 +582,17 @@ void ha_myisammrg::append_create_info(St
packet->append(get_type(&merge_insert_method,file->merge_insert_method-1));
}
packet->append(STRING_WITH_LEN(" UNION=("));
- MYRG_TABLE *open_table,*first;
- current_db= table->s->db;
- db_length= (uint) strlen(current_db);
+ current_db= table->s->db.str;
+ db_length= table->s->db.length;
for (first=open_table=file->open_tables ;
open_table != file->end_table ;
open_table++)
{
LEX_STRING db, name;
+ LINT_INIT(db.str);
+
split_file_name(open_table->table->filename, &db, &name);
if (open_table != first)
packet->append(',');
@@ -626,7 +610,59 @@ void ha_myisammrg::append_create_info(St
}
+bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes)
+{
+ /*
+ For myisammrg, we should always re-generate the mapping file as this
+ is trivial to do
+ */
+ return COMPATIBLE_DATA_NO;
+}
+
+
int ha_myisammrg::check(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_OK;
}
+
+
+extern int myrg_panic(enum ha_panic_function flag);
+int myisammrg_panic(handlerton *hton, ha_panic_function flag)
+{
+ return myrg_panic(flag);
+}
+
+static int myisammrg_init(void *p)
+{
+ handlerton *myisammrg_hton;
+
+ myisammrg_hton= (handlerton *)p;
+
+ myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM;
+ myisammrg_hton->create= myisammrg_create_handler;
+ myisammrg_hton->panic= myisammrg_panic;
+ myisammrg_hton->flags= HTON_CAN_RECREATE|HTON_NO_PARTITION;
+
+ return 0;
+}
+
+struct st_mysql_storage_engine myisammrg_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
+mysql_declare_plugin(myisammrg)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &myisammrg_storage_engine,
+ "MRG_MYISAM",
+ "MySQL AB",
+ "Collection of identical MyISAM tables",
+ PLUGIN_LICENSE_GPL,
+ myisammrg_init, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100, /* 1.0 */
+ NULL, /* status variables */
+ NULL, /* system variables */
+ NULL /* config options */
+}
+mysql_declare_plugin_end;
--- 1.65/mysql-test/r/merge.result 2007-06-07 13:39:10 +05:00
+++ 1.66/mysql-test/r/merge.result 2007-06-14 16:19:44 +05:00
@@ -852,8 +852,8 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
-test.tm1 check Error Table './test/t1' is differently defined or of non-MyISAM type or
doesn't exist
-test.tm1 check Error Table './test/t2' is differently defined or of non-MyISAM type or
doesn't exist
+test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or
doesn't exist
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or
doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t1(a INT);
@@ -861,7 +861,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
-test.tm1 check Error Table './test/t2' is differently defined or of non-MyISAM type or
doesn't exist
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or
doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t2(a BLOB);
@@ -869,7 +869,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
-test.tm1 check Error Table './test/t2' is differently defined or of non-MyISAM type or
doesn't exist
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or
doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
ALTER TABLE t2 MODIFY a INT;
| Thread |
|---|
| • bk commit into 5.1 tree (svoj:1.2549) | Sergey Vojtovich | 14 Jun |