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
bc3e18cd
Commit
bc3e18cd
authored
Jun 30, 2007
by
istruewing@synthia.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge synthia.local:/home/mydev/mysql-5.0-axmrg
into synthia.local:/home/mydev/mysql-5.1-axmrg
parents
e091ce28
c54bce13
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
549 additions
and
148 deletions
+549
-148
include/my_base.h
include/my_base.h
+6
-1
mysql-test/r/federated.result
mysql-test/r/federated.result
+39
-0
mysql-test/r/federated_innodb.result
mysql-test/r/federated_innodb.result
+34
-0
mysql-test/t/federated.test
mysql-test/t/federated.test
+53
-0
mysql-test/t/federated_innodb-slave.opt
mysql-test/t/federated_innodb-slave.opt
+1
-0
mysql-test/t/federated_innodb.test
mysql-test/t/federated_innodb.test
+34
-0
sql/sql_insert.cc
sql/sql_insert.cc
+8
-0
storage/federated/ha_federated.cc
storage/federated/ha_federated.cc
+359
-139
storage/federated/ha_federated.h
storage/federated/ha_federated.h
+15
-8
No files found.
include/my_base.h
View file @
bc3e18cd
...
@@ -180,7 +180,12 @@ enum ha_extra_function {
...
@@ -180,7 +180,12 @@ enum ha_extra_function {
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
*/
*/
HA_EXTRA_DELETE_CANNOT_BATCH
,
HA_EXTRA_DELETE_CANNOT_BATCH
,
HA_EXTRA_UPDATE_CANNOT_BATCH
HA_EXTRA_UPDATE_CANNOT_BATCH
,
/*
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
*/
HA_EXTRA_INSERT_WITH_UPDATE
};
};
/* The following is parameter to ha_panic() */
/* The following is parameter to ha_panic() */
...
...
mysql-test/r/federated.result
View file @
bc3e18cd
...
@@ -1843,6 +1843,45 @@ C3A4C3B6C3BCC39F
...
@@ -1843,6 +1843,45 @@ C3A4C3B6C3BCC39F
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
drop table federated.t1;
drop table federated.t1;
drop table federated.t1;
drop table federated.t1;
create table federated.t1 (a int primary key, b varchar(64))
DEFAULT CHARSET=utf8;
create table federated.t1 (a int primary key, b varchar(64))
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'
DEFAULT CHARSET=utf8;
insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
a b
1 Larry
2 Curly
truncate federated.t1;
replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
a b
1 Moe
2 Curly
update ignore federated.t1 set a=a+1;
select * from federated.t1;
a b
1 Moe
3 Curly
drop table federated.t1;
drop table federated.t1;
create table federated.t1 (a int primary key, b varchar(64))
DEFAULT CHARSET=utf8;
create table federated.t1 (a int primary key, b varchar(64))
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'
DEFAULT CHARSET=utf8;
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe")
on duplicate key update a=a+100;
ERROR 23000: Can't write; duplicate key in table 't1'
select * from federated.t1;
a b
1 Larry
2 Curly
drop table federated.t1;
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.t1;
...
...
mysql-test/r/federated_innodb.result
0 → 100644
View file @
bc3e18cd
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
create table federated.t1 (a int primary key, b varchar(64))
engine=myisam;
create table federated.t1 (a int primary key, b varchar(64))
engine=federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
ERROR 23000: Can't write; duplicate key in table 't1'
select * from federated.t1;
a b
1 Larry
2 Curly
truncate federated.t1;
alter table federated.t1 engine=innodb;
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
ERROR 23000: Can't write; duplicate key in table 't1'
select * from federated.t1;
a b
drop table federated.t1;
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
mysql-test/t/federated.test
View file @
bc3e18cd
...
@@ -1630,4 +1630,57 @@ connection slave;
...
@@ -1630,4 +1630,57 @@ connection slave;
drop
table
federated
.
t1
;
drop
table
federated
.
t1
;
#
# BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE
#
connection
slave
;
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
DEFAULT
CHARSET
=
utf8
;
connection
master
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
ENGINE
=
FEDERATED
connection
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
DEFAULT
CHARSET
=
utf8
;
insert
ignore
into
federated
.
t1
values
(
1
,
"Larry"
),
(
2
,
"Curly"
),
(
1
,
"Moe"
);
select
*
from
federated
.
t1
;
truncate
federated
.
t1
;
replace
into
federated
.
t1
values
(
1
,
"Larry"
),
(
2
,
"Curly"
),
(
1
,
"Moe"
);
select
*
from
federated
.
t1
;
update
ignore
federated
.
t1
set
a
=
a
+
1
;
select
*
from
federated
.
t1
;
drop
table
federated
.
t1
;
connection
slave
;
drop
table
federated
.
t1
;
#
# BUG#25511 Federated Insert failures.
#
# When the user performs a INSERT...ON DUPLICATE KEY UPDATE, we want
# it to fail if a duplicate key exists instead of ignoring it.
#
connection
slave
;
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
DEFAULT
CHARSET
=
utf8
;
connection
master
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
ENGINE
=
FEDERATED
connection
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
DEFAULT
CHARSET
=
utf8
;
--
error
ER_DUP_KEY
insert
into
federated
.
t1
values
(
1
,
"Larry"
),
(
2
,
"Curly"
),
(
1
,
"Moe"
)
on
duplicate
key
update
a
=
a
+
100
;
select
*
from
federated
.
t1
;
drop
table
federated
.
t1
;
connection
slave
;
drop
table
federated
.
t1
;
source
include
/
federated_cleanup
.
inc
;
source
include
/
federated_cleanup
.
inc
;
mysql-test/t/federated_innodb-slave.opt
0 → 100644
View file @
bc3e18cd
--innodb
mysql-test/t/federated_innodb.test
0 → 100644
View file @
bc3e18cd
source
include
/
federated
.
inc
;
source
include
/
have_innodb
.
inc
;
#
# Bug#25513 Federated transaction failures
#
connection
slave
;
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
engine
=
myisam
;
connection
master
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t1
(
a
int
primary
key
,
b
varchar
(
64
))
engine
=
federated
connection
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
;
--
error
ER_DUP_KEY
insert
into
federated
.
t1
values
(
1
,
"Larry"
),
(
2
,
"Curly"
),
(
1
,
"Moe"
);
select
*
from
federated
.
t1
;
connection
slave
;
truncate
federated
.
t1
;
alter
table
federated
.
t1
engine
=
innodb
;
connection
master
;
--
error
ER_DUP_KEY
insert
into
federated
.
t1
values
(
1
,
"Larry"
),
(
2
,
"Curly"
),
(
1
,
"Moe"
);
select
*
from
federated
.
t1
;
drop
table
federated
.
t1
;
connection
slave
;
drop
table
federated
.
t1
;
source
include
/
federated_cleanup
.
inc
;
sql/sql_insert.cc
View file @
bc3e18cd
...
@@ -695,6 +695,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
...
@@ -695,6 +695,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if
(
duplic
==
DUP_REPLACE
&&
if
(
duplic
==
DUP_REPLACE
&&
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
if
(
duplic
==
DUP_UPDATE
)
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
/*
/*
let's *try* to start bulk inserts. It won't necessary
let's *try* to start bulk inserts. It won't necessary
start them as values_list.elements should be greater than
start them as values_list.elements should be greater than
...
@@ -2538,6 +2540,8 @@ bool Delayed_insert::handle_inserts(void)
...
@@ -2538,6 +2540,8 @@ bool Delayed_insert::handle_inserts(void)
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
using_opt_replace
=
1
;
using_opt_replace
=
1
;
}
}
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
thd
.
clear_error
();
// reset error for binlog
thd
.
clear_error
();
// reset error for binlog
if
(
write_record
(
&
thd
,
table
,
&
info
))
if
(
write_record
(
&
thd
,
table
,
&
info
))
{
{
...
@@ -2882,6 +2886,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -2882,6 +2886,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if
(
info
.
handle_duplicates
==
DUP_REPLACE
&&
if
(
info
.
handle_duplicates
==
DUP_REPLACE
&&
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
thd
->
no_trans_update
.
stmt
=
FALSE
;
thd
->
no_trans_update
.
stmt
=
FALSE
;
thd
->
abort_on_warning
=
(
!
info
.
ignore
&&
thd
->
abort_on_warning
=
(
!
info
.
ignore
&&
(
thd
->
variables
.
sql_mode
&
(
thd
->
variables
.
sql_mode
&
...
@@ -3469,6 +3475,8 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -3469,6 +3475,8 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if
(
info
.
handle_duplicates
==
DUP_REPLACE
&&
if
(
info
.
handle_duplicates
==
DUP_REPLACE
&&
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
(
!
table
->
triggers
||
!
table
->
triggers
->
has_delete_triggers
()))
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CAN_REPLACE
);
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
if
(
!
thd
->
prelocked_mode
)
if
(
!
thd
->
prelocked_mode
)
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
thd
->
no_trans_update
.
stmt
=
FALSE
;
thd
->
no_trans_update
.
stmt
=
FALSE
;
...
...
storage/federated/ha_federated.cc
View file @
bc3e18cd
This diff is collapsed.
Click to expand it.
storage/federated/ha_federated.h
View file @
bc3e18cd
...
@@ -88,6 +88,9 @@ class ha_federated: public handler
...
@@ -88,6 +88,9 @@ class ha_federated: public handler
MYSQL_ROW_OFFSET
current_position
;
// Current position used by ::position()
MYSQL_ROW_OFFSET
current_position
;
// Current position used by ::position()
int
remote_error_number
;
int
remote_error_number
;
char
remote_error_buf
[
FEDERATED_QUERY_BUFFER_SIZE
];
char
remote_error_buf
[
FEDERATED_QUERY_BUFFER_SIZE
];
bool
ignore_duplicates
,
replace_duplicates
;
bool
insert_dup_update
;
DYNAMIC_STRING
bulk_insert
;
private:
private:
/*
/*
...
@@ -102,6 +105,14 @@ private:
...
@@ -102,6 +105,14 @@ private:
bool
records_in_range
,
bool
eq_range
);
bool
records_in_range
,
bool
eq_range
);
int
stash_remote_error
();
int
stash_remote_error
();
bool
append_stmt_insert
(
String
*
query
);
int
read_next
(
byte
*
buf
,
MYSQL_RES
*
result
);
int
index_read_idx_with_result_set
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
uint
key_len
,
ha_rkey_function
find_flag
,
MYSQL_RES
**
result
);
public:
public:
ha_federated
(
handlerton
*
hton
,
TABLE_SHARE
*
table_arg
);
ha_federated
(
handlerton
*
hton
,
TABLE_SHARE
*
table_arg
);
~
ha_federated
()
{}
~
ha_federated
()
{}
...
@@ -189,6 +200,8 @@ public:
...
@@ -189,6 +200,8 @@ public:
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
);
// required
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
);
// required
int
close
(
void
);
// required
int
close
(
void
);
// required
void
start_bulk_insert
(
ha_rows
rows
);
int
end_bulk_insert
();
int
write_row
(
uchar
*
buf
);
int
write_row
(
uchar
*
buf
);
int
update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
);
int
update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
);
int
delete_row
(
const
uchar
*
buf
);
int
delete_row
(
const
uchar
*
buf
);
...
@@ -217,6 +230,7 @@ public:
...
@@ -217,6 +230,7 @@ public:
int
rnd_pos
(
uchar
*
buf
,
uchar
*
pos
);
//required
int
rnd_pos
(
uchar
*
buf
,
uchar
*
pos
);
//required
void
position
(
const
uchar
*
record
);
//required
void
position
(
const
uchar
*
record
);
//required
int
info
(
uint
);
//required
int
info
(
uint
);
//required
int
extra
(
ha_extra_function
operation
);
void
update_auto_increment
(
void
);
void
update_auto_increment
(
void
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
...
@@ -231,18 +245,11 @@ public:
...
@@ -231,18 +245,11 @@ public:
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
//required
enum
thr_lock_type
lock_type
);
//required
virtual
bool
get_error_message
(
int
error
,
String
*
buf
);
bool
get_error_message
(
int
error
,
String
*
buf
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
int
connection_commit
();
int
connection_commit
();
int
connection_rollback
();
int
connection_rollback
();
int
connection_autocommit
(
bool
state
);
int
connection_autocommit
(
bool
state
);
int
execute_simple_query
(
const
char
*
query
,
int
len
);
int
execute_simple_query
(
const
char
*
query
,
int
len
);
int
read_next
(
uchar
*
buf
,
MYSQL_RES
*
result
);
int
index_read_idx_with_result_set
(
uchar
*
buf
,
uint
index
,
const
uchar
*
key
,
uint
key_len
,
ha_rkey_function
find_flag
,
MYSQL_RES
**
result
);
};
};
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