Commit 43271e22 authored by unknown's avatar unknown

Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1

into ice.snake.net:/Volumes/ice2/MySQL/bk/mysql-4.1

parents 18904dd8 5b1b5f63
...@@ -202,6 +202,7 @@ MASTER_MYPORT=9306 ...@@ -202,6 +202,7 @@ MASTER_MYPORT=9306
SLAVE_RUNNING=0 SLAVE_RUNNING=0
SLAVE_MYPORT=9307 SLAVE_MYPORT=9307
MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
NDBCLUSTER_PORT=9350
MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
MYSQL_MANAGER_USER=root MYSQL_MANAGER_USER=root
...@@ -258,6 +259,7 @@ while test $# -gt 0; do ...@@ -258,6 +259,7 @@ while test $# -gt 0; do
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;; --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;; --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
--manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;; --manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
--ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
--with-openssl) --with-openssl)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
--ssl-ca=$BASEDIR/SSL/cacert.pem \ --ssl-ca=$BASEDIR/SSL/cacert.pem \
...@@ -1426,7 +1428,7 @@ then ...@@ -1426,7 +1428,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ] if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then then
# Kill any running ndbcluster stuff # Kill any running ndbcluster stuff
./ndb/ndbcluster --stop ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --stop
fi fi
fi fi
...@@ -1447,7 +1449,7 @@ then ...@@ -1447,7 +1449,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ] if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then then
echo "Starting ndbcluster" echo "Starting ndbcluster"
./ndb/ndbcluster --small --discless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --discless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING=`cat Ndb.cfg` export NDB_CONNECTSTRING=`cat Ndb.cfg`
else else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER" export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
...@@ -1547,7 +1549,7 @@ then ...@@ -1547,7 +1549,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ] if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then then
# Kill any running ndbcluster stuff # Kill any running ndbcluster stuff
./ndb/ndbcluster --stop ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --stop
fi fi
fi fi
......
...@@ -43,9 +43,7 @@ HostName: CHOOSE_HOSTNAME_7 ...@@ -43,9 +43,7 @@ HostName: CHOOSE_HOSTNAME_7
[MGM] [MGM]
Id: 1 Id: 1
ExecuteOnComputer: 1 ExecuteOnComputer: 1
PortNumber: CHOOSE_PORT_BASE00 PortNumber: CHOOSE_PORT_MGM
PortNumberStats: CHOOSE_PORT_BASE01
[DB] [DB]
Id: 2 Id: 2
...@@ -74,4 +72,4 @@ Id: 14 ...@@ -74,4 +72,4 @@ Id: 14
ExecuteOnComputer: 7 ExecuteOnComputer: 7
[TCP DEFAULT] [TCP DEFAULT]
PortNumber: CHOOSE_PORT_BASE02 PortNumber: CHOOSE_PORT_TRANSPORTER
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# This scripts starts the table handler ndbcluster # This scripts starts the table handler ndbcluster
# configurable parameters, make sure to change in mysqlcluterd as well # configurable parameters, make sure to change in mysqlcluterd as well
port_base="22" # using ports port_base{"00","01", etc} port_base="2200"
fsdir=`pwd` fsdir=`pwd`
# end configurable parameters # end configurable parameters
...@@ -85,8 +85,8 @@ fs_ndb=$fsdir/ndbcluster ...@@ -85,8 +85,8 @@ fs_ndb=$fsdir/ndbcluster
fs_mgm_1=$fs_ndb/1.ndb_mgm fs_mgm_1=$fs_ndb/1.ndb_mgm
fs_ndb_2=$fs_ndb/2.ndb_db fs_ndb_2=$fs_ndb/2.ndb_db
fs_ndb_3=$fs_ndb/3.ndb_db fs_ndb_3=$fs_ndb/3.ndb_db
fs_name_2=$fs_ndb/node-2-fs fs_name_2=$fs_ndb/node-2-fs-$port_base
fs_name_3=$fs_ndb/node-3-fs fs_name_3=$fs_ndb/node-3-fs-$port_base
NDB_HOME= NDB_HOME=
export NDB_CONNECTSTRING export NDB_CONNECTSTRING
...@@ -125,8 +125,9 @@ fi ...@@ -125,8 +125,9 @@ fi
# set som help variables # set som help variables
ndb_host="localhost" ndb_host="localhost"
ndb_port=$port_base"00" ndb_mgmd_port=$port_base
NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_port;nodeid=" port_transporter=`expr $ndb_mgmd_port + 2`
NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_mgmd_port;nodeid="
# Start management server as deamon # Start management server as deamon
...@@ -145,7 +146,8 @@ sed \ ...@@ -145,7 +146,8 @@ sed \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \ -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
-e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \ -e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \
-e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \ -e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \
-e s,"CHOOSE_PORT_BASE",$port_base,g \ -e s,"CHOOSE_PORT_MGM",$ndb_mgmd_port,g \
-e s,"CHOOSE_PORT_TRANSPORTER",$port_transporter,g \
< ndb/ndb_config_2_node.ini \ < ndb/ndb_config_2_node.ini \
> "$fs_mgm_1/config.ini" > "$fs_mgm_1/config.ini"
fi fi
...@@ -195,7 +197,7 @@ status_ndbcluster ...@@ -195,7 +197,7 @@ status_ndbcluster
status_ndbcluster() { status_ndbcluster() {
# Start management client # Start management client
echo "show" | $exec_mgmtclient $ndb_host $ndb_port echo "show" | $exec_mgmtclient $ndb_host $ndb_mgmd_port
} }
stop_default_ndbcluster() { stop_default_ndbcluster() {
...@@ -210,11 +212,11 @@ if [ ! -f $cfgfile ] ; then ...@@ -210,11 +212,11 @@ if [ ! -f $cfgfile ] ; then
fi fi
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"` ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"` ndb_mgmd_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
# Start management client # Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port" exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_mgmd_port"
echo "$exec_mgmtclient" echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient echo "all stop" | $exec_mgmtclient
......
...@@ -470,3 +470,9 @@ t1 CREATE TABLE `t1` ( ...@@ -470,3 +470,9 @@ t1 CREATE TABLE `t1` (
ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
DROP TABLE t1; DROP TABLE t1;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
alter table t1 drop key a;
drop table t1;
select * from t9; select * from t9 order by a;
a b a b
1 2
2 3 2 3
4 5
3 4 3 4
1 2 4 5
show status like 'handler_discover%'; show status like 'handler_discover%';
Variable_name Value Variable_name Value
Handler_discover 1 Handler_discover 1
......
...@@ -304,3 +304,11 @@ SHOW CREATE TABLE t1; ...@@ -304,3 +304,11 @@ SHOW CREATE TABLE t1;
--error 1091 --error 1091
ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 DROP PRIMARY KEY;
DROP TABLE t1; DROP TABLE t1;
# BUG#3899
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
--error 1091
alter table t1 drop key no_such_key;
alter table t1 drop key a;
drop table t1;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# The previous step has simply removed the frm file # The previous step has simply removed the frm file
# from disk, but left the table in NDB # from disk, but left the table in NDB
# #
select * from t9; select * from t9 order by a;
# handler_discover should be zero # handler_discover should be zero
show status like 'handler_discover%'; show status like 'handler_discover%';
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include <Dbtux.hpp> #include <Dbtux.hpp>
#include <NdbEnv.h> #include <NdbEnv.h>
#ifndef VM_TRACE
#define NEW_BLOCK(B) new B
#else
enum SIMBLOCKLIST_DUMMY { A_VALUE = 0 }; enum SIMBLOCKLIST_DUMMY { A_VALUE = 0 };
static static
...@@ -60,13 +63,13 @@ void * operator new (size_t sz, SIMBLOCKLIST_DUMMY dummy){ ...@@ -60,13 +63,13 @@ void * operator new (size_t sz, SIMBLOCKLIST_DUMMY dummy){
return tmp; return tmp;
} }
#define NEW_BLOCK(B) new(A_VALUE) B
#endif
void void
SimBlockList::load(const Configuration & conf){ SimBlockList::load(const Configuration & conf){
noOfBlocks = 16; noOfBlocks = 16;
theList = new SimulatedBlock * [noOfBlocks]; theList = new SimulatedBlock * [noOfBlocks];
for(int i = 0; i<noOfBlocks; i++)
theList[i] = 0;
Dbdict* dbdict = 0; Dbdict* dbdict = 0;
Dbdih* dbdih = 0; Dbdih* dbdih = 0;
...@@ -75,28 +78,28 @@ SimBlockList::load(const Configuration & conf){ ...@@ -75,28 +78,28 @@ SimBlockList::load(const Configuration & conf){
Uint32 dl; Uint32 dl;
const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator(); const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
if(p && !ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl) && dl){ if(p && !ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl) && dl){
fs = new (A_VALUE) VoidFs(conf); fs = NEW_BLOCK(VoidFs)(conf);
} else { } else {
fs = new (A_VALUE) Ndbfs(conf); fs = NEW_BLOCK(Ndbfs)(conf);
} }
} }
theList[0] = new (A_VALUE) Dbacc(conf); theList[0] = NEW_BLOCK(Dbacc)(conf);
theList[1] = new (A_VALUE) Cmvmi(conf); theList[1] = NEW_BLOCK(Cmvmi)(conf);
theList[2] = fs; theList[2] = fs;
theList[3] = dbdict = new (A_VALUE) Dbdict(conf); theList[3] = dbdict = NEW_BLOCK(Dbdict)(conf);
theList[4] = dbdih = new (A_VALUE) Dbdih(conf); theList[4] = dbdih = NEW_BLOCK(Dbdih)(conf);
theList[5] = new (A_VALUE) Dblqh(conf); theList[5] = NEW_BLOCK(Dblqh)(conf);
theList[6] = new (A_VALUE) Dbtc(conf); theList[6] = NEW_BLOCK(Dbtc)(conf);
theList[7] = new (A_VALUE) Dbtup(conf); theList[7] = NEW_BLOCK(Dbtup)(conf);
theList[8] = new (A_VALUE) Ndbcntr(conf); theList[8] = NEW_BLOCK(Ndbcntr)(conf);
theList[9] = new (A_VALUE) Qmgr(conf); theList[9] = NEW_BLOCK(Qmgr)(conf);
theList[10] = new (A_VALUE) Trix(conf); theList[10] = NEW_BLOCK(Trix)(conf);
theList[11] = new (A_VALUE) Backup(conf); theList[11] = NEW_BLOCK(Backup)(conf);
theList[12] = new (A_VALUE) DbUtil(conf); theList[12] = NEW_BLOCK(DbUtil)(conf);
theList[13] = new (A_VALUE) Suma(conf); theList[13] = NEW_BLOCK(Suma)(conf);
theList[14] = new (A_VALUE) Grep(conf); theList[14] = NEW_BLOCK(Grep)(conf);
theList[15] = new (A_VALUE) Dbtux(conf); theList[15] = NEW_BLOCK(Dbtux)(conf);
// Metadata common part shared by block instances // Metadata common part shared by block instances
ptrMetaDataCommon = new MetaData::Common(*dbdict, *dbdih); ptrMetaDataCommon = new MetaData::Common(*dbdict, *dbdih);
......
...@@ -38,10 +38,6 @@ Name: Ndb.cpp ...@@ -38,10 +38,6 @@ Name: Ndb.cpp
#include <NdbEnv.h> #include <NdbEnv.h>
#include <BaseString.hpp> #include <BaseString.hpp>
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
/**************************************************************************** /****************************************************************************
void connect(); void connect();
...@@ -1028,18 +1024,14 @@ const char * Ndb::getCatalogName() const ...@@ -1028,18 +1024,14 @@ const char * Ndb::getCatalogName() const
void Ndb::setCatalogName(const char * a_catalog_name) void Ndb::setCatalogName(const char * a_catalog_name)
{ {
if (a_catalog_name) { if (a_catalog_name) {
strncpy(theDataBase, a_catalog_name, NDB_MAX_DATABASE_NAME_SIZE); snprintf(theDataBase, sizeof(theDataBase), "%s",
// Prepare prefix for faster operations a_catalog_name ? a_catalog_name : "");
uint db_len = MIN(strlen(theDataBase), NDB_MAX_DATABASE_NAME_SIZE - 1);
uint schema_len = int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1); theDataBase, table_name_separator,
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1); theDataBaseSchema, table_name_separator);
prefixName[db_len] = table_name_separator; prefixEnd = prefixName + (len < sizeof(prefixName) ? len :
strncpy(prefixName+db_len+1, theDataBaseSchema, sizeof(prefixName) - 1);
NDB_MAX_SCHEMA_NAME_SIZE - 1);
prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
} }
} }
...@@ -1051,18 +1043,14 @@ const char * Ndb::getSchemaName() const ...@@ -1051,18 +1043,14 @@ const char * Ndb::getSchemaName() const
void Ndb::setSchemaName(const char * a_schema_name) void Ndb::setSchemaName(const char * a_schema_name)
{ {
if (a_schema_name) { if (a_schema_name) {
strncpy(theDataBaseSchema, a_schema_name, NDB_MAX_SCHEMA_NAME_SIZE); snprintf(theDataBaseSchema, sizeof(theDataBase), "%s",
// Prepare prefix for faster operations a_schema_name ? a_schema_name : "");
uint db_len = MIN(strlen(theDataBase), NDB_MAX_DATABASE_NAME_SIZE - 1);
uint schema_len = int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1); theDataBase, table_name_separator,
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1); theDataBaseSchema, table_name_separator);
prefixName[db_len] = table_name_separator; prefixEnd = prefixName + (len < sizeof(prefixName) ? len :
strncpy(prefixName+db_len+1, theDataBaseSchema, sizeof(prefixName) - 1);
NDB_MAX_SCHEMA_NAME_SIZE - 1);
prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
} }
} }
......
...@@ -56,7 +56,7 @@ Ndb(const char* aDataBase); ...@@ -56,7 +56,7 @@ Ndb(const char* aDataBase);
Parameters: aDataBase : Name of the database. Parameters: aDataBase : Name of the database.
Remark: Connect to the database. Remark: Connect to the database.
***************************************************************************/ ***************************************************************************/
Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : Ndb::Ndb( const char* aDataBase , const char* aSchema) :
theNdbObjectIdMap(0), theNdbObjectIdMap(0),
thePreparedTransactionsArray(NULL), thePreparedTransactionsArray(NULL),
theSentTransactionsArray(NULL), theSentTransactionsArray(NULL),
...@@ -121,22 +121,16 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : ...@@ -121,22 +121,16 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
theLastTupleId[i] = 0; theLastTupleId[i] = 0;
}//for }//for
if (aDataBase) snprintf(theDataBase, sizeof(theDataBase), "%s",
strncpy(theDataBase, aDataBase, NDB_MAX_DATABASE_NAME_SIZE); aDataBase ? aDataBase : "");
else snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s",
memset(theDataBase, 0, sizeof(theDataBase)); aSchema ? aSchema : "");
strncpy(theDataBaseSchema, aDataBaseSchema, NDB_MAX_SCHEMA_NAME_SIZE);
// Prepare prefix for faster operations int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
uint db_len = MIN(strlen(theDataBase), NDB_MAX_DATABASE_NAME_SIZE - 1); theDataBase, table_name_separator,
uint schema_len = theDataBaseSchema, table_name_separator);
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1); prefixEnd = prefixName + (len < sizeof(prefixName) ? len :
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1); sizeof(prefixName) - 1);
prefixName[db_len] = table_name_separator;
strncpy(prefixName+db_len+1, theDataBaseSchema,
NDB_MAX_SCHEMA_NAME_SIZE - 1);
prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
NdbMutex_Lock(&createNdbMutex); NdbMutex_Lock(&createNdbMutex);
......
...@@ -103,7 +103,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ ...@@ -103,7 +103,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
isam/isamchk$BS isam/pack_isam$BS \ isam/isamchk$BS isam/pack_isam$BS \
myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \ myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \
myisam/myisam_ftdump$BS \ myisam/myisam_ftdump$BS \
sql/mysqld$BS \ sql/mysqld$BS sql/mysql_tzinfo_to_sql$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/mysqldump$BS client/mysqlimport$BS \ client/mysqldump$BS client/mysqlimport$BS \
client/mysqltest$BS client/mysqlcheck$BS \ client/mysqltest$BS client/mysqlcheck$BS \
......
...@@ -385,17 +385,25 @@ int ha_report_binlog_offset_and_commit(THD *thd, ...@@ -385,17 +385,25 @@ int ha_report_binlog_offset_and_commit(THD *thd,
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
THD_TRANS *trans; THD_TRANS *trans;
trans = &thd->transaction.all; trans = &thd->transaction.all;
if (trans->innobase_tid) if (trans->innodb_active_trans)
{ {
/*
If we updated some InnoDB tables (innodb_active_trans is true), the
binlog coords will be reported into InnoDB during the InnoDB commit
(innobase_report_binlog_offset_and_commit). But if we updated only
non-InnoDB tables, we need an explicit call to report it.
*/
if ((error=innobase_report_binlog_offset_and_commit(thd, if ((error=innobase_report_binlog_offset_and_commit(thd,
trans->innobase_tid, trans->innobase_tid,
log_file_name, log_file_name,
end_offset))) end_offset)))
{ {
my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); my_error(ER_ERROR_DURING_COMMIT, MYF(0), error);
error=1; error=1;
} }
} }
else if (opt_innodb_safe_binlog) // Don't report if not useful
innobase_store_binlog_offset_and_flush_log(log_file_name, end_offset);
#endif #endif
return error; return error;
} }
......
...@@ -283,7 +283,7 @@ class handler :public Sql_alloc ...@@ -283,7 +283,7 @@ class handler :public Sql_alloc
create_time(0), check_time(0), update_time(0), create_time(0), check_time(0), update_time(0),
key_used_on_scan(MAX_KEY), active_index(MAX_KEY), key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), block_size(0), ref_length(sizeof(my_off_t)), block_size(0),
raid_type(0), ft_handler(0), implicit_emptied(0), inited(NONE) raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0)
{} {}
virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ } virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ }
int ha_open(const char *name, int mode, int test_if_locked); int ha_open(const char *name, int mode, int test_if_locked);
......
...@@ -2073,9 +2073,9 @@ bool MYSQL_LOG::cut_spurious_tail() ...@@ -2073,9 +2073,9 @@ bool MYSQL_LOG::cut_spurious_tail()
name); name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
sql_print_error("After InnoDB crash recovery, trying to truncate " sql_print_error("After InnoDB crash recovery, checking if the binary log "
"the binary log '%s' at position %s corresponding to the " "'%s' contains rolled back transactions which must be "
"last committed transaction...", name, llstr(pos, llbuf1)); "removed from it...", name);
/* If we have a too long binlog, cut. If too short, print error */ /* If we have a too long binlog, cut. If too short, print error */
int fd= my_open(name, O_EXCL | O_APPEND | O_BINARY | O_WRONLY, MYF(MY_WME)); int fd= my_open(name, O_EXCL | O_APPEND | O_BINARY | O_WRONLY, MYF(MY_WME));
if (fd < 0) if (fd < 0)
...@@ -2091,10 +2091,17 @@ bool MYSQL_LOG::cut_spurious_tail() ...@@ -2091,10 +2091,17 @@ bool MYSQL_LOG::cut_spurious_tail()
if (pos > (actual_size= my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME)))) if (pos > (actual_size= my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME))))
{ {
/*
Note that when we have MyISAM rollback this error message should be
reconsidered.
*/
sql_print_error("The binary log '%s' is shorter than its expected size " sql_print_error("The binary log '%s' is shorter than its expected size "
"(actual: %s, expected: %s) so it misses at least one " "(actual: %s, expected: %s) so it misses at least one "
"committed transaction; so it should not be used for " "committed transaction; so it should not be used for "
"replication.", name, llstr(actual_size, llbuf1), "replication or point-in-time recovery. You would need "
"to restart slaves from a fresh master's data "
"snapshot ",
name, llstr(actual_size, llbuf1),
llstr(pos, llbuf2)); llstr(pos, llbuf2));
error= 1; error= 1;
goto err; goto err;
......
...@@ -869,7 +869,7 @@ extern ulong rpl_recovery_rank, thread_cache_size; ...@@ -869,7 +869,7 @@ extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log; extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log;
extern ulong specialflag, current_pid; extern ulong specialflag, current_pid;
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter; extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
extern my_bool relay_log_purge; extern my_bool relay_log_purge, opt_innodb_safe_binlog;
extern uint test_flags,select_errors,ha_open_options; extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version, mysqld_port, dropping_tables; extern uint protocol_version, mysqld_port, dropping_tables;
extern uint delay_key_write_options, lower_case_table_names; extern uint delay_key_write_options, lower_case_table_names;
......
...@@ -2538,6 +2538,9 @@ server."); ...@@ -2538,6 +2538,9 @@ server.");
if (opt_innodb_safe_binlog) if (opt_innodb_safe_binlog)
{ {
if (have_innodb != SHOW_OPTION_YES)
sql_print_error("Warning: --innodb-safe-binlog is meaningful only if "
"the InnoDB storage engine is enabled in the server.");
if (innobase_flush_log_at_trx_commit != 1) if (innobase_flush_log_at_trx_commit != 1)
{ {
sql_print_error("Warning: --innodb-safe-binlog is meaningful only if " sql_print_error("Warning: --innodb-safe-binlog is meaningful only if "
...@@ -4633,7 +4636,7 @@ replicating a LOAD DATA INFILE command.", ...@@ -4633,7 +4636,7 @@ replicating a LOAD DATA INFILE command.",
enough, as then user can't set it to 1 so it will always be ignored in the enough, as then user can't set it to 1 so it will always be ignored in the
rest of code. rest of code.
*/ */
#if MYSQL_VERSION_ID > 40103 #if MYSQL_VERSION_ID >= 40103
/* /*
innodb_safe_binlog is not a variable, just an option. Does not make innodb_safe_binlog is not a variable, just an option. Does not make
sense to make it a variable, as it is only used at startup (and so the sense to make it a variable, as it is only used at startup (and so the
...@@ -4641,9 +4644,8 @@ replicating a LOAD DATA INFILE command.", ...@@ -4641,9 +4644,8 @@ replicating a LOAD DATA INFILE command.",
effect). effect).
*/ */
{"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG, {"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG,
"After a crash recovery by InnoDB, truncate the binary log to the last \ "After a crash recovery by InnoDB, truncate the binary log after the last "
InnoDB committed transaction. Use only if this server updates ONLY InnoDB \ "not-rolled-back statement/transaction.",
tables.",
(gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
#endif #endif
......
...@@ -131,7 +131,8 @@ static int remove_dup_with_hash_index(THD *thd,TABLE *table, ...@@ -131,7 +131,8 @@ static int remove_dup_with_hash_index(THD *thd,TABLE *table,
static int join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count); static int join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count);
static ulong used_blob_length(CACHE_FIELD **ptr); static ulong used_blob_length(CACHE_FIELD **ptr);
static bool store_record_in_cache(JOIN_CACHE *cache); static bool store_record_in_cache(JOIN_CACHE *cache);
static void reset_cache(JOIN_CACHE *cache); static void reset_cache_read(JOIN_CACHE *cache);
static void reset_cache_write(JOIN_CACHE *cache);
static void read_cached_record(JOIN_TAB *tab); static void read_cached_record(JOIN_TAB *tab);
static bool cmp_buffer_with_ref(JOIN_TAB *tab); static bool cmp_buffer_with_ref(JOIN_TAB *tab);
static bool setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields, static bool setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields,
...@@ -5843,8 +5844,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last) ...@@ -5843,8 +5844,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
/* read through all records */ /* read through all records */
if ((error=join_init_read_record(join_tab))) if ((error=join_init_read_record(join_tab)))
{ {
reset_cache(&join_tab->cache); reset_cache_write(&join_tab->cache);
join_tab->cache.records=0; join_tab->cache.ptr_record= (uint) ~0;
return -error; /* No records or error */ return -error; /* No records or error */
} }
...@@ -5867,21 +5867,23 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last) ...@@ -5867,21 +5867,23 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
!join_tab->cache.select->skip_record())) !join_tab->cache.select->skip_record()))
{ {
uint i; uint i;
reset_cache(&join_tab->cache); reset_cache_read(&join_tab->cache);
for (i=(join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;) for (i=(join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;)
{ {
read_cached_record(join_tab); read_cached_record(join_tab);
if (!select || !select->skip_record()) if (!select || !select->skip_record())
if ((error=(join_tab->next_select)(join,join_tab+1,0)) < 0) if ((error=(join_tab->next_select)(join,join_tab+1,0)) < 0)
{
reset_cache_write(&join_tab->cache);
return error; /* purecov: inspected */ return error; /* purecov: inspected */
}
} }
} }
} while (!(error=info->read_record(info))); } while (!(error=info->read_record(info)));
if (skip_last) if (skip_last)
read_cached_record(join_tab); // Restore current record read_cached_record(join_tab); // Restore current record
reset_cache(&join_tab->cache); reset_cache_write(&join_tab->cache);
join_tab->cache.records=0; join_tab->cache.ptr_record= (uint) ~0;
if (error > 0) // Fatal error if (error > 0) // Fatal error
return -1; /* purecov: inspected */ return -1; /* purecov: inspected */
for (JOIN_TAB *tmp2=join->join_tab; tmp2 != join_tab ; tmp2++) for (JOIN_TAB *tmp2=join->join_tab; tmp2 != join_tab ; tmp2++)
...@@ -7776,7 +7778,6 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -7776,7 +7778,6 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
} }
} }
cache->records=0; cache->ptr_record= (uint) ~0;
cache->length=length+blobs*sizeof(char*); cache->length=length+blobs*sizeof(char*);
cache->blobs=blobs; cache->blobs=blobs;
*blob_ptr=0; /* End sequentel */ *blob_ptr=0; /* End sequentel */
...@@ -7784,7 +7785,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -7784,7 +7785,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
if (!(cache->buff=(uchar*) my_malloc(size,MYF(0)))) if (!(cache->buff=(uchar*) my_malloc(size,MYF(0))))
DBUG_RETURN(1); /* Don't use cache */ /* purecov: inspected */ DBUG_RETURN(1); /* Don't use cache */ /* purecov: inspected */
cache->end=cache->buff+size; cache->end=cache->buff+size;
reset_cache(cache); reset_cache_write(cache);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -7868,13 +7869,21 @@ store_record_in_cache(JOIN_CACHE *cache) ...@@ -7868,13 +7869,21 @@ store_record_in_cache(JOIN_CACHE *cache)
static void static void
reset_cache(JOIN_CACHE *cache) reset_cache_read(JOIN_CACHE *cache)
{ {
cache->record_nr=0; cache->record_nr=0;
cache->pos=cache->buff; cache->pos=cache->buff;
} }
static void reset_cache_write(JOIN_CACHE *cache)
{
reset_cache_read(cache);
cache->records= 0;
cache->ptr_record= (uint) ~0;
}
static void static void
read_cached_record(JOIN_TAB *tab) read_cached_record(JOIN_TAB *tab)
{ {
......
...@@ -1817,7 +1817,7 @@ alter: ...@@ -1817,7 +1817,7 @@ alter:
lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.default_table_charset= thd->variables.collation_database; lex->create_info.default_table_charset= thd->variables.collation_database;
lex->create_info.row_type= ROW_TYPE_NOT_USED; lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_info.clear(); lex->alter_info.reset();
lex->alter_info.is_simple= 1; lex->alter_info.is_simple= 1;
lex->alter_info.flags= 0; lex->alter_info.flags= 0;
} }
......
...@@ -292,7 +292,7 @@ install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql ...@@ -292,7 +292,7 @@ install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql
# Save manual to avoid rebuilding # Save manual to avoid rebuilding
mv Docs/manual.ps Docs/manual.ps.save mv Docs/manual.ps Docs/manual.ps.save
make distclean make clean
mv Docs/manual.ps.save Docs/manual.ps mv Docs/manual.ps.save Docs/manual.ps
# RPM:s destroys Makefile.in files, so we generate them here # RPM:s destroys Makefile.in files, so we generate them here
...@@ -482,6 +482,7 @@ fi ...@@ -482,6 +482,7 @@ fi
%attr(755, root, root) %{_bindir}/mysql_install_db %attr(755, root, root) %{_bindir}/mysql_install_db
%attr(755, root, root) %{_bindir}/mysql_secure_installation %attr(755, root, root) %{_bindir}/mysql_secure_installation
%attr(755, root, root) %{_bindir}/mysql_setpermission %attr(755, root, root) %{_bindir}/mysql_setpermission
%attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql
%attr(755, root, root) %{_bindir}/mysql_zap %attr(755, root, root) %{_bindir}/mysql_zap
%attr(755, root, root) %{_bindir}/mysqlbug %attr(755, root, root) %{_bindir}/mysqlbug
%attr(755, root, root) %{_bindir}/mysqld_multi %attr(755, root, root) %{_bindir}/mysqld_multi
...@@ -578,6 +579,11 @@ fi ...@@ -578,6 +579,11 @@ fi
# The spec file changelog only includes changes made to the spec file # The spec file changelog only includes changes made to the spec file
# itself # itself
%changelog %changelog
* Thu Jun 24 2004 Lenz Grimmer <lenz@mysql.com>
- added mysql_tzinfo_to_sql to the server subpackage
- run "make clean" instead of "make distclean"
* Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com> * Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com>
- added ncurses-devel to the build prerequisites (BUG 3377) - added ncurses-devel to the build prerequisites (BUG 3377)
......
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