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
51e4650e
Commit
51e4650e
authored
Jan 02, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.5 into 10.0
parents
eef2bc5a
20fab71b
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
134 additions
and
23 deletions
+134
-23
mysql-test/include/truncate_file.inc
mysql-test/include/truncate_file.inc
+3
-8
mysql-test/r/ps.result
mysql-test/r/ps.result
+18
-0
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
+1
-1
mysql-test/t/ps.test
mysql-test/t/ps.test
+15
-0
sql/sql_class.cc
sql/sql_class.cc
+8
-1
sql/sql_derived.cc
sql/sql_derived.cc
+46
-5
sql/table.cc
sql/table.cc
+3
-0
sql/table.h
sql/table.h
+6
-0
storage/innobase/include/trx0rec.h
storage/innobase/include/trx0rec.h
+2
-1
storage/innobase/row/row0purge.cc
storage/innobase/row/row0purge.cc
+2
-2
storage/innobase/trx/trx0rec.cc
storage/innobase/trx/trx0rec.cc
+13
-1
storage/xtradb/include/trx0rec.h
storage/xtradb/include/trx0rec.h
+2
-1
storage/xtradb/row/row0purge.cc
storage/xtradb/row/row0purge.cc
+2
-2
storage/xtradb/trx/trx0rec.cc
storage/xtradb/trx/trx0rec.cc
+13
-1
No files found.
mysql-test/include/truncate_file.inc
View file @
51e4650e
# truncate a giving file, all contents of the file are be cleared
if
(
!
$
file
)
if
(
!
$
TRUNCATE_FILE
)
{
--
echo
Please
assign
a
file
name
to
$file
!!
exit
;
die
TRUNCATE_FILE
is
not
set
;
}
let
TRUNCATE_FILE
=
$file
;
perl
;
use
Env
;
Env
::
import
(
'TRUNCATE_FILE'
);
open
FILE
,
'>'
,
$TRUNCATE_FILE
||
die
"Can not open file
$file
"
;
open
FILE
,
'>'
,
$ENV
{
TRUNCATE_FILE
}
or
die
"open(>
$ENV
{
TRUNCATE_FILE
}
): $!"
;
close
FILE
;
EOF
mysql-test/r/ps.result
View file @
51e4650e
...
...
@@ -4322,4 +4322,22 @@ set join_cache_level=@join_cache_level_save;
deallocate prepare stmt;
drop view v1,v2,v3;
drop table t1,t2,t3;
#
# MDEV-10657: incorrect result returned with binary protocol
# (prepared statements)
#
create table t1 (code varchar(10) primary key);
INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3');
SELECT X.*
FROM
(SELECT CODE, RN
FROM
(SELECT A.CODE, @cnt := @cnt + 1 AS RN
FROM t1 A, (SELECT @cnt := 0) C) T
) X;
CODE RN
LINE1 1
LINE2 2
LINE3 3
drop table t1;
# End of 5.5 tests
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
View file @
51e4650e
...
...
@@ -25,7 +25,7 @@ sync_slave_with_master;
connection
master
;
# Delete './master-bin.000001' from index file.
let
$MYSQLD_DATADIR
=
`SELECT @@DATADIR`
;
let
$file
=
$MYSQLD_DATADIR
/
master
-
bin
.
index
;
let
TRUNCATE_FILE
=
$MYSQLD_DATADIR
/
master
-
bin
.
index
;
source
include
/
truncate_file
.
inc
;
if
(
`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`
)
...
...
mysql-test/t/ps.test
View file @
51e4650e
...
...
@@ -3843,4 +3843,19 @@ deallocate prepare stmt;
drop
view
v1
,
v2
,
v3
;
drop
table
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-10657: incorrect result returned with binary protocol
--
echo
# (prepared statements)
--
echo
#
create
table
t1
(
code
varchar
(
10
)
primary
key
);
INSERT
INTO
t1
(
code
)
VALUES
(
'LINE1'
),
(
'LINE2'
),
(
'LINE3'
);
SELECT
X
.*
FROM
(
SELECT
CODE
,
RN
FROM
(
SELECT
A
.
CODE
,
@
cnt
:=
@
cnt
+
1
AS
RN
FROM
t1
A
,
(
SELECT
@
cnt
:=
0
)
C
)
T
)
X
;
drop
table
t1
;
--
echo
# End of 5.5 tests
sql/sql_class.cc
View file @
51e4650e
...
...
@@ -2394,6 +2394,8 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
MEM_ROOT
*
runtime_memroot
)
{
Item_change_record
*
change
;
DBUG_ENTER
(
"THD::nocheck_register_item_tree_change"
);
DBUG_PRINT
(
"enter"
,
(
"Register %p <- %p"
,
old_value
,
(
*
place
)));
/*
Now we use one node per change, which adds some memory overhead,
but still is rather fast as we use alloc_root for allocations.
...
...
@@ -2406,12 +2408,13 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
OOM, thd->fatal_error() is called by the error handler of the
memroot. Just return.
*/
return
;
DBUG_VOID_RETURN
;
}
change
=
new
(
change_mem
)
Item_change_record
;
change
->
place
=
place
;
change
->
old_value
=
old_value
;
change_list
.
append
(
change
);
DBUG_VOID_RETURN
;
}
/**
...
...
@@ -2452,7 +2455,11 @@ void THD::rollback_item_tree_changes()
DBUG_ENTER
(
"rollback_item_tree_changes"
);
while
((
change
=
it
++
))
{
DBUG_PRINT
(
"info"
,
(
"revert %p -> %p"
,
change
->
old_value
,
(
*
change
->
place
)));
*
change
->
place
=
change
->
old_value
;
}
/* We can forget about changes memory: it's allocated in runtime memroot */
change_list
.
empty
();
DBUG_VOID_RETURN
;
...
...
sql/sql_derived.cc
View file @
51e4650e
...
...
@@ -362,6 +362,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX
*
parent_lex
=
derived
->
select_lex
;
Query_arena
*
arena
,
backup
;
DBUG_ENTER
(
"mysql_derived_merge"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
if
(
derived
->
merged
)
DBUG_RETURN
(
FALSE
);
...
...
@@ -510,7 +513,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
bool
mysql_derived_merge_for_insert
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
*
derived
)
{
DBUG_ENTER
(
"mysql_derived_merge_for_insert"
);
DBUG_PRINT
(
"enter"
,
(
"derived: %p"
,
derived
));
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
DBUG_PRINT
(
"info"
,
(
"merged_for_insert: %d is_materialized_derived: %d "
"is_multitable: %d single_table_updatable: %d "
"merge_underlying_list: %d"
,
...
...
@@ -566,7 +571,9 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived)
{
SELECT_LEX_UNIT
*
unit
=
derived
->
get_unit
();
DBUG_ENTER
(
"mysql_derived_init"
);
DBUG_PRINT
(
"enter"
,
(
"derived: %p"
,
derived
));
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
// Skip already prepared views/DT
if
(
!
unit
||
unit
->
prepared
)
...
...
@@ -637,8 +644,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX_UNIT
*
unit
=
derived
->
get_unit
();
DBUG_ENTER
(
"mysql_derived_prepare"
);
bool
res
=
FALSE
;
DBUG_PRINT
(
"enter"
,
(
"unit: %p table_list: %p Alias '%s'"
,
unit
,
derived
,
derived
->
alias
));
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
unit
));
// Skip already prepared views/DT
if
(
!
unit
||
unit
->
prepared
||
...
...
@@ -796,6 +804,9 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
bool
res
=
FALSE
;
DBUG_ENTER
(
"mysql_derived_optimize"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
if
(
unit
->
optimized
)
DBUG_RETURN
(
FALSE
);
...
...
@@ -861,6 +872,9 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
bool
mysql_derived_create
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
*
derived
)
{
DBUG_ENTER
(
"mysql_derived_create"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
TABLE
*
table
=
derived
->
table
;
SELECT_LEX_UNIT
*
unit
=
derived
->
get_unit
();
...
...
@@ -910,9 +924,13 @@ bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived)
bool
mysql_derived_fill
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
*
derived
)
{
DBUG_ENTER
(
"mysql_derived_fill"
)
;
Field_iterator_table
field_iterator
;
SELECT_LEX_UNIT
*
unit
=
derived
->
get_unit
();
bool
res
=
FALSE
;
DBUG_ENTER
(
"mysql_derived_fill"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
if
(
unit
->
executed
&&
!
unit
->
uncacheable
&&
!
unit
->
describe
)
DBUG_RETURN
(
FALSE
);
...
...
@@ -952,7 +970,27 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
if
(
derived_result
->
flush
())
res
=
TRUE
;
unit
->
executed
=
TRUE
;
if
(
derived
->
field_translation
)
{
/* reset translation table to materialized table */
field_iterator
.
set_table
(
derived
->
table
);
for
(
uint
i
=
0
;
!
field_iterator
.
end_of_fields
();
field_iterator
.
next
(),
i
=
i
+
1
)
{
Item
*
item
;
if
(
!
(
item
=
field_iterator
.
create_item
(
thd
)))
{
res
=
TRUE
;
break
;
}
thd
->
change_item_tree
(
&
derived
->
field_translation
[
i
].
item
,
item
);
}
}
}
if
(
res
||
!
lex
->
describe
)
unit
->
cleanup
();
lex
->
current_select
=
save_current_select
;
...
...
@@ -981,6 +1019,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
bool
mysql_derived_reinit
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
*
derived
)
{
DBUG_ENTER
(
"mysql_derived_reinit"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
derived
->
alias
?
derived
->
alias
:
"<NULL>"
),
derived
->
get_unit
()));
st_select_lex_unit
*
unit
=
derived
->
get_unit
();
derived
->
merged_for_insert
=
FALSE
;
...
...
sql/table.cc
View file @
51e4650e
...
...
@@ -4173,6 +4173,9 @@ bool TABLE_LIST::create_field_translation(THD *thd)
Query_arena
*
arena
,
backup
;
bool
res
=
FALSE
;
DBUG_ENTER
(
"TABLE_LIST::create_field_translation"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
alias
?
alias
:
"<NULL>"
),
get_unit
()));
if
(
thd
->
stmt_arena
->
is_conventional
()
||
thd
->
stmt_arena
->
is_stmt_prepare_or_first_sp_execute
())
...
...
sql/table.h
View file @
51e4650e
...
...
@@ -2206,6 +2206,9 @@ struct TABLE_LIST
inline
void
set_merged_derived
()
{
DBUG_ENTER
(
"set_merged_derived"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
alias
?
alias
:
"<NULL>"
),
get_unit
()));
derived_type
=
((
derived_type
&
DTYPE_MASK
)
|
DTYPE_TABLE
|
DTYPE_MERGE
);
set_check_merged
();
...
...
@@ -2218,6 +2221,9 @@ struct TABLE_LIST
void
set_materialized_derived
()
{
DBUG_ENTER
(
"set_materialized_derived"
);
DBUG_PRINT
(
"enter"
,
(
"Alias: '%s' Unit: %p"
,
(
alias
?
alias
:
"<NULL>"
),
get_unit
()));
derived_type
=
((
derived_type
&
(
derived
?
DTYPE_MASK
:
DTYPE_VIEW
))
|
DTYPE_TABLE
|
DTYPE_MATERIALIZE
);
set_check_materialized
();
...
...
storage/innobase/include/trx0rec.h
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -196,6 +196,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t
*
index
,
/*!< in: clustered index */
const
upd_t
*
update
,
/*!< in: updated columns */
dtuple_t
**
row
,
/*!< out, own: partial row */
ibool
ignore_prefix
,
/*!< in: flag to indicate if we
expect blob prefixes in undo. Used
...
...
storage/innobase/row/row0purge.cc
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -823,7 +823,7 @@ row_purge_parse_undo_rec(
if
(
!
(
node
->
cmpl_info
&
UPD_NODE_NO_ORD_CHANGE
))
{
ptr
=
trx_undo_rec_get_partial_row
(
ptr
,
clust_index
,
&
node
->
row
,
ptr
,
clust_index
,
node
->
update
,
&
node
->
row
,
type
==
TRX_UNDO_UPD_DEL_REC
,
node
->
heap
);
}
...
...
storage/innobase/trx/trx0rec.cc
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -1075,6 +1075,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t
*
index
,
/*!< in: clustered index */
const
upd_t
*
update
,
/*!< in: updated columns */
dtuple_t
**
row
,
/*!< out, own: partial row */
ibool
ignore_prefix
,
/*!< in: flag to indicate if we
expect blob prefixes in undo. Used
...
...
@@ -1102,6 +1103,13 @@ trx_undo_rec_get_partial_row(
->
mtype
=
DATA_MISSING
;
}
for
(
const
upd_field_t
*
uf
=
update
->
fields
,
*
const
ue
=
update
->
fields
+
update
->
n_fields
;
uf
!=
ue
;
uf
++
)
{
ulint
c
=
dict_index_get_nth_col
(
index
,
uf
->
field_no
)
->
ind
;
*
dtuple_get_nth_field
(
*
row
,
c
)
=
uf
->
new_val
;
}
end_ptr
=
ptr
+
mach_read_from_2
(
ptr
);
ptr
+=
2
;
...
...
@@ -1122,6 +1130,10 @@ trx_undo_rec_get_partial_row(
ptr
=
trx_undo_rec_get_col_val
(
ptr
,
&
field
,
&
len
,
&
orig_len
);
dfield
=
dtuple_get_nth_field
(
*
row
,
col_no
);
ut_ad
(
dfield
->
type
.
mtype
==
DATA_MISSING
||
dict_col_type_assert_equal
(
col
,
&
dfield
->
type
));
ut_ad
(
dfield
->
type
.
mtype
==
DATA_MISSING
||
dfield
->
len
==
len
);
dict_col_copy_type
(
dict_table_get_nth_col
(
index
->
table
,
col_no
),
dfield_get_type
(
dfield
));
...
...
storage/xtradb/include/trx0rec.h
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -196,6 +196,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t
*
index
,
/*!< in: clustered index */
const
upd_t
*
update
,
/*!< in: updated columns */
dtuple_t
**
row
,
/*!< out, own: partial row */
ibool
ignore_prefix
,
/*!< in: flag to indicate if we
expect blob prefixes in undo. Used
...
...
storage/xtradb/row/row0purge.cc
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -823,7 +823,7 @@ row_purge_parse_undo_rec(
if
(
!
(
node
->
cmpl_info
&
UPD_NODE_NO_ORD_CHANGE
))
{
ptr
=
trx_undo_rec_get_partial_row
(
ptr
,
clust_index
,
&
node
->
row
,
ptr
,
clust_index
,
node
->
update
,
&
node
->
row
,
type
==
TRX_UNDO_UPD_DEL_REC
,
node
->
heap
);
}
...
...
storage/xtradb/trx/trx0rec.cc
View file @
51e4650e
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -1076,6 +1076,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t
*
index
,
/*!< in: clustered index */
const
upd_t
*
update
,
/*!< in: updated columns */
dtuple_t
**
row
,
/*!< out, own: partial row */
ibool
ignore_prefix
,
/*!< in: flag to indicate if we
expect blob prefixes in undo. Used
...
...
@@ -1103,6 +1104,13 @@ trx_undo_rec_get_partial_row(
->
mtype
=
DATA_MISSING
;
}
for
(
const
upd_field_t
*
uf
=
update
->
fields
,
*
const
ue
=
update
->
fields
+
update
->
n_fields
;
uf
!=
ue
;
uf
++
)
{
ulint
c
=
dict_index_get_nth_col
(
index
,
uf
->
field_no
)
->
ind
;
*
dtuple_get_nth_field
(
*
row
,
c
)
=
uf
->
new_val
;
}
end_ptr
=
ptr
+
mach_read_from_2
(
ptr
);
ptr
+=
2
;
...
...
@@ -1123,6 +1131,10 @@ trx_undo_rec_get_partial_row(
ptr
=
trx_undo_rec_get_col_val
(
ptr
,
&
field
,
&
len
,
&
orig_len
);
dfield
=
dtuple_get_nth_field
(
*
row
,
col_no
);
ut_ad
(
dfield
->
type
.
mtype
==
DATA_MISSING
||
dict_col_type_assert_equal
(
col
,
&
dfield
->
type
));
ut_ad
(
dfield
->
type
.
mtype
==
DATA_MISSING
||
dfield
->
len
==
len
);
dict_col_copy_type
(
dict_table_get_nth_col
(
index
->
table
,
col_no
),
dfield_get_type
(
dfield
));
...
...
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