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
4d026889
Commit
4d026889
authored
Oct 07, 2008
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
1ad9d235
4be617cb
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
321 additions
and
127 deletions
+321
-127
mysql-test/r/partition.result
mysql-test/r/partition.result
+70
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+49
-0
sql/ha_partition.cc
sql/ha_partition.cc
+33
-0
sql/opt_range.cc
sql/opt_range.cc
+5
-3
sql/partition_info.h
sql/partition_info.h
+3
-2
sql/sql_partition.cc
sql/sql_partition.cc
+161
-122
No files found.
mysql-test/r/partition.result
View file @
4d026889
...
@@ -1637,4 +1637,74 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
...
@@ -1637,4 +1637,74 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
count(*)
count(*)
1
1
drop table t1, t2;
drop table t1, t2;
create table t1 (s1 int) partition by hash(s1) partitions 2;
create index i on t1 (s1);
insert into t1 values (1);
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1 order by s1 desc;
select * from t1;
s1
1
1
1
1
1
1
1
1
drop table t1;
create table t1 (s1 int) partition by range(s1)
(partition pa1 values less than (10),
partition pa2 values less than MAXVALUE);
create index i on t1 (s1);
insert into t1 values (1);
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1 order by s1 desc;
select * from t1;
s1
1
1
1
1
1
1
1
1
drop table t1;
create table t1 (s1 int) partition by range(s1)
(partition pa1 values less than (10),
partition pa2 values less than MAXVALUE);
create index i on t1 (s1);
insert into t1 values (20);
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1 order by s1 desc;
select * from t1;
s1
20
20
20
20
20
20
20
20
drop table t1;
create table t1 (s1 int) partition by range(s1)
(partition pa1 values less than (10),
partition pa2 values less than MAXVALUE);
create index i on t1 (s1);
insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8);
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1;
insert into t1 select s1 from t1 order by s1 desc;
insert into t1 select s1 from t1 where s1=3;
select count(*) from t1;
count(*)
288
drop table t1;
End of 5.1 tests
End of 5.1 tests
mysql-test/t/partition.test
View file @
4d026889
...
@@ -1791,4 +1791,53 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
...
@@ -1791,4 +1791,53 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug #38005 Partitions: error with insert select
#
create
table
t1
(
s1
int
)
partition
by
hash
(
s1
)
partitions
2
;
create
index
i
on
t1
(
s1
);
insert
into
t1
values
(
1
);
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
order
by
s1
desc
;
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
s1
int
)
partition
by
range
(
s1
)
(
partition
pa1
values
less
than
(
10
),
partition
pa2
values
less
than
MAXVALUE
);
create
index
i
on
t1
(
s1
);
insert
into
t1
values
(
1
);
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
order
by
s1
desc
;
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
s1
int
)
partition
by
range
(
s1
)
(
partition
pa1
values
less
than
(
10
),
partition
pa2
values
less
than
MAXVALUE
);
create
index
i
on
t1
(
s1
);
insert
into
t1
values
(
20
);
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
order
by
s1
desc
;
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
s1
int
)
partition
by
range
(
s1
)
(
partition
pa1
values
less
than
(
10
),
partition
pa2
values
less
than
MAXVALUE
);
create
index
i
on
t1
(
s1
);
insert
into
t1
values
(
1
),
(
2
),
(
3
),
(
4
),
(
5
),
(
6
),
(
7
),
(
8
);
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
;
insert
into
t1
select
s1
from
t1
order
by
s1
desc
;
insert
into
t1
select
s1
from
t1
where
s1
=
3
;
select
count
(
*
)
from
t1
;
drop
table
t1
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
sql/ha_partition.cc
View file @
4d026889
...
@@ -4290,6 +4290,17 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
...
@@ -4290,6 +4290,17 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
break
;
break
;
case
partition_index_first
:
case
partition_index_first
:
DBUG_PRINT
(
"info"
,
(
"index_first on partition %d"
,
i
));
DBUG_PRINT
(
"info"
,
(
"index_first on partition %d"
,
i
));
/* MyISAM engine can fail if we call index_first() when indexes disabled */
/* that happens if the table is empty. */
/* Here we use file->stats.records instead of file->records() because */
/* file->records() is supposed to return an EXACT count, and it can be */
/* possibly slow. We don't need an exact number, an approximate one- from*/
/* the last ::info() call - is sufficient. */
if
(
file
->
stats
.
records
==
0
)
{
error
=
HA_ERR_END_OF_FILE
;
break
;
}
error
=
file
->
index_first
(
buf
);
error
=
file
->
index_first
(
buf
);
break
;
break
;
case
partition_index_first_unordered
:
case
partition_index_first_unordered
:
...
@@ -4377,10 +4388,32 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
...
@@ -4377,10 +4388,32 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
m_start_key
.
flag
);
m_start_key
.
flag
);
break
;
break
;
case
partition_index_first
:
case
partition_index_first
:
/* MyISAM engine can fail if we call index_first() when indexes disabled */
/* that happens if the table is empty. */
/* Here we use file->stats.records instead of file->records() because */
/* file->records() is supposed to return an EXACT count, and it can be */
/* possibly slow. We don't need an exact number, an approximate one- from*/
/* the last ::info() call - is sufficient. */
if
(
file
->
stats
.
records
==
0
)
{
error
=
HA_ERR_END_OF_FILE
;
break
;
}
error
=
file
->
index_first
(
rec_buf_ptr
);
error
=
file
->
index_first
(
rec_buf_ptr
);
reverse_order
=
FALSE
;
reverse_order
=
FALSE
;
break
;
break
;
case
partition_index_last
:
case
partition_index_last
:
/* MyISAM engine can fail if we call index_last() when indexes disabled */
/* that happens if the table is empty. */
/* Here we use file->stats.records instead of file->records() because */
/* file->records() is supposed to return an EXACT count, and it can be */
/* possibly slow. We don't need an exact number, an approximate one- from*/
/* the last ::info() call - is sufficient. */
if
(
file
->
stats
.
records
==
0
)
{
error
=
HA_ERR_END_OF_FILE
;
break
;
}
error
=
file
->
index_last
(
rec_buf_ptr
);
error
=
file
->
index_last
(
rec_buf_ptr
);
reverse_order
=
TRUE
;
reverse_order
=
TRUE
;
break
;
break
;
...
...
sql/opt_range.cc
View file @
4d026889
...
@@ -3145,10 +3145,12 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
...
@@ -3145,10 +3145,12 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
ppar
->
subpart_fields
););
ppar
->
subpart_fields
););
/* Find the subpartition (it's HASH/KEY so we always have one) */
/* Find the subpartition (it's HASH/KEY so we always have one) */
partition_info
*
part_info
=
ppar
->
part_info
;
partition_info
*
part_info
=
ppar
->
part_info
;
uint32
subpart_id
=
part_info
->
get_subpartition_id
(
part_info
);
uint32
part_id
,
subpart_id
;
if
(
part_info
->
get_subpartition_id
(
part_info
,
&
subpart_id
))
return
0
;
/* Mark this partition as used in each subpartition. */
/* Mark this partition as used in each subpartition. */
uint32
part_id
;
while
((
part_id
=
ppar
->
part_iter
.
get_next
(
&
ppar
->
part_iter
))
!=
while
((
part_id
=
ppar
->
part_iter
.
get_next
(
&
ppar
->
part_iter
))
!=
NOT_A_PARTITION_ID
)
NOT_A_PARTITION_ID
)
{
{
...
...
sql/partition_info.h
View file @
4d026889
...
@@ -25,7 +25,8 @@ class partition_info;
...
@@ -25,7 +25,8 @@ class partition_info;
typedef
int
(
*
get_part_id_func
)(
partition_info
*
part_info
,
typedef
int
(
*
get_part_id_func
)(
partition_info
*
part_info
,
uint32
*
part_id
,
uint32
*
part_id
,
longlong
*
func_value
);
longlong
*
func_value
);
typedef
uint32
(
*
get_subpart_id_func
)(
partition_info
*
part_info
);
typedef
int
(
*
get_subpart_id_func
)(
partition_info
*
part_info
,
uint32
*
part_id
);
struct
st_ddl_log_memory_entry
;
struct
st_ddl_log_memory_entry
;
...
...
sql/sql_partition.cc
View file @
4d026889
This diff is collapsed.
Click to expand it.
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