summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-01-11 05:10:08 +0100
committerjimw@mysql.com <>2005-01-11 05:10:08 +0100
commit3d0e2e70c64b8745412b262a7dcb2bcecb44e394 (patch)
treeefcb9c5ca5983631374c7707ab34e58700a568f4 /sql
parent442fae37c5cdcfbba3b3cbe4de6a7ad6098a997b (diff)
parentd5f18e63b31553fab457116b5c8c964dd2fa44ea (diff)
downloadmariadb-git-3d0e2e70c64b8745412b262a7dcb2bcecb44e394.tar.gz
Merge
Diffstat (limited to 'sql')
-rw-r--r--sql/examples/ha_archive.cc30
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/set_var.cc5
-rw-r--r--sql/sql_table.cc21
4 files changed, 31 insertions, 27 deletions
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index f04853fd482..dccff88bf1f 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -333,10 +333,8 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL)
goto error2;
if (my_hash_insert(&archive_open_tables, (byte*) share))
- goto error2;
- thr_lock_init(&share->lock);
- if (pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST))
goto error3;
+ thr_lock_init(&share->lock);
}
share->use_count++;
pthread_mutex_unlock(&archive_mutex);
@@ -344,14 +342,13 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
return share;
error3:
- VOID(pthread_mutex_destroy(&share->mutex));
- thr_lock_delete(&share->lock);
/* We close, but ignore errors since we already have errors */
(void)gzclose(share->archive_write);
error2:
my_close(share->meta_file,MYF(0));
error:
pthread_mutex_unlock(&archive_mutex);
+ VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0));
return NULL;
@@ -485,23 +482,30 @@ int ha_archive::create(const char *name, TABLE *table_arg,
if ((archive= gzdopen(create_file, "ab")) == NULL)
{
error= errno;
- delete_table(name);
- goto error;
+ goto error2;
}
if (write_data_header(archive))
{
- gzclose(archive);
- goto error2;
+ error= errno;
+ goto error3;
}
if (gzclose(archive))
+ {
+ error= errno;
goto error2;
+ }
+
+ my_close(create_file, MYF(0));
DBUG_RETURN(0);
+error3:
+ /* We already have an error, so ignore results of gzclose. */
+ (void)gzclose(archive);
error2:
- error= errno;
- delete_table(name);
+ my_close(create_file, MYF(0));
+ delete_table(name);
error:
/* Return error number, if we got one */
DBUG_RETURN(error ? error : -1);
@@ -751,7 +755,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
if ((rebuild_file= gzopen(data_file_name, "rb")) == NULL)
DBUG_RETURN(errno ? errno : -1);
- if (rc= read_data_header(rebuild_file))
+ if ((rc= read_data_header(rebuild_file)))
goto error;
/*
@@ -823,7 +827,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(-1);
}
- while (read= gzread(reader, block, IO_SIZE))
+ while ((read= gzread(reader, block, IO_SIZE)))
gzwrite(writer, block, read);
gzclose(reader);
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 3bec00a5177..55f56645f82 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -255,6 +255,8 @@ my_bool
my_net_write(NET *net,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE];
+ if (unlikely(!net->vio)) // nowhere to write
+ return 0;
/*
Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH
length. The last packet is always a packet that is < MAX_PACKET_LENGTH.
diff --git a/sql/set_var.cc b/sql/set_var.cc
index d710be2bb2e..13e3d375448 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -745,11 +745,11 @@ struct show_var_st init_vars[]= {
{"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL},
{"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
{"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL},
- {"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL},
{"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT},
{"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
{"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
{"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
+ {"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL},
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
@@ -758,10 +758,9 @@ struct show_var_st init_vars[]= {
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
{sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS},
{sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
- {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
- {sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
{"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG },
+ {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
{"innodb_thread_concurrency", (char*) &innobase_thread_concurrency, SHOW_LONG },
#endif
{sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS},
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d7a272f804c..5f8e6cf1f5a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3588,6 +3588,16 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ulong save_sql_mode;
DBUG_ENTER("copy_data_between_tables");
+ /*
+ Turn off recovery logging since rollback of an alter table is to
+ delete the new table so there is no need to log the changes to it.
+
+ This needs to be done before external_lock
+ */
+ error= ha_enable_transaction(thd, FALSE);
+ if (error)
+ DBUG_RETURN(-1);
+
if (!(copy= new Copy_field[to->s->fields]))
DBUG_RETURN(-1); /* purecov: inspected */
@@ -3646,17 +3656,6 @@ copy_data_between_tables(TABLE *from,TABLE *to,
goto err;
};
- /*
- Turn off recovery logging since rollback of an alter table is to
- delete the new table so there is no need to log the changes to it.
- */
- error= ha_enable_transaction(thd,FALSE);
- if (error)
- {
- error= 1;
- goto err;
- }
-
/* Handler must be told explicitly to retrieve all columns, because
this function does not set field->query_id in the columns to the
current query id */