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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
04c6b03c
Commit
04c6b03c
authored
Feb 20, 2017
by
sjaakola
Committed by
Jan Lindström
Aug 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refs: MW-360 * merged relevant parts of DROP TABLE query splitting from mysql-wsrep-features
parent
a754387a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
190 deletions
+208
-190
sql/sql_parse.cc
sql/sql_parse.cc
+1
-20
sql/sql_table.cc
sql/sql_table.cc
+0
-88
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+207
-79
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+0
-3
No files found.
sql/sql_parse.cc
View file @
04c6b03c
...
...
@@ -4030,26 +4030,6 @@ case SQLCOM_PREPARE:
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd
->
variables
.
option_bits
|=
OPTION_KEEP_LOG
;
}
#ifdef WITH_WSREP
bool
has_tmp_tables
=
false
;
for
(
TABLE_LIST
*
table
=
all_tables
;
table
;
table
=
table
->
next_global
)
{
if
(
lex
->
drop_temporary
||
find_temporary_table
(
thd
,
table
))
{
has_tmp_tables
=
true
;
break
;
}
}
if
(
has_tmp_tables
)
{
wsrep_replicate_drop_query
(
thd
,
first_table
,
lex
->
check_exists
,
lex
->
drop_temporary
,
false
);
}
else
{
WSREP_TO_ISOLATION_BEGIN
(
NULL
,
NULL
,
all_tables
);
}
#endif
/* WITH_WSREP */
/*
If we are a slave, we should add IF EXISTS if the query executed
on the master without an error. This will help a slave to
...
...
@@ -4060,6 +4040,7 @@ case SQLCOM_PREPARE:
slave_ddl_exec_mode_options
==
SLAVE_EXEC_MODE_IDEMPOTENT
)
lex
->
check_exists
=
1
;
WSREP_TO_ISOLATION_BEGIN
(
NULL
,
NULL
,
all_tables
);
/* DDL and binlog write order are protected by metadata locks. */
res
=
mysql_rm_table
(
thd
,
first_table
,
lex
->
check_exists
,
lex
->
drop_temporary
);
...
...
sql/sql_table.cc
View file @
04c6b03c
...
...
@@ -2156,94 +2156,6 @@ static uint32 comment_length(THD *thd, uint32 comment_pos,
return
0
;
}
#ifdef WITH_WSREP
static
void
wsrep_append_name
(
THD
*
thd
,
String
*
packet
,
const
char
*
name
,
uint
length
,
const
CHARSET_INFO
*
from_cs
,
const
CHARSET_INFO
*
to_cs
)
{
const
char
*
to_name
=
name
;
size_t
to_length
=
length
;
String
to_string
(
name
,
length
,
from_cs
);
if
(
from_cs
!=
NULL
&&
to_cs
!=
NULL
&&
from_cs
!=
to_cs
)
thd
->
convert_string
(
&
to_string
,
from_cs
,
to_cs
);
if
(
to_cs
!=
NULL
)
{
to_name
=
to_string
.
c_ptr
();
to_length
=
to_string
.
length
();
}
packet
->
append
(
to_name
,
to_length
,
packet
->
charset
());
}
int
wsrep_replicate_drop_query
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
if_exists
,
bool
drop_temporary
,
bool
dont_log_query
)
{
TABLE_LIST
*
table
;
int
error
=
0
;
String
built_query
;
bool
non_tmp_table_deleted
=
FALSE
;
DBUG_ENTER
(
"wsrep_build_drop_query"
);
if
(
!
dont_log_query
)
{
if
(
!
drop_temporary
)
{
built_query
.
set_charset
(
system_charset_info
);
if
(
if_exists
)
built_query
.
append
(
"DROP TABLE IF EXISTS "
);
else
built_query
.
append
(
"DROP TABLE "
);
}
}
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
{
char
*
db
=
table
->
db
;
int
db_len
=
table
->
db_length
;
DBUG_PRINT
(
"table"
,
(
"table_l: '%s'.'%s' table: 0x%lx s: 0x%lx"
,
table
->
db
,
table
->
table_name
,
(
long
)
table
->
table
,
table
->
table
?
(
long
)
table
->
table
->
s
:
(
long
)
-
1
));
if
(
!
find_temporary_table
(
thd
,
table
))
{
non_tmp_table_deleted
=
TRUE
;
if
(
thd
->
db
==
NULL
||
strcmp
(
db
,
thd
->
db
)
!=
0
)
{
wsrep_append_name
(
thd
,
&
built_query
,
db
,
db_len
,
system_charset_info
,
thd
->
charset
());
built_query
.
append
(
"."
);
}
thd
->
variables
.
option_bits
&=
~
OPTION_QUOTE_SHOW_CREATE
;
wsrep_append_name
(
thd
,
&
built_query
,
table
->
table_name
,
strlen
(
table
->
table_name
),
system_charset_info
,
thd
->
charset
());
built_query
.
append
(
","
);
}
}
if
(
non_tmp_table_deleted
)
{
/* Chop of the last comma */
built_query
.
chop
();
built_query
.
append
(
" /* generated by server */"
);
WSREP_DEBUG
(
"TOI for %s"
,
built_query
.
ptr
());
if
(
WSREP_TO_ISOLATION_BEGIN_QUERY
(
built_query
.
ptr
(),
NULL
,
NULL
,
tables
))
{
WSREP_DEBUG
(
"TOI failed for DROP TABLE: %s"
,
WSREP_QUERY
(
thd
));
error
=
1
;
goto
end
;
}
}
end:
DBUG_RETURN
(
error
);
}
#endif
/* WITH_WSREP */
/**
Execute the drop of a normal or temporary table.
...
...
sql/wsrep_mysqld.cc
View file @
04c6b03c
This diff is collapsed.
Click to expand it.
sql/wsrep_mysqld.h
View file @
04c6b03c
...
...
@@ -337,9 +337,6 @@ void wsrep_init_sidno(const wsrep_uuid_t&);
bool
wsrep_node_is_donor
();
bool
wsrep_node_is_synced
();
int
wsrep_replicate_drop_query
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
if_exists
,
bool
drop_temporary
,
bool
dont_log_query
);
#define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
...
...
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