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
f0ddf5a6
Commit
f0ddf5a6
authored
May 10, 2013
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support upsert x=x+values(x) expressions
parent
2090a320
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
37 deletions
+110
-37
mysql-test/suite/tokudb/r/fast_upsert_values.result
mysql-test/suite/tokudb/r/fast_upsert_values.result
+23
-0
mysql-test/suite/tokudb/t/fast_upsert_values.test
mysql-test/suite/tokudb/t/fast_upsert_values.test
+32
-0
storage/tokudb/ha_tokudb_update.cc
storage/tokudb/ha_tokudb_update.cc
+55
-37
No files found.
mysql-test/suite/tokudb/r/fast_upsert_values.result
0 → 100644
View file @
f0ddf5a6
set default_storage_engine='tokudb';
drop table if exists t;
set tokudb_disable_slow_upsert=1;
create table t (id int primary key, x int not null);
insert noar into t values (1,1);
insert noar into t values (1,1) on duplicate key update x=x+1;
select * from t;
id x
1 2
insert noar into t values (1,10) on duplicate key update x=values(x)+1;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
select * from t;
id x
1 2
insert noar into t values (1,10) on duplicate key update x=x+values(x);
select * from t;
id x
1 12
insert noar into t values (1,100) on duplicate key update x=x+values(x);
select * from t;
id x
1 112
drop table t;
mysql-test/suite/tokudb/t/fast_upsert_values.test
0 → 100644
View file @
f0ddf5a6
# verify that values(x) works in update expression
source
include
/
have_tokudb
.
inc
;
set
default_storage_engine
=
'tokudb'
;
disable_warnings
;
drop
table
if
exists
t
;
enable_warnings
;
set
tokudb_disable_slow_upsert
=
1
;
create
table
t
(
id
int
primary
key
,
x
int
not
null
);
insert
noar
into
t
values
(
1
,
1
);
insert
noar
into
t
values
(
1
,
1
)
on
duplicate
key
update
x
=
x
+
1
;
select
*
from
t
;
replace_regex
/
MariaDB
/
XYZ
/
/
MySQL
/
XYZ
/
;
error
ER_UNSUPPORTED_EXTENSION
;
insert
noar
into
t
values
(
1
,
10
)
on
duplicate
key
update
x
=
values
(
x
)
+
1
;
select
*
from
t
;
insert
noar
into
t
values
(
1
,
10
)
on
duplicate
key
update
x
=
x
+
values
(
x
);
select
*
from
t
;
insert
noar
into
t
values
(
1
,
100
)
on
duplicate
key
update
x
=
x
+
values
(
x
);
select
*
from
t
;
drop
table
t
;
storage/tokudb/ha_tokudb_update.cc
View file @
f0ddf5a6
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
// Restrictions:
// Restrictions:
// No triggers
// No triggers
// Statement or mixed replication
// Statement or mixed replication
// Does not support row based replication
// Primary key must be defined
// Primary key must be defined
// Simple and compound primary key
// Simple and compound primary key
// Int, char and varchar primary key types
// Int, char and varchar primary key types
...
@@ -14,10 +13,10 @@
...
@@ -14,10 +13,10 @@
// Integer and char field updates
// Integer and char field updates
// Update expressions:
// Update expressions:
// x = constant
// x = constant
// x = x
+
constant
// x = x
+
constant
// x = x
-
constant
// x = x
-
constant
//
x = if
(x=0,0,x-1)
//
x = if
(x=0,0,x-1)
//
Session variable enables fast updates and fast upserts
//
x = x + values(x)
// Session variable disables slow updates and slow upserts
// Session variable disables slow updates and slow upserts
// Future features:
// Future features:
...
@@ -72,7 +71,14 @@ static void dump_item(Item *item) {
...
@@ -72,7 +71,14 @@ static void dump_item(Item *item) {
fprintf
(
stderr
,
")
\n
"
);
fprintf
(
stderr
,
")
\n
"
);
break
;
break
;
}
}
case
Item
:
:
INSERT_VALUE_ITEM
:
{
Item_insert_value
*
value_item
=
static_cast
<
Item_insert_value
*>
(
item
);
fprintf
(
stderr
,
":insert_value"
);
dump_item
(
value_item
->
arg
);
break
;
}
default:
default:
fprintf
(
stderr
,
":unsupported
\n
"
);
break
;
break
;
}
}
}
}
...
@@ -158,7 +164,6 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i
...
@@ -158,7 +164,6 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i
int
ha_tokudb
::
fast_update
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
,
Item
*
conds
)
{
int
ha_tokudb
::
fast_update
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
,
Item
*
conds
)
{
TOKUDB_DBUG_ENTER
(
"ha_tokudb::fast_update"
);
TOKUDB_DBUG_ENTER
(
"ha_tokudb::fast_update"
);
int
error
=
0
;
int
error
=
0
;
unsigned
line
=
0
;
// debug
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
dump_item_list
(
"fields"
,
update_fields
);
dump_item_list
(
"fields"
,
update_fields
);
...
@@ -170,24 +175,20 @@ int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &upda
...
@@ -170,24 +175,20 @@ int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &upda
if
(
update_fields
.
elements
<
1
||
update_fields
.
elements
!=
update_values
.
elements
)
{
if
(
update_fields
.
elements
<
1
||
update_fields
.
elements
!=
update_values
.
elements
)
{
error
=
ENOTSUP
;
// something is fishy with the parameters
error
=
ENOTSUP
;
// something is fishy with the parameters
line
=
__LINE__
;
goto
return_error
;
goto
return_error
;
}
}
if
(
!
check_fast_update
(
thd
,
update_fields
,
update_values
,
conds
))
{
if
(
!
check_fast_update
(
thd
,
update_fields
,
update_values
,
conds
))
{
error
=
ENOTSUP
;
error
=
ENOTSUP
;
line
=
__LINE__
;
goto
check_error
;
goto
check_error
;
}
}
error
=
send_update_message
(
update_fields
,
update_values
,
conds
,
transaction
);
error
=
send_update_message
(
update_fields
,
update_values
,
conds
,
transaction
);
if
(
error
!=
0
)
{
if
(
error
!=
0
)
{
line
=
__LINE__
;
goto
check_error
;
goto
check_error
;
}
}
check_error:
check_error:
line
=
line
;
// debug
if
(
error
!=
0
)
{
if
(
error
!=
0
)
{
if
(
get_disable_slow_update
(
thd
))
if
(
get_disable_slow_update
(
thd
))
error
=
HA_ERR_UNSUPPORTED
;
error
=
HA_ERR_UNSUPPORTED
;
...
@@ -202,9 +203,9 @@ int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &upda
...
@@ -202,9 +203,9 @@ int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &upda
// Return true if an expression is a simple int expression or a simple function of +- int expression.
// Return true if an expression is a simple int expression or a simple function of +- int expression.
static
bool
check_int_result
(
Item
*
item
)
{
static
bool
check_int_result
(
Item
*
item
)
{
Item
::
Type
t
=
item
->
type
();
Item
::
Type
t
=
item
->
type
();
if
(
t
==
Item
::
INT_ITEM
)
if
(
t
==
Item
::
INT_ITEM
)
{
return
true
;
return
true
;
else
if
(
t
==
Item
::
FUNC_ITEM
)
{
}
else
if
(
t
==
Item
::
FUNC_ITEM
)
{
Item_func
*
item_func
=
static_cast
<
Item_func
*>
(
item
);
Item_func
*
item_func
=
static_cast
<
Item_func
*>
(
item
);
if
(
strcmp
(
item_func
->
func_name
(),
"+"
)
!=
0
&&
strcmp
(
item_func
->
func_name
(),
"-"
)
!=
0
)
if
(
strcmp
(
item_func
->
func_name
(),
"+"
)
!=
0
&&
strcmp
(
item_func
->
func_name
(),
"-"
)
!=
0
)
return
false
;
return
false
;
...
@@ -218,8 +219,21 @@ static bool check_int_result(Item *item) {
...
@@ -218,8 +219,21 @@ static bool check_int_result(Item *item) {
return
false
;
return
false
;
}
}
// check that an item is an insert value item with the same field name
static
bool
check_insert_value
(
Item
*
item
,
const
char
*
field_name
)
{
if
(
item
->
type
()
!=
Item
::
INSERT_VALUE_ITEM
)
return
false
;
Item_insert_value
*
value_item
=
static_cast
<
Item_insert_value
*>
(
item
);
if
(
value_item
->
arg
->
type
()
!=
Item
::
FIELD_ITEM
)
return
false
;
Item_field
*
arg
=
static_cast
<
Item_field
*>
(
value_item
->
arg
);
if
(
strcmp
(
field_name
,
arg
->
field_name
)
!=
0
)
return
false
;
return
true
;
}
// Return true if an expression looks like field_name op constant.
// Return true if an expression looks like field_name op constant.
static
bool
check_x_op_constant
(
const
char
*
field_name
,
Item
*
item
,
const
char
*
op
,
Item
**
item_constant
)
{
static
bool
check_x_op_constant
(
const
char
*
field_name
,
Item
*
item
,
const
char
*
op
,
Item
**
item_constant
,
bool
allow_insert_value
)
{
if
(
item
->
type
()
!=
Item
::
FUNC_ITEM
)
if
(
item
->
type
()
!=
Item
::
FUNC_ITEM
)
return
false
;
return
false
;
Item_func
*
item_func
=
static_cast
<
Item_func
*>
(
item
);
Item_func
*
item_func
=
static_cast
<
Item_func
*>
(
item
);
...
@@ -235,6 +249,7 @@ static bool check_x_op_constant(const char *field_name, Item *item, const char *
...
@@ -235,6 +249,7 @@ static bool check_x_op_constant(const char *field_name, Item *item, const char *
if
(
strcmp
(
field_name
,
arg0
->
field_name
)
!=
0
)
if
(
strcmp
(
field_name
,
arg0
->
field_name
)
!=
0
)
return
false
;
return
false
;
if
(
!
check_int_result
(
arguments
[
1
]))
if
(
!
check_int_result
(
arguments
[
1
]))
if
(
!
(
allow_insert_value
&&
check_insert_value
(
arguments
[
1
],
field_name
)))
return
false
;
return
false
;
*
item_constant
=
arguments
[
1
];
*
item_constant
=
arguments
[
1
];
return
true
;
return
true
;
...
@@ -243,9 +258,9 @@ static bool check_x_op_constant(const char *field_name, Item *item, const char *
...
@@ -243,9 +258,9 @@ static bool check_x_op_constant(const char *field_name, Item *item, const char *
// Return true if an expression looks like field_name = constant
// Return true if an expression looks like field_name = constant
static
bool
check_x_equal_0
(
const
char
*
field_name
,
Item
*
item
)
{
static
bool
check_x_equal_0
(
const
char
*
field_name
,
Item
*
item
)
{
Item
*
item_constant
;
Item
*
item_constant
;
if
(
!
check_x_op_constant
(
field_name
,
item
,
"="
,
&
item_constant
))
if
(
!
check_x_op_constant
(
field_name
,
item
,
"="
,
&
item_constant
,
false
))
return
false
;
return
false
;
if
(
item_constant
->
val_int
()
!=
0
)
if
(
item_constant
->
type
()
!=
Item
::
INT_ITEM
||
item_constant
->
val_int
()
!=
0
)
return
false
;
return
false
;
return
true
;
return
true
;
}
}
...
@@ -253,9 +268,9 @@ static bool check_x_equal_0(const char *field_name, Item *item) {
...
@@ -253,9 +268,9 @@ static bool check_x_equal_0(const char *field_name, Item *item) {
// Return true if an expression looks like fieldname - 1
// Return true if an expression looks like fieldname - 1
static
bool
check_x_minus_1
(
const
char
*
field_name
,
Item
*
item
)
{
static
bool
check_x_minus_1
(
const
char
*
field_name
,
Item
*
item
)
{
Item
*
item_constant
;
Item
*
item_constant
;
if
(
!
check_x_op_constant
(
field_name
,
item
,
"-"
,
&
item_constant
))
if
(
!
check_x_op_constant
(
field_name
,
item
,
"-"
,
&
item_constant
,
false
))
return
false
;
return
false
;
if
(
item_constant
->
val_int
()
!=
1
)
if
(
item_constant
->
type
()
!=
Item
::
INT_ITEM
||
item_constant
->
val_int
()
!=
1
)
return
false
;
return
false
;
return
true
;
return
true
;
}
}
...
@@ -284,7 +299,7 @@ static bool check_decr_floor_expression(Field *lhs_field, Item *item) {
...
@@ -284,7 +299,7 @@ static bool check_decr_floor_expression(Field *lhs_field, Item *item) {
}
}
// Check if lhs = rhs expression is simple. Return true if it is.
// Check if lhs = rhs expression is simple. Return true if it is.
static
bool
check_update_expression
(
Item
*
lhs_item
,
Item
*
rhs_item
,
TABLE
*
table
)
{
static
bool
check_update_expression
(
Item
*
lhs_item
,
Item
*
rhs_item
,
TABLE
*
table
,
bool
allow_insert_value
)
{
Field
*
lhs_field
=
find_field_by_name
(
table
,
lhs_item
);
Field
*
lhs_field
=
find_field_by_name
(
table
,
lhs_item
);
if
(
lhs_field
==
NULL
)
if
(
lhs_field
==
NULL
)
return
false
;
return
false
;
...
@@ -301,9 +316,9 @@ static bool check_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table
...
@@ -301,9 +316,9 @@ static bool check_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table
if
(
check_int_result
(
rhs_item
))
if
(
check_int_result
(
rhs_item
))
return
true
;
return
true
;
Item
*
item_constant
;
Item
*
item_constant
;
if
(
check_x_op_constant
(
lhs_field
->
field_name
,
rhs_item
,
"+"
,
&
item_constant
))
if
(
check_x_op_constant
(
lhs_field
->
field_name
,
rhs_item
,
"+"
,
&
item_constant
,
allow_insert_value
))
return
true
;
return
true
;
if
(
check_x_op_constant
(
lhs_field
->
field_name
,
rhs_item
,
"-"
,
&
item_constant
))
if
(
check_x_op_constant
(
lhs_field
->
field_name
,
rhs_item
,
"-"
,
&
item_constant
,
allow_insert_value
))
return
true
;
return
true
;
if
(
check_decr_floor_expression
(
lhs_field
,
rhs_item
))
if
(
check_decr_floor_expression
(
lhs_field
,
rhs_item
))
return
true
;
return
true
;
...
@@ -324,7 +339,7 @@ static bool check_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table
...
@@ -324,7 +339,7 @@ static bool check_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table
}
}
// Check that all update expressions are simple. Return true if they are.
// Check that all update expressions are simple. Return true if they are.
static
bool
check_all_update_expressions
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
TABLE
*
table
)
{
static
bool
check_all_update_expressions
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
TABLE
*
table
,
bool
allow_insert_value
)
{
List_iterator
<
Item
>
lhs_i
(
fields
);
List_iterator
<
Item
>
lhs_i
(
fields
);
List_iterator
<
Item
>
rhs_i
(
values
);
List_iterator
<
Item
>
rhs_i
(
values
);
while
(
1
)
{
while
(
1
)
{
...
@@ -332,9 +347,8 @@ static bool check_all_update_expressions(List<Item> &fields, List<Item> &values,
...
@@ -332,9 +347,8 @@ static bool check_all_update_expressions(List<Item> &fields, List<Item> &values,
if
(
lhs_item
==
NULL
)
if
(
lhs_item
==
NULL
)
break
;
break
;
Item
*
rhs_item
=
rhs_i
++
;
Item
*
rhs_item
=
rhs_i
++
;
if
(
rhs_item
==
NULL
)
assert
(
rhs_item
!=
NULL
);
assert
(
0
);
// can not happen
if
(
!
check_update_expression
(
lhs_item
,
rhs_item
,
table
,
allow_insert_value
))
if
(
!
check_update_expression
(
lhs_item
,
rhs_item
,
table
))
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
@@ -477,7 +491,7 @@ bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &valu
...
@@ -477,7 +491,7 @@ bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &valu
if
(
clustering_keys_exist
(
table
))
if
(
clustering_keys_exist
(
table
))
return
false
;
return
false
;
if
(
!
check_all_update_expressions
(
fields
,
values
,
table
))
if
(
!
check_all_update_expressions
(
fields
,
values
,
table
,
false
))
return
false
;
return
false
;
if
(
!
check_point_update
(
conds
,
table
))
if
(
!
check_point_update
(
conds
,
table
))
...
@@ -508,7 +522,17 @@ static void marshall_blobs_descriptor(tokudb::buffer &b, TABLE *table, KEY_AND_C
...
@@ -508,7 +522,17 @@ static void marshall_blobs_descriptor(tokudb::buffer &b, TABLE *table, KEY_AND_C
static
inline
uint32_t
get_null_bit_position
(
uint32_t
null_bit
);
static
inline
uint32_t
get_null_bit_position
(
uint32_t
null_bit
);
// Marshall update operatins to a buffer.
// evaluate the int value of an item
static
longlong
item_val_int
(
Item
*
item
)
{
Item
::
Type
t
=
item
->
type
();
if
(
t
==
Item
::
INSERT_VALUE_ITEM
)
{
Item_insert_value
*
value_item
=
static_cast
<
Item_insert_value
*>
(
item
);
return
value_item
->
arg
->
val_int
();
}
else
return
item
->
val_int
();
}
// Marshall update operations to a buffer.
static
void
marshall_update
(
tokudb
::
buffer
&
b
,
Item
*
lhs_item
,
Item
*
rhs_item
,
TABLE
*
table
,
TOKUDB_SHARE
*
share
)
{
static
void
marshall_update
(
tokudb
::
buffer
&
b
,
Item
*
lhs_item
,
Item
*
rhs_item
,
TABLE
*
table
,
TOKUDB_SHARE
*
share
)
{
// figure out the update operation type (again)
// figure out the update operation type (again)
Field
*
lhs_field
=
find_field_by_name
(
table
,
lhs_item
);
Field
*
lhs_field
=
find_field_by_name
(
table
,
lhs_item
);
...
@@ -549,14 +573,14 @@ static void marshall_update(tokudb::buffer &b, Item *lhs_item, Item *rhs_item, T
...
@@ -549,14 +573,14 @@ static void marshall_update(tokudb::buffer &b, Item *lhs_item, Item *rhs_item, T
Item_func
*
rhs_func
=
static_cast
<
Item_func
*>
(
rhs_item
);
Item_func
*
rhs_func
=
static_cast
<
Item_func
*>
(
rhs_item
);
Item
**
arguments
=
rhs_func
->
arguments
();
Item
**
arguments
=
rhs_func
->
arguments
();
if
(
strcmp
(
rhs_func
->
func_name
(),
"if"
)
==
0
)
{
if
(
strcmp
(
rhs_func
->
func_name
(),
"if"
)
==
0
)
{
update_operation
=
'-'
;
// we only support one if function for now, and it is a de
s
crement with floor.
update_operation
=
'-'
;
// we only support one if function for now, and it is a decrement with floor.
v_ll
=
1
;
v_ll
=
1
;
}
else
if
(
rhs_func
->
argument_count
()
==
1
)
{
}
else
if
(
rhs_func
->
argument_count
()
==
1
)
{
update_operation
=
'='
;
update_operation
=
'='
;
v_ll
=
rhs_func
->
val_int
();
v_ll
=
rhs_func
->
val_int
();
}
else
{
}
else
{
update_operation
=
rhs_func
->
func_name
()[
0
];
update_operation
=
rhs_func
->
func_name
()[
0
];
v_ll
=
arguments
[
1
]
->
val_int
(
);
v_ll
=
item_val_int
(
arguments
[
1
]
);
}
}
v_length
=
lhs_field
->
pack_length
();
v_length
=
lhs_field
->
pack_length
();
v_ptr
=
&
v_ll
;
v_ptr
=
&
v_ll
;
...
@@ -717,8 +741,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
...
@@ -717,8 +741,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
if
(
lhs_item
==
NULL
)
if
(
lhs_item
==
NULL
)
break
;
break
;
Item
*
rhs_item
=
rhs_i
++
;
Item
*
rhs_item
=
rhs_i
++
;
if
(
rhs_item
==
NULL
)
assert
(
rhs_item
!=
NULL
);
assert
(
0
);
// can not happen
marshall_update
(
update_message
,
lhs_item
,
rhs_item
,
table
,
share
);
marshall_update
(
update_message
,
lhs_item
,
rhs_item
,
table
,
share
);
}
}
...
@@ -746,7 +769,6 @@ int ha_tokudb::upsert(THD *thd, List<Item> &update_fields, List<Item> &update_va
...
@@ -746,7 +769,6 @@ int ha_tokudb::upsert(THD *thd, List<Item> &update_fields, List<Item> &update_va
TOKUDB_DBUG_ENTER
(
"ha_tokudb::upsert"
);
TOKUDB_DBUG_ENTER
(
"ha_tokudb::upsert"
);
int
error
=
0
;
int
error
=
0
;
unsigned
line
=
0
;
// debug
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
fprintf
(
stderr
,
"upsert
\n
"
);
fprintf
(
stderr
,
"upsert
\n
"
);
...
@@ -756,24 +778,20 @@ int ha_tokudb::upsert(THD *thd, List<Item> &update_fields, List<Item> &update_va
...
@@ -756,24 +778,20 @@ int ha_tokudb::upsert(THD *thd, List<Item> &update_fields, List<Item> &update_va
if
(
update_fields
.
elements
<
1
||
update_fields
.
elements
!=
update_values
.
elements
)
{
if
(
update_fields
.
elements
<
1
||
update_fields
.
elements
!=
update_values
.
elements
)
{
error
=
ENOTSUP
;
// not an upsert or something is fishy with the parameters
error
=
ENOTSUP
;
// not an upsert or something is fishy with the parameters
line
=
__LINE__
;
goto
return_error
;
goto
return_error
;
}
}
if
(
!
check_upsert
(
thd
,
update_fields
,
update_values
))
{
if
(
!
check_upsert
(
thd
,
update_fields
,
update_values
))
{
error
=
ENOTSUP
;
error
=
ENOTSUP
;
line
=
__LINE__
;
goto
check_error
;
goto
check_error
;
}
}
error
=
send_upsert_message
(
thd
,
update_fields
,
update_values
,
transaction
);
error
=
send_upsert_message
(
thd
,
update_fields
,
update_values
,
transaction
);
if
(
error
!=
0
)
{
if
(
error
!=
0
)
{
line
=
__LINE__
;
goto
check_error
;
goto
check_error
;
}
}
check_error:
check_error:
line
=
line
;
// debug
if
(
error
!=
0
)
{
if
(
error
!=
0
)
{
if
(
get_disable_slow_upsert
(
thd
))
if
(
get_disable_slow_upsert
(
thd
))
error
=
HA_ERR_UNSUPPORTED
;
error
=
HA_ERR_UNSUPPORTED
;
...
@@ -811,7 +829,7 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up
...
@@ -811,7 +829,7 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up
!
(
thd
->
variables
.
binlog_format
==
BINLOG_FORMAT_STMT
||
thd
->
variables
.
binlog_format
==
BINLOG_FORMAT_MIXED
))
!
(
thd
->
variables
.
binlog_format
==
BINLOG_FORMAT_STMT
||
thd
->
variables
.
binlog_format
==
BINLOG_FORMAT_MIXED
))
return
false
;
return
false
;
if
(
!
check_all_update_expressions
(
update_fields
,
update_values
,
table
))
if
(
!
check_all_update_expressions
(
update_fields
,
update_values
,
table
,
true
))
return
false
;
return
false
;
return
true
;
return
true
;
...
...
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