Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
22546845
Commit
22546845
authored
Aug 19, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
parents
68bc1c28
0db5b4d2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
30 deletions
+78
-30
include/mysql.h
include/mysql.h
+1
-1
include/mysql_com.h
include/mysql_com.h
+6
-6
libmysql/libmysql.c
libmysql/libmysql.c
+1
-1
mysql-test/r/rpl_heap.result
mysql-test/r/rpl_heap.result
+6
-6
mysql-test/t/rpl_heap.test
mysql-test/t/rpl_heap.test
+4
-2
sql/log.cc
sql/log.cc
+14
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/sql_class.h
sql/sql_class.h
+21
-0
sql/sql_parse.cc
sql/sql_parse.cc
+3
-3
sql/sql_table.cc
sql/sql_table.cc
+21
-10
No files found.
include/mysql.h
View file @
22546845
...
@@ -454,7 +454,7 @@ int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
...
@@ -454,7 +454,7 @@ int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
const
char
*
passwd
);
const
char
*
passwd
);
int
STDCALL
mysql_shutdown
(
MYSQL
*
mysql
,
int
STDCALL
mysql_shutdown
(
MYSQL
*
mysql
,
enum
enum_shutdown_level
enum
mysql_
enum_shutdown_level
shutdown_level
);
shutdown_level
);
int
STDCALL
mysql_dump_debug_info
(
MYSQL
*
mysql
);
int
STDCALL
mysql_dump_debug_info
(
MYSQL
*
mysql
);
int
STDCALL
mysql_refresh
(
MYSQL
*
mysql
,
int
STDCALL
mysql_refresh
(
MYSQL
*
mysql
,
...
...
include/mysql_com.h
View file @
22546845
...
@@ -238,17 +238,17 @@ enum mysql_enum_shutdown_level {
...
@@ -238,17 +238,17 @@ enum mysql_enum_shutdown_level {
comparisons). Note that DEFAULT does not respect the growing property, but
comparisons). Note that DEFAULT does not respect the growing property, but
it's ok.
it's ok.
*/
*/
DEFAULT
=
0
,
SHUTDOWN_DEFAULT
=
0
,
/* wait for existing connections to finish */
/* wait for existing connections to finish */
WAIT_CONNECTIONS
=
MYSQL_SHUTDOWN_KILLABLE_CONNECT
,
SHUTDOWN_
WAIT_CONNECTIONS
=
MYSQL_SHUTDOWN_KILLABLE_CONNECT
,
/* wait for existing trans to finish */
/* wait for existing trans to finish */
WAIT_TRANSACTIONS
=
MYSQL_SHUTDOWN_KILLABLE_TRANS
,
SHUTDOWN_
WAIT_TRANSACTIONS
=
MYSQL_SHUTDOWN_KILLABLE_TRANS
,
/* wait for existing updates to finish (=> no partial MyISAM update) */
/* wait for existing updates to finish (=> no partial MyISAM update) */
WAIT_UPDATES
=
MYSQL_SHUTDOWN_KILLABLE_UPDATE
,
SHUTDOWN_
WAIT_UPDATES
=
MYSQL_SHUTDOWN_KILLABLE_UPDATE
,
/* flush InnoDB buffers and other storage engines' buffers*/
/* flush InnoDB buffers and other storage engines' buffers*/
WAIT_ALL_BUFFERS
=
(
MYSQL_SHUTDOWN_KILLABLE_UPDATE
<<
1
),
SHUTDOWN_
WAIT_ALL_BUFFERS
=
(
MYSQL_SHUTDOWN_KILLABLE_UPDATE
<<
1
),
/* don't flush InnoDB buffers, flush other storage engines' buffers*/
/* don't flush InnoDB buffers, flush other storage engines' buffers*/
WAIT_CRITICAL_BUFFERS
=
(
MYSQL_SHUTDOWN_KILLABLE_UPDATE
<<
1
)
+
1
,
SHUTDOWN_
WAIT_CRITICAL_BUFFERS
=
(
MYSQL_SHUTDOWN_KILLABLE_UPDATE
<<
1
)
+
1
,
/* Now the 2 levels of the KILL command */
/* Now the 2 levels of the KILL command */
#if MYSQL_VERSION_ID >= 50000
#if MYSQL_VERSION_ID >= 50000
KILL_QUERY
=
254
,
KILL_QUERY
=
254
,
...
...
libmysql/libmysql.c
View file @
22546845
...
@@ -1291,7 +1291,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
...
@@ -1291,7 +1291,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
int
STDCALL
int
STDCALL
mysql_shutdown
(
MYSQL
*
mysql
,
enum
enum_shutdown_level
shutdown_level
)
mysql_shutdown
(
MYSQL
*
mysql
,
enum
mysql_
enum_shutdown_level
shutdown_level
)
{
{
uchar
level
[
1
];
uchar
level
[
1
];
DBUG_ENTER
(
"mysql_shutdown"
);
DBUG_ENTER
(
"mysql_shutdown"
);
...
...
mysql-test/r/rpl_heap.result
View file @
22546845
reset master;
reset master;
drop table if exists t1;
drop table if exists t1;
create table t1
(a int) type=HEAP
;
create table t1
type=HEAP select 10 as a
;
insert into t1 values(1
0
);
insert into t1 values(1
1
);
show binlog events from 79;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1 (a int) type=HEAP
master-bin.001 79 Query 1 79 use `test`; create table t1 type=HEAP select 10 as a
master-bin.001 147 Query 1 147 use `test`; DELETE FROM `test`.`t1`
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
master-bin.001 205 Query 1 205 use `test`; insert into t1 values(10)
reset slave;
reset slave;
start slave;
start slave;
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`a`
int(11) default NULL
`a`
bigint(2) NOT NULL default '0'
) TYPE=HEAP
) TYPE=HEAP
select * from t1;
select * from t1;
a
a
10
10
11
select * from t1;
select * from t1;
a
a
select * from t1 limit 10;
select * from t1 limit 10;
...
...
mysql-test/t/rpl_heap.test
View file @
22546845
...
@@ -13,8 +13,10 @@ connect (slave,localhost,root,,test,0,slave.sock);
...
@@ -13,8 +13,10 @@ connect (slave,localhost,root,,test,0,slave.sock);
connection
master
;
connection
master
;
reset
master
;
reset
master
;
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
create
table
t1
(
a
int
)
type
=
HEAP
;
# we use CREATE SELECT to verify that DELETE does not get into binlog
insert
into
t1
values
(
10
);
# before CREATE SELECT
create
table
t1
type
=
HEAP
select
10
as
a
;
insert
into
t1
values
(
11
);
save_master_pos
;
save_master_pos
;
show
binlog
events
from
79
;
show
binlog
events
from
79
;
connection
slave
;
connection
slave
;
...
...
sql/log.cc
View file @
22546845
...
@@ -1877,6 +1877,20 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
...
@@ -1877,6 +1877,20 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
}
}
Disable_binlog
::
Disable_binlog
(
THD
*
thd_arg
)
:
thd
(
thd_arg
),
save_options
(
thd_arg
->
options
)
{
thd_arg
->
options
&=
~
OPTION_BIN_LOG
;
};
Disable_binlog
::~
Disable_binlog
()
{
thd
->
options
=
save_options
;
}
/*
/*
Check if a string is a valid number
Check if a string is a valid number
...
...
sql/mysql_priv.h
View file @
22546845
...
@@ -518,7 +518,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -518,7 +518,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
HA_CREATE_INFO
*
create_info
,
HA_CREATE_INFO
*
create_info
,
List
<
create_field
>
&
fields
,
List
<
Key
>
&
keys
,
List
<
create_field
>
&
fields
,
List
<
Key
>
&
keys
,
bool
tmp_table
,
bool
no_log
,
uint
select_field_count
);
bool
tmp_table
,
uint
select_field_count
);
TABLE
*
create_table_from_items
(
THD
*
thd
,
HA_CREATE_INFO
*
create_info
,
TABLE
*
create_table_from_items
(
THD
*
thd
,
HA_CREATE_INFO
*
create_info
,
const
char
*
db
,
const
char
*
name
,
const
char
*
db
,
const
char
*
name
,
List
<
create_field
>
*
extra_fields
,
List
<
create_field
>
*
extra_fields
,
...
...
sql/sql_class.h
View file @
22546845
...
@@ -1017,6 +1017,27 @@ public:
...
@@ -1017,6 +1017,27 @@ public:
#define SYSTEM_THREAD_SLAVE_IO 2
#define SYSTEM_THREAD_SLAVE_IO 2
#define SYSTEM_THREAD_SLAVE_SQL 4
#define SYSTEM_THREAD_SLAVE_SQL 4
/*
Disables binary logging for one thread, and resets it back to what it was
before being disabled.
Some functions (like the internal mysql_create_table() when it's called by
mysql_alter_table()) must NOT write to the binlog (binlogging is done at the
at a later stage of the command already, and must be, for locking reasons);
so we internally disable it temporarily by creating the Disable_binlog
object and reset the state by destroying the object (don't forget that! or
write code so that the object gets automatically destroyed when leaving a
function...).
*/
class
Disable_binlog
{
private:
THD
*
thd
;
ulong
save_options
;
ulong
save_master_access
;
public:
Disable_binlog
(
THD
*
thd_arg
);
~
Disable_binlog
();
};
/*
/*
Used to hold information about file and file structure in exchainge
Used to hold information about file and file structure in exchainge
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
...
...
sql/sql_parse.cc
View file @
22546845
...
@@ -1643,8 +1643,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1643,8 +1643,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
SHUTDOWN_DEFAULT is 0. If client is >= 4.1.3, the shutdown level is in
SHUTDOWN_DEFAULT is 0. If client is >= 4.1.3, the shutdown level is in
packet[0].
packet[0].
*/
*/
enum
enum_shutdown_level
level
=
enum
mysql_
enum_shutdown_level
level
=
(
enum
enum_shutdown_level
)
(
uchar
)
packet
[
0
];
(
enum
mysql_
enum_shutdown_level
)
(
uchar
)
packet
[
0
];
DBUG_PRINT
(
"quit"
,(
"Got shutdown command for level %u"
,
level
));
DBUG_PRINT
(
"quit"
,(
"Got shutdown command for level %u"
,
level
));
if
(
level
==
SHUTDOWN_DEFAULT
)
if
(
level
==
SHUTDOWN_DEFAULT
)
level
=
SHUTDOWN_WAIT_ALL_BUFFERS
;
// soon default will be configurable
level
=
SHUTDOWN_WAIT_ALL_BUFFERS
;
// soon default will be configurable
...
@@ -2379,7 +2379,7 @@ mysql_execute_command(THD *thd)
...
@@ -2379,7 +2379,7 @@ mysql_execute_command(THD *thd)
res
=
mysql_create_table
(
thd
,
create_table
->
db
,
res
=
mysql_create_table
(
thd
,
create_table
->
db
,
create_table
->
real_name
,
&
lex
->
create_info
,
create_table
->
real_name
,
&
lex
->
create_info
,
lex
->
create_list
,
lex
->
create_list
,
lex
->
key_list
,
0
,
0
,
0
);
// do logging
lex
->
key_list
,
0
,
0
);
}
}
if
(
!
res
)
if
(
!
res
)
send_ok
(
thd
);
send_ok
(
thd
);
...
...
sql/sql_table.cc
View file @
22546845
...
@@ -1090,7 +1090,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -1090,7 +1090,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
keys List of keys to create
keys List of keys to create
tmp_table Set to 1 if this is an internal temporary table
tmp_table Set to 1 if this is an internal temporary table
(From ALTER TABLE)
(From ALTER TABLE)
no_log Don't log the query to binary log.
DESCRIPTION
DESCRIPTION
If one creates a temporary table, this is automaticly opened
If one creates a temporary table, this is automaticly opened
...
@@ -1108,7 +1107,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -1108,7 +1107,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
HA_CREATE_INFO
*
create_info
,
HA_CREATE_INFO
*
create_info
,
List
<
create_field
>
&
fields
,
List
<
create_field
>
&
fields
,
List
<
Key
>
&
keys
,
bool
tmp_table
,
bool
no_log
,
List
<
Key
>
&
keys
,
bool
tmp_table
,
uint
select_field_count
)
uint
select_field_count
)
{
{
char
path
[
FN_REFLEN
];
char
path
[
FN_REFLEN
];
...
@@ -1277,7 +1276,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -1277,7 +1276,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
thd
->
tmp_table_used
=
1
;
thd
->
tmp_table_used
=
1
;
}
}
if
(
!
tmp_table
&&
!
no_log
)
if
(
!
tmp_table
)
{
{
// Must be written before unlock
// Must be written before unlock
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
...
@@ -1352,6 +1351,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -1352,6 +1351,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
TABLE
*
table
;
TABLE
*
table
;
tmp_table
.
table_name
=
0
;
tmp_table
.
table_name
=
0
;
uint
select_field_count
=
items
->
elements
;
uint
select_field_count
=
items
->
elements
;
Disable_binlog
disable_binlog
(
thd
);
DBUG_ENTER
(
"create_table_from_items"
);
DBUG_ENTER
(
"create_table_from_items"
);
/* Add selected items to field list */
/* Add selected items to field list */
...
@@ -1382,9 +1382,17 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -1382,9 +1382,17 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
}
/* create and lock table */
/* create and lock table */
/* QQ: This should be done atomic ! */
/* QQ: This should be done atomic ! */
/* We don't log the statement, it will be logged later */
if
(
mysql_create_table
(
thd
,
db
,
name
,
create_info
,
*
extra_fields
,
if
(
mysql_create_table
(
thd
,
db
,
name
,
create_info
,
*
extra_fields
,
*
keys
,
0
,
1
,
select_field_count
))
// no logging
*
keys
,
0
,
select_field_count
))
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
/*
If this is a HEAP table, the automatic DELETE FROM which is written to the
binlog when a HEAP table is opened for the first time since startup, must
not be written: 1) it would be wrong (imagine we're in CREATE SELECT: we
don't want to delete from it) 2) it would be written before the CREATE
TABLE, which is a wrong order. So we keep binary logging disabled.
*/
if
(
!
(
table
=
open_table
(
thd
,
db
,
name
,
name
,(
bool
*
)
0
)))
if
(
!
(
table
=
open_table
(
thd
,
db
,
name
,
name
,(
bool
*
)
0
)))
{
{
quick_rm_table
(
create_info
->
db_type
,
db
,
table_case_name
(
create_info
,
name
));
quick_rm_table
(
create_info
->
db_type
,
db
,
table_case_name
(
create_info
,
name
));
...
@@ -1401,6 +1409,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -1401,6 +1409,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
}
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
DBUG_RETURN
(
table
);
DBUG_RETURN
(
table
);
/* Note that leaving the function resets binlogging properties */
}
}
...
@@ -3008,12 +3017,14 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -3008,12 +3017,14 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
}
else
else
create_info
->
data_file_name
=
create_info
->
index_file_name
=
0
;
create_info
->
data_file_name
=
create_info
->
index_file_name
=
0
;
{
/* We don't log the statement, it will be logged later */
Disable_binlog
disable_binlog
(
thd
);
if
((
error
=
mysql_create_table
(
thd
,
new_db
,
tmp_name
,
if
((
error
=
mysql_create_table
(
thd
,
new_db
,
tmp_name
,
create_info
,
create_info
,
create_list
,
key_list
,
1
,
1
,
0
)))
// no logging
create_list
,
key_list
,
1
,
0
)))
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
if
(
table
->
tmp_table
)
if
(
table
->
tmp_table
)
new_table
=
open_table
(
thd
,
new_db
,
tmp_name
,
tmp_name
,
0
);
new_table
=
open_table
(
thd
,
new_db
,
tmp_name
,
tmp_name
,
0
);
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment