Commit ccdb4f66 authored by unknown's avatar unknown

Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-wl2278


BitKeeper/etc/logging_ok:
  auto-union
configure.in:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
ndb/include/mgmapi/mgmapi.h:
  Auto merged
ndb/src/kernel/vm/Configuration.cpp:
  Auto merged
ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
sql/sql_parse.cc:
  Auto merged
parents 7a37dcc1 a58a1dac
......@@ -48,8 +48,8 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch
c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
base_max_configs="--with-innodb --with-bdb --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio"
max_leave_isam_configs="--with-innodb --with-bdb --with-ndbcluster --with-archive-storage-engine --with-federated-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server"
base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio"
max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-federated-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server"
max_no_es_configs="$max_leave_isam_configs --without-isam"
max_configs="$max_no_es_configs --with-embedded-server"
......
......@@ -38,6 +38,7 @@ brian@zim.(none)
carsten@tsort.bitbybit.dk
cps@silver_beast.(none)
davida@isil.mysql.com
dean@mysql.com
dellis@goetia.(none)
dlenev@brandersnatch.localdomain
dlenev@build.mysql.com
......
......@@ -56,28 +56,6 @@ czech danish dutch english estonian french german greek hungarian \
italian japanese korean norwegian norwegian-ny polish portuguese \
romanian russian serbian slovak spanish swedish ukrainian"
# Generate make rules for all error messages
AVAILABLE_LANGUAGES_ERRORS=
AVAILABLE_LANGUAGES_ERRORS_RULES=$srcdir/ac_available_languages_fragment
rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES
for i in $AVAILABLE_LANGUAGES
do
AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys"
case $host_os in
netware*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err.linux -C\$(srcdir)/charsets/ $i/errmsg.txt $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err -C\$(srcdir)/charsets/ $i/errmsg.txt $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
esac
done
#####
#####
......@@ -93,7 +71,6 @@ AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
AC_SUBST(SHARED_LIB_VERSION)
AC_SUBST(AVAILABLE_LANGUAGES)
AC_SUBST(AVAILABLE_LANGUAGES_ERRORS)
AC_SUBST_FILE(AVAILABLE_LANGUAGES_ERRORS_RULES)
AC_SUBST([NDB_VERSION_MAJOR])
AC_SUBST([NDB_VERSION_MINOR])
......
......@@ -261,6 +261,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
}
/*
If ndocs == 0, this will not allocate RAM for FT_INFO.doc[],
so if ndocs == 0, FT_INFO.doc[] must not be accessed.
*/
dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+
sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1),
MYF(0));
......@@ -329,7 +333,8 @@ float ft_nlq_find_relevance(FT_INFO *handler,
else
a=c;
}
if (docs[a].dpos == docid)
/* bounds check to avoid accessing unallocated handler->doc */
if (a < handler->ndocs && docs[a].dpos == docid)
return (float) docs[a].weight;
else
return 0.0;
......
This diff is collapsed.
......@@ -123,6 +123,17 @@ sub spawn_impl ($$$$$$$) {
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
if ( $::glob_cygwin_shell and $mode eq 'test' )
{
# Programs started from mysqltest under Cygwin, are to
# execute them within Cygwin. Else simple things in test
# files like
# --system "echo 1 > file"
# will fail.
# FIXME not working :-(
# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
}
if ( $output )
{
if ( ! open(STDOUT,">",$output) )
......@@ -130,6 +141,7 @@ sub spawn_impl ($$$$$$$) {
mtr_error("can't redirect STDOUT to \"$output\": $!");
}
}
if ( $error )
{
if ( $output eq $error )
......@@ -147,6 +159,7 @@ sub spawn_impl ($$$$$$$) {
}
}
}
if ( $input )
{
if ( ! open(STDIN,"<",$input) )
......@@ -154,7 +167,11 @@ sub spawn_impl ($$$$$$$) {
mtr_error("can't redirect STDIN to \"$input\": $!");
}
}
exec($path,@$arg_list_t);
if ( ! exec($path,@$arg_list_t) )
{
mtr_error("failed to execute \"$path\": $!");
}
}
}
}
......@@ -569,7 +586,7 @@ sub mtr_stop_mysqld_servers ($) {
sub mtr_mysqladmin_shutdown () {
my $spec= shift;
my @mysql_admin_pids;
my %mysql_admin_pids;
my @to_kill_specs;
foreach my $srv ( @$spec )
......@@ -611,13 +628,19 @@ sub mtr_mysqladmin_shutdown () {
# We don't wait for termination of mysqladmin
my $pid= mtr_spawn($::exe_mysqladmin, $args,
"", $::path_manager_log, $::path_manager_log, "");
push(@mysql_admin_pids, $pid);
$mysql_admin_pids{$pid}= 1;
}
# We wait blocking, we wait for the last one anyway
foreach my $pid (@mysql_admin_pids)
while (keys %mysql_admin_pids)
{
waitpid($pid,0); # FIXME no need to check -1 or 0?
foreach my $pid (keys %mysql_admin_pids)
{
if ( waitpid($pid,0) > 0 )
{
delete $mysql_admin_pids{$pid};
}
}
}
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
......
......@@ -360,6 +360,10 @@ sub main () {
if ( $opt_start_and_exit )
{
if ( ndbcluster_start() )
{
mtr_error("Can't start ndbcluster");
}
if ( mysqld_start('master',0,[],[]) )
{
mtr_report("Servers started, exiting");
......@@ -1053,7 +1057,7 @@ sub ndbcluster_start () {
"--data-dir=$glob_mysql_test_dir/var"],
"", "/dev/null", "", "") )
{
mtr_error("Error ndbcluster_install");
mtr_error("Error ndbcluster_start");
return 1;
}
......@@ -1248,7 +1252,7 @@ sub install_db ($$) {
}
else
{
print OUT $_;
print OUT "$_ ";
}
}
close OUT;
......@@ -1258,6 +1262,7 @@ sub install_db ($$) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--console");
mtr_add_arg($args, "--skip-grant-tables");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
......@@ -1516,8 +1521,8 @@ sub report_failure_and_restart ($) {
# but stop before actually running mysqld or anything.
sub do_before_start_master ($$) {
my $tname= shift;
my $master_init_script= shift;
my $tname= shift;
my $init_script= shift;
# FIXME what about second master.....
......@@ -1538,18 +1543,18 @@ sub do_before_start_master ($$) {
unlink("$glob_mysql_test_dir/var/master1-data/relay-log.info");
# Run master initialization shell script if one exists
if ( $master_init_script and
mtr_run($master_init_script, [], "", "", "", "") != 0 )
if ( $init_script )
{
mtr_error("Can't run $master_init_script");
# We ignore the return code
mtr_run("/bin/sh", ["-c",$init_script], "", "", "", "");
}
# for gcov FIXME needed? If so we need more absolute paths
# chdir($glob_basedir);
}
sub do_before_start_slave ($$) {
my $tname= shift;
my $slave_init_script= shift;
my $tname= shift;
my $init_script= shift;
# Remove stale binary logs and old master.info files
# except for too tests which need them
......@@ -1566,10 +1571,10 @@ sub do_before_start_slave ($$) {
}
# Run slave initialization shell script if one exists
if ( $slave_init_script and
mtr_run($slave_init_script, [], "", "", "", "") != 0 )
if ( $init_script )
{
mtr_error("Can't run $slave_init_script");
# We ignore the return code
mtr_run("/bin/sh", ["-c",$init_script], "", "", "", "");
}
`rm -f $glob_mysql_test_dir/var/slave-data/log.*`;
......@@ -1601,6 +1606,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--no-defaults", $prefix);
}
mtr_add_arg($args, "%s--console", $prefix);
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
mtr_add_arg($args, "%s--core", $prefix);
......
......@@ -163,3 +163,12 @@ select * from t1;
a b
7 7
drop table t1;
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
a
0
2
DROP TABLE t1;
......@@ -17,8 +17,6 @@ master-bin.000001 # Query 1 # create database `drop-temp+table-test`
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int)
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int)
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn1`
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
......@@ -402,6 +402,12 @@ select count(*) from t1;
count(*)
1
drop table t1;
CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
MATCH(a) AGAINST ('nosuchword')
0
DROP TABLE t1;
create table t1 (a int primary key, b text, fulltext(b));
create table t2 (a int, b text);
insert t1 values (1, "aaaa"), (2, "bbbb");
......
......@@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
aaaaaaaaa dsaass de sushi 1 1.92378664
aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
aaaaaaaaa dsaass de Feijoada 3 0.00000000
aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
ssde df s fsda sad er um copo de Vodka 5 0.00000000
ssde df s fsda sad er um chocolate Snickers 6 0.00000000
aaaaaaaaa dsaass de Bife 7 0.00000000
aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
aaaaaaaaa dsaass de sushi 1 1.923787
aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000
aaaaaaaaa dsaass de Feijoada 3 0.000000
aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000
ssde df s fsda sad er um copo de Vodka 5 0.000000
ssde df s fsda sad er um chocolate Snickers 6 0.000000
aaaaaaaaa dsaass de Bife 7 0.000000
aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
......@@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0
ssde df s fsda sad er um chocolate Snickers 6 0
aaaaaaaaa dsaass de Bife 7 0
aaaaaaaaa dsaass de Pizza de Salmao 8 0
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
aaaaaaaaa dsaass de sushi 1 1.92378664
aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
aaaaaaaaa dsaass de Feijoada 3 0.00000000
aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
ssde df s fsda sad er um copo de Vodka 5 0.00000000
ssde df s fsda sad er um chocolate Snickers 6 0.00000000
aaaaaaaaa dsaass de Bife 7 0.00000000
aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
aaaaaaaaa dsaass de sushi 1 1.923787
aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000
aaaaaaaaa dsaass de Feijoada 3 0.000000
aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000
ssde df s fsda sad er um copo de Vodka 5 0.000000
ssde df s fsda sad er um chocolate Snickers 6 0.000000
aaaaaaaaa dsaass de Bife 7 0.000000
aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest;
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.t1 ( n int);
insert into mysqltest.t1 values(1)/
insert into mysqltest.t1 values(2);
insert into mysqltest.t1 values(3);
insert into mysqltest.t1 values(4);
insert into mysqltest.t1 values(5)/
select * from mysqltest.t1;
n
1
2
3
4
5
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest
master-bin.000001 # Query 1 # create database mysqltest
master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int)
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1)
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2)
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3)
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4)
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5)
drop database mysqltest;
......@@ -141,3 +141,14 @@ delete t1 from t1 where a = 3;
check table t1;
select * from t1;
drop table t1;
#
# Bug #8392: delete with ORDER BY containing a direct reference to the table
#
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
DROP TABLE t1;
......@@ -309,6 +309,14 @@ REPAIR TABLE t1;
select count(*) from t1;
drop table t1;
#
# testing out of bounds memory access in ft_nlq_find_relevance()
# (bug#8522); visible in valgrind.
#
CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
DROP TABLE t1;
#
# bug#6784
# mi_flush_bulk_insert (on dup key error in mi_write)
......
......@@ -29,13 +29,13 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
......
......@@ -606,6 +606,7 @@ drop table t2;
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
# rename must fail, t7 does not exist
--replace_result \\ /
--error 1017
execute stmt1 ;
create table t7 (a int) ;
......
......@@ -6,7 +6,7 @@ connection master;
drop database if exists mysqltest;
sync_slave_with_master;
# can't read dir
--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X"
--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
--error 12
show tables from mysqltest;
......
--replicate-ignore-table=mysqltest.t2
source include/master-slave.inc;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
sync_slave_with_master;
connection master;
disconnect master;
connection slave;
--real_sleep 3; # time for DROP to be written
show status like 'Slave_open_temp_tables';
# Test for BUG#8436: verify that a multi-query (i.e. one query
# containing several queries (assuming client has
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
# one binlog event containing all queries)
# PS doesn't support multi-statements
--disable_ps_protocol
source include/master-slave.inc;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
delimiter /;
create table mysqltest.t1 ( n int);
insert into mysqltest.t1 values(1)/
insert into mysqltest.t1 values(2);
insert into mysqltest.t1 values(3);
insert into mysqltest.t1 values(4);
insert into mysqltest.t1 values(5)/
delimiter ;/
sync_slave_with_master;
select * from mysqltest.t1;
connection master;
--replace_column 2 # 5 #
show binlog events from 95;
drop database mysqltest;
sync_slave_with_master;
......@@ -489,6 +489,12 @@ extern "C" {
int ndb_mgm_set_connectstring(NdbMgmHandle handle,
const char *connect_string);
int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid);
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/**
* Gets the connectstring used for a connection
*
......
......@@ -55,6 +55,8 @@ public:
*/
Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds);
int setNodeId(Uint32 nodeid);
/**
* Get config using socket
*/
......
......@@ -316,6 +316,12 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
return true;
}
int
ConfigRetriever::setNodeId(Uint32 nodeid)
{
return ndb_mgm_set_configuration_nodeid(m_handle, nodeid);
}
Uint32
ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds)
{
......
......@@ -141,6 +141,8 @@ Configuration::init(int argc, char** argv)
else
_programName = strdup("");
globalData.ownId= 0;
return true;
}
......@@ -216,6 +218,13 @@ Configuration::fetch_configuration(){
ConfigRetriever &cr= *m_config_retriever;
/**
* if we have a nodeid set (e.g in a restart situation)
* reuse it
*/
if (globalData.ownId)
cr.setNodeId(globalData.ownId);
globalData.ownId = cr.allocNodeId(2 /*retry*/,3 /*delay*/);
if(globalData.ownId == 0){
......
......@@ -1752,6 +1752,15 @@ ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *cfg)
}
}
extern "C"
int
ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid)
{
CHECK_HANDLE(handle, -1);
handle->cfg._ownNodeId= nodeid;
return 0;
}
extern "C"
int
ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle)
......
......@@ -1083,16 +1083,19 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it,
}
ndbout << ")" << endl;
} else {
if(ndb_mgm_find(it, CFG_NODE_ID, node_id) != 0){
ndb_mgm_first(it);
if(ndb_mgm_find(it, CFG_NODE_ID, node_id) == 0){
const char *config_hostname= 0;
ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &config_hostname);
if (config_hostname == 0 || config_hostname[0] == 0)
config_hostname= "any host";
ndbout_c(" (not connected, accepting connect from %s)",
config_hostname);
}
else
{
ndbout_c("Unable to find node with id: %d", node_id);
return;
}
const char *config_hostname= 0;
ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &config_hostname);
if (config_hostname == 0 || config_hostname[0] == 0)
config_hostname= "any host";
ndbout << " (not connected, accepting connect from "
<< config_hostname << ")" << endl;
}
}
}
......
......@@ -496,58 +496,58 @@ void close_temporary(TABLE *table,bool delete_table)
void close_temporary_tables(THD *thd)
{
TABLE *table,*next;
char *query, *name_in_query, *end;
uint greatest_key_length= 0;
char *query, *end;
uint query_buf_size;
bool found_user_tables = 0;
if (!thd->temporary_tables)
return;
/*
We write a DROP TEMPORARY TABLE for each temp table left, so that our
replication slave can clean them up. Not one multi-table DROP TABLE binlog
event: this would cause problems if slave uses --replicate-*-table.
*/
LINT_INIT(end);
query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS
/* We'll re-use always same buffer so make it big enough for longest name */
for (table=thd->temporary_tables ; table ; table=table->next)
greatest_key_length= max(greatest_key_length, table->s->key_length);
/*
We are going to add 4 ` around the db/table names, so 1 does not look
enough; indeed it is enough, because table->key_length is greater (by 8,
because of server_id and thread_id) than db||table.
*/
query_buf_size+= table->s->key_length+1;
if ((query = alloc_root(thd->mem_root, greatest_key_length+50)))
if ((query = alloc_root(thd->mem_root, query_buf_size)))
// Better add "if exists", in case a RESET MASTER has been done
name_in_query= strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `");
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ");
for (table=thd->temporary_tables ; table ; table=next)
{
/*
In we are OOM for 'query' this is not fatal. We skip temporary tables
not created directly by the user.
*/
if (query && mysql_bin_log.is_open() && (table->s->table_name[0] != '#'))
if (query) // we might be out of memory, but this is not fatal
{
/*
Here we assume table_cache_key always starts
with \0 terminated db name
*/
end = strxmov(name_in_query, table->s->db, "`.`",
table->s->table_name, "`", NullS);
Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE);
/*
Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as
"killed", because it's not really a statement updating data, and there
are 99.99% chances it will succeed on slave. And, if thread is
killed now, it's not clever either.
If a real update (one updating a persistent table) was killed on the
master, then this real update will be logged with error_code=killed,
rightfully causing the slave to stop.
*/
qinfo.error_code= 0;
mysql_bin_log.write(&qinfo);
// skip temporary tables not created directly by the user
if (table->s->table_name[0] != '#')
found_user_tables = 1;
end = strxmov(end,"`",table->s->db,"`.`",
table->s->table_name,"`,", NullS);
}
next=table->next;
close_temporary(table);
}
if (query && found_user_tables && mysql_bin_log.is_open())
{
/* The -1 is to remove last ',' */
thd->clear_error();
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE);
/*
Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as
"killed", because it's not really a statement updating data, and there
are 99.99% chances it will succeed on slave.
If a real update (one updating a persistent table) was killed on the
master, then this real update will be logged with error_code=killed,
rightfully causing the slave to stop.
*/
qinfo.error_code= 0;
mysql_bin_log.write(&qinfo);
}
thd->temporary_tables=0;
}
......
......@@ -135,6 +135,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
bzero((char*) &tables,sizeof(tables));
tables.table = table;
tables.alias = table_list->alias;
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
......
......@@ -1671,6 +1671,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
if (alloc_query(thd, packet, packet_length))
break; // fatal error is set
char *packet_end= thd->query + thd->query_length;
mysql_log.write(thd,command,"%s",thd->query);
DBUG_PRINT("query",("%-.4096s",thd->query));
mysql_parse(thd,thd->query, thd->query_length);
......@@ -1686,7 +1687,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (thd->lock || thd->open_tables || thd->derived_tables)
close_thread_tables(thd);
#endif
ulong length= thd->query_length-(ulong)(packet-thd->query);
ulong length= (ulong)(packet_end-packet);
/* Remove garbage at start of query */
while (my_isspace(thd->charset(), *packet) && length > 0)
......@@ -2376,9 +2377,14 @@ mysql_execute_command(THD *thd)
}
/*
Skip if we are in the slave thread, some table rules have been
given and the table list says the query should not be replicated
given and the table list says the query should not be replicated.
Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it
(otherwise we have stale files on slave caused by exclusion of one tmp
table).
*/
if (all_tables_not_ok(thd, all_tables))
if (!(lex->sql_command == SQLCOM_DROP_TABLE &&
lex->drop_temporary && lex->drop_if_exists) &&
all_tables_not_ok(thd, all_tables))
{
/* we warn the slave SQL thread */
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
......@@ -4957,6 +4963,20 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
}
else
{
/*
Binlog logs a string starting from thd->query and having length
thd->query_length; so we set thd->query_length correctly (to not
log several statements in one event, when we executed only first).
We set it to not see the ';' (otherwise it would get into binlog
and Query_log_event::print() would give ';;' output).
This also helps display only the current query in SHOW
PROCESSLIST.
Note that we don't need LOCK_thread_count to modify query_length.
*/
if (lex->found_colon &&
(thd->query_length= (ulong)(lex->found_colon - thd->query)))
thd->query_length--;
/* Actually execute the query */
mysql_execute_command(thd);
query_cache_end_of_result(thd);
}
......
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