Commit 98b89b29 authored by unknown's avatar unknown

Fixed new bug in BDB tables


myisam/mi_info.c:
  Fixed potential bug
scripts/safe_mysqld.sh:
  Only set --user if running as root
sql/ha_berkeley.cc:
  Fixed core dump bug in ALTER TABLE
sql/mysql_priv.h:
  Fixed wrong define
sql/mysqld.cc:
  Cleanup
parent 568cb597
......@@ -57,7 +57,6 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
x->index_file_length=info->state->key_file_length;
x->keys = share->state.header.keys;
x->key_map = share->state.key_map;
x->check_time = share->state.check_time;
x->mean_reclength = info->state->records ?
(ulong) (info->state->data_file_length-info->state->empty)/
......@@ -87,6 +86,7 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
x->raid_type= share->base.raid_type;
x->raid_chunks= share->base.raid_chunks;
x->raid_chunksize= share->base.raid_chunksize;
x->key_map = share->state.key_map;
}
if ((flag & HA_STATUS_TIME) && !my_fstat(info->dfile,&state,MYF(0)))
x->update_time=state.st_mtime;
......
......@@ -149,8 +149,10 @@ then
fi
fi
USER=""
if test -w /
then
USER_OPTION="--user=$user"
# If we are root, change the err log to the right user.
touch $err_log; chown $user $err_log
if test -n "$open_files"
......@@ -211,9 +213,9 @@ do
rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety
if test -z "$args"
then
$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
else
eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
fi
if test ! -f $pid_file # This is removed if normal shutdown
then
......
......@@ -796,7 +796,8 @@ int ha_berkeley::write_row(byte * record)
else
{
DB_TXN *sub_trans = transaction;
ulong thd_options = table->in_use->options;
/* Don't use sub transactions in temporary tables (in_use == 0) */
ulong thd_options = table->in_use ? table->in_use->options : 0;
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{
key_map changed_keys = 0;
......@@ -1014,7 +1015,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
DBT prim_key, key, old_prim_key;
int error;
DB_TXN *sub_trans;
ulong thd_options = table->in_use->options;
ulong thd_options = table->in_use ? table->in_use->options : 0;
bool primary_key_changed;
DBUG_ENTER("update_row");
......@@ -1112,23 +1113,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
break;
}
}
#ifdef BROKEN_CODE_HERE
int new_error;
DBUG_PRINT("error",("Got error %d",error));
if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
DBUG_PRINT("trans",("aborting subtransaction"));
new_error=txn_abort(sub_trans);
}
else if (changed_keys)
new_error=restore_keys(changed_keys, primary_key,
old_row, old_prim_key, new_row, prim_key);
if (new_error)
{
error=new_error; // This shouldn't happen
break;
}
#endif
}
else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
......@@ -1227,7 +1211,7 @@ int ha_berkeley::delete_row(const byte * record)
int error;
DBT row, prim_key;
key_map keys=table->keys_in_use;
ulong thd_options = table->in_use->options;
ulong thd_options = table->in_use ? table->in_use->options : 0;
DBUG_ENTER("delete_row");
statistic_increment(ha_delete_count,&LOCK_status);
......
......@@ -164,7 +164,7 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2
/* Set if we are updating a non-transaction safe table */
#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_QUOTE_SHOW_CREATE*2
#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
/* The following is set when parsing the query */
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
......
......@@ -1120,8 +1120,8 @@ terribly wrong\n");
*(ebp+17) : *(ebp+1));
if (new_ebp <= ebp )
{
fprintf(stderr, "New value of ebp failed sanity check\
terminating backtrace\n");
fprintf(stderr, "\
New value of ebp failed sanity check terminating backtrace\n");
return;
}
ebp = new_ebp;
......
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