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
4c7a7439
Commit
4c7a7439
authored
Jul 26, 2019
by
Eugene Kosov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
de9e3930
29df1003
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
65 additions
and
41 deletions
+65
-41
mysql-test/suite/versioning/r/truncate.result
mysql-test/suite/versioning/r/truncate.result
+12
-0
mysql-test/suite/versioning/t/truncate.test
mysql-test/suite/versioning/t/truncate.test
+14
-0
mysys/thr_mutex.c
mysys/thr_mutex.c
+2
-2
plugin/server_audit/server_audit.c
plugin/server_audit/server_audit.c
+3
-3
plugin/server_audit/test_audit_v4.c
plugin/server_audit/test_audit_v4.c
+2
-2
sql/sql_delete.cc
sql/sql_delete.cc
+10
-7
storage/innobase/btr/btr0cur.cc
storage/innobase/btr/btr0cur.cc
+1
-1
storage/innobase/include/btr0cur.h
storage/innobase/include/btr0cur.h
+1
-1
storage/innobase/include/row0upd.h
storage/innobase/include/row0upd.h
+18
-8
storage/innobase/row/row0upd.cc
storage/innobase/row/row0upd.cc
+2
-17
No files found.
mysql-test/suite/versioning/r/truncate.result
View file @
4c7a7439
...
@@ -130,5 +130,17 @@ truncate t1;
...
@@ -130,5 +130,17 @@ truncate t1;
truncate t2;
truncate t2;
ERROR HY000: System-versioned tables do not support TRUNCATE TABLE
ERROR HY000: System-versioned tables do not support TRUNCATE TABLE
unlock tables;
unlock tables;
#
# MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
#
create or replace table t1 (
f varchar(1),
row_start SYS_TYPE as row start,
row_end SYS_TYPE as row end,
period for system_time (row_start, row_end))
with system versioning;
insert into t1 (f) values ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h');
delete from t1;
delete history from t1;
drop database test;
drop database test;
create database test;
create database test;
mysql-test/suite/versioning/t/truncate.test
View file @
4c7a7439
...
@@ -145,5 +145,19 @@ truncate t2;
...
@@ -145,5 +145,19 @@ truncate t2;
unlock
tables
;
unlock
tables
;
--
echo
#
--
echo
# MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
--
echo
#
--
replace_result
$sys_datatype_expl
SYS_TYPE
eval
create
or
replace
table
t1
(
f
varchar
(
1
),
row_start
$sys_datatype_expl
as
row
start
,
row_end
$sys_datatype_expl
as
row
end
,
period
for
system_time
(
row_start
,
row_end
))
with
system
versioning
;
insert
into
t1
(
f
)
values
(
'a'
),
(
'b'
),
(
'c'
),
(
'd'
),
(
'e'
),
(
'f'
),
(
'g'
),
(
'h'
);
delete
from
t1
;
delete
history
from
t1
;
drop
database
test
;
drop
database
test
;
create
database
test
;
create
database
test
;
mysys/thr_mutex.c
View file @
4c7a7439
...
@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
...
@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int
error
;
int
error
;
DBUG_PRINT
(
"mutex"
,
(
"%s (0x%lx) locking"
,
mp
->
name
?
mp
->
name
:
"Null"
,
DBUG_PRINT
(
"mutex"
,
(
"%s (0x%lx) locking"
,
mp
->
name
?
mp
->
name
:
"Null"
,
(
ulong
)
mp
));
(
ulong
)
mp
));
pthread_mutex_lock
(
&
mp
->
global
);
if
(
!
mp
->
file
)
if
(
!
mp
->
file
)
{
{
fprintf
(
stderr
,
fprintf
(
stderr
,
...
@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
...
@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
fflush
(
stderr
);
fflush
(
stderr
);
abort
();
abort
();
}
}
pthread_mutex_lock
(
&
mp
->
global
);
if
(
mp
->
count
>
0
)
if
(
mp
->
count
>
0
)
{
{
/*
/*
...
...
plugin/server_audit/server_audit.c
View file @
4c7a7439
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#define PLUGIN_VERSION 0x104
#define PLUGIN_VERSION 0x104
#define PLUGIN_STR_VERSION "1.4.
7
"
#define PLUGIN_STR_VERSION "1.4.
8
"
#define _my_thread_var loc_thread_var
#define _my_thread_var loc_thread_var
...
@@ -2261,7 +2261,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
...
@@ -2261,7 +2261,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
}
}
int
get_db_mysql57
(
MYSQL_THD
thd
,
char
**
name
,
in
t
*
len
)
int
get_db_mysql57
(
MYSQL_THD
thd
,
char
**
name
,
size_
t
*
len
)
{
{
int
db_off
;
int
db_off
;
int
db_len_off
;
int
db_len_off
;
...
@@ -2288,7 +2288,7 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
...
@@ -2288,7 +2288,7 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
#ifdef __linux__
#ifdef __linux__
*
name
=
*
(
char
**
)
(((
char
*
)
thd
)
+
db_off
);
*
name
=
*
(
char
**
)
(((
char
*
)
thd
)
+
db_off
);
*
len
=
*
((
in
t
*
)
(((
char
*
)
thd
)
+
db_len_off
));
*
len
=
*
((
size_
t
*
)
(((
char
*
)
thd
)
+
db_len_off
));
if
(
*
name
&&
(
*
name
)[
*
len
]
!=
0
)
if
(
*
name
&&
(
*
name
)[
*
len
]
!=
0
)
return
1
;
return
1
;
return
0
;
return
0
;
...
...
plugin/server_audit/test_audit_v4.c
View file @
4c7a7439
...
@@ -16,7 +16,7 @@ enum enum_server_command{ SERVCOM_A, SERVCOM_B };
...
@@ -16,7 +16,7 @@ enum enum_server_command{ SERVCOM_A, SERVCOM_B };
#include "plugin_audit_v4.h"
#include "plugin_audit_v4.h"
extern
void
auditing
(
MYSQL_THD
thd
,
unsigned
int
event_class
,
const
void
*
ev
);
extern
void
auditing
(
MYSQL_THD
thd
,
unsigned
int
event_class
,
const
void
*
ev
);
extern
int
get_db_mysql57
(
MYSQL_THD
thd
,
char
**
name
,
in
t
*
len
);
extern
int
get_db_mysql57
(
MYSQL_THD
thd
,
char
**
name
,
size_
t
*
len
);
struct
mysql_event_general_302
struct
mysql_event_general_302
...
@@ -35,7 +35,7 @@ struct mysql_event_general_302
...
@@ -35,7 +35,7 @@ struct mysql_event_general_302
unsigned
long
long
general_rows
;
unsigned
long
long
general_rows
;
unsigned
long
long
query_id
;
unsigned
long
long
query_id
;
char
*
database
;
char
*
database
;
in
t
database_length
;
size_
t
database_length
;
};
};
...
...
sql/sql_delete.cc
View file @
4c7a7439
...
@@ -351,8 +351,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -351,8 +351,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
THD_STAGE_INFO
(
thd
,
stage_init_update
);
THD_STAGE_INFO
(
thd
,
stage_init_update
);
bool
trunca
te_history
=
table_list
->
vers_conditions
.
is_set
();
bool
dele
te_history
=
table_list
->
vers_conditions
.
is_set
();
if
(
trunca
te_history
)
if
(
dele
te_history
)
{
{
DBUG_ASSERT
(
!
table_list
->
period_conditions
.
is_set
());
DBUG_ASSERT
(
!
table_list
->
period_conditions
.
is_set
());
...
@@ -401,7 +401,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -401,7 +401,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
select_lex
->
item_list
,
&
conds
,
select_lex
->
item_list
,
&
conds
,
&
delete_while_scanning
))
&
delete_while_scanning
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
if
(
delete_history
)
table
->
vers_write
=
false
;
if
(
with_select
)
if
(
with_select
)
(
void
)
result
->
prepare
(
select_lex
->
item_list
,
NULL
);
(
void
)
result
->
prepare
(
select_lex
->
item_list
,
NULL
);
...
@@ -752,7 +755,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -752,7 +755,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
while
(
!
(
error
=
info
.
read_record
())
&&
!
thd
->
killed
&&
while
(
!
(
error
=
info
.
read_record
())
&&
!
thd
->
killed
&&
!
thd
->
is_error
())
!
thd
->
is_error
())
{
{
if
(
record_should_be_deleted
(
thd
,
table
,
select
,
explain
,
trunca
te_history
))
if
(
record_should_be_deleted
(
thd
,
table
,
select
,
explain
,
dele
te_history
))
{
{
table
->
file
->
position
(
table
->
record
[
0
]);
table
->
file
->
position
(
table
->
record
[
0
]);
if
(
unlikely
((
error
=
if
(
unlikely
((
error
=
...
@@ -801,10 +804,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -801,10 +804,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
{
if
(
delete_while_scanning
)
if
(
delete_while_scanning
)
delete_record
=
record_should_be_deleted
(
thd
,
table
,
select
,
explain
,
delete_record
=
record_should_be_deleted
(
thd
,
table
,
select
,
explain
,
trunca
te_history
);
dele
te_history
);
if
(
delete_record
)
if
(
delete_record
)
{
{
if
(
!
trunca
te_history
&&
table
->
triggers
&&
if
(
!
dele
te_history
&&
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_DELETE
,
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_DELETE
,
TRG_ACTION_BEFORE
,
FALSE
))
TRG_ACTION_BEFORE
,
FALSE
))
{
{
...
@@ -840,7 +843,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -840,7 +843,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if
(
likely
(
!
error
))
if
(
likely
(
!
error
))
{
{
deleted
++
;
deleted
++
;
if
(
!
trunca
te_history
&&
table
->
triggers
&&
if
(
!
dele
te_history
&&
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_DELETE
,
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_DELETE
,
TRG_ACTION_AFTER
,
FALSE
))
TRG_ACTION_AFTER
,
FALSE
))
{
{
...
...
storage/innobase/btr/btr0cur.cc
View file @
4c7a7439
...
@@ -98,7 +98,7 @@ throughput clearly from about 100000. */
...
@@ -98,7 +98,7 @@ throughput clearly from about 100000. */
#define BTR_CUR_FINE_HISTORY_LENGTH 100000
#define BTR_CUR_FINE_HISTORY_LENGTH 100000
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
ulint
btr_cur_n_non_sea
;
Atomic_counter
<
ulint
>
btr_cur_n_non_sea
;
/** Old value of btr_cur_n_non_sea. Copied by
/** Old value of btr_cur_n_non_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
srv_printf_innodb_monitor(). */
...
...
storage/innobase/include/btr0cur.h
View file @
4c7a7439
...
@@ -1034,7 +1034,7 @@ inherited external field. */
...
@@ -1034,7 +1034,7 @@ inherited external field. */
#define BTR_EXTERN_INHERITED_FLAG 64U
#define BTR_EXTERN_INHERITED_FLAG 64U
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
extern
ulint
btr_cur_n_non_sea
;
extern
Atomic_counter
<
ulint
>
btr_cur_n_non_sea
;
/** Old value of btr_cur_n_non_sea. Copied by
/** Old value of btr_cur_n_non_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
srv_printf_innodb_monitor(). */
...
...
storage/innobase/include/row0upd.h
View file @
4c7a7439
...
@@ -571,14 +571,6 @@ struct upd_node_t{
...
@@ -571,14 +571,6 @@ struct upd_node_t{
/* column assignment list */
/* column assignment list */
ulint
magic_n
;
ulint
magic_n
;
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
@param[in] trx transaction */
void
make_versioned_update
(
const
trx_t
*
trx
);
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
Do not touch other fields at all.
@param[in] trx transaction */
void
make_versioned_delete
(
const
trx_t
*
trx
);
private:
private:
/** Appends row_start or row_end field to update vector and sets a
/** Appends row_start or row_end field to update vector and sets a
CURRENT_TIMESTAMP/trx->id value to it.
CURRENT_TIMESTAMP/trx->id value to it.
...
@@ -587,6 +579,24 @@ struct upd_node_t{
...
@@ -587,6 +579,24 @@ struct upd_node_t{
@param[in] trx transaction
@param[in] trx transaction
@param[in] vers_sys_idx table->row_start or table->row_end */
@param[in] vers_sys_idx table->row_start or table->row_end */
void
make_versioned_helper
(
const
trx_t
*
trx
,
ulint
idx
);
void
make_versioned_helper
(
const
trx_t
*
trx
,
ulint
idx
);
public:
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
@param[in] trx transaction */
void
make_versioned_update
(
const
trx_t
*
trx
)
{
make_versioned_helper
(
trx
,
table
->
vers_start
);
}
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
Do not touch other fields at all.
@param[in] trx transaction */
void
make_versioned_delete
(
const
trx_t
*
trx
)
{
update
->
n_fields
=
0
;
is_delete
=
VERSIONED_DELETE
;
make_versioned_helper
(
trx
,
table
->
vers_end
);
}
};
};
#define UPD_NODE_MAGIC_N 1579975
#define UPD_NODE_MAGIC_N 1579975
...
...
storage/innobase/row/row0upd.cc
View file @
4c7a7439
...
@@ -3476,7 +3476,8 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
...
@@ -3476,7 +3476,8 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dict_index_t
*
clust_index
=
dict_table_get_first_index
(
table
);
dict_index_t
*
clust_index
=
dict_table_get_first_index
(
table
);
/* row_create_update_node_for_mysql() pre-allocated this much */
/* row_create_update_node_for_mysql() pre-allocated this much.
At least one PK column always remains unchanged. */
ut_ad
(
update
->
n_fields
<
ulint
(
table
->
n_cols
+
table
->
n_v_cols
));
ut_ad
(
update
->
n_fields
<
ulint
(
table
->
n_cols
+
table
->
n_v_cols
));
update
->
n_fields
++
;
update
->
n_fields
++
;
...
@@ -3496,19 +3497,3 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
...
@@ -3496,19 +3497,3 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dfield_set_data
(
&
ufield
->
new_val
,
update
->
vers_sys_value
,
col
->
len
);
dfield_set_data
(
&
ufield
->
new_val
,
update
->
vers_sys_value
,
col
->
len
);
}
}
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
@param[in] trx transaction */
void
upd_node_t
::
make_versioned_update
(
const
trx_t
*
trx
)
{
make_versioned_helper
(
trx
,
table
->
vers_start
);
}
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
Do not touch other fields at all.
@param[in] trx transaction */
void
upd_node_t
::
make_versioned_delete
(
const
trx_t
*
trx
)
{
update
->
n_fields
=
0
;
is_delete
=
VERSIONED_DELETE
;
make_versioned_helper
(
trx
,
table
->
vers_end
);
}
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