summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-08 11:47:34 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-08 11:47:34 +0300
commit8e9c21de2ba0a41ba81ce14f0c5bbaa2187015b3 (patch)
tree519c781289c4f4c0769d932057d293ba813f2b8c /sql
parent0ce7e16ef3b9fbe6aa253ac9cef407710dd250e9 (diff)
downloadmariadb-git-8e9c21de2ba0a41ba81ce14f0c5bbaa2187015b3.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_berkeley.cc14
-rw-r--r--sql/lock.cc11
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/violite.c6
4 files changed, 22 insertions, 11 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 7ee72803dd9..ac4088ed6a9 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1181,9 +1181,11 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
DBUG_ENTER("remove_key");
DBUG_PRINT("enter",("index: %d",keynr));
- if (keynr == primary_key ||
- ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) ==
- HA_NOSAME))
+ 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)) ==
+ HA_NOSAME))
{ // Unique key
dbug_assert(keynr == primary_key || prim_key->data != key_buff2);
error=key_file[keynr]->del(key_file[keynr], trans,
@@ -1312,7 +1314,10 @@ int ha_berkeley::index_init(uint keynr)
an active cursor at this point
*/
if (cursor)
+ {
+ DBUG_PRINT("note",("Closing active cursor"));
cursor->c_close(cursor);
+ }
active_index=keynr;
if ((error=key_file[keynr]->cursor(key_file[keynr], transaction, &cursor,
table->reginfo.lock_type >
@@ -1659,12 +1664,13 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
if (!thd->transaction.bdb_lock_count++)
{
changed_rows=0;
+ transaction=0; // Safety
/* First table lock, start transaction */
if ((thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN |
OPTION_TABLE_LOCK)) &&
!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 */
DBUG_PRINT("trans",("starting transaction all"));
if ((error=txn_begin(db_env, 0,
diff --git a/sql/lock.cc b/sql/lock.cc
index a8b26c3b17d..7bac2d54631 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -169,8 +169,11 @@ static int lock_external(TABLE **tables,uint count)
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
{
DBUG_ENTER("mysql_unlock_tables");
- thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
- VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
+ if (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));
+ }
my_free((gptr) sql_lock,MYF(0));
DBUG_VOID_RETURN;
}
@@ -213,7 +216,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (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 */
@@ -232,7 +235,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (i != found)
{
VOID(unlock_external(thd,table,i-found));
- sql_lock->table_count-=found;
+ sql_lock->table_count=found;
}
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b30cb6bb639..b6c261d1463 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2516,6 +2516,7 @@ static void
join_free(JOIN *join)
{
JOIN_TAB *tab,*end;
+ DBUG_ENTER("join_free");
if (join->table)
{
@@ -2556,6 +2557,7 @@ join_free(JOIN *join)
join->tmp_table_param.copy_funcs.delete_elements();
delete [] join->tmp_table_param.copy_field;
join->tmp_table_param.copy_field=0;
+ DBUG_VOID_RETURN;
}
diff --git a/sql/violite.c b/sql/violite.c
index 0d96c71969c..d551b9b8632 100644
--- a/sql/violite.c
+++ b/sql/violite.c
@@ -154,7 +154,7 @@ int vio_read(Vio * vio, gptr buf, int size)
{
int r;
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 (vio->type == VIO_TYPE_NAMEDPIPE)
{
@@ -188,7 +188,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
{
int r;
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 ( vio->type == VIO_TYPE_NAMEDPIPE)
{
@@ -303,7 +303,7 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
int r=0;
uint opt = 0;
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));
if (vio->type != VIO_TYPE_NAMEDPIPE)
{