Merge gleb.loc:/home/uchum/work/bk/5.1

into  gleb.loc:/home/uchum/work/bk/5.1-opt


mysql-test/t/disabled.def:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  SCCS merged
tests/mysql_client_test.c:
  SCCS merged
This commit is contained in:
unknown 2007-07-20 04:21:46 +05:00
commit 568eccb513
120 changed files with 1796 additions and 1902 deletions

View file

@ -264,6 +264,7 @@ enum enum_commands {
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_SEND_QUIT,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@ -351,6 +352,7 @@ const char *command_names[]=
"append_file",
"cat_file",
"diff_files",
"send_quit",
0
};
@ -2541,6 +2543,48 @@ void do_diff_files(struct st_command *command)
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_send_quit
command called command
DESCRIPTION
Sends a simple quit command to the server for the named connection.
*/
void do_send_quit(struct st_command *command)
{
char *p= command->first_argument, *name;
struct st_connection *con;
DBUG_ENTER("do_send_quit");
DBUG_PRINT("enter",("name: '%s'",p));
if (!*p)
die("Missing connection name in do_send_quit");
name= p;
while (*p && !my_isspace(charset_info,*p))
p++;
if (*p)
*p++= 0;
command->last_argument= p;
/* Loop through connection pool for connection to close */
for (con= connections; con < next_con; con++)
{
DBUG_PRINT("info", ("con->name: %s", con->name));
if (!strcmp(con->name, name))
{
simple_command(&con->mysql,COM_QUIT,NullS,0,1);
DBUG_VOID_RETURN;
}
}
die("connection '%s' not found in connection pool", name);
}
/*
SYNOPSIS
do_perl
@ -3454,11 +3498,10 @@ void do_close_connection(struct st_command *command)
my_free(con->name, MYF(0));
/*
When the connection is closed set name to "closed_connection"
When the connection is closed set name to "-closed_connection-"
to make it possible to reuse the connection name.
The connection slot will not be reused
*/
if (!(con->name = my_strdup("closed_connection", MYF(MY_WME))))
if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
die("Out of memory");
DBUG_VOID_RETURN;
@ -3636,6 +3679,7 @@ void do_connect(struct st_command *command)
int con_port= opt_port;
char *con_options;
bool con_ssl= 0, con_compress= 0;
struct st_connection* con_slot;
static DYNAMIC_STRING ds_connection_name;
static DYNAMIC_STRING ds_host;
@ -3717,19 +3761,24 @@ void do_connect(struct st_command *command)
con_options= end;
}
if (next_con == connections_end)
die("Connection limit exhausted, you can have max %d connections",
(int) (sizeof(connections)/sizeof(struct st_connection)));
if (find_connection_by_name(ds_connection_name.str))
die("Connection %s already exists", ds_connection_name.str);
if (next_con != connections_end)
con_slot= next_con;
else
{
if (!(con_slot= find_connection_by_name("-closed_connection-")))
die("Connection limit exhausted, you can have max %d connections",
(int) (sizeof(connections)/sizeof(struct st_connection)));
}
if (!mysql_init(&next_con->mysql))
if (!mysql_init(&con_slot->mysql))
die("Failed on mysql_init()");
if (opt_compress || con_compress)
mysql_options(&next_con->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME,
mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR,
@ -3738,12 +3787,12 @@ void do_connect(struct st_command *command)
#ifdef HAVE_OPENSSL
if (opt_use_ssl || con_ssl)
{
mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */
opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost");
mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
mysql_options(&con_slot->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert);
#endif
}
@ -3757,16 +3806,19 @@ void do_connect(struct st_command *command)
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
dynstr_set(&ds_database, "");
if (connect_n_handle_errors(command, &next_con->mysql,
if (connect_n_handle_errors(command, &con_slot->mysql,
ds_host.str,ds_user.str,
ds_password.str, ds_database.str,
con_port, ds_sock.str))
{
DBUG_PRINT("info", ("Inserting connection %s in connection pool",
ds_connection_name.str));
if (!(next_con->name= my_strdup(ds_connection_name.str, MYF(MY_WME))))
if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME))))
die("Out of memory");
cur_con= next_con++;
cur_con= con_slot;
if (con_slot == next_con)
next_con++; /* if we used the next_con slot, advance the pointer */
}
dynstr_free(&ds_connection_name);
@ -6335,6 +6387,7 @@ int main(int argc, char **argv)
case Q_WRITE_FILE: do_write_file(command); break;
case Q_APPEND_FILE: do_append_file(command); break;
case Q_DIFF_FILES: do_diff_files(command); break;
case Q_SEND_QUIT: do_send_quit(command); break;
case Q_CAT_FILE: do_cat_file(command); break;
case Q_COPY_FILE: do_copy_file(command); break;
case Q_CHMOD_FILE: do_chmod_file(command); break;

View file

@ -277,6 +277,8 @@ int SSL_session_reused(SSL*);
int SSL_set_rfd(SSL*, int);
int SSL_set_wfd(SSL*, int);
void SSL_set_shutdown(SSL*, int);
void SSL_set_quiet_shutdown(SSL *ssl,int mode);
int SSL_get_quiet_shutdown(SSL *ssl);
int SSL_want_read(SSL*);
int SSL_want_write(SSL*);

View file

@ -584,6 +584,7 @@ class SSL {
Socket socket_; // socket wrapper
Buffers buffers_; // buffered handshakes and data
Log log_; // logger
bool quietShutdown_; // shutdown without handshakes
// optimization variables
bool has_data_; // buffered data ready?
@ -610,6 +611,7 @@ public:
Buffers& useBuffers();
bool HasData() const;
bool GetQuietShutdown() const;
// sets
void set_pending(Cipher suite);
@ -621,6 +623,7 @@ public:
void SetError(YasslError);
int SetCompression();
void UnSetCompression();
void SetQuietShutdown(bool mode);
// helpers
bool isTLS() const;

View file

@ -411,8 +411,10 @@ int SSL_clear(SSL* ssl)
int SSL_shutdown(SSL* ssl)
{
Alert alert(warning, close_notify);
sendAlert(*ssl, alert);
if (!ssl->GetQuietShutdown()) {
Alert alert(warning, close_notify);
sendAlert(*ssl, alert);
}
ssl->useLog().ShowTCP(ssl->getSocket().get_fd(), true);
GetErrors().Remove();
@ -421,6 +423,18 @@ int SSL_shutdown(SSL* ssl)
}
void SSL_set_quiet_shutdown(SSL *ssl,int mode)
{
ssl->SetQuietShutdown(mode != 0);
}
int SSL_get_quiet_shutdown(SSL *ssl)
{
return ssl->GetQuietShutdown();
}
/* on by default but allow user to turn off */
long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode)
{

View file

@ -291,7 +291,7 @@ const ClientKeyFactory& sslFactory::getClientKey() const
SSL::SSL(SSL_CTX* ctx)
: secure_(ctx->getMethod()->getVersion(), crypto_.use_random(),
ctx->getMethod()->getSide(), ctx->GetCiphers(), ctx,
ctx->GetDH_Parms().set_), has_data_(false)
ctx->GetDH_Parms().set_), quietShutdown_(false), has_data_(false)
{
if (int err = crypto_.get_random().GetError()) {
SetError(YasslError(err));
@ -773,6 +773,12 @@ void SSL::SetError(YasslError ye)
// TODO: add string here
}
// set the quiet shutdown mode (close_nofiy not sent or received on shutdown)
void SSL::SetQuietShutdown(bool mode)
{
quietShutdown_ = mode;
}
Buffers& SSL::useBuffers()
{
@ -1330,6 +1336,12 @@ YasslError SSL::GetError() const
}
bool SSL::GetQuietShutdown() const
{
return quietShutdown_;
}
bool SSL::GetMultiProtocol() const
{
return secure_.GetContext()->getMethod()->multipleProtocol();

View file

@ -80,72 +80,11 @@ drop table t1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
reset master;
create table t1(n int) engine=myisam;
begin;
insert into t1 values (4);
insert into t1 values (5);
insert into t1 values (6);
commit;
drop table t1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
# now show this also works for SHOW MASTER STATUS
# as this is what "mysqldump --master-data=1" uses.
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
show master status;
insert into t1 values (1);
show master status;
insert into t1 values (2);
insert into t1 values (3);
show master status;
commit;
show master status;
drop table t1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
set autocommit= 0;
reset master;
create table t1(n int) engine=myisam;
show master status;
insert into t1 values (4);
show master status;
insert into t1 values (5);
insert into t1 values (6);
show master status;
commit;
show master status;
drop table t1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
set session autocommit = @ac;
# now show that nothing breaks if we need to read from the cache more
# than once, resulting in split event-headers
set @bcs = @@binlog_cache_size;
set @ac = @@autocommit;
set global binlog_cache_size=4096;
set autocommit= 0;
reset master;
create table t1 (a int) engine=innodb;

View file

@ -1,6 +1,10 @@
# Check that server is compiled and started with support for NDB
disable_query_log;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
enable_query_log;
#disable_query_log;
#--require r/true.require
#select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
#--source include/ndb_not_readonly.inc
#enable_query_log;
# always make sure we have both mysql servers started ok before test starts
# there are some initial startup bugs that are avoided by doing this, avoiding sporadic
# failures in mysql-test-run
--source include/have_multi_ndb.inc

View file

@ -0,0 +1,51 @@
-- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,)
-- connection con1
SET autocommit=0;
SELECT * FROM t1 FOR UPDATE;
-- if ($con1_extra_sql_present) {
-- eval $con1_extra_sql
-- }
-- connection con2
SET autocommit=0;
SELECT * FROM t2 FOR UPDATE;
-- if ($con2_extra_sql_present) {
-- eval $con2_extra_sql
-- }
-- if ($con1_should_be_rolledback) {
-- connection con1
-- send
INSERT INTO t2 VALUES (0);
-- connection con2
INSERT INTO t1 VALUES (0);
ROLLBACK;
-- connection con1
-- error ER_LOCK_DEADLOCK
-- reap
-- }
# else
-- if (!$con1_should_be_rolledback) {
-- connection con2
-- send
INSERT INTO t1 VALUES (0);
-- connection con1
INSERT INTO t2 VALUES (0);
ROLLBACK;
-- connection con2
-- error ER_LOCK_DEADLOCK
-- reap
-- }
-- connection default
DELETE FROM t5_nontrans;
-- disconnect con1
-- disconnect con2

View file

@ -4,7 +4,12 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection slave;
-- source include/have_ndb.inc
# Check that server is compiled and started with support for NDB
disable_query_log;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
enable_query_log;
-- source include/master-slave-reset.inc

View file

@ -3211,3 +3211,14 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs

View file

@ -0,0 +1 @@
SET storage_engine=InnoDB;

View file

@ -420,7 +420,7 @@ mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
OK
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted, you can have max 128 connections
mysqltest: The test didn't produce any output
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);

View file

@ -0,0 +1,3 @@
DROP TABLE IF EXISTS t1, t2;
create table t1 (a int);
drop table t1;

View file

@ -258,117 +258,8 @@ master-bin.000001 419 Table_map 1 458 table_id: # (test.t1)
master-bin.000001 458 Write_rows 1 492 table_id: # flags: STMT_END_F
master-bin.000001 492 Xid 1 519 COMMIT /* XID */
master-bin.000001 519 Query 1 595 use `test`; drop table t1
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
master-bin.000001 205 Table_map 1 244 table_id: # (test.t1)
master-bin.000001 244 Write_rows 1 278 table_id: # flags: STMT_END_F
master-bin.000001 278 Xid 1 305 COMMIT /* XID */
master-bin.000001 305 Table_map 1 344 table_id: # (test.t1)
master-bin.000001 344 Write_rows 1 378 table_id: # flags: STMT_END_F
master-bin.000001 378 Xid 1 405 COMMIT /* XID */
master-bin.000001 405 Table_map 1 444 table_id: # (test.t1)
master-bin.000001 444 Write_rows 1 478 table_id: # flags: STMT_END_F
master-bin.000001 478 Xid 1 505 COMMIT /* XID */
master-bin.000001 505 Query 1 581 use `test`; drop table t1
reset master;
create table t1(n int) engine=myisam;
begin;
insert into t1 values (4);
insert into t1 values (5);
insert into t1 values (6);
commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
master-bin.000001 205 Table_map 1 244 table_id: # (test.t1)
master-bin.000001 244 Write_rows 1 278 table_id: # flags: STMT_END_F
master-bin.000001 278 Table_map 1 317 table_id: # (test.t1)
master-bin.000001 317 Write_rows 1 351 table_id: # flags: STMT_END_F
master-bin.000001 351 Table_map 1 390 table_id: # (test.t1)
master-bin.000001 390 Write_rows 1 424 table_id: # flags: STMT_END_F
master-bin.000001 424 Query 1 500 use `test`; drop table t1
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 205
insert into t1 values (1);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 305
insert into t1 values (2);
insert into t1 values (3);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 505
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 505
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
master-bin.000001 205 Table_map 1 244 table_id: # (test.t1)
master-bin.000001 244 Write_rows 1 278 table_id: # flags: STMT_END_F
master-bin.000001 278 Xid 1 305 COMMIT /* XID */
master-bin.000001 305 Table_map 1 344 table_id: # (test.t1)
master-bin.000001 344 Write_rows 1 378 table_id: # flags: STMT_END_F
master-bin.000001 378 Xid 1 405 COMMIT /* XID */
master-bin.000001 405 Table_map 1 444 table_id: # (test.t1)
master-bin.000001 444 Write_rows 1 478 table_id: # flags: STMT_END_F
master-bin.000001 478 Xid 1 505 COMMIT /* XID */
master-bin.000001 505 Query 1 581 use `test`; drop table t1
set autocommit= 0;
reset master;
create table t1(n int) engine=myisam;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 205
insert into t1 values (4);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 278
insert into t1 values (5);
insert into t1 values (6);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 424
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 424
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
master-bin.000001 205 Table_map 1 244 table_id: # (test.t1)
master-bin.000001 244 Write_rows 1 278 table_id: # flags: STMT_END_F
master-bin.000001 278 Table_map 1 317 table_id: # (test.t1)
master-bin.000001 317 Write_rows 1 351 table_id: # flags: STMT_END_F
master-bin.000001 351 Table_map 1 390 table_id: # (test.t1)
master-bin.000001 390 Write_rows 1 424 table_id: # flags: STMT_END_F
master-bin.000001 424 Query 1 500 use `test`; drop table t1
set session autocommit = @ac;
set @bcs = @@binlog_cache_size;
set @ac = @@autocommit;
set global binlog_cache_size=4096;
set autocommit= 0;
reset master;
create table t1 (a int) engine=innodb;
show binlog events from 0;

View file

@ -165,105 +165,8 @@ master-bin.000001 361 Query 1 449 use `test`; insert into t1 values (2)
master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3)
master-bin.000001 537 Xid 1 564 COMMIT /* XID */
master-bin.000001 564 Query 1 640 use `test`; drop table t1
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1)
master-bin.000001 293 Xid 1 320 COMMIT /* XID */
master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2)
master-bin.000001 408 Xid 1 435 COMMIT /* XID */
master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3)
master-bin.000001 523 Xid 1 550 COMMIT /* XID */
master-bin.000001 550 Query 1 626 use `test`; drop table t1
reset master;
create table t1(n int) engine=myisam;
begin;
insert into t1 values (4);
insert into t1 values (5);
insert into t1 values (6);
commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4)
master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5)
master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6)
master-bin.000001 469 Query 1 545 use `test`; drop table t1
set autocommit= 1;
reset master;
create table t1(n int) engine=innodb;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 205
insert into t1 values (1);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 320
insert into t1 values (2);
insert into t1 values (3);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 550
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 550
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1)
master-bin.000001 293 Xid 1 320 COMMIT /* XID */
master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2)
master-bin.000001 408 Xid 1 435 COMMIT /* XID */
master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3)
master-bin.000001 523 Xid 1 550 COMMIT /* XID */
master-bin.000001 550 Query 1 626 use `test`; drop table t1
set autocommit= 0;
reset master;
create table t1(n int) engine=myisam;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 205
insert into t1 values (4);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 293
insert into t1 values (5);
insert into t1 values (6);
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 469
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 469
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4)
master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5)
master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6)
master-bin.000001 469 Query 1 545 use `test`; drop table t1
set session autocommit = @ac;
set @bcs = @@binlog_cache_size;
set @ac = @@autocommit;
set global binlog_cache_size=4096;
set autocommit= 0;
reset master;
create table t1 (a int) engine=innodb;
show binlog events from 0;

View file

@ -1,4 +1,3 @@
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc

View file

@ -1,4 +1,3 @@
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
-- source include/have_binlog_format_row.inc

View file

@ -15,9 +15,8 @@ rpl_ndb_circular_simplex : BUG#27972 2007-04-20 mats Slave cannot start where it
rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
rpl_ndb_2myisam : BUG#19227 Seems to pass currently
rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_ndb_innodb2ndb : Bug#29549 rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb failed on Solaris for pack_length issue
rpl_ndb_myisam2ndb : Bug#29549 rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb failed on Solaris for pack_length issue
rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB
rpl_ndb_mix_innodb : BUG#28123 rpl_ndb_mix_innodb.test casue slave to core on sol10-sparc-a
rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset

View file

@ -30,6 +30,8 @@
#
###########################################################################
# Test requires server to accept client connections (for mysqldump portions)
--source include/not_embedded.inc
--source include/have_utf8.inc
--source include/have_cp866.inc
--source include/have_cp1251.inc

View file

@ -30,6 +30,8 @@
#
###########################################################################
# Test requires server to accept client connections (for mysqldump portions)
--source include/not_embedded.inc
--source include/have_utf8.inc
--source include/have_cp866.inc
--source include/have_cp1251.inc

View file

@ -2349,6 +2349,21 @@ SHOW CREATE TABLE t1;
DROP TABLE t1,t2;
#
# Bug #21101 (Prints wrong error message if max row size is too large)
#
--error 1118
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #

View file

@ -0,0 +1,108 @@
#
# Ensure that the number of locks (SELECT FOR UPDATE for example) is
# added to the number of altered rows when choosing the smallest
# transaction to kill as a victim when a deadlock is detected.
# Also transactions what had edited non-transactional tables should
# be heavier than ones that had not.
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we do not really care about what gets printed, we are only
# interested in getting the deadlock resolved according to our
# expectations
-- disable_query_log
-- disable_result_log
# we want to use "-- eval statement1; statement2" which does not work with
# prepared statements. Because this test should not behave differently with
# or without prepared statements we disable them so the test does not fail
# if someone runs ./mysql-test-run.pl --ps-protocol
-- disable_ps_protocol
-- disable_warnings
DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans;
-- enable_warnings
# we will create a simple deadlock with t1, t2 and two connections
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
# auxiliary table with a bulk of rows which will be locked by a
# transaction to increase its weight
CREATE TABLE t3 (a INT);
# auxiliary empty table which will be inserted by a
# transaction to increase its weight
CREATE TABLE t4 (a INT);
# auxiliary non-transactional table which will be edited by a
# transaction to tremendously increase its weight
CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
# insert a lot of rows in t3
INSERT INTO t3 VALUES (1);
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
INSERT INTO t3 SELECT * FROM t3;
# test locking weight
-- let $con1_extra_sql =
-- let $con1_extra_sql_present = 0
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
# test weight when non-transactional tables are edited
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql =
-- let $con2_extra_sql_present = 0
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 1
-- source include/innodb_trx_weight.inc
-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
-- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1)
-- let $con1_extra_sql_present = 1
-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
-- let $con2_extra_sql_present = 1
-- let $con1_should_be_rolledback = 0
-- source include/innodb_trx_weight.inc
DROP TABLE t1, t2, t3, t4, t5_nontrans;

View file

@ -1263,7 +1263,7 @@ while ($i)
EOF
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
# Repeat connect/disconnect
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
let $i=200;
while ($i)

56
mysql-test/t/ssl-big.test Normal file
View file

@ -0,0 +1,56 @@
# Turn on ssl between the client and server
# and run a number of tests
-- source include/have_ssl.inc
-- source include/big_test.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
#
# Bug #29579 Clients using SSL can hang the server
#
connect (ssl_con,localhost,root,,,,,SSL);
create table t1 (a int);
disconnect ssl_con;
--disable_query_log
--disable_result_log
let $count= 2000;
while ($count)
{
connect (ssl_con,localhost,root,,,,,SSL);
eval insert into t1 values ($count);
dec $count;
# This select causes the net buffer to fill as the server sends the results
# but the client doesn't reap the results. The results are larger each time
# through the loop, so that eventually the buffer is completely full
# at the exact moment the server attempts to the close the connection with
# the lock held.
send select * from t1;
# now send the quit the command so the server will initiate the shutdown.
send_quit ssl_con;
# if the server is hung, this will hang too:
connect (ssl_con2,localhost,root,,,,,SSL);
# no hang if we get here, close and retry
disconnect ssl_con2;
disconnect ssl_con;
}
--enable_query_log
--enable_result_log
connect (ssl_con,localhost,root,,,,,SSL);
drop table t1;

View file

@ -22,11 +22,14 @@ connection con2;
lock tables t1 read;
unlock tables;
lock tables t1 read;
let $ID= `select connection_id()`;
connection con1;
--send
update t1 set n = 3;
connection con2;
sleep 1;
# wait for the other query to start executing
let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = 0;
--source include/wait_condition.inc
unlock tables;
connection con1;
reap;

View file

@ -3942,7 +3942,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
return ER_ERROR_ON_WRITE;
uint bytes= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
uint length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
long val;
uchar header[LOG_EVENT_HEADER_LEN];
@ -3999,7 +3999,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
/* if there is anything to write, process it. */
if (likely(bytes > 0))
if (likely(length > 0))
{
/*
process all event-headers in this (partial) cache.
@ -4008,18 +4008,18 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
very next iteration, just "eventually").
*/
while (hdr_offs < bytes)
while (hdr_offs < length)
{
/*
partial header only? save what we can get, process once
we get the rest.
*/
if (hdr_offs + LOG_EVENT_HEADER_LEN > bytes)
if (hdr_offs + LOG_EVENT_HEADER_LEN > length)
{
carry= bytes - hdr_offs;
carry= length - hdr_offs;
memcpy(header, (char *)cache->read_pos + hdr_offs, carry);
bytes= hdr_offs;
length= hdr_offs;
}
else
{
@ -4039,21 +4039,23 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
}
/*
Adjust hdr_offs. Note that this doesn't mean it will necessarily
be valid in the next iteration; if the current event is very long,
it may take a couple of read-iterations (and subsequent fixings
of hdr_offs) for it to become valid again.
if we had a split header, hdr_offs was already fixed above.
Adjust hdr_offs. Note that it may still point beyond the segment
read in the next iteration; if the current event is very long,
it may take a couple of read-iterations (and subsequent adjustments
of hdr_offs) for it to point into the then-current segment.
If we have a split header (!carry), hdr_offs will be set at the
beginning of the next iteration, overwriting the value we set here:
*/
if (carry == 0)
hdr_offs -= bytes;
hdr_offs -= length;
}
/* Write data to the binary log file */
if (my_b_write(&log_file, cache->read_pos, bytes))
if (my_b_write(&log_file, cache->read_pos, length))
return ER_ERROR_ON_WRITE;
cache->read_pos=cache->read_end; // Mark buffer used up
} while ((bytes=my_b_fill(cache)));
} while ((length= my_b_fill(cache)));
DBUG_ASSERT(carry == 0);
if (sync_log)
flush_and_sync();

View file

@ -719,6 +719,26 @@ bool end_active_trans(THD *thd);
int end_trans(THD *thd, enum enum_mysql_completiontype completion);
Item *negate_expression(THD *thd, Item *expr);
/* log.cc */
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
typedef void (*sql_print_message_func)(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
extern sql_print_message_func sql_print_message_handlers[];
int error_log_print(enum loglevel level, const char *format,
va_list args);
bool slow_log_print(THD *thd, const char *query, uint query_length,
time_t query_start_arg);
bool general_log_print(THD *thd, enum enum_server_command command,
const char *format,...);
#include "sql_class.h"
#include "sql_acl.h"
#include "tztime.h"
@ -1617,25 +1637,6 @@ bool init_errmessage(void);
#endif /* MYSQL_SERVER */
void sql_perror(const char *message);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
typedef void (*sql_print_message_func)(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
extern sql_print_message_func sql_print_message_handlers[];
int error_log_print(enum loglevel level, const char *format,
va_list args);
bool slow_log_print(THD *thd, const char *query, uint query_length,
time_t query_start_arg);
bool general_log_print(THD *thd, enum enum_server_command command,
const char *format,...);
bool fn_format_relative_to_data_home(char * to, const char *name,
const char *dir, const char *extension);
#ifdef MYSQL_SERVER

View file

@ -27,6 +27,7 @@
#include <my_dir.h>
#include <sql_common.h>
#include <errmsg.h>
#include <mysys_err.h>
#ifdef HAVE_REPLICATION
@ -2204,20 +2205,23 @@ reading event"))
if (event_len == packet_error)
{
uint mysql_error_number= mysql_errno(mysql);
if (mysql_error_number == CR_NET_PACKET_TOO_LARGE)
{
switch (mysql_error_number) {
case CR_NET_PACKET_TOO_LARGE:
sql_print_error("\
Log entry on master is longer than max_allowed_packet (%ld) on \
slave. If the entry is correct, restart the server with a higher value of \
max_allowed_packet",
thd->variables.max_allowed_packet);
goto err;
}
if (mysql_error_number == ER_MASTER_FATAL_ERROR_READING_BINLOG)
{
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
sql_print_error(ER(mysql_error_number), mysql_error_number,
mysql_error(mysql));
goto err;
case EE_OUTOFMEMORY:
case ER_OUTOFMEMORY:
sql_print_error("\
Stopping slave I/O thread due to out-of-memory error from master");
goto err;
}
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
reconnect_messages[SLAVE_RECON_ACT_EVENT]))

View file

@ -2576,7 +2576,7 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd)
return(thd->no_trans_update.all);
}
extern "C" int thd_binlog_format(const THD *thd)
extern "C" int thd_binlog_format(const MYSQL_THD thd)
{
return (int) thd->variables.binlog_format;
}

View file

@ -65,11 +65,23 @@ typedef struct st_user_var_events
#define RP_LOCK_LOG_IS_ALREADY_LOCKED 1
#define RP_FORCE_ROTATE 2
/*
The COPY_INFO structure is used by INSERT/REPLACE code.
The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
UPDATE code:
If a row is inserted then the copied variable is incremented.
If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
new data differs from the old one then the copied and the updated
variables are incremented.
The touched variable is incremented if a row was touched by the update part
of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
was actually changed or not.
*/
typedef struct st_copy_info {
ha_rows records;
ha_rows deleted;
ha_rows updated;
ha_rows copied;
ha_rows records; /* Number of processed records */
ha_rows deleted; /* Number of deleted records */
ha_rows updated; /* Number of updated records */
ha_rows copied; /* Number of copied records */
ha_rows error_count;
ha_rows touched; /* Number of touched records */
enum enum_duplicates handle_duplicates;
@ -1558,11 +1570,27 @@ public:
proc_info = old_msg;
pthread_mutex_unlock(&mysys_var->mutex);
}
static inline void safe_time(time_t *t)
{
/**
Wrapper around time() which retries on error (-1)
@details
This is needed because, despite the documentation, time() may fail
in some circumstances. Here we retry time() until it succeeds, and
log the failure so that performance problems related to this can be
identified.
*/
while(unlikely(time(t) == ((time_t) -1)))
sql_print_information("time() failed with %d", errno);
}
inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); }
inline void end_time() { time(&start_time); }
inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else { safe_time(&start_time); time_after_lock= start_time; }}
inline void end_time() { safe_time(&start_time); }
inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; }
inline void lock_time() { time(&time_after_lock); }
inline void lock_time() { safe_time(&time_after_lock); }
inline ulonglong found_rows(void)
{
return limit_found_rows;

View file

@ -661,7 +661,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
/*
Fill in the given fields and dump it to the table file
*/
info.records= info.deleted= info.copied= info.updated= 0;
bzero((char*) &info,sizeof(info));
info.ignore= ignore;
info.handle_duplicates=duplic;
info.update_fields= &update_fields;
@ -1421,6 +1421,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto before_trg_err;
table->file->restore_auto_increment(prev_insert_id);
if (table->next_number_field)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
info->touched++;
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
!bitmap_is_subset(table->write_set, table->read_set)) ||
compare_record(table))
@ -1449,9 +1453,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
handled separately by THD::arg_of_last_insert_id_function.
*/
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
if (table->next_number_field)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
trg_error= (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE));

View file

@ -5905,12 +5905,17 @@ int initialize_schema_table(st_plugin_int *plugin)
schema_table->idx_field1= -1,
schema_table->idx_field2= -1;
/* Make the name available to the init() function. */
schema_table->table_name= plugin->name.str;
if (plugin->plugin->init(schema_table))
{
sql_print_error("Plugin '%s' init function returned error.",
plugin->name.str);
goto err;
}
/* Make sure the plugin name is not set inside the init() function. */
schema_table->table_name= plugin->name.str;
}

View file

@ -163,6 +163,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
share->rows_recorded= 0;
share->update_file_opened= FALSE;
share->tina_write_opened= FALSE;
share->data_file_version= 0;
strmov(share->table_name, table_name);
fn_format(share->data_file_name, table_name, "", CSV_EXT,
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
@ -440,7 +441,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
*/
current_position(0), next_position(0), local_saved_data_file_length(0),
file_buff(0), chain_alloced(0), chain_size(DEFAULT_CHAIN_LENGTH),
records_is_known(0)
local_data_file_version(0), records_is_known(0)
{
/* Set our original buffers from pre-allocated memory */
buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin);
@ -815,6 +816,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
}
local_data_file_version= share->data_file_version;
if ((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
DBUG_RETURN(0);
@ -985,6 +987,33 @@ int ha_tina::delete_row(const uchar * buf)
}
/**
@brief Initialize the data file.
@details Compare the local version of the data file with the shared one.
If they differ, there are some changes behind and we have to reopen
the data file to make the changes visible.
Call @c file_buff->init_buff() at the end to read the beginning of the
data file into buffer.
@retval 0 OK.
@retval 1 There was an error.
*/
int ha_tina::init_data_file()
{
if (local_data_file_version != share->data_file_version)
{
local_data_file_version= share->data_file_version;
if (my_close(data_file, MYF(0)) ||
(data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
return 1;
}
file_buff->init_buff(data_file);
return 0;
}
/*
All table scans call this first.
The order of a table scan is:
@ -1021,9 +1050,8 @@ int ha_tina::rnd_init(bool scan)
DBUG_ENTER("ha_tina::rnd_init");
/* set buffer to the beginning of the file */
file_buff->init_buff(data_file);
if (share->crashed)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
if (share->crashed || init_data_file())
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
current_position= next_position= 0;
stats.records= 0;
@ -1246,6 +1274,16 @@ int ha_tina::rnd_end()
/* Open the file again */
if (((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1))
DBUG_RETURN(-1);
/*
As we reopened the data file, increase share->data_file_version
in order to force other threads waiting on a table lock and
have already opened the table to reopen the data file.
That makes the latest changes become visible to them.
Update local_data_file_version as no need to reopen it in the
current thread.
*/
share->data_file_version++;
local_data_file_version= share->data_file_version;
/*
The datafile is consistent at this point and the write filedes is
closed, so nothing worrying will happen to it in case of a crash.
@ -1308,7 +1346,8 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
file_buff->init_buff(data_file);
if (init_data_file())
DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
/*
Local_saved_data_file_length is initialized during the lock phase.
@ -1480,7 +1519,8 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
file_buff->init_buff(data_file);
if (init_data_file())
DBUG_RETURN(HA_ERR_CRASHED);
/*
Local_saved_data_file_length is initialized during the lock phase.

View file

@ -49,6 +49,7 @@ typedef struct st_tina_share {
File tina_write_filedes; /* File handler for readers */
bool crashed; /* Meta file is crashed */
ha_rows rows_recorded; /* Number of rows in tables */
uint data_file_version; /* Version of the data file used */
} TINA_SHARE;
struct tina_set {
@ -79,12 +80,14 @@ class ha_tina: public handler
tina_set *chain_ptr;
uchar chain_alloced;
uint32 chain_size;
uint local_data_file_version; /* Saved version of the data file used */
bool records_is_known;
private:
bool get_write_pos(off_t *end_pos, tina_set *closest_hole);
int open_update_temp_file_if_needed();
int init_tina_writer();
int init_data_file();
public:
ha_tina(handlerton *hton, TABLE_SHARE *table_arg);

View file

@ -25,102 +25,146 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/sql \
-I$(srcdir)
AUTOMAKE_OPTIONS = foreign
TAR = gtar
noinst_HEADERS =
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \
ha ibuf lock log mach mem mtr page \
handler \
pars que read rem row srv sync thr trx usr
EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr0cur.ic \
include/btr0pcur.h include/btr0pcur.ic include/btr0sea.h include/btr0sea.ic \
include/btr0types.h \
include/buf0buf.h include/buf0buf.ic include/buf0flu.h include/buf0flu.ic \
include/buf0lru.h include/buf0lru.ic include/buf0rea.h include/buf0types.h \
include/data0data.h include/data0data.ic include/data0type.h include/data0type.ic \
include/data0types.h include/db0err.h \
include/dict0boot.h include/dict0boot.ic include/dict0crea.h include/dict0crea.ic \
include/dict0dict.h include/dict0dict.ic include/dict0load.h include/dict0load.ic \
include/dict0mem.h include/dict0mem.ic include/dict0types.h \
include/dyn0dyn.h include/dyn0dyn.ic \
include/eval0eval.h include/eval0eval.ic include/eval0proc.h include/eval0proc.ic \
include/fil0fil.h include/fsp0fsp.h include/fsp0fsp.ic \
include/fut0fut.h include/fut0fut.ic include/fut0lst.h include/fut0lst.ic \
include/ha0ha.h include/ha0ha.ic include/hash0hash.h include/hash0hash.ic \
include/ibuf0ibuf.h include/ibuf0ibuf.ic include/ibuf0types.h \
include/lock0lock.h include/lock0lock.ic include/lock0types.h \
include/log0log.h include/log0log.ic include/log0recv.h include/log0recv.ic \
include/mach0data.h include/mach0data.ic include/mem0dbg.h include/mem0dbg.ic \
include/mem0mem.h include/mem0mem.ic include/mem0pool.h include/mem0pool.ic \
include/mtr0log.h include/mtr0log.ic include/mtr0mtr.h include/mtr0mtr.ic \
include/mtr0types.h include/os0file.h \
include/os0proc.h include/os0proc.ic include/os0sync.h include/os0sync.ic \
include/os0thread.h include/os0thread.ic \
include/page0cur.h include/page0cur.ic include/page0page.h include/page0page.ic \
include/page0types.h \
include/pars0grm.h include/pars0opt.h include/pars0opt.ic \
include/pars0pars.h include/pars0pars.ic include/pars0sym.h include/pars0sym.ic \
include/pars0types.h \
include/que0que.h include/que0que.ic include/que0types.h \
include/read0read.h include/read0read.ic include/read0types.h \
include/rem0cmp.h include/rem0cmp.ic include/rem0rec.h include/rem0rec.ic \
include/rem0types.h \
include/row0ins.h include/row0ins.ic include/row0mysql.h include/row0mysql.ic \
include/row0purge.h include/row0purge.ic include/row0row.h include/row0row.ic \
include/row0sel.h include/row0sel.ic include/row0types.h \
include/row0uins.h include/row0uins.ic include/row0umod.h include/row0umod.ic \
include/row0undo.h include/row0undo.ic include/row0upd.h include/row0upd.ic \
include/row0vers.h include/row0vers.ic \
include/srv0que.h include/srv0srv.h include/srv0srv.ic include/srv0start.h \
include/sync0arr.h include/sync0arr.ic include/sync0rw.h include/sync0rw.ic \
include/sync0sync.h include/sync0sync.ic include/sync0types.h \
include/thr0loc.h include/thr0loc.ic \
include/trx0purge.h include/trx0purge.ic include/trx0rec.h include/trx0rec.ic \
include/trx0roll.h include/trx0roll.ic include/trx0rseg.h include/trx0rseg.ic \
include/trx0sys.h include/trx0sys.ic include/trx0trx.h include/trx0trx.ic \
include/trx0types.h include/trx0undo.h include/trx0undo.ic include/trx0xa.h \
include/univ.i include/usr0sess.h include/usr0sess.ic include/usr0types.h \
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
handler/ha_innodb.h \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
include/ut0list.h include/ut0list.ic \
include/ut0wqueue.h \
pars/make_bison.sh pars/make_flex.sh \
pars/pars0grm.y pars/pars0lex.l \
CMakeLists.txt plug.in
noinst_LIBRARIES = libinnobase.a
libinnobase_a_LIBADD = usr/libusr.a srv/libsrv.a dict/libdict.a \
que/libque.a srv/libsrv.a ibuf/libibuf.a \
row/librow.a pars/libpars.a btr/libbtr.a \
trx/libtrx.a read/libread.a usr/libusr.a \
buf/libbuf.a ibuf/libibuf.a eval/libeval.a \
log/liblog.a fsp/libfsp.a fut/libfut.a \
fil/libfil.a lock/liblock.a mtr/libmtr.a \
page/libpage.a rem/librem.a thr/libthr.a \
sync/libsync.a data/libdata.a mach/libmach.a \
ha/libha.a dyn/libdyn.a mem/libmem.a \
handler/libhandler.a \
ut/libut.a os/libos.a ut/libut.a
libinnobase_a_SOURCES =
DEFS = @DEFS@
libinnobase.a: $(libinnobase_a_LIBADD)
-rm -f $@
if test "$(host_os)" = "netware" ; \
then \
$(libinnobase_a_AR) $@ $(libinnobase_a_LIBADD) ; \
else \
for arc in $(libinnobase_a_LIBADD); do \
arpath=`echo $$arc|sed 's|[^/]*$$||'`; \
$(AR) t $$arc|sed "s|^|$$arpath|"; \
done | sort -u | xargs $(AR) cq $@ ; \
$(RANLIB) $@ ; \
fi
noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \
include/btr0cur.h include/btr0cur.ic \
include/btr0pcur.h include/btr0pcur.ic \
include/btr0sea.h include/btr0sea.ic \
include/btr0types.h include/buf0buf.h \
include/buf0buf.ic include/buf0flu.h \
include/buf0flu.ic include/buf0lru.h \
include/buf0lru.ic include/buf0rea.h \
include/buf0types.h include/data0data.h \
include/data0data.ic include/data0type.h \
include/data0type.ic include/data0types.h \
include/db0err.h include/dict0boot.h \
include/dict0boot.ic include/dict0crea.h \
include/dict0crea.ic include/dict0dict.h \
include/dict0dict.ic include/dict0load.h \
include/dict0load.ic include/dict0mem.h \
include/dict0mem.ic include/dict0types.h \
include/dyn0dyn.h include/dyn0dyn.ic \
include/eval0eval.h include/eval0eval.ic \
include/eval0proc.h include/eval0proc.ic \
include/fil0fil.h include/fsp0fsp.h \
include/fsp0fsp.ic include/fut0fut.h \
include/fut0fut.ic include/fut0lst.h \
include/fut0lst.ic include/ha0ha.h \
include/ha0ha.ic include/hash0hash.h \
include/hash0hash.ic include/ibuf0ibuf.h \
include/ibuf0ibuf.ic include/ibuf0types.h \
include/lock0lock.h include/lock0lock.ic \
include/lock0types.h include/log0log.h \
include/log0log.ic include/log0recv.h \
include/log0recv.ic include/mach0data.h \
include/mach0data.ic include/mem0dbg.h \
include/mem0dbg.ic mem/mem0dbg.c \
include/mem0mem.h include/mem0mem.ic \
include/mem0pool.h include/mem0pool.ic \
include/mtr0log.h include/mtr0log.ic \
include/mtr0mtr.h include/mtr0mtr.ic \
include/mtr0types.h include/os0file.h \
include/os0proc.h include/os0proc.ic \
include/os0sync.h include/os0sync.ic \
include/os0thread.h include/os0thread.ic \
include/page0cur.h include/page0cur.ic \
include/page0page.h include/page0page.ic \
include/page0types.h include/pars0grm.h \
include/pars0opt.h include/pars0opt.ic \
include/pars0pars.h include/pars0pars.ic \
include/pars0sym.h include/pars0sym.ic \
include/pars0types.h include/que0que.h \
include/que0que.ic include/que0types.h \
include/read0read.h include/read0read.ic \
include/read0types.h include/rem0cmp.h \
include/rem0cmp.ic include/rem0rec.h \
include/rem0rec.ic include/rem0types.h \
include/row0ins.h include/row0ins.ic \
include/row0mysql.h include/row0mysql.ic \
include/row0purge.h include/row0purge.ic \
include/row0row.h include/row0row.ic \
include/row0sel.h include/row0sel.ic \
include/row0types.h include/row0uins.h \
include/row0uins.ic include/row0umod.h \
include/row0umod.ic include/row0undo.h \
include/row0undo.ic include/row0upd.h \
include/row0upd.ic include/row0vers.h \
include/row0vers.ic include/srv0que.h \
include/srv0srv.h include/srv0srv.ic \
include/srv0start.h include/sync0arr.h \
include/sync0arr.ic include/sync0rw.h \
include/sync0rw.ic include/sync0sync.h \
include/sync0sync.ic include/sync0types.h \
include/thr0loc.h include/thr0loc.ic \
include/trx0purge.h include/trx0purge.ic \
include/trx0rec.h include/trx0rec.ic \
include/trx0roll.h include/trx0roll.ic \
include/trx0rseg.h include/trx0rseg.ic \
include/trx0sys.h include/trx0sys.ic \
include/trx0trx.h include/trx0trx.ic \
include/trx0types.h include/trx0undo.h \
include/trx0undo.ic include/trx0xa.h \
include/univ.i include/usr0sess.h \
include/usr0sess.ic include/usr0types.h \
include/ut0byte.h include/ut0byte.ic \
include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic \
include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h \
include/ut0ut.ic include/ut0vec.h \
include/ut0vec.ic include/ut0list.h \
include/ut0list.ic include/ut0wqueue.h \
include/ha_prototypes.h handler/ha_innodb.h
EXTRA_LIBRARIES = libinnobase.a
noinst_LIBRARIES = @plugin_innobase_static_target@
libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \
btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \
buf/buf0lru.c buf/buf0rea.c data/data0data.c \
data/data0type.c dict/dict0boot.c \
dict/dict0crea.c dict/dict0dict.c \
dict/dict0load.c dict/dict0mem.c dyn/dyn0dyn.c \
eval/eval0eval.c eval/eval0proc.c \
fil/fil0fil.c fsp/fsp0fsp.c fut/fut0fut.c \
fut/fut0lst.c ha/ha0ha.c ha/hash0hash.c \
ibuf/ibuf0ibuf.c lock/lock0lock.c \
log/log0log.c log/log0recv.c mach/mach0data.c \
mem/mem0mem.c mem/mem0pool.c mtr/mtr0log.c \
mtr/mtr0mtr.c os/os0file.c os/os0proc.c \
os/os0sync.c os/os0thread.c page/page0cur.c \
page/page0page.c pars/lexyy.c pars/pars0grm.c \
pars/pars0opt.c pars/pars0pars.c \
pars/pars0sym.c que/que0que.c read/read0read.c \
rem/rem0cmp.c rem/rem0rec.c row/row0ins.c \
row/row0mysql.c row/row0purge.c row/row0row.c \
row/row0sel.c row/row0uins.c row/row0umod.c \
row/row0undo.c row/row0upd.c row/row0vers.c \
srv/srv0que.c srv/srv0srv.c srv/srv0start.c \
sync/sync0arr.c sync/sync0rw.c \
sync/sync0sync.c thr/thr0loc.c trx/trx0purge.c \
trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c \
trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c \
usr/usr0sess.c ut/ut0byte.c ut/ut0dbg.c \
ut/ut0list.c ut/ut0mem.c ut/ut0rnd.c \
ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \
handler/ha_innodb.cc
libinnobase_a_CXXFLAGS= $(AM_CFLAGS)
libinnobase_a_CFLAGS = $(AM_CFLAGS)
EXTRA_LTLIBRARIES = ha_innodb.la
pkglib_LTLIBRARIES = @plugin_innobase_shared_target@
ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES)
EXTRA_DIST = CMakeLists.txt plug.in \
pars/make_bison.sh pars/make_flex.sh \
pars/pars0grm.y pars/pars0lex.l
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libbtr.a
libbtr_a_SOURCES = btr0btr.c btr0cur.c btr0pcur.c btr0sea.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -2606,8 +2606,11 @@ btr_index_rec_validate(
rec_get_nth_field(rec, offsets, i, &len);
/* Note that prefix indexes are not fixed size even when
their type is CHAR. */
/* Note that if fixed_size != 0, it equals the
length of a fixed-size column in the clustered index.
A prefix index of the column is of fixed, but different
length. When fixed_size == 0, prefix_len is the maximum
length of the prefix index column. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0
&& len != UNIV_SQL_NULL && fixed_size

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libbuf.a
libbuf_a_SOURCES = buf0buf.c buf0flu.c buf0lru.c buf0rea.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libdata.a
libdata_a_SOURCES = data0data.c data0type.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -18,6 +18,8 @@ Created 5/30/1994 Heikki Tuuri
#include "dict0dict.h"
#include "btr0cur.h"
#include <ctype.h>
#ifdef UNIV_DEBUG
byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */

View file

@ -190,7 +190,8 @@ dtype_validate(
dtype_t* type) /* in: type struct to validate */
{
ut_a(type);
ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL));
ut_a(type->mtype >= DATA_VARCHAR);
ut_a(type->mtype <= DATA_MYSQL);
if (type->mtype == DATA_SYS) {
ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS);

View file

@ -1,26 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libdict.a
libdict_a_SOURCES = dict0boot.c dict0crea.c dict0dict.c dict0load.c\
dict0mem.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1195,7 +1195,8 @@ dict_create_or_check_foreign_constraint_tables(void)
fprintf(stderr, "InnoDB: error %lu in creation\n",
(ulong) error);
ut_a(error == DB_OUT_OF_FILE_SPACE);
ut_a(error == DB_OUT_OF_FILE_SPACE
|| error == DB_TOO_MANY_CONCURRENT_TRXS);
fprintf(stderr,
"InnoDB: creation failed\n"

View file

@ -30,6 +30,8 @@ Created 1/8/1996 Heikki Tuuri
# include "m_ctype.h" /* my_isspace() */
#endif /* !UNIV_HOTBACKUP */
#include <ctype.h>
dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
@ -1529,6 +1531,12 @@ dict_index_add_col(
if (field->fixed_len > DICT_MAX_INDEX_COL_LEN) {
field->fixed_len = 0;
}
#if DICT_MAX_INDEX_COL_LEN != 768
/* The comparison limit above must be constant. If it were
changed, the disk format of some fixed-length columns would
change, which would be a disaster. */
# error "DICT_MAX_INDEX_COL_LEN != 768"
#endif
if (!(col->prtype & DATA_NOT_NULL)) {
index->n_nullable++;
@ -1585,9 +1593,6 @@ dict_index_copy_types(
ifield = dict_index_get_nth_field(index, i);
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dict_col_copy_type(dict_field_get_col(ifield), dfield_type);
if (UNIV_UNLIKELY(ifield->prefix_len)) {
dfield_type->len = ifield->prefix_len;
}
}
}
@ -3361,7 +3366,8 @@ dict_create_foreign_constraints(
ulint err;
mem_heap_t* heap;
ut_a(trx && trx->mysql_thd);
ut_a(trx);
ut_a(trx->mysql_thd);
str = dict_strip_comments(sql_string);
heap = mem_heap_create(10000);
@ -3403,7 +3409,8 @@ dict_foreign_parse_drop_constraints(
FILE* ef = dict_foreign_err_file;
struct charset_info_st* cs;
ut_a(trx && trx->mysql_thd);
ut_a(trx);
ut_a(trx->mysql_thd);
cs = innobase_get_charset(trx->mysql_thd);
@ -3712,7 +3719,7 @@ dict_index_calc_min_rec_len(
}
/* round the NULL flags up to full bytes */
sum += (nullable + 7) / 8;
sum += UT_BITS_IN_BYTES(nullable);
return(sum);
}

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libdyn.a
libdyn_a_SOURCES = dyn0dyn.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libeval.a
libeval_a_SOURCES = eval0eval.c eval0proc.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libfil.a
libfil_a_SOURCES = fil0fil.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,26 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libfsp.a
libfsp_a_SOURCES = fsp0fsp.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -205,10 +205,9 @@ the extent are free and which contain old tuple version to clean. */
space */
#define XDES_FSEG 4 /* extent belongs to a segment */
/* File extent data structure size in bytes. The "+ 7 ) / 8" part in the
definition rounds the number of bytes upward. */
/* File extent data structure size in bytes. */
#define XDES_SIZE \
(XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8)
(XDES_BITMAP + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE))
/* Offset of the descriptor array on a descriptor page */
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
@ -3649,7 +3648,11 @@ fsp_validate(
n_full_frag_pages = FSP_EXTENT_SIZE
* flst_get_len(header + FSP_FULL_FRAG, &mtr);
ut_a(free_limit <= size || (space != 0 && size < FSP_EXTENT_SIZE));
if (UNIV_UNLIKELY(free_limit > size)) {
ut_a(space != 0);
ut_a(size < FSP_EXTENT_SIZE);
}
flst_validate(header + FSP_FREE, &mtr);
flst_validate(header + FSP_FREE_FRAG, &mtr);

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libfut.a
libfut_a_SOURCES = fut0fut.c fut0lst.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libha.a
libha_a_SOURCES = ha0ha.c hash0hash.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,28 +0,0 @@
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
DEFS = -DMYSQL_SERVER @DEFS@
noinst_LIBRARIES = libhandler.a
libhandler_a_SOURCES = ha_innodb.cc
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

File diff suppressed because it is too large Load diff

View file

@ -190,27 +190,50 @@ class ha_innobase: public handler
uint table_changes);
};
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
extern long long innobase_buffer_pool_size, innobase_log_file_size;
extern long innobase_log_buffer_size;
extern long innobase_additional_mem_pool_size;
extern long innobase_buffer_pool_awe_mem_mb;
extern long innobase_file_io_threads, innobase_lock_wait_timeout;
extern long innobase_force_recovery;
extern long innobase_open_files;
extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
/* Some accessor functions which the InnoDB plugin needs, but which
can not be added to mysql/plugin.h as part of the public interface;
the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
#ifndef INNODB_COMPATIBILITY_HOOKS
#error InnoDB needs MySQL to be built with #define INNODB_COMPATIBILITY_HOOKS
#endif
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_auto_extend_increment;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay;
extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
extern ulong srv_flush_log_at_trx_commit;
struct charset_info_st *thd_charset(MYSQL_THD thd);
char **thd_query(MYSQL_THD thd);
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
*/
const char* mysql_bin_log_file_name(void);
/** Get the current position of the MySQL binlog.
* @return byte offset from the beginning of the binlog
*/
ulonglong mysql_bin_log_file_pos(void);
/**
Check if a user thread is a replication slave thread
@param thd user thread
@retval 0 the user thread is not a replication slave thread
@retval 1 the user thread is a replication slave thread
*/
int thd_slave_thread(const MYSQL_THD thd);
/**
Check if a user thread is running a non-transactional update
@param thd user thread
@retval 0 the user thread is not running a non-transactional update
@retval 1 the user thread is running a non-transactional update
*/
int thd_non_transactional_update(const MYSQL_THD thd);
/**
Get the user thread's binary logging format
@param thd user thread
@return Value to be used as index into the binlog_format_names array
*/
int thd_binlog_format(const MYSQL_THD thd);
}
/*

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libibuf.a
libibuf_a_SOURCES = ibuf0ibuf.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -150,9 +150,30 @@ ulint ibuf_flush_count = 0;
#define IBUF_COUNT_N_PAGES 2000
/* Buffered entry counts for file pages, used in debugging */
static ulint* ibuf_counts[IBUF_COUNT_N_SPACES];
static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES];
static ibool ibuf_counts_inited = FALSE;
/**********************************************************************
Checks that the indexes to ibuf_counts[][] are within limits. */
UNIV_INLINE
void
ibuf_count_check(
/*=============*/
ulint space_id, /* in: space identifier */
ulint page_no) /* in: page number */
{
if (space_id < IBUF_COUNT_N_SPACES && page_no < IBUF_COUNT_N_PAGES) {
return;
}
fprintf(stderr,
"InnoDB: UNIV_IBUF_DEBUG limits space_id and page_no\n"
"InnoDB: and breaks crash recovery.\n"
"InnoDB: space_id=%lu, should be 0<=space_id<%lu\n"
"InnoDB: page_no=%lu, should be 0<=page_no<%lu\n",
(ulint) space_id, (ulint) IBUF_COUNT_N_SPACES,
(ulint) page_no, (ulint) IBUF_COUNT_N_PAGES);
ut_error;
}
#endif
/* The start address for an insert buffer bitmap page bitmap */
@ -328,15 +349,9 @@ ibuf_count_get(
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
ut_ad(space < IBUF_COUNT_N_SPACES);
ut_ad(page_no < IBUF_COUNT_N_PAGES);
ibuf_count_check(space, page_no);
if (!ibuf_counts_inited) {
return(0);
}
return(*(ibuf_counts[space] + page_no));
return(ibuf_counts[space][page_no]);
}
/**********************************************************************
@ -349,11 +364,10 @@ ibuf_count_set(
ulint page_no,/* in: page number */
ulint val) /* in: value to set */
{
ut_a(space < IBUF_COUNT_N_SPACES);
ut_a(page_no < IBUF_COUNT_N_PAGES);
ibuf_count_check(space, page_no);
ut_a(val < UNIV_PAGE_SIZE);
*(ibuf_counts[space] + page_no) = val;
ibuf_counts[space][page_no] = val;
}
#endif
@ -378,22 +392,6 @@ ibuf_init_at_db_start(void)
ibuf->size = 0;
#ifdef UNIV_IBUF_DEBUG
{
ulint i, j;
for (i = 0; i < IBUF_COUNT_N_SPACES; i++) {
ibuf_counts[i] = mem_alloc(sizeof(ulint)
* IBUF_COUNT_N_PAGES);
for (j = 0; j < IBUF_COUNT_N_PAGES; j++) {
ibuf_count_set(i, j, 0);
}
}
ibuf_counts_inited = TRUE;
}
#endif
mutex_create(&ibuf_pessimistic_insert_mutex,
SYNC_IBUF_PESS_INSERT_MUTEX);
@ -567,7 +565,8 @@ ibuf_bitmap_page_init(
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
byte_offset = bit_offset / 8 + 1; /* better: (bit_offset + 7) / 8 */
byte_offset = bit_offset / 8 + 1;
/* better: byte_offset = UT_BITS_IN_BYTES(bit_offset); */
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
@ -1441,6 +1440,9 @@ ibuf_entry_build(
*buf2++ = 0; /* write the compact format indicator */
}
for (i = 0; i < n_fields; i++) {
ulint fixed_len;
const dict_field_t* ifield;
/* We add 4 below because we have the 4 extra fields at the
start of an ibuf record */
@ -1448,10 +1450,30 @@ ibuf_entry_build(
entry_field = dtuple_get_nth_field(entry, i);
dfield_copy(field, entry_field);
ifield = dict_index_get_nth_field(index, i);
/* Prefix index columns of fixed-length columns are of
fixed length. However, in the function call below,
dfield_get_type(entry_field) contains the fixed length
of the column in the clustered index. Replace it with
the fixed length of the secondary index column. */
fixed_len = ifield->fixed_len;
#ifdef UNIV_DEBUG
if (fixed_len) {
/* dict_index_add_col() should guarantee these */
ut_ad(fixed_len <= (ulint) entry_field->type.len);
if (ifield->prefix_len) {
ut_ad(ifield->prefix_len == fixed_len);
} else {
ut_ad(fixed_len
== (ulint) entry_field->type.len);
}
}
#endif /* UNIV_DEBUG */
dtype_new_store_for_order_and_null_size(
buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
dfield_get_type(entry_field),
dict_index_get_nth_field(index, i)->prefix_len);
dfield_get_type(entry_field), fixed_len);
}
/* Store the type info in buf2 to field 3 of tuple */

View file

@ -1,10 +0,0 @@
# Makefile included in Makefile.am in every subdirectory
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/storage/innobase/include \
-I$(top_srcdir)/sql \
-I$(srcdir)
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -62,6 +62,11 @@ Created 5/24/1996 Heikki Tuuri
lead to a duplicate key in some
table */
#define DB_TOO_MANY_CONCURRENT_TRXS 47 /* when InnoDB runs out of the
preconfigured undo slots, this can
only happen when there are too many
concurrent transactions */
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_OVERFLOW 1001

View file

@ -92,6 +92,17 @@ dict_col_copy_type_noninline(
/*=========================*/
const dict_col_t* col, /* in: column */
dtype_t* type); /* out: data type */
#ifdef UNIV_DEBUG
/*************************************************************************
Assert that a column and a data type match. */
UNIV_INLINE
ibool
dict_col_type_assert_equal(
/*=======================*/
/* out: TRUE */
const dict_col_t* col, /* in: column */
const dtype_t* type); /* in: data type */
#endif /* UNIV_DEBUG */
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE

View file

@ -30,6 +30,30 @@ dict_col_copy_type(
type->mbmaxlen = col->mbmaxlen;
}
#ifdef UNIV_DEBUG
/*************************************************************************
Assert that a column and a data type match. */
UNIV_INLINE
ibool
dict_col_type_assert_equal(
/*=======================*/
/* out: TRUE */
const dict_col_t* col, /* in: column */
const dtype_t* type) /* in: data type */
{
ut_ad(col);
ut_ad(type);
ut_ad(col->mtype == type->mtype);
ut_ad(col->prtype == type->prtype);
ut_ad(col->len == type->len);
ut_ad(col->mbminlen == type->mbminlen);
ut_ad(col->mbmaxlen == type->mbmaxlen);
return(TRUE);
}
#endif /* UNIV_DEBUG */
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE

View file

@ -158,10 +158,13 @@ struct dict_col_struct{
of an index */
};
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can
create a column prefix index on 255 characters of a TEXT field also in the
UTF-8 charset. In that charset, a character may take at most 3 bytes. */
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
indexed column length (or indexed prefix length). It is set to 3*256,
so that one can create a column prefix index on 256 characters of a
TEXT or VARCHAR column also in the UTF-8 charset. In that charset,
a character may take at most 3 bytes.
This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
files would be at risk! */
#define DICT_MAX_INDEX_COL_LEN 768

View file

@ -1,6 +1,9 @@
#ifndef HA_INNODB_PROTOTYPES_H
#define HA_INNODB_PROTOTYPES_H
#include "univ.i" /* ulint, uint */
#include "m_ctype.h" /* CHARSET_INFO */
/* Prototypes for global functions in ha_innodb.cc that are called by
InnoDB's C-code. */
@ -19,4 +22,30 @@ innobase_convert_string(
CHARSET_INFO* from_cs,
uint* errors);
/**********************************************************************
Returns true if the thread is the replication thread on the slave
server. Used in srv_conc_enter_innodb() to determine if the thread
should be allowed to enter InnoDB - the replication thread is treated
differently than other threads. Also used in
srv_conc_force_exit_innodb(). */
ibool
thd_is_replication_slave_thread(
/*============================*/
/* out: true if thd is the replication thread */
void* thd); /* in: thread handle (THD*) */
/**********************************************************************
Returns true if the transaction this thread is processing has edited
non-transactional tables. Used by the deadlock detector when deciding
which transaction to rollback in case of a deadlock - we try to avoid
rolling back transactions that have edited non-transactional tables. */
ibool
thd_has_edited_nontrans_tables(
/*===========================*/
/* out: true if non-transactional tables have
been edited */
void* thd); /* in: thread handle (THD*) */
#endif

View file

@ -94,7 +94,8 @@ log. */
#define OS_FILE_PATH_ERROR 74
#define OS_FILE_AIO_RESOURCES_RESERVED 75 /* wait for OS aio resources
to become available again */
#define OS_FILE_ERROR_NOT_SPECIFIED 76
#define OS_FILE_SHARING_VIOLATION 76
#define OS_FILE_ERROR_NOT_SPECIFIED 77
/* Types for aio operations */
#define OS_FILE_READ 10

View file

@ -795,7 +795,8 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
ulint* offsets, /* in: array for rec_get_offsets() */
ulint* offsets, /* out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /* in: number of elements */
{
ut_ad(offsets);
@ -1282,7 +1283,8 @@ UNIV_INLINE
void
rec_offs_set_n_fields(
/*==================*/
ulint* offsets, /* in: array returned by rec_get_offsets() */
ulint* offsets, /* in/out: array returned by
rec_get_offsets() */
ulint n_fields) /* in: number of fields */
{
ut_ad(offsets);

View file

@ -460,6 +460,19 @@ row_check_table_for_mysql(
/* out: DB_ERROR or DB_SUCCESS */
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
handle */
/*************************************************************************
Get the min of the maximum possible row sizes. */
ulint
page_get_free_space_of_empty_noninline(
/*===================================*/
/* out: The (approx) maximum size
of a row, this is a conservative
estimate, since the size can be
slightly larger depending upon
the ROW_FORMAT setting.*/
dict_table_t* table); /* in: table for which max record
size required.*/
/* A struct describing a place for an individual column in the MySQL
row format which is presented to the table handler in ha_innobase.

View file

@ -371,6 +371,18 @@ trx_is_interrupted(
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
/***********************************************************************
Compares the "weight" (or size) of two transactions. The weight of one
transaction is estimated as the number of altered rows + the number of
locked rows. Transactions that have edited non-transactional tables are
considered heavier than ones that have not. */
int
trx_weight_cmp(
/*===========*/
/* out: <0, 0 or >0; similar to strcmp(3) */
trx_t* a, /* in: the first transaction to be compared */
trx_t* b); /* in: the second transaction to be compared */
/* Signal to a transaction */
struct trx_sig_struct{
@ -453,7 +465,8 @@ struct trx_struct{
dulint table_id; /* table id if the preceding field is
TRUE */
/*------------------------------*/
int active_trans; /* 1 - if a transaction in MySQL
unsigned duplicates:2; /* TRX_DUP_IGNORE | TRX_DUP_REPLACE */
unsigned active_trans:2; /* 1 - if a transaction in MySQL
is active. 2 - if prepare_commit_mutex
was taken */
void* mysql_thd; /* MySQL thread handle corresponding
@ -610,7 +623,7 @@ struct trx_struct{
NULL */
ibool was_chosen_as_deadlock_victim;
/* when the transaction decides to wait
for a lock, this it sets this to FALSE;
for a lock, it sets this to FALSE;
if another transaction chooses this
transaction as a victim in deadlock
resolution, it sets this to TRUE */
@ -651,7 +664,12 @@ struct trx_struct{
cannot be any activity in the undo
logs! */
dulint undo_no; /* next undo log record number to
assign */
assign; since the undo log is
private for a transaction, this
is a simple ascending sequence
with no gaps; thus it represents
the number of modified/inserted
rows in a transaction */
trx_savept_t last_sql_stat_start;
/* undo_no when the last sql statement
was started: in case of an error, trx
@ -681,19 +699,19 @@ struct trx_struct{
single operation of a
transaction, e.g., a parallel
query */
/* Transaction concurrency states */
/* Transaction concurrency states (trx->conc_state) */
#define TRX_NOT_STARTED 1
#define TRX_ACTIVE 2
#define TRX_COMMITTED_IN_MEMORY 3
#define TRX_PREPARED 4 /* Support for 2PC/XA */
/* Transaction execution states when trx state is TRX_ACTIVE */
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
#define TRX_QUE_RUNNING 1 /* transaction is running */
#define TRX_QUE_LOCK_WAIT 2 /* transaction is waiting for a lock */
#define TRX_QUE_ROLLING_BACK 3 /* transaction is rolling back */
#define TRX_QUE_COMMITTING 4 /* transaction is committing */
/* Transaction isolation levels */
/* Transaction isolation levels (trx->isolation_level) */
#define TRX_ISO_READ_UNCOMMITTED 1 /* dirty read: non-locking
SELECTs are performed so that
we do not look at a possible
@ -728,6 +746,12 @@ struct trx_struct{
converted to LOCK IN SHARE
MODE reads */
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
Multiple flags can be combined with bitwise OR. */
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
/* Types of a trx signal */
#define TRX_SIG_NO_SIGNAL 100
#define TRX_SIG_TOTAL_ROLLBACK 1

View file

@ -222,13 +222,16 @@ trx_undo_lists_init(
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused. */
trx_undo_t*
ulint
trx_undo_assign_undo(
/*=================*/
/* out: the undo log, NULL if did not succeed: out of
space */
trx_t* trx, /* in: transaction */
ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/* out: DB_SUCCESS if undo log assign
* successful, possible error codes are:
* ER_TOO_MANY_CONCURRENT_TRXS
* DB_OUT_OF_FILE_SPAC
* DB_OUT_OF_MEMORY */
trx_t* trx, /* in: transaction */
ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/**********************************************************************
Sets the state of the undo log segment at a transaction finish. */

View file

@ -121,6 +121,11 @@ ut_2_power_up(
/* out: first power of 2 which is >= n */
ulint n) /* in: number != 0 */
__attribute__((const));
/* Determine how many bytes (groups of 8 bits) are needed to
store the given number of bits. */
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
/****************************************************************
Sort function for ulint arrays. */

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = liblock.a
liblock_a_SOURCES = lock0lock.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -3174,7 +3174,8 @@ lock_deadlock_occurs(
ulint ret;
ulint cost = 0;
ut_ad(trx && lock);
ut_ad(trx);
ut_ad(lock);
ut_ad(mutex_own(&kernel_mutex));
retry:
/* We check that adding this trx to the waits-for graph
@ -3246,7 +3247,9 @@ lock_deadlock_recursive(
trx_t* lock_trx;
ulint ret;
ut_a(trx && start && wait_lock);
ut_a(trx);
ut_a(start);
ut_a(wait_lock);
ut_ad(mutex_own(&kernel_mutex));
if (trx->deadlock_mark == 1) {
@ -3357,8 +3360,8 @@ lock_deadlock_recursive(
return(LOCK_VICTIM_IS_START);
}
if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) {
if (trx_weight_cmp(wait_lock->trx,
start) >= 0) {
/* Our recursion starting point
transaction is 'smaller', let us
choose 'start' as the victim and roll
@ -4423,12 +4426,9 @@ lock_table_queue_validate(
dict_table_t* table) /* in: table */
{
lock_t* lock;
ibool is_waiting;
ut_ad(mutex_own(&kernel_mutex));
is_waiting = FALSE;
lock = UT_LIST_GET_FIRST(table->locks);
while (lock) {
@ -4438,13 +4438,10 @@ lock_table_queue_validate(
if (!lock_get_wait(lock)) {
ut_a(!is_waiting);
ut_a(!lock_table_other_has_incompatible(
lock->trx, 0, table,
lock_get_mode(lock)));
} else {
is_waiting = TRUE;
ut_a(lock_table_has_to_wait_in_queue(lock));
}

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = liblog.a
liblog_a_SOURCES = log0log.c log0recv.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -3039,10 +3039,22 @@ loop:
mutex_enter(&kernel_mutex);
/* Check that there are no longer transactions. We need this wait
even for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose
them. */
/* We need the monitor threads to stop before we proceed with a
normal shutdown. In case of very fast shutdown, however, we can
proceed without waiting for monitor threads. */
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
|| srv_lock_timeout_and_monitor_active)) {
mutex_exit(&kernel_mutex);
goto loop;
}
/* Check that there are no longer transactions. We need this wait even
for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose them. */
if (trx_n_mysql_transactions > 0
|| UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
@ -3163,22 +3175,8 @@ loop:
goto loop;
}
/* The lock timeout thread should now have exited */
if (srv_lock_timeout_and_monitor_active) {
goto loop;
}
/* We now let also the InnoDB error monitor thread to exit */
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
if (srv_error_monitor_active) {
goto loop;
}
/* Make some checks that the server really is quiet */
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
ut_a(buf_all_freed());

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libmach.a
libmach_a_SOURCES = mach0data.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,27 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libmem.a
libmem_a_SOURCES = mem0mem.c mem0pool.c
EXTRA_DIST = mem0dbg.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libmtr.a
libmtr_a_SOURCES = mtr0mtr.c mtr0log.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libos.a
libos_a_SOURCES = os0proc.c os0sync.c os0thread.c os0file.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -250,6 +250,15 @@ os_file_get_last_error(
"InnoDB: the directory. It may also be"
" you have created a subdirectory\n"
"InnoDB: of the same name as a data file.\n");
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
fprintf(stderr,
"InnoDB: The error means that another program"
" is using InnoDB's files.\n"
"InnoDB: This might be a backup or antivirus"
" software or another instance\n"
"InnoDB: of MySQL."
" Please close it to get rid of this error.\n");
} else {
fprintf(stderr,
"InnoDB: Some operating system error numbers"
@ -268,6 +277,9 @@ os_file_get_last_error(
return(OS_FILE_DISK_FULL);
} else if (err == ERROR_FILE_EXISTS) {
return(OS_FILE_ALREADY_EXISTS);
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
return(OS_FILE_SHARING_VIOLATION);
} else {
return(100 + err);
}
@ -388,6 +400,10 @@ os_file_handle_error_cond_exit(
|| err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else if (err == OS_FILE_SHARING_VIOLATION) {
os_thread_sleep(10000000); /* 10 sec */
return(TRUE);
} else {
if (name) {
fprintf(stderr, "InnoDB: File name %s\n", name);

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libpage.a
libpage_a_SOURCES = page0page.c page0cur.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,27 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libpars.a
noinst_HEADERS = pars0grm.h
libpars_a_SOURCES = pars0grm.c lexyy.c pars0opt.c pars0pars.c pars0sym.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -2,6 +2,7 @@ MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine],
[Transactional Tables using InnoDB], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a])
MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la])
MYSQL_PLUGIN_ACTIONS(innobase, [
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
AC_SUBST(innodb_system_libs)
@ -38,37 +39,5 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac
AC_CONFIG_FILES(
storage/innobase/ut/Makefile
storage/innobase/btr/Makefile
storage/innobase/buf/Makefile
storage/innobase/data/Makefile
storage/innobase/dict/Makefile
storage/innobase/dyn/Makefile
storage/innobase/eval/Makefile
storage/innobase/fil/Makefile
storage/innobase/fsp/Makefile
storage/innobase/fut/Makefile
storage/innobase/ha/Makefile
storage/innobase/ibuf/Makefile
storage/innobase/lock/Makefile
storage/innobase/log/Makefile
storage/innobase/mach/Makefile
storage/innobase/mem/Makefile
storage/innobase/mtr/Makefile
storage/innobase/os/Makefile
storage/innobase/page/Makefile
storage/innobase/pars/Makefile
storage/innobase/que/Makefile
storage/innobase/read/Makefile
storage/innobase/rem/Makefile
storage/innobase/row/Makefile
storage/innobase/srv/Makefile
storage/innobase/sync/Makefile
storage/innobase/thr/Makefile
storage/innobase/trx/Makefile
storage/innobase/handler/Makefile
storage/innobase/usr/Makefile)
])
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(innobase, [handler/ha_innodb.cc])

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libque.a
libque_a_SOURCES = que0que.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libread.a
libread_a_SOURCES = read0read.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = librem.a
librem_a_SOURCES = rem0rec.c rem0cmp.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -153,7 +153,6 @@ static
void
rec_init_offsets(
/*=============*/
/* out: the offsets */
rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */
ulint* offsets)/* in/out: array of offsets;
@ -189,7 +188,7 @@ rec_init_offsets(
}
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
offs = 0;
null_mask = 1;
@ -304,7 +303,7 @@ rec_get_offsets_func(
/* out: the new offsets */
rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in: array consisting of offsets[0]
ulint* offsets,/* in/out: array consisting of offsets[0]
allocated elements, or an array from
rec_get_offsets(), or NULL */
ulint n_fields,/* in: maximum number of initialized fields
@ -440,7 +439,7 @@ rec_get_converted_size_new(
dtuple_t* dtuple) /* in: data tuple */
{
ulint size = REC_N_NEW_EXTRA_BYTES
+ (index->n_nullable + 7) / 8;
+ UT_BITS_IN_BYTES(index->n_nullable);
ulint i;
ulint n_fields;
ut_ad(index && dtuple);
@ -459,10 +458,10 @@ rec_get_converted_size_new(
break;
case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM:
/* infimum or supremum record, 8 bytes */
return(size + 8); /* no extra data needed */
/* infimum or supremum record, 8 data bytes */
return(REC_N_NEW_EXTRA_BYTES + 8);
default:
ut_a(0);
ut_error;
return(ULINT_UNDEFINED);
}
@ -476,21 +475,31 @@ rec_get_converted_size_new(
len = dtuple_get_nth_field(dtuple, i)->len;
col = dict_field_get_col(field);
ut_ad(len != UNIV_SQL_NULL || !(col->prtype & DATA_NOT_NULL));
ut_ad(dict_col_type_assert_equal(
col, dfield_get_type(dtuple_get_nth_field(
dtuple, i))));
if (len == UNIV_SQL_NULL) {
/* No length is stored for NULL fields. */
ut_ad(!(col->prtype & DATA_NOT_NULL));
continue;
}
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
ut_ad(!field->fixed_len || len == field->fixed_len);
if (field->fixed_len) {
ut_ad(len == field->fixed_len);
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len);
} else if (len < 128
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
size++;
} else {
/* For variable-length columns, we look up the
maximum length from the column itself. If this
is a prefix index column shorter than 256 bytes,
this will waste one byte. */
size += 2;
}
size += len;
@ -586,7 +595,7 @@ rec_set_nth_field_extern_bit_new(
we do not write to log about the change */
{
byte* nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
byte* lens = nulls - (index->n_nullable + 7) / 8;
byte* lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
ulint i;
ulint n_fields;
ulint null_mask = 1;
@ -875,7 +884,7 @@ rec_convert_dtuple_to_rec_new(
/* Calculate the offset of the origin in the physical record.
We must loop over all fields to do this. */
rec += (index->n_nullable + 7) / 8;
rec += UT_BITS_IN_BYTES(index->n_nullable);
for (i = 0; i < n_fields; i++) {
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
@ -892,6 +901,11 @@ rec_convert_dtuple_to_rec_new(
len = dfield_get_len(field);
fixed_len = dict_index_get_nth_field(index, i)->fixed_len;
ut_ad(dict_col_type_assert_equal(
dict_field_get_col(dict_index_get_nth_field(
index, i)),
dfield_get_type(field)));
if (!(dtype_get_prtype(type) & DATA_NOT_NULL)) {
if (len == UNIV_SQL_NULL)
continue;
@ -915,7 +929,7 @@ rec_convert_dtuple_to_rec_new(
init:
end = rec;
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
/* clear the SQL-null flags */
memset (lens + 1, 0, nulls - lens);
@ -1172,7 +1186,7 @@ rec_copy_prefix_to_buf(
}
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (index->n_nullable + 7) / 8;
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
UNIV_PREFETCH_R(lens);
prefix_len = 0;
null_mask = 1;

View file

@ -1,26 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = librow.a
librow_a_SOURCES = row0ins.c row0mysql.c row0purge.c row0row.c row0sel.c\
row0uins.c row0umod.c row0undo.c row0upd.c row0vers.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -51,21 +51,6 @@ innobase_invalidate_query_cache(
ulint full_name_len); /* in: full name length where also the null
chars count */
/**********************************************************************
This function returns true if
1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
2) SQL-query in the current thread
is INSERT ON DUPLICATE KEY UPDATE.
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
innobase_query_is_update(void);
/*************************************************************************
Creates an insert node struct. */
@ -448,7 +433,11 @@ row_ins_cascade_calc_update_vec(
ulint i;
ulint j;
ut_a(node && foreign && cascade && table && index);
ut_a(node);
ut_a(foreign);
ut_a(cascade);
ut_a(table);
ut_a(index);
/* Calculate the appropriate update vector which will set the fields
in the child index record to the same value (possibly padded with
@ -791,7 +780,10 @@ row_ins_foreign_check_on_constraint(
trx_t* trx;
mem_heap_t* tmp_heap = NULL;
ut_a(thr && foreign && pcur && mtr);
ut_a(thr);
ut_a(foreign);
ut_a(pcur);
ut_a(mtr);
trx = thr_get_trx(thr);
@ -1308,7 +1300,8 @@ run_again:
goto exit_func;
}
ut_a(check_table && check_index);
ut_a(check_table);
ut_a(check_index);
if (check_table != table) {
/* We already have a LOCK_IX on table, but not necessarily
@ -1336,11 +1329,9 @@ run_again:
/* Scan index records and check if there is a matching record */
for (;;) {
page_t* page;
rec = btr_pcur_get_rec(&pcur);
page = buf_frame_align(rec);
if (rec == page_get_infimum_rec(page)) {
if (page_rec_is_infimum(rec)) {
goto next_rec;
}
@ -1348,7 +1339,7 @@ run_again:
offsets = rec_get_offsets(rec, check_index,
offsets, ULINT_UNDEFINED, &heap);
if (rec == page_get_supremum_rec(page)) {
if (page_rec_is_supremum(rec)) {
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index, offsets, thr);
@ -1654,6 +1645,7 @@ row_ins_scan_sec_index_for_duplicate(
btr_pcur_t pcur;
ulint err = DB_SUCCESS;
ibool moved;
unsigned allow_duplicates;
mtr_t mtr;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@ -1684,12 +1676,14 @@ row_ins_scan_sec_index_for_duplicate(
btr_pcur_open(index, entry, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr);
allow_duplicates = thr_get_trx(thr)->duplicates & TRX_DUP_IGNORE;
/* Scan index records and check if there is a duplicate */
for (;;) {
rec = btr_pcur_get_rec(&pcur);
if (rec == page_get_infimum_rec(buf_frame_align(rec))) {
if (page_rec_is_infimum(rec)) {
goto next_rec;
}
@ -1697,7 +1691,7 @@ row_ins_scan_sec_index_for_duplicate(
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
if (allow_duplicates) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
@ -1826,7 +1820,7 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
if (innobase_query_is_update()) {
if (trx->duplicates & TRX_DUP_IGNORE) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
@ -1864,7 +1858,7 @@ row_ins_duplicate_error_in_clust(
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
if (trx->duplicates & TRX_DUP_IGNORE) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for

View file

@ -476,7 +476,8 @@ handle_new_error:
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_ROW_IS_REFERENCED
|| err == DB_NO_REFERENCED_ROW
|| err == DB_CANNOT_ADD_CONSTRAINT) {
|| err == DB_CANNOT_ADD_CONSTRAINT
|| err == DB_TOO_MANY_CONCURRENT_TRXS) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
@ -4058,3 +4059,25 @@ row_check_table_for_mysql(
return(ret);
}
/*************************************************************************
Get the maximum row size. */
ulint
page_get_free_space_of_empty_noninline(
/*===================================*/
/* out: The (approx) maximum size
of a row, this is a conservative
estimate, since the size can be
slightly larger depending upon
the ROW_FORMAT setting.*/
dict_table_t* table) /* in: table for which max record
size is required.*/
{
ibool compact;
compact = dict_table_is_comp(table);
return(page_get_free_space_of_empty(compact) / 2);
}

View file

@ -142,20 +142,15 @@ row_build_index_entry(
dfield_copy(dfield, dfield2);
/* If a column prefix index, take only the prefix */
if (ind_field->prefix_len) {
if (dfield_get_len(dfield2) != UNIV_SQL_NULL) {
if (ind_field->prefix_len > 0
&& dfield_get_len(dfield2) != UNIV_SQL_NULL) {
storage_len = dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen, col->mbmaxlen,
ind_field->prefix_len,
dfield_get_len(dfield2),
dfield2->data);
storage_len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminlen, col->mbmaxlen,
ind_field->prefix_len,
dfield_get_len(dfield2), dfield2->data);
dfield_set_len(dfield, storage_len);
}
dfield_get_type(dfield)->len = ind_field->prefix_len;
dfield_set_len(dfield, storage_len);
}
}
@ -478,7 +473,9 @@ row_build_row_ref_in_tuple(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_a(ref && index && rec);
ut_a(ref);
ut_a(index);
ut_a(rec);
if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr);

View file

@ -3619,6 +3619,32 @@ shortcut_fails_too_big_rec:
pcur, 0, &mtr);
pcur->trx_if_known = trx;
rec = btr_pcur_get_rec(pcur);
if (!moves_up
&& !page_rec_is_supremum(rec)
&& set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record
to prevent phantoms in ORDER BY ... DESC queries */
offsets = rec_get_offsets(page_rec_get_next(rec),
index, offsets,
ULINT_UNDEFINED, &heap);
err = sel_set_rec_lock(page_rec_get_next(rec),
index, offsets,
prebuilt->select_lock_type,
LOCK_GAP, thr);
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
}
} else {
if (mode == PAGE_CUR_G) {
btr_pcur_open_at_index_side(

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libsrv.a
libsrv_a_SOURCES = srv0srv.c srv0que.c srv0start.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -47,6 +47,7 @@ Created 10/8/1995 Heikki Tuuri
#include "dict0boot.h"
#include "srv0start.h"
#include "row0mysql.h"
#include "ha_prototypes.h"
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */
@ -180,6 +181,16 @@ dulint srv_archive_recovery_limit_lsn;
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
/* This parameter is used to throttle the number of insert buffers that are
merged in a batch. By increasing this parameter on a faster disk you can
possibly reduce the number of I/O operations performed to complete the
merge operation. The value of this parameter is used as is by the
background loop when the system is idle (low load), on a busy system
the parameter is scaled down by a factor of 4, this is to avoid putting
a heavier load on the I/O sub system. */
ulong srv_insert_buffer_batch_size = 20;
char* srv_file_flush_method_str = NULL;
ulint srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
ulint srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
@ -977,6 +988,17 @@ srv_conc_enter_innodb(
srv_conc_slot_t* slot = NULL;
ulint i;
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
/* TODO Do something more interesting (based on a config
parameter). Some users what to give the replication
thread very low priority, see http://bugs.mysql.com/25078
This can be done by introducing
innodb_replication_delay(ms) config parameter */
return;
}
/* If trx has 'free tickets' to enter the engine left, then use one
such ticket */
@ -1017,7 +1039,7 @@ retry:
if (!has_slept && !trx->has_search_latch
&& NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
has_slept = TRUE; /* We let is sleep only once to avoid
has_slept = TRUE; /* We let it sleep only once to avoid
starvation */
srv_conc_n_waiting_threads++;
@ -1130,7 +1152,7 @@ srv_conc_force_enter_innodb(
srv_conc_n_threads++;
trx->declared_to_be_inside_innodb = TRUE;
trx->n_tickets_to_enter_innodb = 0;
trx->n_tickets_to_enter_innodb = 1;
os_fast_mutex_unlock(&srv_conc_mutex);
}
@ -1152,6 +1174,12 @@ srv_conc_force_exit_innodb(
return;
}
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
return;
}
if (trx->declared_to_be_inside_innodb == FALSE) {
return;
@ -1853,6 +1881,7 @@ srv_lock_timeout_and_monitor_thread(
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
time_t last_tablespace_monitor_time;
time_t last_monitor_time;
ibool some_waits;
double wait_time;
@ -1865,6 +1894,7 @@ srv_lock_timeout_and_monitor_thread(
UT_NOT_USED(arg);
srv_last_monitor_time = time(NULL);
last_table_monitor_time = time(NULL);
last_tablespace_monitor_time = time(NULL);
last_monitor_time = time(NULL);
loop:
srv_lock_timeout_and_monitor_active = TRUE;
@ -1901,9 +1931,9 @@ loop:
}
if (srv_print_innodb_tablespace_monitor
&& difftime(current_time, last_table_monitor_time) > 60) {
last_table_monitor_time = time(NULL);
&& difftime(current_time,
last_tablespace_monitor_time) > 60) {
last_tablespace_monitor_time = time(NULL);
fputs("========================"
"========================\n",
@ -2100,7 +2130,7 @@ loop:
os_thread_sleep(2000000);
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
goto loop;
}
@ -2270,7 +2300,8 @@ loop:
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
ibuf_contract_for_n_pages(
TRUE, srv_insert_buffer_batch_size / 4);
srv_main_thread_op_info = "flushing log";
@ -2331,7 +2362,7 @@ loop:
even if the server were active */
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
ibuf_contract_for_n_pages(TRUE, srv_insert_buffer_batch_size / 4);
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
@ -2469,7 +2500,8 @@ background_loop:
if (srv_fast_shutdown && srv_shutdown_state > 0) {
n_bytes_merged = 0;
} else {
n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
n_bytes_merged = ibuf_contract_for_n_pages(
TRUE, srv_insert_buffer_batch_size);
}
srv_main_thread_op_info = "reserving kernel mutex";

View file

@ -1025,6 +1025,12 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_IBUF_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
"InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n");
#endif
#ifdef UNIV_SYNC_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003-2004 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libsync.a
libsync_a_SOURCES = sync0arr.c sync0rw.c sync0sync.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -670,7 +670,9 @@ sync_array_detect_deadlock(
ibool ret;
rw_lock_debug_t*debug;
ut_a(arr && start && cell);
ut_a(arr);
ut_a(start);
ut_a(cell);
ut_ad(cell->wait_object);
ut_ad(os_thread_get_curr_id() == start->thread);
ut_ad(depth < 100);

View file

@ -1,25 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libthr.a
libthr_a_SOURCES = thr0loc.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1,26 +0,0 @@
# Copyright (C) 2001, 2003 MySQL AB & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libtrx.a
libtrx_a_SOURCES = trx0purge.c trx0rec.c trx0roll.c trx0rseg.c\
trx0sys.c trx0trx.c trx0undo.c
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -1024,6 +1024,7 @@ trx_undo_report_row_operation(
ibool is_insert;
trx_rseg_t* rseg;
mtr_t mtr;
ulint err = DB_SUCCESS;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
@ -1035,7 +1036,7 @@ trx_undo_report_row_operation(
*roll_ptr = ut_dulint_zero;
return(DB_SUCCESS);
return(err);
}
ut_ad(thr);
@ -1053,7 +1054,7 @@ trx_undo_report_row_operation(
if (trx->insert_undo == NULL) {
trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
err = trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
}
undo = trx->insert_undo;
@ -1063,7 +1064,7 @@ trx_undo_report_row_operation(
if (trx->update_undo == NULL) {
trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
err = trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
}
@ -1071,11 +1072,11 @@ trx_undo_report_row_operation(
is_insert = FALSE;
}
if (undo == NULL) {
/* Did not succeed: out of space */
if (err != DB_SUCCESS) {
/* Did not succeed: return the error encountered */
mutex_exit(&(trx->undo_mutex));
return(DB_OUT_OF_FILE_SPACE);
return(err);
}
page_no = undo->last_page_no;
@ -1107,7 +1108,9 @@ trx_undo_report_row_operation(
if (offset == 0) {
/* The record did not fit on the page. We erase the
end segment of the undo log page and write a log
record of it to to ensure deterministic contents. */
record of it: this is to ensure that in the debug
version the replicate page constructed using the log
records stays identical to the original page */
trx_undo_erase_page_end(undo_page, &mtr);
}
@ -1163,7 +1166,7 @@ trx_undo_report_row_operation(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return(DB_SUCCESS);
return(err);
}
/*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/

View file

@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri
#include "btr0sea.h"
#include "os0proc.h"
#include "trx0xa.h"
#include "ha_prototypes.h"
/* Copy of the prototype for innobase_mysql_print_thd: this
copy MUST be equal to the one in mysql/sql/ha_innodb.cc ! */
@ -130,6 +131,8 @@ trx_create(
trx->mysql_thd = NULL;
trx->mysql_query_str = NULL;
trx->active_trans = 0;
trx->duplicates = 0;
trx->n_mysql_tables_in_use = 0;
trx->mysql_n_tables_locked = 0;
@ -1771,6 +1774,61 @@ trx_print(
}
}
/***********************************************************************
Compares the "weight" (or size) of two transactions. The weight of one
transaction is estimated as the number of altered rows + the number of
locked rows. Transactions that have edited non-transactional tables are
considered heavier than ones that have not. */
int
trx_weight_cmp(
/*===========*/
/* out: <0, 0 or >0; similar to strcmp(3) */
trx_t* a, /* in: the first transaction to be compared */
trx_t* b) /* in: the second transaction to be compared */
{
ibool a_notrans_edit;
ibool b_notrans_edit;
/* If mysql_thd is NULL for a transaction we assume that it has
not edited non-transactional tables. */
a_notrans_edit = a->mysql_thd != NULL
&& thd_has_edited_nontrans_tables(a->mysql_thd);
b_notrans_edit = b->mysql_thd != NULL
&& thd_has_edited_nontrans_tables(b->mysql_thd);
if (a_notrans_edit && !b_notrans_edit) {
return(1);
}
if (!a_notrans_edit && b_notrans_edit) {
return(-1);
}
/* Either both had edited non-transactional tables or both had
not, we fall back to comparing the number of altered/locked
rows. */
#if 0
fprintf(stderr,
"%s TRX_WEIGHT(a): %lld+%lu, TRX_WEIGHT(b): %lld+%lu\n",
__func__,
ut_conv_dulint_to_longlong(a->undo_no),
UT_LIST_GET_LEN(a->trx_locks),
ut_conv_dulint_to_longlong(b->undo_no),
UT_LIST_GET_LEN(b->trx_locks));
#endif
#define TRX_WEIGHT(t) \
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
return(ut_dulint_cmp(TRX_WEIGHT(a), TRX_WEIGHT(b)));
}
/********************************************************************
Prepares a transaction. */
@ -1889,7 +1947,7 @@ Does the transaction prepare for MySQL. */
ulint
trx_prepare_for_mysql(
/*====-=============*/
/*==================*/
/* out: 0 or error number */
trx_t* trx) /* in: trx handle */
{

Some files were not shown because too many files have changed in this diff Show more