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
2968543f
Commit
2968543f
authored
Dec 08, 2017
by
Eugene Kosov
Committed by
Aleksey Midenkov
Dec 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IB: NULL instead of autodecrement [closes #373]
parent
947aa0ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
76 deletions
+39
-76
mysql-test/suite/versioning/r/alter.result
mysql-test/suite/versioning/r/alter.result
+11
-45
mysql-test/suite/versioning/t/alter.test
mysql-test/suite/versioning/t/alter.test
+7
-22
sql/handler.cc
sql/handler.cc
+1
-1
storage/innobase/row/row0merge.cc
storage/innobase/row/row0merge.cc
+20
-8
No files found.
mysql-test/suite/versioning/r/alter.result
View file @
2968543f
...
@@ -405,32 +405,13 @@ call verify_vtq;
...
@@ -405,32 +405,13 @@ call verify_vtq;
No A B C D
No A B C D
1 1 1 1 1
1 1 1 1 1
2 1 1 1 1
2 1 1 1 1
alter table t add b int auto_increment unique;
call verify_vtq;
No A B C D
select * from t for system_time all;
a b
1 -1
2 -2
3 1
insert into t values (4, NULL);
select * from t for system_time all;
a b
1 -1
2 -2
3 1
4 2
call verify_vtq;
No A B C D
1 1 1 1 1
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);
delete from t where a<3;
alter table t add b int not null unique;
alter table t add b int not null unique;
ERROR 23000: Duplicate entry '...' for key 'b'
ERROR 23000: Duplicate entry '...' for key 'b'
alter table t add b int auto_increment unique;
alter table t add b int auto_increment unique;
ERROR 42000: Table '
#sql-temporary
' uses an extension that doesn't exist in this MariaDB version
ERROR 42000: Table '
test/t
' uses an extension that doesn't exist in this MariaDB version
alter table t add b int auto_increment null unique;
alter table t add b int auto_increment null unique;
call verify_vtq;
No A B C D
select * from t;
select * from t;
a b
a b
3 1
3 1
...
@@ -446,35 +427,20 @@ a b
...
@@ -446,35 +427,20 @@ a b
2 NULL
2 NULL
3 1
3 1
4 2
4 2
create or replace table t (a int) with system versioning engine=innodb;
insert into t values (1), (2), (3);
delete from t where a<3;
call verify_vtq;
No A B C D
1 1 1 1 1
2 1 1 1 1
alter table t add b tinyint auto_increment unique;
call verify_vtq;
No A B C D
select * from t for system_time all;
a b
1 -1
2 -2
3 1
insert into t values (4, NULL);
select * from t for system_time all;
a b
1 -1
2 -2
3 1
4 2
call verify_vtq;
call verify_vtq;
No A B C D
No A B C D
1 1 1 1 1
1 1 1 1 1
create or replace table t (a int) with system versioning;
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);
insert into t values (1), (2), (3);
delete from t where a<3;
delete from t where a<3;
alter table t add b tinyint auto_increment null unique;
alter table t add b int not null unique;
ERROR 23000: Duplicate entry '...' for key 'b'
alter table t add b int auto_increment unique;
ERROR 42000: Table '#sql-temporary' uses an extension that doesn't exist in this MariaDB version
alter table t add b int auto_increment null unique;
select * from t;
a b
3 1
select * from t for system_time all;
select * from t for system_time all;
a b
a b
1 NULL
1 NULL
...
...
mysql-test/suite/versioning/t/alter.test
View file @
2968543f
...
@@ -209,10 +209,16 @@ create or replace table t (a int) with system versioning engine=innodb;
...
@@ -209,10 +209,16 @@ create or replace table t (a int) with system versioning engine=innodb;
insert
into
t
values
(
1
),
(
2
),
(
3
);
insert
into
t
values
(
1
),
(
2
),
(
3
);
delete
from
t
where
a
<
3
;
delete
from
t
where
a
<
3
;
call
verify_vtq
;
call
verify_vtq
;
--
replace_regex
/
'0-[- 0-9.:]+'
/
'...'
/
--
error
ER_DUP_ENTRY
alter
table
t
add
b
int
not
null
unique
;
--
error
ER_UNSUPPORTED_EXTENSION
alter
table
t
add
b
int
auto_increment
unique
;
alter
table
t
add
b
int
auto_increment
unique
;
alter
table
t
add
b
int
auto_increment
null
unique
;
call
verify_vtq
;
call
verify_vtq
;
select
*
from
t
;
select
*
from
t
for
system_time
all
;
select
*
from
t
for
system_time
all
;
insert
into
t
values
(
4
,
NULL
);
insert
into
t
values
(
4
,
0
);
select
*
from
t
for
system_time
all
;
select
*
from
t
for
system_time
all
;
call
verify_vtq
;
call
verify_vtq
;
...
@@ -231,27 +237,6 @@ select * from t for system_time all;
...
@@ -231,27 +237,6 @@ select * from t for system_time all;
insert
into
t
values
(
4
,
0
);
insert
into
t
values
(
4
,
0
);
select
*
from
t
for
system_time
all
;
select
*
from
t
for
system_time
all
;
create
or
replace
table
t
(
a
int
)
with
system
versioning
engine
=
innodb
;
insert
into
t
values
(
1
),
(
2
),
(
3
);
delete
from
t
where
a
<
3
;
call
verify_vtq
;
alter
table
t
add
b
tinyint
auto_increment
unique
;
call
verify_vtq
;
select
*
from
t
for
system_time
all
;
insert
into
t
values
(
4
,
NULL
);
select
*
from
t
for
system_time
all
;
call
verify_vtq
;
create
or
replace
table
t
(
a
int
)
with
system
versioning
;
insert
into
t
values
(
1
),
(
2
),
(
3
);
delete
from
t
where
a
<
3
;
# kvm-deb-trusty-ppc64le fails with "Out of range value for column 'b' at row 3"
--
error
0
,
ER_WARN_DATA_OUT_OF_RANGE
alter
table
t
add
b
tinyint
auto_increment
null
unique
;
select
*
from
t
for
system_time
all
;
insert
into
t
values
(
4
,
0
);
select
*
from
t
for
system_time
all
;
create
or
replace
table
t
(
create
or
replace
table
t
(
a
int
,
a
int
,
sys_trx_start
bigint
(
20
)
unsigned
generated
always
as
row
start
,
sys_trx_start
bigint
(
20
)
unsigned
generated
always
as
row
start
,
...
...
sql/handler.cc
View file @
2968543f
...
@@ -3071,9 +3071,9 @@ int handler::update_auto_increment()
...
@@ -3071,9 +3071,9 @@ int handler::update_auto_increment()
table
->
next_number_field
->
set_null
();
table
->
next_number_field
->
set_null
();
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
}
table
->
next_number_field
->
set_notnull
();
table
->
next_number_field
->
set_notnull
();
}
}
}
/*
/*
next_insert_id is a "cursor" into the reserved interval, it may go greater
next_insert_id is a "cursor" into the reserved interval, it may go greater
...
...
storage/innobase/row/row0merge.cc
View file @
2968543f
...
@@ -1742,9 +1742,9 @@ row_merge_read_clustered_index(
...
@@ -1742,9 +1742,9 @@ row_merge_read_clustered_index(
double
curr_progress
=
0.0
;
double
curr_progress
=
0.0
;
ib_uint64_t
read_rows
=
0
;
ib_uint64_t
read_rows
=
0
;
ib_uint64_t
table_total_rows
=
0
;
ib_uint64_t
table_total_rows
=
0
;
ulonglong
historic_auto_decrement
=
0xffffffffffffffff
;
char
new_sys_trx_start
[
8
];
char
new_sys_trx_start
[
8
];
char
new_sys_trx_end
[
8
];
char
new_sys_trx_end
[
8
];
byte
any_autoinc_data
[
8
]
=
{
0
};
DBUG_ENTER
(
"row_merge_read_clustered_index"
);
DBUG_ENTER
(
"row_merge_read_clustered_index"
);
...
@@ -2253,9 +2253,26 @@ row_merge_read_clustered_index(
...
@@ -2253,9 +2253,26 @@ row_merge_read_clustered_index(
=
dfield
->
is_version_historical_end
();
=
dfield
->
is_version_historical_end
();
}
}
const
dfield_t
*
dfield
;
dfield_t
*
dfield
;
dfield
=
dtuple_get_nth_field
(
row
,
add_autoinc
);
dfield
=
dtuple_get_nth_field
(
row
,
add_autoinc
);
if
(
new_table
->
versioned
())
{
if
(
historical_row
)
{
if
(
dfield_get_type
(
dfield
)
->
prtype
&
DATA_NOT_NULL
)
{
err
=
DB_UNSUPPORTED
;
my_error
(
ER_UNSUPPORTED_EXTENSION
,
MYF
(
0
),
old_table
->
name
);
goto
func_exit
;
}
dfield_set_null
(
dfield
);
}
else
{
// set not null
ulint
len
=
dfield_get_type
(
dfield
)
->
len
;
dfield_set_data
(
dfield
,
any_autoinc_data
,
len
);
}
}
if
(
dfield_is_null
(
dfield
))
{
if
(
dfield_is_null
(
dfield
))
{
goto
write_buffers
;
goto
write_buffers
;
}
}
...
@@ -2273,12 +2290,7 @@ row_merge_read_clustered_index(
...
@@ -2273,12 +2290,7 @@ row_merge_read_clustered_index(
goto
func_exit
;
goto
func_exit
;
}
}
ulonglong
value
;
ulonglong
value
=
sequence
++
;
if
(
likely
(
!
historical_row
))
{
value
=
sequence
++
;
}
else
{
value
=
historic_auto_decrement
--
;
}
switch
(
dtype_get_mtype
(
dtype
))
{
switch
(
dtype_get_mtype
(
dtype
))
{
case
DATA_INT
:
{
case
DATA_INT
:
{
...
...
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