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
826f615f
Commit
826f615f
authored
Jan 11, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-14788 System versioning cannot be based on local timestamps, as it is now
followup to
be81b00c
Fix updates and deletes too
parent
6a8cf407
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
15 deletions
+27
-15
mysql-test/suite/versioning/r/insert.result
mysql-test/suite/versioning/r/insert.result
+6
-0
mysql-test/suite/versioning/r/update.result
mysql-test/suite/versioning/r/update.result
+2
-4
mysql-test/suite/versioning/t/insert.test
mysql-test/suite/versioning/t/insert.test
+4
-0
mysql-test/suite/versioning/t/update.test
mysql-test/suite/versioning/t/update.test
+2
-3
sql/sql_delete.cc
sql/sql_delete.cc
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+2
-7
sql/table.cc
sql/table.cc
+9
-0
sql/table.h
sql/table.h
+1
-0
No files found.
mysql-test/suite/versioning/r/insert.result
View file @
826f615f
...
...
@@ -353,6 +353,12 @@ a
select * from t1 for system_time as of sysdate(6);
a
1
update t1 set a=2;
delete from t1;
select *, row_start > @a, row_end > @a from t1 for system_time all;
a row_start > @a row_end > @a
1 0 1
2 1 1
#
# MDEV-14871 Server crashes in fill_record / fill_record_n_invoke_before_triggers upon inserting into versioned table with trigger
#
...
...
mysql-test/suite/versioning/r/update.result
View file @
826f615f
...
...
@@ -616,12 +616,10 @@ No A B C D
2 1 1 1 1
3 1 1 1 1
### Issue #365, bug 7 (duplicate of historical row)
set timestamp= 1000000019;
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
update t1 set b= 2;
insert into t1 (a) values (1) on duplicate key update a= 2;
ERROR 23000: Duplicate entry '1-2001-09-09 01:46:59.000000' for key 'PRIMARY'
replace t1 values (1,2),(1,3),(2,4);
ERROR 23000: Duplicate entry '1-YYYY-MM-DD hh:mm:ss.uuuuuu' for key 'PRIMARY'
drop database test;
create database test;
mysql-test/suite/versioning/t/insert.test
View file @
826f615f
...
...
@@ -251,6 +251,10 @@ set @a=sysdate(6);
select
*
from
t1
for
system_time
as
of
now
(
6
);
select
*
from
t1
for
system_time
as
of
sysdate
(
6
);
update
t1
set
a
=
2
;
delete
from
t1
;
--
sorted_result
select
*
,
row_start
>
@
a
,
row_end
>
@
a
from
t1
for
system_time
all
;
--
echo
#
--
echo
# MDEV-14871 Server crashes in fill_record / fill_record_n_invoke_before_triggers upon inserting into versioned table with trigger
...
...
mysql-test/suite/versioning/t/update.test
View file @
826f615f
...
...
@@ -277,13 +277,12 @@ call test_07('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_trx_end)');
call
verify_vtq
;
--
echo
### Issue #365, bug 7 (duplicate of historical row)
set
timestamp
=
1000000019
;
create
or
replace
table
t1
(
a
int
primary
key
,
b
int
)
with
system
versioning
engine
myisam
;
insert
into
t1
(
a
)
values
(
1
);
update
t1
set
b
=
2
;
--
replace_regex
/
'1-[- .\d:]+'
/
'1-YYYY-MM-DD hh:mm:ss.uuuuuu'
/
--
error
ER_DUP_ENTRY
insert
into
t1
(
a
)
values
(
1
)
on
duplicate
key
update
a
=
2
;
replace
t1
values
(
1
,
2
),(
1
,
3
),(
2
,
4
)
;
drop
database
test
;
create
database
test
;
sql/sql_delete.cc
View file @
826f615f
...
...
@@ -253,7 +253,7 @@ int TABLE::delete_row()
return
file
->
ha_delete_row
(
record
[
0
]);
store_record
(
this
,
record
[
1
]);
vers_
end_field
()
->
set_time
();
vers_
update_end
();
return
file
->
ha_update_row
(
record
[
1
],
record
[
0
]);
}
...
...
sql/sql_insert.cc
View file @
826f615f
...
...
@@ -1638,8 +1638,7 @@ int vers_insert_history_row(TABLE *table)
restore_record
(
table
,
record
[
1
]);
// Set Sys_end to now()
if
(
table
->
vers_end_field
()
->
set_time
())
DBUG_ASSERT
(
0
);
table
->
vers_update_end
();
return
table
->
file
->
ha_write_row
(
table
->
record
[
0
]);
}
...
...
@@ -1971,11 +1970,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
DBUG_ASSERT
(
table
->
insert_values
);
store_record
(
table
,
insert_values
);
restore_record
(
table
,
record
[
1
]);
if
(
table
->
vers_end_field
()
->
set_time
())
{
error
=
1
;
goto
err
;
}
table
->
vers_update_end
();
error
=
table
->
file
->
ha_update_row
(
table
->
record
[
1
],
table
->
record
[
0
]);
restore_record
(
table
,
insert_values
);
...
...
sql/table.cc
View file @
826f615f
...
...
@@ -7800,6 +7800,15 @@ void TABLE::vers_update_fields()
}
void
TABLE
::
vers_update_end
()
{
vers_end_field
()
->
set_notnull
();
if
(
vers_end_field
()
->
store_timestamp
(
in_use
->
system_time
,
in_use
->
system_time_sec_part
))
DBUG_ASSERT
(
0
);
}
bool
TABLE_LIST
::
vers_vtmd_name
(
String
&
out
)
const
{
static
const
char
*
vtmd_suffix
=
"_vtmd"
;
...
...
sql/table.h
View file @
826f615f
...
...
@@ -1588,6 +1588,7 @@ struct TABLE
int
delete_row
();
void
vers_update_fields
();
void
vers_update_end
();
/** Number of additional fields used in versioned tables */
#define VERSIONING_FIELDS 2
...
...
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