Commit 50aeb581 authored by unknown's avatar unknown

Merge mysql.com:/home/my/mysql-4.0 into mysql.com:/home/my/mysql-4.1


client/mysqlimport.c:
  Auto merged
myisam/mi_locking.c:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_handler.cc:
  Auto merged
parents 449a4ce5 f0f4d4c3
......@@ -267,10 +267,8 @@ static int write_to_table(char *filename, MYSQL *sock)
DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename));
local_file= sock->unix_socket == 0 || opt_local_file;
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
if (local_file)
if (! opt_local_file)
strmov(hard_path,filename);
else
my_load_path(hard_path, filename, NULL); /* filename includes the path */
......@@ -289,7 +287,7 @@ static int write_to_table(char *filename, MYSQL *sock)
to_unix_path(hard_path);
if (verbose)
{
if (local_file)
if (opt_local_file)
fprintf(stdout, "Loading data from LOCAL file: %s into %s\n",
hard_path, tablename);
else
......@@ -298,7 +296,7 @@ static int write_to_table(char *filename, MYSQL *sock)
}
sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'",
opt_low_priority ? "LOW_PRIORITY" : "",
local_file ? "LOCAL" : "", hard_path);
opt_local_file ? "LOCAL" : "", hard_path);
end= strend(sql_statement);
if (replace)
end= strmov(end, " REPLACE");
......
......@@ -21,19 +21,6 @@
isamdatabase.
*/
/*
state.open_count in the .MYI file is used the following way:
- For the first change of the file in this process it's incremented with
mi_mark_file_change(). (We have a write lock on the file in this case)
- In mi_close() it's decremented by _mi_decrement_open_count() if it
was incremented in the same process.
This mean that if we are the only process using the file, the open_count
tells us if the MYISAM file wasn't properly closed. (This is true if
my_disable_locking is set).
*/
#include "myisamdef.h"
/* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
......@@ -439,7 +426,24 @@ int _mi_test_if_changed(register MI_INFO *info)
} /* _mi_test_if_changed */
/* Put a mark in the .MYI file that someone is updating the table */
/*
Put a mark in the .MYI file that someone is updating the table
DOCUMENTATION
state.open_count in the .MYI file is used the following way:
- For the first change of the .MYI file in this process open_count is
incremented by mi_mark_file_change(). (We have a write lock on the file
when this happens)
- In mi_close() it's decremented by _mi_decrement_open_count() if it
was incremented in the same process.
This mean that if we are the only process using the file, the open_count
tells us if the MYISAM file wasn't properly closed. (This is true if
my_disable_locking is set).
*/
int _mi_mark_file_changed(MI_INFO *info)
{
......
......@@ -681,7 +681,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen= 0);
int mysql_ha_close(THD *thd, TABLE_LIST *tables);
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, int mode_flags);
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags);
/* mysql_ha_flush mode_flags bits */
#define MYSQL_HA_CLOSE_FINAL 0x00
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
......
......@@ -71,7 +71,7 @@ static enum enum_ha_read_modes rkey_to_rnext[]=
thd->open_tables=thd->handler_tables; \
thd->handler_tables=tmp; }
static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, int mode_flags);
static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags);
/*
......@@ -151,8 +151,9 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
uint dblen, namelen, aliaslen, counter;
int err;
DBUG_ENTER("mysql_ha_open");
DBUG_PRINT("enter",("mysql_ha_open: '%s'.'%s' as '%s' reopen %d",
tables->db, tables->real_name, tables->alias, reopen));
DBUG_PRINT("enter",("'%s'.'%s' as '%s' reopen: %d",
tables->db, tables->real_name, tables->alias,
(int) reopen));
if (! hash_inited(&thd->handler_tables_hash))
{
......@@ -170,7 +171,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
if (hash_search(&thd->handler_tables_hash, (byte*) tables->alias,
strlen(tables->alias) + 1))
{
DBUG_PRINT("info",("mysql_ha_open: duplicate '%s'", tables->alias));
DBUG_PRINT("info",("duplicate '%s'", tables->alias));
if (! reopen)
my_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE),
MYF(0), tables->alias);
......@@ -210,10 +211,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
&name, namelen,
&alias, aliaslen,
NullS)))
{
DBUG_PRINT("exit",("mysql_ha_open: malloc ERROR"));
goto err;
}
/* structure copy */
*hash_tables= *tables;
hash_tables->db= db;
......@@ -233,11 +231,11 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
if (! reopen)
send_ok(thd);
DBUG_PRINT("exit",("mysql_ha_open: OK"));
DBUG_PRINT("exit",("OK"));
DBUG_RETURN(0);
err:
DBUG_PRINT("exit",("mysql_ha_open: ERROR"));
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(-1);
}
......@@ -266,7 +264,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
bool was_flushed= FALSE;
bool not_opened;
DBUG_ENTER("mysql_ha_close");
DBUG_PRINT("enter",("mysql_ha_close: '%s'.'%s' as '%s'",
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
tables->db, tables->real_name, tables->alias));
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
......@@ -286,7 +284,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
#if MYSQL_VERSION_ID < 40100
if (*tables->db && strcmp(hash_tables->db, tables->db))
{
DBUG_PRINT("info",("mysql_ha_close: wrong db"));
DBUG_PRINT("info",("wrong db"));
hash_tables= NULL;
}
else
......@@ -322,12 +320,12 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
tables->alias, "HANDLER");
#endif
DBUG_PRINT("exit",("mysql_ha_close: ERROR"));
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(-1);
}
send_ok(thd);
DBUG_PRINT("exit",("mysql_ha_close: OK"));
DBUG_PRINT("exit", ("OK"));
DBUG_RETURN(0);
}
......@@ -370,7 +368,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
uint key_len;
bool was_flushed;
DBUG_ENTER("mysql_ha_read");
DBUG_PRINT("enter",("mysql_ha_read: '%s'.'%s' as '%s'",
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
tables->db, tables->real_name, tables->alias));
LINT_INIT(key);
......@@ -385,9 +383,9 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
strlen(tables->alias) + 1)))
{
table= hash_tables->table;
DBUG_PRINT("info",("mysql_ha_read: found in hash '%s'.'%s' as '%s' tab %p",
hash_tables->db, hash_tables->real_name,
hash_tables->alias, table));
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
hash_tables->db, hash_tables->real_name,
hash_tables->alias, table));
if (!table)
{
/*
......@@ -395,12 +393,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
*/
if (mysql_ha_open(thd, hash_tables, 1))
{
DBUG_PRINT("exit",("mysql_ha_read: reopen failed"));
DBUG_PRINT("exit",("reopen failed"));
goto err0;
}
table= hash_tables->table;
DBUG_PRINT("info",("mysql_ha_read: re-opened '%s'.'%s' as '%s' tab %p",
DBUG_PRINT("info",("re-opened '%s'.'%s' as '%s' tab %p",
hash_tables->db, hash_tables->real_name,
hash_tables->alias, table));
}
......@@ -408,7 +406,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
#if MYSQL_VERSION_ID < 40100
if (*tables->db && strcmp(table->table_cache_key, tables->db))
{
DBUG_PRINT("info",("mysql_ha_read: wrong db"));
DBUG_PRINT("info",("wrong db"));
table= NULL;
}
#endif
......@@ -584,12 +582,13 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
ok:
mysql_unlock_tables(thd,lock);
send_eof(thd);
DBUG_PRINT("exit",("mysql_ha_read: OK"));
DBUG_PRINT("exit",("OK"));
DBUG_RETURN(0);
err:
mysql_unlock_tables(thd,lock);
err0:
DBUG_PRINT("exit",("mysql_ha_read: ERROR"));
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(-1);
}
......@@ -623,24 +622,23 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
0 ok
*/
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, int mode_flags)
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
{
TABLE_LIST **tmp_tables_p;
TABLE_LIST *tmp_tables;
TABLE **table_ptr;
bool was_flushed;
DBUG_ENTER("mysql_ha_flush");
DBUG_PRINT("enter",("mysql_ha_flush: tables %p mode_flags 0x%02x",
tables, mode_flags));
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
if (tables)
{
/* Close all tables in the list. */
for (tmp_tables= tables ; tmp_tables; tmp_tables= tmp_tables->next)
{
DBUG_PRINT("info",("mysql_ha_flush: in tables list '%s'.'%s' as '%s'",
tmp_tables->db, tmp_tables->real_name,
tmp_tables->alias));
DBUG_PRINT("info-in-tables-list",("'%s'.'%s' as '%s'",
tmp_tables->db, tmp_tables->real_name,
tmp_tables->alias));
/* Close all currently open handler tables with the same base table. */
table_ptr= &(thd->handler_tables);
while (*table_ptr)
......@@ -651,7 +649,7 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, int mode_flags)
! my_strcasecmp(&my_charset_latin1, (*table_ptr)->real_name,
tmp_tables->real_name))
{
DBUG_PRINT("info",("mysql_ha_flush: *table_ptr '%s'.'%s' as '%s'",
DBUG_PRINT("info",("*table_ptr '%s'.'%s' as '%s'",
(*table_ptr)->table_cache_key,
(*table_ptr)->real_name,
(*table_ptr)->table_name));
......@@ -680,7 +678,6 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, int mode_flags)
}
}
DBUG_PRINT("exit",("mysql_ha_flush: OK"));
DBUG_RETURN(0);
}
......@@ -702,15 +699,15 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, int mode_flags)
0 ok
*/
static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, int mode_flags)
static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
{
TABLE_LIST *hash_tables;
TABLE *table= *table_ptr;
bool was_flushed;
DBUG_ENTER("mysql_ha_flush_table");
DBUG_PRINT("info",("mysql_ha_flush_table: '%s'.'%s' as '%s' flags 0x%02x",
table->table_cache_key, table->real_name,
table->table_name, mode_flags));
DBUG_PRINT("enter",("'%s'.'%s' as '%s' flags: 0x%02x",
table->table_cache_key, table->real_name,
table->table_name, mode_flags));
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
(*table_ptr)->table_name,
......@@ -735,6 +732,5 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, int mode_flags)
VOID(pthread_cond_broadcast(&COND_refresh));
}
DBUG_PRINT("exit",("mysql_ha_flush_table: OK"));
DBUG_RETURN(0);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment