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
53370de1
Commit
53370de1
authored
Aug 04, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IB: partition-wise ha_innopart::rnd_init() [fixes #208]
parent
5ce6044b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
2 deletions
+44
-2
mysql-test/suite/versioning/r/partition.result
mysql-test/suite/versioning/r/partition.result
+10
-0
mysql-test/suite/versioning/t/partition.test
mysql-test/suite/versioning/t/partition.test
+10
-0
sql/partition_info.cc
sql/partition_info.cc
+1
-0
sql/partitioning/partition_handler.cc
sql/partitioning/partition_handler.cc
+1
-0
sql/partitioning/partition_handler.h
sql/partitioning/partition_handler.h
+7
-0
storage/innobase/handler/ha_innopart.h
storage/innobase/handler/ha_innopart.h
+15
-2
No files found.
mysql-test/suite/versioning/r/partition.result
View file @
53370de1
...
...
@@ -147,11 +147,21 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 VERSIONING ENGINE = ${INNODB_OR_MYISAM},
PARTITION p1 VERSIONING ENGINE = ${INNODB_OR_MYISAM},
PARTITION pn AS OF NOW ENGINE = ${INNODB_OR_MYISAM})
insert into t1 values (1), (2);
alter table t1 drop partition pn;
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERSIONING' and exactly one last 'AS OF NOW'
alter table t1 drop partition p1;
alter table t1 drop partition p0;
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERSIONING' and exactly one last 'AS OF NOW'
select x from t1;
x
1
2
create or replace table t1 (x int)
with system versioning
partition by system_time (
partition p0 versioning,
partition pn as of now);
set @now= now(6);
insert into t1 values (1);
set @ts_start= sys_commit_ts('sys_trx_start');
...
...
mysql-test/suite/versioning/t/partition.test
View file @
53370de1
...
...
@@ -79,13 +79,23 @@ alter table t1 add partition (
--
replace_result
InnoDB
$
{
INNODB_OR_MYISAM
}
MyISAM
$
{
INNODB_OR_MYISAM
}
"bigint(20) unsigned"
$
{
SYS_TRX_TYPE
}
timestamp
(
6
)
$
{
SYS_TRX_TYPE
}
show
create
table
t1
;
insert
into
t1
values
(
1
),
(
2
);
--
error
ER_VERS_WRONG_PARTS
alter
table
t1
drop
partition
pn
;
alter
table
t1
drop
partition
p1
;
--
error
ER_VERS_WRONG_PARTS
alter
table
t1
drop
partition
p0
;
select
x
from
t1
;
# insert, delete, update
create
or
replace
table
t1
(
x
int
)
with
system
versioning
partition
by
system_time
(
partition
p0
versioning
,
partition
pn
as
of
now
);
set
@
now
=
now
(
6
);
insert
into
t1
values
(
1
);
set
@
ts_start
=
sys_commit_ts
(
'sys_trx_start'
);
...
...
sql/partition_info.cc
View file @
53370de1
...
...
@@ -1024,6 +1024,7 @@ bool partition_info::vers_scan_min_max(THD *thd, partition_element *part)
for
(;
part_id
<
part_id_end
;
++
part_id
)
{
handler
*
file
=
table
->
file
->
part_handler
(
part_id
);
// requires update_partition() for ha_innopart
DBUG_ASSERT
(
file
);
int
rc
=
file
->
ha_external_lock
(
thd
,
F_RDLCK
);
// requires ha_commit_trans() for ha_innobase
if
(
rc
)
{
...
...
sql/partitioning/partition_handler.cc
View file @
53370de1
...
...
@@ -286,6 +286,7 @@ Partition_helper::Partition_helper(handler *main_handler)
m_part_info
(),
m_tot_parts
(),
m_last_part
(),
m_cur_part
(
NO_CURRENT_PART_ID
),
m_err_rec
(),
m_ordered
(),
m_ordered_scan_ongoing
(),
...
...
sql/partitioning/partition_handler.h
View file @
53370de1
...
...
@@ -1061,6 +1061,13 @@ class Partition_helper : public Sql_alloc
/** Total number of partitions. */
uint
m_tot_parts
;
uint
m_last_part
;
// Last accessed partition.
uint
m_cur_part
;
// Current partition
/* In fact m_cur_part duplicates m_part_spec, but is required due to different
rnd_init() semantics between ha_innopart and ha_partition.
ha_innopart::rnd_init() is table-wise (it has separate *_in_part() methods).
ha_partition::rnd_init() is partition-wise. m_cur_part is used to imitate
partition-wise rnd_init() and should not be merged with m_part_spec because of
different usage scenarios. */
const
uchar
*
m_err_rec
;
// record which gave error.
bool
m_auto_increment_safe_stmt_log_lock
;
bool
m_auto_increment_lock
;
...
...
storage/innobase/handler/ha_innopart.h
View file @
53370de1
...
...
@@ -755,6 +755,7 @@ class ha_innopart:
virtual
handler
*
part_handler
(
uint32
part_id
)
{
set_partition
(
part_id
);
m_cur_part
=
part_id
;
return
this
;
}
...
...
@@ -1095,12 +1096,21 @@ class ha_innopart:
rnd_init
(
bool
scan
)
{
return
(
Partition_helper
::
ph_rnd_init
(
scan
));
if
(
m_cur_part
!=
NO_CURRENT_PART_ID
)
{
m_scan_value
=
scan
;
m_part_spec
.
start_part
=
m_cur_part
;
m_part_spec
.
end_part
=
m_cur_part
;
return
rnd_init_in_part
(
m_cur_part
,
scan
);
}
else
return
(
Partition_helper
::
ph_rnd_init
(
scan
));
}
int
rnd_end
()
{
m_cur_part
=
NO_CURRENT_PART_ID
;
return
(
Partition_helper
::
ph_rnd_end
());
}
...
...
@@ -1411,7 +1421,10 @@ class ha_innopart:
rnd_next
(
uchar
*
record
)
{
return
(
Partition_helper
::
ph_rnd_next
(
record
));
if
(
m_cur_part
!=
NO_CURRENT_PART_ID
)
return
rnd_next_in_part
(
m_cur_part
,
record
);
else
return
(
Partition_helper
::
ph_rnd_next
(
record
));
}
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