Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/Users/kent/mysql/bk/mysql-5.0


mysql-test/t/mysqldump.test:
  Auto merged
This commit is contained in:
unknown 2005-09-30 14:06:08 +02:00
commit 936a6905ad
58 changed files with 1416 additions and 1829 deletions

View file

@ -1434,7 +1434,7 @@ int main(int argc, char** argv)
of transaction.
*/
fprintf(result_file,
"# End of log file\nROLLBACK;\n"
"# End of log file\nROLLBACK /* added by mysqlbinlog */;\n"
"/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n");
if (disable_log_bin)
fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");

View file

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.14-rc)
AM_INIT_AUTOMAKE(mysql, 5.0.15-rc)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -18,7 +18,7 @@ SHARED_LIB_VERSION=15:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=14
NDB_VERSION_BUILD=15
NDB_VERSION_STATUS="rc"
# Set all version vars based on $VERSION. How do we do this more elegant ?

View file

@ -1092,7 +1092,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
"Keypointers and record positions doesn't match");
error=1;
}
else if (param->glob_crc != info->s->state.checksum &&
else if (param->glob_crc != info->state->checksum &&
(info->s->options &
(HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)))
{
@ -1388,7 +1388,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
info->state->data_file_length=sort_param.max_pos;
}
if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc;
info->state->checksum=param->glob_crc;
if (!(param->testflag & T_SILENT))
{
@ -2156,7 +2156,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
my_errno);
}
if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc;
info->state->checksum=param->glob_crc;
if (my_chsize(share->kfile,info->state->key_file_length,0,MYF(0)))
mi_check_print_warning(param,
@ -2577,7 +2577,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
my_errno);
}
if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc;
info->state->checksum=param->glob_crc;
if (my_chsize(share->kfile,info->state->key_file_length,0,MYF(0)))
mi_check_print_warning(param,
@ -3808,7 +3808,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
(*org_info)->s->state.create_time=share.state.create_time;
(*org_info)->s->state.unique=(*org_info)->this_unique=
share.state.unique;
(*org_info)->s->state.checksum=share.state.checksum;
(*org_info)->state->checksum=info.state->checksum;
(*org_info)->state->del=info.state->del;
(*org_info)->s->state.dellink=share.state.dellink;
(*org_info)->state->empty=info.state->empty;

View file

@ -93,7 +93,7 @@ int mi_delete(MI_INFO *info,const byte *record)
if ((*share->delete_record)(info))
goto err; /* Remove record from database */
info->s->state.checksum-=info->checksum;
info->state->checksum-=info->checksum;
info->update= HA_STATE_CHANGED+HA_STATE_DELETED+HA_STATE_ROW_CHANGED;
info->state->records--;

View file

@ -41,7 +41,7 @@ int mi_delete_all_rows(MI_INFO *info)
info->state->key_file_length=share->base.keystart;
info->state->data_file_length=0;
info->state->empty=info->state->key_empty=0;
state->checksum=0;
info->state->checksum=0;
for (i=share->base.max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH ; i-- ; )
state->key_del[i]= HA_OFFSET_ERROR;

View file

@ -822,7 +822,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
mi_sizestore(ptr,state->state.empty); ptr +=8;
mi_sizestore(ptr,state->state.key_empty); ptr +=8;
mi_int8store(ptr,state->auto_increment); ptr +=8;
mi_int8store(ptr,(ulonglong) state->checksum);ptr +=8;
mi_int8store(ptr,(ulonglong) state->state.checksum);ptr +=8;
mi_int4store(ptr,state->process); ptr +=4;
mi_int4store(ptr,state->unique); ptr +=4;
mi_int4store(ptr,state->status); ptr +=4;
@ -884,7 +884,7 @@ char *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state)
state->state.empty = mi_sizekorr(ptr); ptr +=8;
state->state.key_empty= mi_sizekorr(ptr); ptr +=8;
state->auto_increment=mi_uint8korr(ptr); ptr +=8;
state->checksum=(ha_checksum) mi_uint8korr(ptr); ptr +=8;
state->state.checksum=(ha_checksum) mi_uint8korr(ptr); ptr +=8;
state->process= mi_uint4korr(ptr); ptr +=4;
state->unique = mi_uint4korr(ptr); ptr +=4;
state->status = mi_uint4korr(ptr); ptr +=4;

View file

@ -162,7 +162,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
if (auto_key_changed)
update_auto_increment(info,newrec);
if (share->calc_checksum)
share->state.checksum+=(info->checksum - old_checksum);
info->state->checksum+=(info->checksum - old_checksum);
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);

View file

@ -142,7 +142,7 @@ int mi_write(MI_INFO *info, byte *record)
{
if ((*share->write_record)(info,record))
goto err;
share->state.checksum+=info->checksum;
info->state->checksum+=info->checksum;
}
if (share->base.auto_key)
update_auto_increment(info,record);

View file

@ -1261,7 +1261,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
share->base.raid_chunksize);
}
if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
printf("Checksum: %23s\n",llstr(info->s->state.checksum,llbuff));
printf("Checksum: %23s\n",llstr(info->state->checksum,llbuff));
;
if (share->options & HA_OPTION_DELAY_KEY_WRITE)
printf("Keys are only flushed at close\n");
@ -1576,7 +1576,7 @@ static int mi_sort_records(MI_CHECK *param,
old_record_count=info->state->records;
info->state->records=0;
if (sort_info.new_data_file_type != COMPRESSED_RECORD)
share->state.checksum=0;
info->state->checksum=0;
if (sort_record_index(&sort_param,info,keyinfo,share->state.key_root[sort_key],
temp_buff, sort_key,new_file,update_index) ||

View file

@ -38,6 +38,7 @@ typedef struct st_mi_status_info
my_off_t key_empty; /* lost space in indexfile */
my_off_t key_file_length;
my_off_t data_file_length;
ha_checksum checksum;
} MI_STATUS_INFO;
typedef struct st_mi_state_info
@ -75,7 +76,6 @@ typedef struct st_mi_state_info
ulong sec_index_changed; /* Updated when new sec_index */
ulong sec_index_used; /* which extra index are in use */
ulonglong key_map; /* Which keys are in use */
ha_checksum checksum;
ulong version; /* timestamp of create */
time_t create_time; /* Time when created database */
time_t recover_time; /* Time for last recover */

View file

@ -2965,7 +2965,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
share->state.key_root[key]= HA_OFFSET_ERROR;
for (key=0 ; key < share->state.header.max_block_size ; key++)
share->state.key_del[key]= HA_OFFSET_ERROR;
share->state.checksum=crc; /* Save crc here */
isam_file->state->checksum=crc; /* Save crc here */
share->changed=1; /* Force write of header */
share->state.open_count=0;
share->global_changed=0;
@ -3001,7 +3001,7 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
state.dellink= HA_OFFSET_ERROR;
state.version=(ulong) time((time_t*) 0);
mi_clear_all_keys_active(state.key_map);
state.checksum=crc;
state.state.checksum=crc;
if (isam_file->s->base.keys)
isamchk_neaded=1;
state.changed=STATE_CHANGED | STATE_NOT_ANALYZED; /* Force check of table */

View file

@ -1429,10 +1429,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
1 SIMPLE t1 ref v v 13 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
alter table t1 add key(v);
@ -1622,10 +1622,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 258 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 258 NULL # Using where
1 SIMPLE t1 ref v v 258 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 258 NULL # Using where
1 SIMPLE t1 ref v v 258 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 258 const # Using where
@ -1702,10 +1702,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
1 SIMPLE t1 ref v v 33 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
1 SIMPLE t1 ref v v 33 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 33 const # Using where

View file

@ -18,6 +18,6 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t2 values (@v);
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t2;

View file

@ -2625,11 +2625,11 @@ test.test_checksum 1531596814
insert into test_checksum values(3);
checksum table test_checksum;
Table Checksum
test.test_checksum 1531596814
test.test_checksum 2605035534
commit;
checksum table test_checksum;
Table Checksum
test.test_checksum 2050879373
test.test_checksum 127268899
commit;
drop table test_checksum;
create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1;
@ -2642,5 +2642,5 @@ set autocommit=1;
insert into test_checksum values(3);
checksum table test_checksum;
Table Checksum
test.test_checksum 2050879373
test.test_checksum 127268899
drop table test_checksum;

View file

@ -1375,3 +1375,31 @@ groupid price
6 9900
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1(a int);
CREATE TABLE t2(b int);
CREATE TABLE t3(c int, d int);
CREATE TABLE t4(d int);
CREATE TABLE t5(e int, f int);
CREATE TABLE t6(f int);
CREATE VIEW v1 AS
SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
CREATE VIEW v2 AS
SELECT e FROM t5 NATURAL JOIN t6;
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 't1.x' in 'field list'
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
ERROR 42S22: Unknown column 't1.x' in 'field list'
SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e
SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v1.x' in 'field list'
SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e
SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v2.x' in 'field list'
DROP VIEW v1, v2;
DROP TABLE t1, t2, t3, t4, t5, t6;

View file

@ -40,7 +40,7 @@ load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-3-0' INTO table t1;
SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-4-0' INTO table t1;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Broken LOAD DATA --
@ -53,7 +53,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --database --
@ -62,7 +62,7 @@ ROLLBACK;
ROLLBACK;
SET INSERT_ID=1;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
@ -75,7 +75,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote --
@ -106,7 +106,7 @@ load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-3-2' INTO table t1;
SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-4-2' INTO table t1;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Broken LOAD DATA --
@ -119,7 +119,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --database --
@ -128,7 +128,7 @@ ROLLBACK;
ROLLBACK;
SET INSERT_ID=1;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
@ -141,7 +141,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- reading stdin --
@ -154,7 +154,7 @@ BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@ -164,6 +164,6 @@ BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1, t2;

View file

@ -40,7 +40,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@ -67,7 +67,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@ -84,7 +84,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@ -107,7 +107,7 @@ SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@ -128,7 +128,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@ -148,7 +148,7 @@ SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Local with 2 binlogs on command line --
@ -184,7 +184,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@ -218,7 +218,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@ -242,7 +242,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@ -272,7 +272,7 @@ SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@ -300,7 +300,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@ -320,7 +320,7 @@ SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote --
@ -349,7 +349,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@ -376,7 +376,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@ -393,7 +393,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@ -416,7 +416,7 @@ SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@ -437,7 +437,7 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@ -457,7 +457,7 @@ SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote with 2 binlogs on command line --
@ -493,7 +493,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@ -527,7 +527,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@ -551,7 +551,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@ -581,7 +581,7 @@ SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@ -609,7 +609,7 @@ SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@ -629,7 +629,7 @@ SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- to-last-log --
@ -661,7 +661,7 @@ SET INSERT_ID=6;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- end of test --

View file

@ -1735,22 +1735,65 @@ create view v1 as
select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
drop view v1, v2, v3;
drop table t1;
show full tables;
Tables_in_test Table_type
t1 BASE TABLE
v1 VIEW
v2 VIEW
v3 VIEW
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
select * from v1;
a b c
1 2 one
2 4 two
3 6 three
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1,2,'one'),(2,4,'two'),(3,6,'three');
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE TABLE `v3` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1*/;
/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop view v1, v2, v3;
drop table t1;
CREATE TABLE t1 (a int, b bigint default NULL);

View file

@ -247,7 +247,7 @@ SET TIMESTAMP=1000000000;
SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30;
INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1;
create table `t1` (

View file

@ -64,7 +64,7 @@ SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1;
set time_zone='UTC';

View file

@ -73,7 +73,7 @@ Table Create Table
user CREATE TABLE `user` (
`Host` char(60) collate utf8_bin NOT NULL default '',
`User` char(16) collate utf8_bin NOT NULL default '',
`Password` char(41) collate utf8_bin NOT NULL default '',
`Password` binary(41) NOT NULL default '',
`Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
`Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
`Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',

View file

@ -476,7 +476,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(0,11));
ERROR 42000: Scale may not be larger than the precision (column 'a_dec').
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a_dec').
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
select * from t1;

View file

@ -226,6 +226,6 @@ reckey recdesc
109 Has 109 as key
drop table t1;
create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D) or double(M,D), M must be >= D (column 's1').
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2));
ERROR 42000: For float(M,D) or double(M,D), M must be >= D (column 's1').
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').

View file

@ -936,7 +936,7 @@ ERROR 42000: Too big scale 31 specified for column 'sl'. Maximum is 30.
create table t1 (sl decimal(0,38));
ERROR 42000: Too big scale 38 specified for column 'sl'. Maximum is 30.
create table t1 (sl decimal(0,30));
ERROR 42000: Scale may not be larger than the precision (column 'sl').
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl').
create table t1 (sl decimal(5, 5));
show create table t1;
Table Create Table

View file

@ -28,6 +28,6 @@ SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
SET TIMESTAMP=10000;
insert into t1 values (@var1),(@var2);
# End of log file
ROLLBACK;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1;

View file

@ -801,3 +801,34 @@ SELECT * FROM
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
#
# Bug #13545: problem with NATURAL/USING joins.
#
CREATE TABLE t1(a int);
CREATE TABLE t2(b int);
CREATE TABLE t3(c int, d int);
CREATE TABLE t4(d int);
CREATE TABLE t5(e int, f int);
CREATE TABLE t6(f int);
CREATE VIEW v1 AS
SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
CREATE VIEW v2 AS
SELECT e FROM t5 NATURAL JOIN t6;
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
--error 1054
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
--error 1054
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
--error 1054
SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
--error 1054
SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
DROP VIEW v1, v2;
DROP TABLE t1, t2, t3, t4, t5, t6;

View file

@ -758,17 +758,7 @@ select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
--exec $MYSQL_DUMP test > var/tmp/bug10927.sql
drop view v1, v2, v3;
drop table t1;
--exec $MYSQL test < var/tmp/bug10927.sql
# Without dropping the original tables in between
--exec $MYSQL_DUMP test > var/tmp/bug10927.sql
--exec $MYSQL test < var/tmp/bug10927.sql
show full tables;
show create view v1;
select * from v1;
--exec $MYSQL_DUMP --skip-comments test
drop view v1, v2, v3;
drop table t1;

View file

@ -152,7 +152,7 @@ drop table t1;
# bug #12694 (float(m,d) specifications)
#
--error 1453
--error 1427
create table t1 (s1 float(0,2));
--error 1453
--error 1427
create table t1 (s1 float(1,2));

View file

@ -161,10 +161,12 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
#define FLUSH_CACHE 2000 /* sort this many blocks at once */
static int flush_all_key_blocks(KEY_CACHE *keycache);
#ifdef THREAD
static void link_into_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread);
static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread);
#endif
static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block);
static void test_key_cache(KEY_CACHE *keycache,
const char *where, my_bool lock);
@ -215,6 +217,7 @@ static void keycache_debug_print _VARARGS((const char *fmt,...));
#endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */
#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF)
#ifdef THREAD
static long keycache_thread_id;
#define KEYCACHE_THREAD_TRACE(l) \
KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id))
@ -226,6 +229,11 @@ static long keycache_thread_id;
#define KEYCACHE_THREAD_TRACE_END(l) \
KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id))
#else /* THREAD */
#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,(""))
#endif /* THREAD */
#else
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
#define KEYCACHE_THREAD_TRACE_END(l)
@ -492,6 +500,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache_pthread_mutex_lock(&keycache->cache_lock);
#ifdef THREAD
wqueue= &keycache->resize_queue;
thread= my_thread_var;
link_into_queue(wqueue, thread);
@ -500,6 +509,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
{
keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
}
#endif
keycache->resize_in_flush= 1;
if (flush_all_key_blocks(keycache))
@ -512,12 +522,16 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
}
keycache->resize_in_flush= 0;
keycache->can_be_used= 0;
#ifdef THREAD
while (keycache->cnt_for_resize_op)
{
KEYCACHE_DBUG_PRINT("resize_key_cache: wait",
("suspend thread %ld", thread->id));
keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
}
#else
KEYCACHE_DBUG_ASSERT(keycache->cnt_for_resize_op == 0);
#endif
end_key_cache(keycache, 0); /* Don't free mutex */
/* The following will work even if use_mem is 0 */
@ -525,6 +539,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
division_limit, age_threshold);
finish:
#ifdef THREAD
unlink_from_queue(wqueue, thread);
/* Signal for the next resize request to proceeed if any */
if (wqueue->last_thread)
@ -533,6 +548,7 @@ finish:
("thread %ld", wqueue->last_thread->next->id));
keycache_pthread_cond_signal(&wqueue->last_thread->next->suspend);
}
#endif
keycache_pthread_mutex_unlock(&keycache->cache_lock);
return blocks;
}
@ -553,6 +569,7 @@ static inline void inc_counter_for_resize_op(KEY_CACHE *keycache)
*/
static inline void dec_counter_for_resize_op(KEY_CACHE *keycache)
{
#ifdef THREAD
struct st_my_thread_var *last_thread;
if (!--keycache->cnt_for_resize_op &&
(last_thread= keycache->resize_queue.last_thread))
@ -561,6 +578,9 @@ static inline void dec_counter_for_resize_op(KEY_CACHE *keycache)
("thread %ld", last_thread->next->id));
keycache_pthread_cond_signal(&last_thread->next->suspend);
}
#else
keycache->cnt_for_resize_op--;
#endif
}
/*
@ -650,6 +670,7 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
} /* end_key_cache */
#ifdef THREAD
/*
Link a thread into double-linked queue of waiting threads.
@ -786,6 +807,7 @@ static void release_queue(KEYCACHE_WQUEUE *wqueue)
while (thread != last);
wqueue->last_thread= NULL;
}
#endif
/*
@ -893,6 +915,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
BLOCK_LINK **pins;
KEYCACHE_DBUG_ASSERT(! (block->hash_link && block->hash_link->requests));
#ifdef THREAD
if (!hot && keycache->waiting_for_block.last_thread)
{
/* Signal that in the LRU warm sub-chain an available block has appeared */
@ -929,6 +952,10 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
#endif
return;
}
#else /* THREAD */
KEYCACHE_DBUG_ASSERT(! (!hot && keycache->waiting_for_block.last_thread));
/* Condition not transformed using DeMorgan, to keep the text identical */
#endif /* THREAD */
pins= hot ? &keycache->used_ins : &keycache->used_last;
ins= *pins;
if (ins)
@ -1101,6 +1128,7 @@ static inline void remove_reader(BLOCK_LINK *block)
static inline void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block)
{
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
while (block->hash_link->requests)
{
@ -1111,6 +1139,9 @@ static inline void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block)
keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
block->condvar= NULL;
}
#else
KEYCACHE_DBUG_ASSERT(block->hash_link->requests == 0);
#endif
}
@ -1140,6 +1171,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
if ((*hash_link->prev= hash_link->next))
hash_link->next->prev= hash_link->prev;
hash_link->block= NULL;
#ifdef THREAD
if (keycache->waiting_for_hash_link.last_thread)
{
/* Signal that a free hash link has appeared */
@ -1175,6 +1207,9 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
hash_link);
return;
}
#else /* THREAD */
KEYCACHE_DBUG_ASSERT(! (keycache->waiting_for_hash_link.last_thread));
#endif /* THREAD */
hash_link->next= keycache->free_hash_list;
keycache->free_hash_list= hash_link;
}
@ -1240,6 +1275,7 @@ restart:
}
else
{
#ifdef THREAD
/* Wait for a free hash link */
struct st_my_thread_var *thread= my_thread_var;
KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting"));
@ -1252,6 +1288,9 @@ restart:
keycache_pthread_cond_wait(&thread->suspend,
&keycache->cache_lock);
thread->opt_info= NULL;
#else
KEYCACHE_DBUG_ASSERT(0);
#endif
goto restart;
}
hash_link->file= file;
@ -1363,6 +1402,7 @@ restart:
/* Wait intil the page is flushed on disk */
hash_link->requests--;
{
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
add_to_queue(&block->wqueue[COND_FOR_SAVED], thread);
do
@ -1373,6 +1413,16 @@ restart:
&keycache->cache_lock);
}
while(thread->next);
#else
KEYCACHE_DBUG_ASSERT(0);
/*
Given the use of "resize_in_flush", it seems impossible
that this whole branch is ever entered in single-threaded case
because "(wrmode && keycache->resize_in_flush)" cannot be true.
TODO: Check this, and then put the whole branch into the
"#ifdef THREAD" guard.
*/
#endif
}
/* Invalidate page in the block if it has not been done yet */
if (block->status)
@ -1401,6 +1451,7 @@ restart:
KEYCACHE_DBUG_PRINT("find_key_block",
("request waiting for old page to be saved"));
{
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
/* Put the request into the queue of those waiting for the old page */
add_to_queue(&block->wqueue[COND_FOR_SAVED], thread);
@ -1413,6 +1464,10 @@ restart:
&keycache->cache_lock);
}
while(thread->next);
#else
KEYCACHE_DBUG_ASSERT(0);
/* No parallel requests in single-threaded case */
#endif
}
KEYCACHE_DBUG_PRINT("find_key_block",
("request for old page resubmitted"));
@ -1471,6 +1526,7 @@ restart:
all of them must get the same block
*/
#ifdef THREAD
if (! keycache->used_last)
{
struct st_my_thread_var *thread= my_thread_var;
@ -1486,6 +1542,9 @@ restart:
while (thread->next);
thread->opt_info= NULL;
}
#else
KEYCACHE_DBUG_ASSERT(keycache->used_last);
#endif
block= hash_link->block;
if (! block)
{
@ -1674,6 +1733,7 @@ static void read_block(KEY_CACHE *keycache,
KEYCACHE_DBUG_PRINT("read_block",
("secondary request waiting for new page to be read"));
{
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
/* Put the request into a queue and wait until it can be processed */
add_to_queue(&block->wqueue[COND_FOR_REQUESTED], thread);
@ -1685,6 +1745,10 @@ static void read_block(KEY_CACHE *keycache,
&keycache->cache_lock);
}
while (thread->next);
#else
KEYCACHE_DBUG_ASSERT(0);
/* No parallel requests in single-threaded case */
#endif
}
KEYCACHE_DBUG_PRINT("read_block",
("secondary request: new page in cache"));
@ -1822,7 +1886,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
#ifndef THREAD
/* This is only true if we where able to read everything in one block */
if (return_buffer)
return (block->buffer);
DBUG_RETURN(block->buffer);
#endif
buff+= read_length;
filepos+= read_length+offset;
@ -2398,6 +2462,7 @@ restart:
#endif
block= first_in_switch;
{
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
add_to_queue(&block->wqueue[COND_FOR_SAVED], thread);
do
@ -2408,6 +2473,10 @@ restart:
&keycache->cache_lock);
}
while (thread->next);
#else
KEYCACHE_DBUG_ASSERT(0);
/* No parallel requests in single-threaded case */
#endif
}
#if defined(KEYCACHE_DEBUG)
cnt++;
@ -2574,7 +2643,6 @@ static void test_key_cache(KEY_CACHE *keycache __attribute__((unused)),
static void keycache_dump(KEY_CACHE *keycache)
{
FILE *keycache_dump_file=fopen(KEYCACHE_DUMP_FILE, "w");
struct st_my_thread_var *thread_var= my_thread_var;
struct st_my_thread_var *last;
struct st_my_thread_var *thread;
BLOCK_LINK *block;

View file

@ -553,7 +553,6 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_STATISTICS_CONF 454
#define GSN_START_ORD 455
/* 456 unused */
/* 457 unused */
#define GSN_EVENT_SUBSCRIBE_REQ 458
@ -835,14 +834,6 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
/* Start Global Replication */
#define GSN_GREP_REQ 656
/**
* Management server
*/
#define GSN_MGM_LOCK_CONFIG_REQ 657
#define GSN_MGM_LOCK_CONFIG_REP 658
#define GSN_MGM_UNLOCK_CONFIG_REQ 659
#define GSN_MGM_UNLOCK_CONFIG_REP 660
#define GSN_UTIL_CREATE_LOCK_REQ 132
#define GSN_UTIL_CREATE_LOCK_REF 133
#define GSN_UTIL_CREATE_LOCK_CONF 188
@ -900,6 +891,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_RESUME_REQ 682
#define GSN_STOP_REQ 443
#define GSN_STOP_REF 444
#define GSN_STOP_CONF 456
#define GSN_API_VERSION_REQ 697
#define GSN_API_VERSION_CONF 698

View file

@ -49,12 +49,11 @@ class ApiVersionConf {
*/
friend class MgmtSrv;
public:
STATIC_CONST( SignalLength = 3 );
STATIC_CONST( SignalLength = 4 );
Uint32 senderRef;
Uint32 nodeId; //api node id
Uint32 version; // Version of API node
Uint32 inet_addr;
};
#endif

View file

@ -67,6 +67,13 @@ public:
static bool getStopAbort(const Uint32 & requestInfo);
};
struct StopConf
{
STATIC_CONST( SignalLength = 2 );
Uint32 senderData;
Uint32 nodeState;
};
class StopRef
{
/**
@ -86,7 +93,8 @@ public:
OK = 0,
NodeShutdownInProgress = 1,
SystemShutdownInProgress = 2,
NodeShutdownWouldCauseSystemCrash = 3
NodeShutdownWouldCauseSystemCrash = 3,
TransactionAbortFailed = 4
};
public:

View file

@ -148,9 +148,9 @@ extern "C" {
/** NDB_MGM_EVENT_CATEGORY_INFO */
NDB_LE_InfoEvent = 49,
/* GREP */
NDB_LE_GrepSubscriptionInfo = 52,
NDB_LE_GrepSubscriptionAlert = 53,
/* SINGLE USER */
NDB_LE_SingleUser = 52,
/* NDB_LE_ UNUSED = 53, */
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
NDB_LE_BackupStarted = 54,
@ -593,6 +593,11 @@ extern "C" {
unsigned backup_id;
unsigned error;
} BackupAborted;
/** Log event data @ref NDB_LE_SingleUser */
struct {
unsigned type;
unsigned node_id;
} SingleUser;
#ifndef DOXYGEN_FIX
};
#else

View file

@ -633,6 +633,27 @@ void getTextBackupAborted(QQQQ) {
theData[3]);
}
void getTextSingleUser(QQQQ) {
switch (theData[1])
{
case 0:
BaseString::snprintf(m_text, m_text_len, "Entering single user mode");
break;
case 1:
BaseString::snprintf(m_text, m_text_len,
"Entered single user mode "
"Node %d has exclusive access", theData[2]);
break;
case 2:
BaseString::snprintf(m_text, m_text_len,"Exiting single user mode");
break;
default:
BaseString::snprintf(m_text, m_text_len,
"Unknown single user report %d", theData[1]);
break;
}
}
#if 0
BaseString::snprintf(m_text,
m_text_len,
@ -716,6 +737,9 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
ROW(CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO ),
ROW(InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO ),
//Single User
ROW(SingleUser, LogLevel::llInfo, 7, Logger::LL_INFO ),
// Backup
ROW(BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO ),
ROW(BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO ),

View file

@ -1962,6 +1962,11 @@ Ndbcntr::execRESUME_REQ(Signal* signal){
//ResumeRef * const ref = (ResumeRef *)&signal->theData[0];
jamEntry();
signal->theData[0] = NDB_LE_SingleUser;
signal->theData[1] = 2;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
//Uint32 senderData = req->senderData;
//BlockReference senderRef = req->senderRef;
NodeState newState(NodeState::SL_STARTED);
@ -2000,12 +2005,11 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
return;
}
if(c_stopRec.stopReq.senderRef != 0 && !singleuser){
jam();
if(c_stopRec.stopReq.senderRef != 0){
/**
* Requested a system shutdown
*/
if(StopReq::getSystemStop(req->requestInfo)){
if(!singleuser && StopReq::getSystemStop(req->requestInfo)){
jam();
sendSignalWithDelay(reference(), GSN_STOP_REQ, signal, 100,
StopReq::SignalLength);
@ -2027,23 +2031,28 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
c_stopRec.stopReq = * req;
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) && !singleuser) {
jam();
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
((Configuration&)theConfiguration).stopOnError(false);
}
}
if(!singleuser) {
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo)) {
jam();
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
((Configuration&)theConfiguration).stopOnError(false);
}
}
if(!c_stopRec.checkNodeFail(signal)){
jam();
return;
}
signal->theData[0] = NDB_LE_NDBStopStarted;
signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
}
signal->theData[0] = NDB_LE_NDBStopStarted;
signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
else
{
signal->theData[0] = NDB_LE_SingleUser;
signal->theData[1] = 0;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
}
NodeState newState(NodeState::SL_STOPPING_1,
StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
@ -2125,9 +2134,11 @@ Ndbcntr::StopRecord::checkNodeFail(Signal* signal){
stopReq.senderRef = 0;
NodeState newState(NodeState::SL_STARTED);
cntr.updateNodeState(signal, newState);
if (cntr.getNodeState().startLevel != NodeState::SL_SINGLEUSER)
{
NodeState newState(NodeState::SL_STARTED);
cntr.updateNodeState(signal, newState);
}
signal->theData[0] = NDB_LE_NDBStopAborted;
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 1, JBB);
@ -2223,12 +2234,24 @@ void Ndbcntr::execABORT_ALL_CONF(Signal* signal){
jamEntry();
if(c_stopRec.stopReq.singleuser) {
jam();
NodeState newState(NodeState::SL_SINGLEUSER);
newState.setSingleUser(true);
newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);
updateNodeState(signal, newState);
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
StopConf * const stopConf = (StopConf *)&signal->theData[0];
stopConf->senderData = c_stopRec.stopReq.senderData;
stopConf->nodeState = (Uint32) NodeState::SL_SINGLEUSER;
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);
c_stopRec.stopReq.senderRef = 0; // the command is done
signal->theData[0] = NDB_LE_SingleUser;
signal->theData[1] = 1;
signal->theData[2] = c_stopRec.stopReq.singleUserApi;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
}
else
{
@ -2246,7 +2269,13 @@ void Ndbcntr::execABORT_ALL_CONF(Signal* signal){
void Ndbcntr::execABORT_ALL_REF(Signal* signal){
jamEntry();
ndbrequire(false);
AbortAllRef *abortAllRef = (AbortAllRef *)&signal->theData[0];
AbortAllRef::ErrorCode errorCode = (AbortAllRef::ErrorCode) abortAllRef->errorCode;
StopRef * const stopRef = (StopRef *)&signal->theData[0];
stopRef->senderData = c_stopRec.stopReq.senderData;
stopRef->errorCode = StopRef::TransactionAbortFailed;
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
}
void

View file

@ -2013,6 +2013,8 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) {
else
conf->version = 0;
conf->nodeId = nodeId;
struct in_addr in= globalTransporterRegistry.get_connect_address(nodeId);
conf->inet_addr= in.s_addr;
sendSignal(senderRef,
GSN_API_VERSION_CONF,

View file

@ -289,6 +289,8 @@ struct Ndb_logevent_body_row ndb_logevent_body[]= {
ROW( BackupAborted, "backup_id", 2, backup_id),
ROW( BackupAborted, "error", 3, error),
ROW( SingleUser, "type", 1, type),
ROW( SingleUser, "node_id", 2, node_id),
{ NDB_LE_ILLEGAL_TYPE, 0, 0, 0, 0, 0}
};

View file

@ -1443,9 +1443,8 @@ CommandInterpreter::executeEnterSingleUser(char* parameters)
ndbout_c("Entering single user mode for node %d failed", nodeId);
printError();
} else {
ndbout_c("Entering single user mode");
ndbout_c("Access will be granted for API node %d only.", nodeId);
ndbout_c("Use ALL STATUS to see when single user mode has been entered.");
ndbout_c("Single user mode entered");
ndbout_c("Access is granted for API node %d only.", nodeId);
}
}
@ -1458,7 +1457,7 @@ CommandInterpreter::executeExitSingleUser(char* parameters)
printError();
} else {
ndbout_c("Exiting single user mode in progress.");
ndbout_c("Use ALL STATUS to see when single user mode has been exited.");
ndbout_c("Use ALL STATUS or SHOW to see when single user mode has been exited.");
}
}

View file

@ -179,90 +179,3 @@ void Config::printConfigFile(NdbOut &out) const {
}
#endif
}
Uint32
Config::getGenerationNumber() const {
#if 0
Uint32 ret;
const Properties *prop = NULL;
get("SYSTEM", &prop);
if(prop != NULL)
if(prop->get("ConfigGenerationNumber", &ret))
return ret;
return 0;
#else
return 0;
#endif
}
int
Config::setGenerationNumber(Uint32 gen) {
#if 0
Properties *prop = NULL;
getCopy("SYSTEM", &prop);
if(prop != NULL) {
MGM_REQUIRE(prop->put("ConfigGenerationNumber", gen, true));
MGM_REQUIRE(put("SYSTEM", prop, true));
return 0;
}
return -1;
#else
return -1;
#endif
}
bool
Config::change(const BaseString &section,
const BaseString &param,
const BaseString &value) {
#if 0
const char *name;
Properties::Iterator it(this);
for(name = it.first(); name != NULL; name = it.next()) {
Properties *prop = NULL;
if(strcasecmp(section.c_str(), name) == 0) {
getCopy(name, &prop);
if(prop == NULL) /* doesn't exist */
return false;
if(value == "") {
prop->remove(param.c_str());
put(section.c_str(), prop, true);
} else {
PropertiesType t;
if(!prop->getTypeOf(param.c_str(), &t)) /* doesn't exist */
return false;
switch(t) {
case PropertiesType_Uint32:
long val;
char *ep;
errno = 0;
val = strtol(value.c_str(), &ep, 0);
if(value.length() == 0 || *ep != '\0') /* not a number */
return false;
if(errno == ERANGE)
return false;
prop->put(param.c_str(), (unsigned int)val, true);
put(section.c_str(), prop, true);
break;
case PropertiesType_char:
prop->put(param.c_str(), value.c_str(), true);
put(section.c_str(), prop, true);
break;
default:
return false;
}
}
break;
}
}
return true;
#else
return false;
#endif
}

View file

@ -60,16 +60,6 @@ public:
printConfigFile(ndb);
}
Uint32 getGenerationNumber() const;
int setGenerationNumber(Uint32);
/** Change configuration
*/
bool change(const BaseString &section,
const BaseString &param,
const BaseString &value);
/**
* Info
*/

File diff suppressed because it is too large Load diff

View file

@ -22,15 +22,17 @@
#include <NdbCondition.h>
#include <mgmapi.h>
#include <NdbTCP.h>
#include <ConfigRetriever.hpp>
#include <Vector.hpp>
#include <NodeBitmask.hpp>
#include <signaldata/ManagementServer.hpp>
#include "SignalQueue.hpp"
#include <ndb_version.h>
#include <EventLogger.hpp>
#include <signaldata/EventSubscribeReq.hpp>
#include <SignalSender.hpp>
/**
* @desc Block number for Management server.
* @todo This should probably be somewhere else. I don't know where atm.
@ -200,51 +202,26 @@ public:
~MgmtSrvr();
int status(int processId,
ndb_mgm_node_status * status,
/**
* Get status on a node.
* address may point to a common area (e.g. from inet_addr)
* There is no gaurentee that it is preserved across calls.
* Copy the string if you are not going to use it immediately.
*/
int status(int nodeId,
ndb_mgm_node_status * status,
Uint32 * version,
Uint32 * phase,
bool * systemShutdown,
Uint32 * dynamicId,
Uint32 * nodeGroup,
Uint32 * connectCount);
Uint32 * connectCount,
const char **address);
// All the functions below may return any of this error codes:
// NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
// COULD_NOT_ALLOCATE_MEMORY, SEND_OR_RECEIVE_FAILED
typedef void (* StopCallback)(int nodeId, void * anyData, int errorCode);
typedef void (* VersionCallback)(int nodeId, int version,
void * anyData, int errorCode);
typedef void (* EnterSingleCallback)(int nodeId, void * anyData,
int errorCode);
typedef void (* ExitSingleCallback)(int nodeId, void * anyData,
int errorCode);
/**
* Lock configuration
*/
int lockConf();
/**
* Unlock configuration, and commit it if commit is true
*/
int unlockConf(bool commit);
/**
* Commit new configuration
*/
int commitConfig();
/**
* Rollback configuration
*/
int rollbackConfig();
/**
* Save a configuration to permanent storage
*/
@ -273,12 +250,12 @@ public:
* @param processId: Id of the DB process to stop
* @return 0 if succeeded, otherwise: as stated above, plus:
*/
int stopNode(int nodeId, bool abort = false, StopCallback = 0, void *any= 0);
int stopNode(int nodeId, bool abort = false);
/**
* Stop the system
*/
int stop(int * cnt = 0, bool abort = false, StopCallback = 0, void *any = 0);
int stop(int * cnt = 0, bool abort = false);
/**
* print version info about a node
@ -286,27 +263,18 @@ public:
* @param processId: Id of the DB process to stop
* @return 0 if succeeded, otherwise: as stated above, plus:
*/
int versionNode(int nodeId, bool abort = false,
VersionCallback = 0, void *any= 0);
int versionNode(int nodeId, Uint32 &version, const char **address);
/**
* print version info about all node in the system
*/
int version(int * cnt = 0, bool abort = false,
VersionCallback = 0, void *any = 0);
/**
* Maintenance on the system
*/
int enterSingleUser(int * cnt = 0, Uint32 singleuserNodeId = 0,
EnterSingleCallback = 0, void *any = 0);
int enterSingleUser(int * cnt = 0, Uint32 singleuserNodeId = 0);
/**
* Resume from maintenance on the system
*/
int exitSingleUser(int * cnt = 0, bool abort = false,
ExitSingleCallback = 0, void *any = 0);
int exitSingleUser(int * cnt = 0, bool abort = false);
/**
* Start DB process.
@ -320,15 +288,14 @@ public:
* @param processId: Id of the DB process to start
*/
int restartNode(int processId, bool nostart, bool initialStart,
bool abort = false,
StopCallback = 0, void * anyData = 0);
bool abort = false);
/**
* Restart the system
*/
int restart(bool nostart, bool initialStart,
bool abort = false,
int * stopCount = 0, StopCallback = 0, void * anyData = 0);
int * stopCount = 0);
struct BackupEvent {
enum Event {
@ -482,13 +449,6 @@ public:
*/
const Config * getConfig() const;
/**
* Change configuration paramter
*/
bool changeConfig(const BaseString &section,
const BaseString &param,
const BaseString &value);
/**
* Returns the node count for the specified node type.
*
@ -497,11 +457,6 @@ public:
*/
int getNodeCount(enum ndb_mgm_node_type type) const;
/**
* Returns the nodeId of the management master
*/
NodeId getPrimaryNode() const;
/**
* Returns the port number.
* @return port number.
@ -528,8 +483,17 @@ public:
private:
//**************************************************************************
int setEventReportingLevel(int processId, LogLevel::EventCategory, Uint32);
int send(SignalSender &ss, SimpleSignal &ssig, Uint32 node, Uint32 node_type);
int sendSTOP_REQ(NodeId nodeId,
NodeBitmask &stoppedNodes,
Uint32 singleUserNodeId,
bool abort,
bool stop,
bool restart,
bool nostart,
bool initialStart);
/**
* Check if it is possible to send a signal to a (DB) process
*
@ -593,9 +557,6 @@ private:
// Returns: -
//**************************************************************************
void handle_MGM_LOCK_CONFIG_REQ(NdbApiSignal *signal);
void handle_MGM_UNLOCK_CONFIG_REQ(NdbApiSignal *signal);
//**************************************************************************
// Specific signal handling data
//**************************************************************************
@ -619,59 +580,8 @@ private:
enum WaitSignalType {
NO_WAIT, // We don't expect to receive any signal
WAIT_SET_VAR, // Accept SET_VAR_CONF and SET_VAR_REF
WAIT_SUBSCRIBE_CONF, // Accept event subscription confirmation
WAIT_STOP,
WAIT_BACKUP_STARTED,
WAIT_BACKUP_COMPLETED,
WAIT_VERSION,
WAIT_NODEFAILURE
WAIT_SUBSCRIBE_CONF // Accept event subscription confirmation
};
/**
* Get an unused signal
* @return A signal if succeeded, NULL otherwise
*/
NdbApiSignal* getSignal();
/**
* Add a signal to the list of unused signals
* @param signal: The signal to add
*/
void releaseSignal(NdbApiSignal* signal);
/**
* Remove a signal from the list of unused signals and delete
* the memory for it.
*/
void freeSignal();
/**
* Send a signal
* @param processId: Id of the receiver process
* @param waitState: State denoting a set of signals we accept to receive
* @param signal: The signal to send
* @return 0 if succeeded, -1 otherwise
*/
int sendSignal(Uint16 processId, WaitSignalType waitState,
NdbApiSignal* signal, bool force = false);
/**
* Send a signal and wait for an answer signal
* @param processId: Id of the receiver process
* @param waitState: State denoting a set of signals we accept to receive.
* @param signal: The signal to send
* @return 0 if succeeded, -1 otherwise (for example failed to send or
* failed to receive expected signal).
*/
int sendRecSignal(Uint16 processId, WaitSignalType waitState,
NdbApiSignal* signal, bool force = false,
int waitTime = WAIT_FOR_RESPONSE_TIMEOUT);
/**
* Wait for a signal to arrive.
* @return 0 if signal arrived, -1 otherwise
*/
int receiveOptimisedResponse(int waitTime);
/**
* This function is called from "outside" of MgmtSrvr
@ -682,7 +592,7 @@ private:
static void signalReceivedNotification(void* mgmtSrvr,
NdbApiSignal* signal,
struct LinearSectionPtr ptr[3]);
/**
* Called from "outside" of MgmtSrvr when a DB process has died.
* @param mgmtSrvr: The MgmtSrvr object wreceiveOptimisedResponsehich
@ -719,31 +629,7 @@ private:
class TransporterFacade * theFacade;
class SignalQueue m_signalRecvQueue;
struct StopRecord {
StopRecord(){ inUse = false; callback = 0; singleUserMode = false;}
bool inUse;
bool singleUserMode;
int sentCount;
int reply;
int nodeId;
void * anyData;
StopCallback callback;
};
StopRecord m_stopRec;
struct VersionRecord {
VersionRecord(){ inUse = false; callback = 0;}
bool inUse;
Uint32 version[MAX_NODES];
VersionCallback callback;
};
VersionRecord m_versionRec;
int sendVersionReq( int processId);
void handleStopReply(NodeId nodeId, Uint32 errCode);
int sendVersionReq( int processId, Uint32 &version, const char **address);
int translateStopRef(Uint32 errCode);
bool _isStopThread;
@ -764,14 +650,8 @@ private:
static void *logLevelThread_C(void *);
void logLevelThreadRun();
struct NdbThread *m_signalRecvThread;
static void *signalRecvThread_C(void *);
void signalRecvThreadRun();
Config *_props;
int send(class NdbApiSignal* signal, Uint32 node, Uint32 node_type);
ConfigRetriever *m_config_retriever;
};

View file

@ -23,228 +23,6 @@
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
void
MgmtSrvr::handle_MGM_LOCK_CONFIG_REQ(NdbApiSignal *signal) {
NodeId sender = refToNode(signal->theSendersBlockRef);
const MgmLockConfigReq * const req = CAST_CONSTPTR(MgmLockConfigReq, signal->getDataPtr());
NdbApiSignal *reply = getSignal();
if(signal == NULL)
return; /** @todo handle allocation failure */
reply->set(TestOrd::TraceAPI,
MGMSRV,
GSN_MGM_LOCK_CONFIG_REP,
MgmLockConfigRep::SignalLength);
MgmLockConfigRep *lockRep = CAST_PTR(MgmLockConfigRep, reply->getDataPtrSend());
lockRep->errorCode = MgmLockConfigRep::UNKNOWN_ERROR;
if(req->newConfigGeneration < m_nextConfigGenerationNumber) {
lockRep->errorCode = MgmLockConfigRep::GENERATION_MISMATCH;
goto done;
}
NdbMutex_Lock(m_configMutex);
m_nextConfigGenerationNumber = req->newConfigGeneration+1;
lockRep->errorCode = MgmLockConfigRep::OK;
done:
sendSignal(sender, NO_WAIT, reply, true);
NdbMutex_Unlock(m_configMutex);
return;
}
void
MgmtSrvr::handle_MGM_UNLOCK_CONFIG_REQ(NdbApiSignal *signal) {
NodeId sender = refToNode(signal->theSendersBlockRef);
const MgmUnlockConfigReq * const req = CAST_CONSTPTR(MgmUnlockConfigReq, signal->getDataPtr());
MgmUnlockConfigRep *unlockRep;
NdbApiSignal *reply = getSignal();
if(signal == NULL)
goto error; /** @todo handle allocation failure */
reply->set(TestOrd::TraceAPI,
MGMSRV,
GSN_MGM_UNLOCK_CONFIG_REP,
MgmUnlockConfigRep::SignalLength);
unlockRep = CAST_PTR(MgmUnlockConfigRep, reply->getDataPtrSend());
unlockRep->errorCode = MgmUnlockConfigRep::UNKNOWN_ERROR;
NdbMutex_Lock(m_configMutex);
if(req->commitConfig == 1) {
m_newConfig = fetchConfig();
commitConfig();
} else
rollbackConfig();
unlockRep->errorCode = MgmUnlockConfigRep::OK;
sendSignal(sender, NO_WAIT, reply, true);
error:
NdbMutex_Unlock(m_configMutex);
return;
}
/**
* Prepare all MGM nodes for configuration changes
*
* @returns 0 on success, or -1 on failure
*/
int
MgmtSrvr::lockConf() {
int result = -1;
MgmLockConfigReq* lockReq;
NodeId node = 0;
/* Check if this is the master node */
if(getPrimaryNode() != _ownNodeId)
goto done;
if(NdbMutex_Trylock(m_configMutex) != 0)
return -1;
m_newConfig = new Config(*_config); /* copy the existing config */
_config = m_newConfig;
m_newConfig = new Config(*_config);
m_nextConfigGenerationNumber++;
/* Make sure the new configuration _always_ is at least one step older */
if(m_nextConfigGenerationNumber < m_newConfig->getGenerationNumber()+1)
m_nextConfigGenerationNumber = _config->getGenerationNumber()+1;
m_newConfig->setGenerationNumber(m_nextConfigGenerationNumber);
node = 0;
while(getNextNodeId(&node, NDB_MGM_NODE_TYPE_MGM)) {
if(node != _ownNodeId) {
NdbApiSignal* signal = getSignal();
if (signal == NULL) {
result = COULD_NOT_ALLOCATE_MEMORY;
goto done;
}
lockReq = CAST_PTR(MgmLockConfigReq, signal->getDataPtrSend());
signal->set(TestOrd::TraceAPI,
MGMSRV,
GSN_MGM_LOCK_CONFIG_REQ,
MgmLockConfigReq::SignalLength);
lockReq->newConfigGeneration = m_nextConfigGenerationNumber;
result = sendSignal(node, NO_WAIT, signal, true);
NdbApiSignal *reply =
m_signalRecvQueue.waitFor(GSN_MGM_LOCK_CONFIG_REP, 0);
if(reply == NULL) {
/** @todo handle timeout/error */
ndbout << __FILE__ << ":" << __LINE__ << endl;
result = -1;
goto done;
}
}
}
done:
NdbMutex_Unlock(m_configMutex);
return result;
}
/**
* Unlocks configuration
*
* @returns 0 on success, ! 0 on error
*/
int
MgmtSrvr::unlockConf(bool commit) {
int result = -1;
MgmUnlockConfigReq* unlockReq;
NodeId node = 0;
/* Check if this is the master node */
if(getPrimaryNode() != _ownNodeId)
goto done;
errno = 0;
if(NdbMutex_Lock(m_configMutex) != 0)
return -1;
if(commit)
commitConfig();
else
rollbackConfig();
node = 0;
while(getNextNodeId(&node, NDB_MGM_NODE_TYPE_MGM)) {
if(node != _ownNodeId) {
NdbApiSignal* signal = getSignal();
if (signal == NULL) {
result = COULD_NOT_ALLOCATE_MEMORY;
goto done;
}
unlockReq = CAST_PTR(MgmUnlockConfigReq, signal->getDataPtrSend());
signal->set(TestOrd::TraceAPI,
MGMSRV,
GSN_MGM_UNLOCK_CONFIG_REQ,
MgmUnlockConfigReq::SignalLength);
unlockReq->commitConfig = commit;
result = sendSignal(node, NO_WAIT, signal, true);
NdbApiSignal *reply =
m_signalRecvQueue.waitFor(GSN_MGM_UNLOCK_CONFIG_REP, 0);
if(reply == NULL) {
/** @todo handle timeout/error */
result = -1;
goto done;
}
}
}
done:
NdbMutex_Unlock(m_configMutex);
return result;
}
/**
* Commit the new configuration
*/
int
MgmtSrvr::commitConfig() {
int ret = saveConfig(m_newConfig);
delete _config;
_config = m_newConfig;
m_newConfig = NULL;
ndbout << "commit " << ret << endl;
return ret;
}
/**
* Rollback to the old configuration
*/
int
MgmtSrvr::rollbackConfig() {
delete m_newConfig;
m_newConfig = NULL;
ndbout << "rollback" << endl;
return saveConfig(_config);
}
/**
* Save a configuration to the running configuration file
*/
@ -288,12 +66,3 @@ MgmtSrvr::fetchConfig() {
}
return 0;
}
bool
MgmtSrvr::changeConfig(const BaseString &section,
const BaseString &param,
const BaseString &value) {
if(m_newConfig == NULL)
return false;
return m_newConfig->change(section, param, value);
}

View file

@ -20,123 +20,3 @@
// Some kind of reuse should be preferred.
//******************************************************************************
#include "MgmtSrvr.hpp"
#include <NdbApiSignal.hpp>
#include <NdbTick.h>
NdbApiSignal*
MgmtSrvr::getSignal()
{
NdbApiSignal* tSignal;
tSignal = theSignalIdleList;
if (tSignal != NULL){
NdbApiSignal* tSignalNext = tSignal->next();
tSignal->next(NULL);
theSignalIdleList = tSignalNext;
return tSignal;
} else
{
tSignal = new NdbApiSignal(_ownReference);
if (tSignal != NULL)
tSignal->next(NULL);
}
return tSignal;
}
void
MgmtSrvr::releaseSignal(NdbApiSignal* aSignal)
{
aSignal->next(theSignalIdleList);
theSignalIdleList = aSignal;
}
void
MgmtSrvr::freeSignal()
{
NdbApiSignal* tSignal = theSignalIdleList;
theSignalIdleList = tSignal->next();
delete tSignal;
}
int
MgmtSrvr::sendSignal(Uint16 aNodeId,
WaitSignalType aWaitState,
NdbApiSignal* aSignal,
bool force)
{
int tReturnCode;
theFacade->lock_mutex();
if(force){
tReturnCode = theFacade->sendSignalUnCond(aSignal,
aNodeId);
} else {
tReturnCode = theFacade->sendSignal(aSignal,
aNodeId);
}
releaseSignal(aSignal);
if (tReturnCode == -1) {
theFacade->unlock_mutex();
return -1;
}
theWaitState = aWaitState;
theFacade->unlock_mutex();
return 0;
}
int
MgmtSrvr::sendRecSignal(Uint16 aNodeId,
WaitSignalType aWaitState,
NdbApiSignal* aSignal,
bool force,
int waitTime)
{
int tReturnCode;
theFacade->lock_mutex();
if(force){
tReturnCode = theFacade->sendSignalUnCond(aSignal, aNodeId);
} else {
tReturnCode = theFacade->sendSignalUnCond(aSignal, aNodeId);
}
releaseSignal(aSignal);
if (tReturnCode == -1) {
theFacade->unlock_mutex();
return -1;
}
theWaitState = aWaitState;
theWaitNode = aNodeId;
return receiveOptimisedResponse(waitTime);
}
int
MgmtSrvr::receiveOptimisedResponse(int waitTime)
{
int tResultCode;
theFacade->checkForceSend(_blockNumber);
NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime;
while (theWaitState != NO_WAIT && theWaitState != WAIT_NODEFAILURE
&& waitTime > 0) {
NdbCondition_WaitTimeout(theMgmtWaitForResponseCondPtr,
theFacade->theMutexPtr,
waitTime);
if(theWaitState == NO_WAIT || theWaitState == WAIT_NODEFAILURE)
break;
waitTime = (maxTime - NdbTick_CurrentMillisecond());
}//while
if(theWaitState == NO_WAIT) {
tResultCode = 0;
} else {
tResultCode = -1;
}
theFacade->unlock_mutex();
return tResultCode;
}

View file

@ -222,21 +222,6 @@ ParserRow<MgmApiSession> commands[] = {
MGM_ARG("level", Int, Mandatory, "Severety level"),
MGM_ARG("enable", Int, Mandatory, "1=disable, 0=enable, -1=toggle"),
MGM_CMD("config lock", &MgmApiSession::configLock, ""),
MGM_CMD("config unlock", &MgmApiSession::configUnlock, ""),
MGM_ARG("commit", Int, Mandatory, "Commit changes"),
MGM_CMD("config change", &MgmApiSession::configChange, ""),
MGM_ARG("section", String, Mandatory, "Section"),
MGM_ARG("parameter", String, Mandatory, "Parameter"),
MGM_ARG("value", String, Mandatory, "Value"),
MGM_CMD("config lock", &MgmApiSession::configLock, ""),
MGM_CMD("config unlock", &MgmApiSession::configUnlock, ""),
MGM_ARG("commit", Int, Mandatory, "Commit changes"),
MGM_CMD("set parameter", &MgmApiSession::setParameter, ""),
MGM_ARG("node", String, Mandatory, "Node"),
MGM_ARG("parameter", String, Mandatory, "Parameter"),
@ -940,8 +925,10 @@ printNodeStatus(OutputStream *output,
nodeGroup = 0,
connectCount = 0;
bool system;
mgmsrv.status(nodeId, &status, &version, &startPhase,
&system, &dynamicId, &nodeGroup, &connectCount);
const char *address= NULL;
mgmsrv.status(nodeId, &status, &version, &startPhase,
&system, &dynamicId, &nodeGroup, &connectCount,
&address);
output->println("node.%d.type: %s",
nodeId,
ndb_mgm_get_node_type_string(type));
@ -953,7 +940,7 @@ printNodeStatus(OutputStream *output,
output->println("node.%d.dynamic_id: %d", nodeId, dynamicId);
output->println("node.%d.node_group: %d", nodeId, nodeGroup);
output->println("node.%d.connect_count: %d", nodeId, connectCount);
output->println("node.%d.address: %s", nodeId, mgmsrv.get_connect_address(nodeId));
output->println("node.%d.address: %s", nodeId, address);
}
}
@ -1222,42 +1209,6 @@ MgmApiSession::setLogFilter(Parser_t::Context &ctx,
m_output->println("");
}
void
MgmApiSession::configLock(Parser_t::Context &,
Properties const &) {
int ret = m_mgmsrv.lockConf();
m_output->println("config lock reply");
m_output->println("result: %d", ret);
m_output->println("");
}
void
MgmApiSession::configUnlock(Parser_t::Context &,
Properties const &args) {
Uint32 commit;
args.get("commit", &commit);
int ret = m_mgmsrv.unlockConf(commit == 1);
m_output->println("config unlock reply");
m_output->println("result: %d", ret);
m_output->println("");
}
void
MgmApiSession::configChange(Parser_t::Context &,
Properties const &args) {
BaseString section, param, value;
args.get("section", section);
args.get("parameter", param);
args.get("value", value);
int ret = m_mgmsrv.changeConfig(section.c_str(),
param.c_str(),
value.c_str());
m_output->println("config change reply");
m_output->println("result: %d", ret);
m_output->println("");
}
static NdbOut&
operator<<(NdbOut& out, const LogLevel & ll)
{

View file

@ -83,9 +83,6 @@ public:
void setClusterLogLevel(Parser_t::Context &ctx,
const class Properties &args);
void setLogFilter(Parser_t::Context &ctx, const class Properties &args);
void configLock(Parser_t::Context &ctx, const class Properties &args);
void configUnlock(Parser_t::Context &ctx, const class Properties &args);
void configChange(Parser_t::Context &ctx, const class Properties &args);
void setParameter(Parser_t::Context &ctx, const class Properties &args);
void setConnectionParameter(Parser_t::Context &ctx,

263
ndb/tools/ndb_size.pl Normal file
View file

@ -0,0 +1,263 @@
#!/usr/bin/perl -w
use strict;
use DBI;
use POSIX;
use HTML::Template;
# MySQL Cluster size estimator
# ----------------------------
#
# (C)2005 MySQL AB
#
#
# The purpose of this tool is to work out storage requirements
# from an existing MySQL database.
#
# This involves connecting to a mysql server and throwing a bunch
# of queries at it.
#
# We currently estimate sizes for: 4.1, 5.0 and 5.1 to various amounts
# of accurracy.
#
# There is no warranty.
#
# BUGS
# ----
# - enum/set is 0 byte storage! Woah - efficient!
# - some float stores come out weird (when there's a comma e.g. 'float(4,1)')
# - no disk data values
# - computes the storage requirements of views (and probably MERGE)
# - ignores character sets.
my $template = HTML::Template->new(filename => 'ndb_size.tmpl',
die_on_bad_params => 0);
my $dbh;
{
my $database= $ARGV[0];
my $hostname= $ARGV[1];
my $port= $ARGV[2];
my $user= $ARGV[3];
my $password= $ARGV[4];
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
$dbh= DBI->connect($dsn, $user, $password);
$template->param(db => $database);
$template->param(dsn => $dsn);
}
my @releases = ({rel=>'4.1'},{rel=>'5.0'},{rel=>'5.1'});
$template->param(releases => \@releases);
my $tables = $dbh->selectall_arrayref("show tables");
my @table_size;
sub align {
my($to,@unaligned) = @_;
my @aligned;
foreach my $x (@unaligned) {
push @aligned, $to * POSIX::floor(($x+$to-1)/$to);
}
return @aligned;
}
foreach(@{$tables})
{
my $table= @{$_}[0];
my @columns;
my $info= $dbh->selectall_hashref("describe ".$dbh->quote($table),"Field");
my @count = $dbh->selectrow_array("select count(*) from "
.$dbh->quote($table));
my %columnsize; # used for index calculations
# We now work out the DataMemory usage
# sizes for 4.1, 5.0, 5.1
my @totalsize= (0,0,0);
foreach(keys %$info)
{
my @realsize = (0,0,0);
my $type;
my $size;
my $name= $_;
if($$info{$_}{Type} =~ /^(.*?)\((\d+)\)/)
{
$type= $1;
$size= $2;
}
else
{
$type= $$info{$_}{Type};
}
if($type =~ /tinyint/)
{@realsize=(1,1,1)}
elsif($type =~ /smallint/)
{@realsize=(2,2,2)}
elsif($type =~ /mediumint/)
{@realsize=(3,3,3)}
elsif($type =~ /bigint/)
{@realsize=(8,8,8)}
elsif($type =~ /int/)
{@realsize=(4,4,4)}
elsif($type =~ /float/)
{
if($size<=24)
{@realsize=(4,4,4)}
else
{@realsize=(8,8,8)}
}
elsif($type =~ /double/ || $type =~ /real/)
{@realsize=(8,8,8)}
elsif($type =~ /bit/)
{
my $a=($size+7)/8;
@realsize = ($a,$a,$a);
}
elsif($type =~ /datetime/)
{@realsize=(8,8,8)}
elsif($type =~ /timestamp/)
{@realsize=(4,4,4)}
elsif($type =~ /date/ || $type =~ /time/)
{@realsize=(3,3,3)}
elsif($type =~ /year/)
{@realsize=(1,1,1)}
elsif($type =~ /varchar/ || $type =~ /varbinary/)
{
my $fixed= 1+$size;
my @dynamic=$dbh->selectrow_array("select avg(length("
.$dbh->quote($name)
.")) from ".$dbh->quote($table));
$dynamic[0]=0 if !$dynamic[0];
@realsize= ($fixed,$fixed,ceil($dynamic[0]));
}
elsif($type =~ /binary/ || $type =~ /char/)
{@realsize=($size,$size,$size)}
elsif($type =~ /text/ || $type =~ /blob/)
{@realsize=(256,256,1)} # FIXME check if 5.1 is correct
@realsize= align(4,@realsize);
$totalsize[$_]+=$realsize[$_] foreach 0..$#totalsize;
my @realout;
push @realout,{val=>$_} foreach @realsize;
push @columns, {
name=>$name,
type=>$type,
size=>$size,
key=>$$info{$_}{Key},
datamemory=>\@realout,
};
$columnsize{$name}= \@realsize; # used for index calculations
}
# And now... the IndexMemory usage.
#
# Firstly, we assemble some information about the indexes.
# We use SHOW INDEX instead of using INFORMATION_SCHEMA so
# we can still connect to pre-5.0 mysqlds.
my %indexes;
{
my $sth= $dbh->prepare("show index from "$dbh->quote($table));
$sth->execute;
while(my $i = $sth->fetchrow_hashref)
{
$indexes{${%$i}{Key_name}}= {
type=>${%$i}{Index_type},
unique=>!${%$i}{Non_unique},
comment=>${%$i}{Comment},
} if !defined($indexes{${%$i}{Key_name}});
$indexes{${%$i}{Key_name}}{columns}[${%$i}{Seq_in_index}-1]=
${%$i}{Column_name};
}
}
if(!defined($indexes{PRIMARY})) {
$indexes{PRIMARY}= {
type=>'BTREE',
unique=>1,
comment=>'Hidden pkey created by NDB',
columns=>['HIDDEN_NDB_PKEY'],
};
push @columns, {
name=>'HIDDEN_NDB_PKEY',
type=>'bigint',
size=>8,
key=>'PRI',
datamemory=>[{val=>8},{val=>8},{val=>8}],
};
$columnsize{'HIDDEN_NDB_PKEY'}= [8,8,8];
}
my @IndexDataMemory= ({val=>0},{val=>0},{val=>0});
my @RowIndexMemory= ({val=>0},{val=>0},{val=>0});
my @indexes;
foreach my $index (keys %indexes) {
my $im41= 25;
$im41+=$columnsize{$_}[0] foreach @{$indexes{$index}{columns}};
my @im = ({val=>$im41},{val=>25},{val=>25});
my @dm = ({val=>10},{val=>10},{val=>10});
push @indexes, {
name=>$index,
type=>$indexes{$index}{type},
columns=>join(',',@{$indexes{$index}{columns}}),
indexmemory=>\@im,
datamemory=>\@dm,
};
$IndexDataMemory[$_]{val}+=$dm[$_]{val} foreach 0..2;
$RowIndexMemory[$_]{val}+=$im[$_]{val} foreach 0..2;
}
# total size + 16 bytes overhead
my @TotalDataMemory;
$TotalDataMemory[$_]{val}=$IndexDataMemory[$_]{val}+$totalsize[$_]+16 foreach 0..2;
my @RowDataMemory;
push @RowDataMemory,{val=>$_} foreach @totalsize;
my @RowPerPage;
push @RowPerPage,{val=>(floor((32768-128)/$TotalDataMemory[$_]{val}))} foreach 0..$#TotalDataMemory;
my @RowPerIndexPage;
push @RowPerIndexPage,{val=>(floor(8192/$RowIndexMemory[$_]{val}))} foreach 0..$#TotalDataMemory;
my @DataMemory;
push @DataMemory,{val=>ceil(($count[0]/($RowPerPage[$_]{val})))*32} foreach 0..$#RowPerPage;
my @IndexMemory;
push @IndexMemory,{val=>ceil(($count[0]/($RowPerIndexPage[$_]{val})))*8} foreach 0..$#RowPerPage;
my $count= $count[0];
my @counts;
$counts[$_]{val}= $count foreach 0..$#releases;
push @table_size, {
table=>$table,
indexes=>\@indexes,
columns=>\@columns,
count=>\@counts,
RowDataMemory=>\@RowDataMemory,
releases=>\@releases,
IndexDataMemory=>\@IndexDataMemory,
TotalDataMemory=>\@TotalDataMemory,
RowPerPage=>\@RowPerPage,
DataMemory=>\@DataMemory,
RowIndexMemory=>\@RowIndexMemory,
RowPerIndexPage=>\@RowPerIndexPage,
IndexMemory=>\@IndexMemory,
};
}
$template->param(tables => \@table_size);
print $template->output;

175
ndb/tools/ndb_size.tmpl Normal file
View file

@ -0,0 +1,175 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
<meta name="keywords" content="MySQL Cluster" />
<title>MySQL Cluster size estimate for <TMPL_VAR NAME="db" ESCAPE="HTML"></title>
<style type="text/css">
table { border-collapse: collapse }
td,th { border: 1px solid black }
</style>
</head>
<body>
<h1>MySQL Cluster analysis for <TMPL_VAR NAME="db" escape="html"></h1>
<p>This is an automated analysis of the <TMPL_VAR NAME="DSN" escape="html"> database for migration into <a href="http://www.mysql.com/">MySQL</a> Cluster. No warranty is made to the accuracy of the information.</p>
<p>This information should be valid for MySQL 4.1</p>
<ul>
<TMPL_LOOP NAME="tables">
<li><TMPL_VAR NAME="table"></li>
</TMPL_LOOP>
</ul>
<hr/>
<TMPL_LOOP NAME="tables">
<h2><TMPL_VAR NAME="table"></h2>
<table>
<tr>
<th>Column</th>
<th>Type</th>
<th>Size</th>
<th>Key</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel> NDB Size</th>
</TMPL_LOOP>
</tr>
<TMPL_LOOP NAME="columns">
<tr>
<td><TMPL_VAR NAME=name></td>
<td><TMPL_VAR NAME=type></td>
<td><TMPL_VAR NAME=size></td>
<td><TMPL_VAR NAME=key></td>
<TMPL_LOOP NAME=datamemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
<p>&nbsp;</p>
<h3>Indexes</h3>
<p>We assume that indexes are ORDERED (not created USING HASH). If order is not required, 10 bytes of data memory can be saved per row if the index is created USING HASH</p>
<table>
<tr>
<th>Index</th>
<th>Type</th>
<th>Columns</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel> IdxMem</th>
</TMPL_LOOP>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel> DatMem</th>
</TMPL_LOOP>
</tr>
<TMPL_LOOP NAME="indexes">
<tr>
<td><TMPL_VAR NAME=name></td>
<td><TMPL_VAR NAME=type></td>
<td><TMPL_VAR NAME=columns></td>
<TMPL_LOOP NAME=indexmemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
<TMPL_LOOP NAME=datamemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
<h3>DataMemory Usage</h3>
<table>
<tr>
<th>&nbsp;</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel></th>
</TMPL_LOOP>
</tr>
<tr>
<th>Row Overhead</th>
<TMPL_LOOP NAME=releases>
<td>16</td>
</TMPL_LOOP>
</tr>
<tr>
<th>Column DataMemory/Row</th>
<TMPL_LOOP NAME=RowDataMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Index DataMemory/Row</th>
<TMPL_LOOP NAME=IndexDataMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Total DataMemory/Row</th>
<TMPL_LOOP NAME=TotalDataMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Rows per 32kb page</th>
<TMPL_LOOP NAME=RowPerPage>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Current number of rows</th>
<TMPL_LOOP NAME=count>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Total DataMemory (kb)</th>
<TMPL_LOOP NAME=DataMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</table>
<h3>IndexMemory Usage</h3>
<table>
<tr>
<th>&nbsp;</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel></th>
</TMPL_LOOP>
</tr>
<tr>
<th>IndexMemory/Row</th>
<TMPL_LOOP NAME=RowIndexMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Rows per 8kb page</th>
<TMPL_LOOP NAME=RowPerIndexPage>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Current number of rows</th>
<TMPL_LOOP NAME=count>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
<tr>
<th>Total IndexMemory (kb)</th>
<TMPL_LOOP NAME=IndexMemory>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</table>
<hr/>
</TMPL_LOOP>
<p>This is the output of ndb_size.pl.</p>
</body>
</html>

View file

@ -123,7 +123,7 @@ then
c_u="$c_u CREATE TABLE user ("
c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
c_u="$c_u Password char(41) binary DEFAULT '' NOT NULL,"
c_u="$c_u Password binary(41) DEFAULT '' NOT NULL,"
c_u="$c_u Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
c_u="$c_u Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
c_u="$c_u Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"

View file

@ -156,9 +156,9 @@ alter table columns_priv comment='Column privileges';
ALTER TABLE user
MODIFY Host char(60) NOT NULL default '',
MODIFY User char(16) NOT NULL default '',
MODIFY Password char(41) NOT NULL default '',
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE user
MODIFY Password binary(41) NOT NULL default '',
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,

View file

@ -1703,6 +1703,6 @@ int ha_myisam::ft_read(byte * buf)
uint ha_myisam::checksum() const
{
return (uint)file->s->state.checksum;
return (uint)file->state->checksum;
}

View file

@ -1209,7 +1209,8 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
DBUG_ENTER("ha_ndbcluster::index_flags");
DBUG_PRINT("info", ("idx_no: %d", idx_no));
DBUG_ASSERT(get_index_type_from_table(idx_no) < index_flags_size);
DBUG_RETURN(index_type_flags[get_index_type_from_table(idx_no)]);
DBUG_RETURN(index_type_flags[get_index_type_from_table(idx_no)] |
HA_KEY_SCAN_NOT_ROR);
}
static void shrink_varchar(Field* field, const byte* & ptr, char* buf)

View file

@ -98,6 +98,13 @@
#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */
#define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */
/*
Index scan will not return records in rowid order. Not guaranteed to be
set for unordered (e.g. HASH) indexes.
*/
#define HA_KEY_SCAN_NOT_ROR 128
/* operations for disable/enable indexes */
#define HA_KEY_SWITCH_NONUNIQ 0
#define HA_KEY_SWITCH_ALL 1

View file

@ -5117,6 +5117,8 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
if (cpk_scan)
param->is_ror_scan= TRUE;
}
if (param->table->file->index_flags(key, 0, TRUE) & HA_KEY_SCAN_NOT_ROR)
param->is_ror_scan= FALSE;
DBUG_PRINT("exit", ("Records: %lu", (ulong) records));
DBUG_RETURN(records);
}

View file

@ -5366,12 +5366,12 @@ ER_TOO_BIG_SCALE 42000 S1009
eng "Too big scale %d specified for column '%-.64s'. Maximum is %d."
ER_TOO_BIG_PRECISION 42000 S1009
eng "Too big precision %d specified for column '%-.64s'. Maximum is %d."
ER_SCALE_BIGGER_THAN_PRECISION 42000 S1009
eng "Scale may not be larger than the precision (column '%-.64s')."
ER_M_BIGGER_THAN_D 42000 S1009
eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.64s')."
ER_WRONG_LOCK_OF_SYSTEM_TABLE
eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other tables"
ER_CONNECT_TO_FOREIGN_DATA_SOURCE
eng "Unable to connect to foreign data source - database '%s'!"
eng "Unable to connect to foreign data source - database '%.64s'!"
ER_QUERY_ON_FOREIGN_DATA_SOURCE
eng "There was a problem processing the query on the foreign data source. Data source error: '%-.64s'"
ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST
@ -5400,7 +5400,7 @@ ER_DATETIME_FUNCTION_OVERFLOW 22008
ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
eng "Can't update table '%-.64s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger."
ER_VIEW_PREVENT_UPDATE
eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."
eng "The definition of table '%-.64s' prevents operation %.64s on table '%-.64s'."
ER_PS_NO_RECURSION
eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner"
ER_SP_CANT_SET_AUTOCOMMIT
@ -5419,5 +5419,3 @@ ER_ROW_IS_REFERENCED_2 23000
eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)"
ER_NO_REFERENCED_ROW_2 23000
eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"
ER_M_BIGGER_THAN_D 42000 S1009
eng "For float(M,D) or double(M,D), M must be >= D (column '%-.64s')."

View file

@ -2987,11 +2987,10 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
Check that the table and database that qualify the current field name
are the same as the table reference we are going to search for the field.
We exclude from the test below NATURAL/USING joins and any nested join
that is an operand of NATURAL/USING join, because each column in such
joins may potentially originate from a different table. However, base
tables and views that are under some NATURAL/USING join are searched
as usual base tables/views.
Exclude from the test below nested joins because the columns in a
nested join generally originate from different tables. Nested joins
also have no table name, except when a nested join is a merge view
or an information schema table.
We include explicitly table references with a 'field_translation' table,
because if there are views over natural joins we don't want to search
@ -3001,8 +3000,8 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
TODO: Ensure that table_name, db_name and tables->db always points to
something !
*/
if (/* Exclude natural joins and nested joins underlying natural joins. */
(!(table_list->nested_join && table_list->join_columns) ||
if (/* Exclude nested joins. */
(!table_list->nested_join ||
/* Include merge views and information schema tables. */
table_list->field_translation) &&
/*
@ -3025,13 +3024,10 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
register_tree_change)))
*actual_table= table_list;
}
else if (!(table_list->nested_join && table_list->join_columns))
else if (!table_list->nested_join)
{
/*
'table_list' is a stored table. It is so because the only type of nested
join passed to this procedure is a NATURAL/USING join or an operand of a
NATURAL/USING join.
*/
/* 'table_list' is a stored table. */
DBUG_ASSERT(table_list->table);
if ((fld= find_field_in_table(thd, table_list->table, name, length,
check_grants_table, allow_rowid,
cached_field_index_ptr)))

View file

@ -5751,7 +5751,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
}
if (new_field->length < new_field->decimals)
{
my_error(ER_SCALE_BIGGER_THAN_PRECISION, MYF(0), field_name);
my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
DBUG_RETURN(NULL);
}
new_field->length=

View file

@ -4074,7 +4074,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
strxmov(table_name, table->db ,".", table->table_name, NullS);
t= table->table= open_ltable(thd, table, TL_READ_NO_INSERT);
t= table->table= open_ltable(thd, table, TL_READ);
thd->clear_error(); // these errors shouldn't get client
protocol->prepare_for_resend();