summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-12-02 19:00:26 +0300
committerAlexander Nozdrin <alik@sun.com>2009-12-02 19:00:26 +0300
commit20b95d0831182601e2f92c71a5319f919ca4eb8c (patch)
treeb763ae33d448d0f889f59c967339eb160e42ad74 /storage/myisam
parent273454b969bcb42d8f1e5d047352851bce530a63 (diff)
parent0eda48463ce9c60408515819f9d954fd48567d4f (diff)
downloadmariadb-git-20b95d0831182601e2f92c71a5319f919ca4eb8c.tar.gz
Auto-merge from mysql-next-mr.
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ha_myisam.cc191
-rw-r--r--storage/myisam/ha_myisam.h6
2 files changed, 0 insertions, 197 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index cb8333767f8..5c9cf0c55c3 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -585,90 +585,6 @@ const char *ha_myisam::index_type(uint key_number)
"BTREE");
}
-#ifdef HAVE_REPLICATION
-int ha_myisam::net_read_dump(NET* net)
-{
- int data_fd = file->dfile;
- int error = 0;
-
- my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
- for (;;)
- {
- ulong packet_len = my_net_read(net);
- if (!packet_len)
- break ; // end of file
- if (packet_len == packet_error)
- {
- sql_print_error("ha_myisam::net_read_dump - read error ");
- error= -1;
- goto err;
- }
- if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len,
- MYF(MY_WME|MY_FNABP)))
- {
- error = errno;
- goto err;
- }
- }
-err:
- return error;
-}
-
-
-int ha_myisam::dump(THD* thd, int fd)
-{
- MYISAM_SHARE* share = file->s;
- NET* net = &thd->net;
- uint blocksize = share->blocksize;
- my_off_t bytes_to_read = share->state.state.data_file_length;
- int data_fd = file->dfile;
- uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME));
- if (!buf)
- return ENOMEM;
-
- int error = 0;
- my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
- for (; bytes_to_read > 0;)
- {
- size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
- if (bytes == MY_FILE_ERROR)
- {
- error = errno;
- goto err;
- }
-
- if (fd >= 0)
- {
- if (my_write(fd, buf, bytes, MYF(MY_WME | MY_FNABP)))
- {
- error = errno ? errno : EPIPE;
- goto err;
- }
- }
- else
- {
- if (my_net_write(net, buf, bytes))
- {
- error = errno ? errno : EPIPE;
- goto err;
- }
- }
- bytes_to_read -= bytes;
- }
-
- if (fd < 0)
- {
- if (my_net_write(net, (uchar*) "", 0))
- error = errno ? errno : EPIPE;
- net_flush(net);
- }
-
-err:
- my_free((uchar*) buf, MYF(0));
- return error;
-}
-#endif /* HAVE_REPLICATION */
-
/* Name is here without an extension */
int ha_myisam::open(const char *name, int mode, uint test_if_locked)
@@ -906,113 +822,6 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
}
-int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
-{
- HA_CHECK_OPT tmp_check_opt;
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char* errmsg;
- DBUG_ENTER("restore");
-
- (void) tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name));
-
- if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
- MI_NAME_DEXT))
- DBUG_RETURN(HA_ADMIN_INVALID);
-
- strxmov(dst_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS);
- if (my_copy(src_path, dst_path, MYF(MY_WME)))
- {
- error= HA_ADMIN_FAILED;
- errmsg= "Failed in my_copy (Error %d)";
- goto err;
- }
-
- tmp_check_opt.init();
- tmp_check_opt.flags |= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
- DBUG_RETURN(repair(thd, &tmp_check_opt));
-
- err:
- {
- MI_CHECK param;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "restore";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- mi_check_print_error(&param, errmsg, my_errno);
- DBUG_RETURN(error);
- }
-}
-
-
-int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
-{
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char *errmsg;
- DBUG_ENTER("ha_myisam::backup");
-
- (void) tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name));
-
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- reg_ext))
- {
- errmsg= "Failed in fn_format() for .frm file (errno: %d)";
- error= HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, reg_ext, NullS);
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- error = HA_ADMIN_FAILED;
- errmsg = "Failed copying .frm file (errno: %d)";
- goto err;
- }
-
- /* Change extension */
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- MI_NAME_DEXT))
- {
- errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
- error = HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS);
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- errmsg = "Failed copying .MYD file (errno: %d)";
- error= HA_ADMIN_FAILED;
- goto err;
- }
- DBUG_RETURN(HA_ADMIN_OK);
-
- err:
- {
- MI_CHECK param;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "backup";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag = 0;
- mi_check_print_error(&param,errmsg, my_errno);
- DBUG_RETURN(error);
- }
-}
-
-
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 55a5eac92de..5bb46b03650 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -125,15 +125,9 @@ class ha_myisam: public handler
bool is_crashed() const;
bool auto_repair() const { return myisam_recover_options != 0; }
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
- int restore(THD* thd, HA_CHECK_OPT* check_opt);
- int backup(THD* thd, HA_CHECK_OPT* check_opt);
int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
-#ifdef HAVE_REPLICATION
- int dump(THD* thd, int fd);
- int net_read_dump(NET* net);
-#endif
#ifdef HAVE_QUERY_CACHE
my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length,