Commit 4f08177e authored by unknown's avatar unknown

More debug info

Fix DBUG_ASSERT()
Optimization for BDB tables
Fix for BDB under Win98


Docs/manual.texi:
  Removed wrong info
bdb/os_win32/os_rename.c:
  Fix for windows 98
configure.in:
  Better options for MAC OS X
include/dbug.h:
  Fix DBUG_ASSERT()
mysys/thr_lock.c:
  More DBUG messages
sql/ha_berkeley.cc:
  Use cursor in remove_key
sql/lock.cc:
  Fix possible problem when pre-unlocking tables in SELECT
sql/sql_select.cc:
  More DBUG messages
sql/violite.c:
  Fix DBUG messages
parent 2ec01668
...@@ -32591,9 +32591,6 @@ tblTemp1.fldOrder_ID > 100; ...@@ -32591,9 +32591,6 @@ tblTemp1.fldOrder_ID > 100;
The following conditions hold for an @code{INSERT ... SELECT} statement: The following conditions hold for an @code{INSERT ... SELECT} statement:
@itemize @minus @itemize @minus
@item
The query cannot contain an @code{ORDER BY} clause.
@item @item
The target table of the @code{INSERT} statement cannot appear in the The target table of the @code{INSERT} statement cannot appear in the
@code{FROM} clause of the @code{SELECT} part of the query because it's @code{FROM} clause of the @code{SELECT} part of the query because it's
...@@ -47,7 +47,7 @@ __os_rename(dbenv, old, new) ...@@ -47,7 +47,7 @@ __os_rename(dbenv, old, new)
*/ */
if (MoveFileEx(old, new, MOVEFILE_REPLACE_EXISTING) != TRUE) if (MoveFileEx(old, new, MOVEFILE_REPLACE_EXISTING) != TRUE)
ret = __os_win32_errno(); ret = __os_win32_errno();
if (ret == ENOENT && MoveFile(old, new) == TRUE) if ((ret == ENOENT || ret == EIO) && MoveFile(old, new) == TRUE)
ret = 0; ret = 0;
} }
if (ret != 0) if (ret != 0)
......
...@@ -797,10 +797,8 @@ case $SYSTEM_TYPE in ...@@ -797,10 +797,8 @@ case $SYSTEM_TYPE in
*darwin*) *darwin*)
if test "$ac_cv_prog_gcc" = "yes" if test "$ac_cv_prog_gcc" = "yes"
then then
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS" CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS" CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE"
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE"
MAX_C_OPTIMIZE="-O" MAX_C_OPTIMIZE="-O"
with_named_curses="" with_named_curses=""
fi fi
......
...@@ -66,7 +66,7 @@ extern void _db_unlock_file(); ...@@ -66,7 +66,7 @@ extern void _db_unlock_file();
#define DEBUGGER_ON _no_db_=0 #define DEBUGGER_ON _no_db_=0
#define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_ASSERT(A) A #define DBUG_ASSERT(A) assert(A)
#else /* No debugger */ #else /* No debugger */
#define DBUG_ENTER(a1) #define DBUG_ENTER(a1)
......
...@@ -736,7 +736,7 @@ void thr_unlock(THR_LOCK_DATA *data) ...@@ -736,7 +736,7 @@ void thr_unlock(THR_LOCK_DATA *data)
data->type == TL_WRITE_ALLOW_WRITE)); data->type == TL_WRITE_ALLOW_WRITE));
else else
{ {
DBUG_PRINT("lock",("No locks to free")); DBUG_PRINT("lock",("No waiting read locks to free"));
} }
} }
else if (data && else if (data &&
......
...@@ -1181,7 +1181,9 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record, ...@@ -1181,7 +1181,9 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
DBUG_ENTER("remove_key"); DBUG_ENTER("remove_key");
DBUG_PRINT("enter",("index: %d",keynr)); DBUG_PRINT("enter",("index: %d",keynr));
if (keynr == primary_key || if (keynr == active_index && cursor)
error=cursor->c_del(cursor,0);
else if (keynr == primary_key ||
((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) == ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) ==
HA_NOSAME)) HA_NOSAME))
{ // Unique key { // Unique key
...@@ -1312,7 +1314,10 @@ int ha_berkeley::index_init(uint keynr) ...@@ -1312,7 +1314,10 @@ int ha_berkeley::index_init(uint keynr)
an active cursor at this point an active cursor at this point
*/ */
if (cursor) if (cursor)
{
DBUG_PRINT("note",("Closing active cursor"));
cursor->c_close(cursor); cursor->c_close(cursor);
}
active_index=keynr; active_index=keynr;
if ((error=key_file[keynr]->cursor(key_file[keynr], transaction, &cursor, if ((error=key_file[keynr]->cursor(key_file[keynr], transaction, &cursor,
table->reginfo.lock_type > table->reginfo.lock_type >
...@@ -1659,12 +1664,13 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) ...@@ -1659,12 +1664,13 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
if (!thd->transaction.bdb_lock_count++) if (!thd->transaction.bdb_lock_count++)
{ {
changed_rows=0; changed_rows=0;
transaction=0; // Safety
/* First table lock, start transaction */ /* First table lock, start transaction */
if ((thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN | if ((thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN |
OPTION_TABLE_LOCK)) && OPTION_TABLE_LOCK)) &&
!thd->transaction.all.bdb_tid) !thd->transaction.all.bdb_tid)
{ {
DBUG_ASSERT(thd->transaction.stmt.bdb_tid != 0); DBUG_ASSERT(thd->transaction.stmt.bdb_tid == 0);
/* We have to start a master transaction */ /* We have to start a master transaction */
DBUG_PRINT("trans",("starting transaction all")); DBUG_PRINT("trans",("starting transaction all"));
if ((error=txn_begin(db_env, 0, if ((error=txn_begin(db_env, 0,
......
...@@ -169,8 +169,11 @@ static int lock_external(TABLE **tables,uint count) ...@@ -169,8 +169,11 @@ static int lock_external(TABLE **tables,uint count)
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock) void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
{ {
DBUG_ENTER("mysql_unlock_tables"); DBUG_ENTER("mysql_unlock_tables");
if (sql_lock->lock_count)
{
thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count)); VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
}
my_free((gptr) sql_lock,MYF(0)); my_free((gptr) sql_lock,MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -213,7 +216,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) ...@@ -213,7 +216,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (i != found) if (i != found)
{ {
thr_multi_unlock(lock,i-found); thr_multi_unlock(lock,i-found);
sql_lock->lock_count-=found; sql_lock->lock_count= found;
} }
/* Then to the same for the external locks */ /* Then to the same for the external locks */
...@@ -232,7 +235,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) ...@@ -232,7 +235,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (i != found) if (i != found)
{ {
VOID(unlock_external(thd,table,i-found)); VOID(unlock_external(thd,table,i-found));
sql_lock->table_count-=found; sql_lock->table_count=found;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -2516,6 +2516,7 @@ static void ...@@ -2516,6 +2516,7 @@ static void
join_free(JOIN *join) join_free(JOIN *join)
{ {
JOIN_TAB *tab,*end; JOIN_TAB *tab,*end;
DBUG_ENTER("join_free");
if (join->table) if (join->table)
{ {
...@@ -2556,6 +2557,7 @@ join_free(JOIN *join) ...@@ -2556,6 +2557,7 @@ join_free(JOIN *join)
join->tmp_table_param.copy_funcs.delete_elements(); join->tmp_table_param.copy_funcs.delete_elements();
delete [] join->tmp_table_param.copy_field; delete [] join->tmp_table_param.copy_field;
join->tmp_table_param.copy_field=0; join->tmp_table_param.copy_field=0;
DBUG_VOID_RETURN;
} }
......
...@@ -154,7 +154,7 @@ int vio_read(Vio * vio, gptr buf, int size) ...@@ -154,7 +154,7 @@ int vio_read(Vio * vio, gptr buf, int size)
{ {
int r; int r;
DBUG_ENTER("vio_read"); DBUG_ENTER("vio_read");
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size));
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
if (vio->type == VIO_TYPE_NAMEDPIPE) if (vio->type == VIO_TYPE_NAMEDPIPE)
{ {
...@@ -188,7 +188,7 @@ int vio_write(Vio * vio, const gptr buf, int size) ...@@ -188,7 +188,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
{ {
int r; int r;
DBUG_ENTER("vio_write"); DBUG_ENTER("vio_write");
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size));
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
if ( vio->type == VIO_TYPE_NAMEDPIPE) if ( vio->type == VIO_TYPE_NAMEDPIPE)
{ {
...@@ -303,7 +303,7 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive) ...@@ -303,7 +303,7 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
int r=0; int r=0;
uint opt = 0; uint opt = 0;
DBUG_ENTER("vio_keepalive"); DBUG_ENTER("vio_keepalive");
DBUG_PRINT("enter", ("sd=%d, set_keep_alive=%d", vio->sd, (int) DBUG_PRINT("enter", ("sd=%d set_keep_alive=%d", vio->sd, (int)
set_keep_alive)); set_keep_alive));
if (vio->type != VIO_TYPE_NAMEDPIPE) if (vio->type != VIO_TYPE_NAMEDPIPE)
{ {
......
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