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
ac866d9e
Commit
ac866d9e
authored
Aug 19, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
parents
0c6b9665
95334ac6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
17 deletions
+70
-17
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
+16
-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
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+21
-7
No files found.
mysql-test/r/rpl_heap.result
View file @
ac866d9e
reset master;
drop table if exists t1;
create table t1
(a int) type=HEAP
;
insert into t1 values(1
0
);
create table t1
type=HEAP select 10 as a
;
insert into t1 values(1
1
);
show binlog events from 79;
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 147 Query 1 147 use `test`; DELETE FROM `test`.`t1`
master-bin.001 205 Query 1 205 use `test`; insert into t1 values(10)
master-bin.001 79 Query 1 79 use `test`; create table t1 type=HEAP select 10 as a
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
reset slave;
start slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a`
int(11) default NULL
`a`
bigint(2) NOT NULL default '0'
) TYPE=HEAP
select * from t1;
a
10
11
select * from t1;
a
select * from t1 limit 10;
...
...
mysql-test/t/rpl_heap.test
View file @
ac866d9e
...
...
@@ -13,8 +13,10 @@ connect (slave,localhost,root,,test,0,slave.sock);
connection
master
;
reset
master
;
drop
table
if
exists
t1
;
create
table
t1
(
a
int
)
type
=
HEAP
;
insert
into
t1
values
(
10
);
# we use CREATE SELECT to verify that DELETE does not get into binlog
# before CREATE SELECT
create
table
t1
type
=
HEAP
select
10
as
a
;
insert
into
t1
values
(
11
);
save_master_pos
;
show
binlog
events
from
79
;
connection
slave
;
...
...
sql/log.cc
View file @
ac866d9e
...
...
@@ -1627,6 +1627,22 @@ 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
),
save_master_access
(
thd_arg
->
master_access
)
{
thd_arg
->
options
&=
~
OPTION_BIN_LOG
;
thd_arg
->
master_access
|=
SUPER_ACL
;
// unneeded in 4.1
};
Disable_binlog
::~
Disable_binlog
()
{
thd
->
options
=
save_options
;
thd
->
master_access
=
save_master_access
;
}
/*
Check if a string is a valid number
...
...
sql/mysql_priv.h
View file @
ac866d9e
...
...
@@ -438,7 +438,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
HA_CREATE_INFO
*
create_info
,
List
<
create_field
>
&
fields
,
List
<
Key
>
&
keys
,
bool
tmp_table
,
bool
no_log
);
bool
tmp_table
);
TABLE
*
create_table_from_items
(
THD
*
thd
,
HA_CREATE_INFO
*
create_info
,
const
char
*
db
,
const
char
*
name
,
List
<
create_field
>
*
extra_fields
,
...
...
sql/sql_class.h
View file @
ac866d9e
...
...
@@ -638,6 +638,27 @@ public:
#define SYSTEM_THREAD_SLAVE_IO 2
#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
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
...
...
sql/sql_parse.cc
View file @
ac866d9e
...
...
@@ -1692,7 +1692,7 @@ mysql_execute_command(void)
tables
->
real_name
,
&
lex
->
create_info
,
lex
->
create_list
,
lex
->
key_list
,
0
,
0
);
// do logging
lex
->
key_list
,
0
);
if
(
!
res
)
send_ok
(
&
thd
->
net
);
}
...
...
sql/sql_table.cc
View file @
ac866d9e
...
...
@@ -336,7 +336,6 @@ static int sort_keys(KEY *a, KEY *b)
keys List of keys to create
tmp_table Set to 1 if this is an internal temporary table
(From ALTER TABLE)
no_log Don't log the query to binary log.
DESCRIPTION
If one creates a temporary table, this is automaticly opened
...
...
@@ -354,7 +353,7 @@ static int sort_keys(KEY *a, KEY *b)
int
mysql_create_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
HA_CREATE_INFO
*
create_info
,
List
<
create_field
>
&
fields
,
List
<
Key
>
&
keys
,
bool
tmp_table
,
bool
no_log
)
List
<
Key
>
&
keys
,
bool
tmp_table
)
{
char
path
[
FN_REFLEN
];
const
char
*
key_name
,
*
alias
;
...
...
@@ -779,7 +778,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
goto
end
;
}
}
if
(
!
tmp_table
&&
!
no_log
)
if
(
!
tmp_table
)
{
// Must be written before unlock
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
...
...
@@ -843,6 +842,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
TABLE
tmp_table
;
// Used during 'create_field()'
TABLE
*
table
;
tmp_table
.
table_name
=
0
;
Disable_binlog
disable_binlog
(
thd
);
DBUG_ENTER
(
"create_table_from_items"
);
/* Add selected items to field list */
...
...
@@ -873,9 +873,17 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
/* create and lock table */
/* 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
,
*
keys
,
0
,
1
))
// no logging
*
keys
,
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
)))
{
quick_rm_table
(
create_info
->
db_type
,
db
,
table_case_name
(
create_info
,
name
));
...
...
@@ -892,6 +900,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
DBUG_RETURN
(
table
);
/* Note that leaving the function resets binlogging properties */
}
...
...
@@ -1753,6 +1762,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
List_iterator
<
Key
>
key_it
(
keys
);
List_iterator
<
create_field
>
field_it
(
create_list
);
List
<
key_part_spec
>
key_parts
;
Disable_binlog
*
disable_binlog
;
KEY
*
key_info
=
table
->
key_info
;
for
(
uint
i
=
0
;
i
<
table
->
keys
;
i
++
,
key_info
++
)
...
...
@@ -1915,12 +1925,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
else
create_info
->
data_file_name
=
create_info
->
index_file_name
=
0
;
/* We don't log the statement, it will be logged later */
disable_binlog
=
new
Disable_binlog
(
thd
);
if
((
error
=
mysql_create_table
(
thd
,
new_db
,
tmp_name
,
create_info
,
create_list
,
key_list
,
1
,
1
)))
// no logging
create_list
,
key_list
,
1
)))
{
delete
disable_binlog
;
DBUG_RETURN
(
error
);
}
delete
disable_binlog
;
// reset binlogging properties for next code lines
if
(
table
->
tmp_table
)
new_table
=
open_table
(
thd
,
new_db
,
tmp_name
,
tmp_name
,
0
);
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