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
040fc2d3
Commit
040fc2d3
authored
Apr 07, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.1-new
into mysql.com:C:/cygwin/home/mysqldev/my/mysql-5.1-new
parents
2254c05e
bcb81887
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
350 additions
and
121 deletions
+350
-121
BUILD/SETUP.sh
BUILD/SETUP.sh
+138
-69
BUILD/compile-pentium-debug-max
BUILD/compile-pentium-debug-max
+1
-1
BUILD/compile-pentium-debug-max-no-embedded
BUILD/compile-pentium-debug-max-no-embedded
+1
-1
BUILD/compile-pentium-valgrind-max
BUILD/compile-pentium-valgrind-max
+1
-1
include/my_global.h
include/my_global.h
+1
-1
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+62
-0
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+59
-0
sql/opt_range.cc
sql/opt_range.cc
+1
-3
sql/partition_info.h
sql/partition_info.h
+2
-2
sql/sql_partition.cc
sql/sql_partition.cc
+67
-42
sql/sql_partition.h
sql/sql_partition.h
+17
-1
No files found.
BUILD/SETUP.sh
View file @
040fc2d3
#!/bin/sh
#!/bin/sh
########################################################################
get_key_value
()
{
echo
"
$1
"
|
sed
's/^--[a-zA-Z_-]*=//'
}
usage
()
{
cat
<<
EOF
Usage:
$0
[-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
--with-debug=full Build with full debug.
--warning-mode=[old|pedantic]
Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
EOF
}
parse_options
()
{
while
test
$#
-gt
0
do
case
"
$1
"
in
--prefix
=
*
)
prefix
=
`
get_key_value
"
$1
"
`
;;
--with-debug
=
full
)
full_debug
=
"=full"
;;
--warning-mode
=
*
)
warning_mode
=
`
get_key_value
"
$1
"
`
;;
-c
|
--just-configure
)
just_configure
=
1
;;
-n
|
--just-print
|
--print
)
just_print
=
1
;;
-h
|
--help
)
usage
exit
0
;;
*
)
echo
"Unknown option '
$1
'"
exit
1
;;
esac
shift
done
}
########################################################################
if
!
test
-f
sql/mysqld.cc
if
!
test
-f
sql/mysqld.cc
then
then
echo
"You must run this script from the MySQL top-level directory"
echo
"You must run this script from the MySQL top-level directory"
exit
1
exit
1
fi
fi
prefix
_configs
=
"--prefix=
/usr/local/mysql"
prefix
=
"
/usr/local/mysql"
just_print
=
just_print
=
just_configure
=
just_configure
=
full_debug
=
full_debug
=
warning_mode
=
parse_options
"
$@
"
if
test
-n
"
$MYSQL_BUILD_PREFIX
"
if
test
-n
"
$MYSQL_BUILD_PREFIX
"
then
then
prefix
_configs
=
"--prefix=
$MYSQL_BUILD_PREFIX
"
prefix
=
"
$MYSQL_BUILD_PREFIX
"
fi
fi
while
test
$#
-gt
0
do
case
"
$1
"
in
--prefix
=
*
)
prefix_configs
=
"
$1
"
;
shift
;;
--with-debug
=
full
)
full_debug
=
"=full"
;
shift
;;
-c
|
--just-configure
)
just_configure
=
1
;
shift
;;
-n
|
--just-print
|
--print
)
just_print
=
1
;
shift
;;
-h
|
--help
)
cat
<<
EOF
; exit 0 ;;
Usage:
$0
[-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
--with-debug=full Build with full debug.
--prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
EOF
*
)
echo
"Unknown option '
$1
'"
exit
1
break
;;
esac
done
set
-e
set
-e
#
# Check for the CPU and set up CPU specific flags. We may reset them
# later.
#
path
=
`
dirname
$0
`
.
"
$path
/check-cpu"
export
AM_MAKEFLAGS
export
AM_MAKEFLAGS
AM_MAKEFLAGS
=
"-j 4"
AM_MAKEFLAGS
=
"-j 4"
# SSL library to use.
# SSL library to use.
SSL_LIBRARY
=
--with-yassl
SSL_LIBRARY
=
--with-yassl
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
if
[
"x
$warning_mode
"
!=
"xpedantic"
]
;
then
# The following warning flag will give too many warnings:
# Both C and C++ warnings
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
warnings
=
"-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
# __attribute()__ doesn't work with gnu C++)
warnings
=
"
$warnings
-Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings
=
"
$warnings
-Wwrite-strings"
global_warnings
=
"-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
# C warnings
c_warnings
=
"
$global_warnings
-Wunused"
c_warnings
=
"
$warnings
-Wunused"
cxx_warnings
=
"
$global_warnings
-Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
# C++ warnings
base_max_configs
=
"--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-example-storage-engine --with-partition
$SSL_LIBRARY
"
cxx_warnings
=
"
$warnings
-Woverloaded-virtual -Wsign-promo -Wreorder"
base_max_no_ndb_configs
=
"--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-example-storage-engine --with-partition
$SSL_LIBRARY
"
cxx_warnings
=
"
$warnings
-Wctor-dtor-privacy -Wnon-virtual-dtor"
max_configs
=
"
$base_max_configs
--with-embedded-server"
# Added unless --with-debug=full
max_no_ndb_configs
=
"
$base_max_no_ndb_configs
--with-embedded-server"
debug_extra_cflags
=
"-O1 -Wuninitialized"
valgrind_flags
=
"-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max"
else
warnings
=
"-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
path
=
`
dirname
$0
`
c_warnings
=
"
$warnings
"
.
"
$path
/check-cpu"
cxx_warnings
=
"
$warnings
-std=c++98"
# NOTE: warning mode should not influence optimize/debug mode.
alpha_cflags
=
"
$check_cpu_cflags
-Wa,-m
$cpu_flag
"
# Please feel free to add a separate option if you don't feel it's an overkill.
amd64_cflags
=
"
$check_cpu_cflags
"
debug_extra_flags
=
"-O0"
pentium_cflags
=
"
$check_cpu_cflags
"
# Reset CPU flags (-mtune), they don't work in -pedantic mode
pentium64_cflags
=
"
$check_cpu_cflags
-m64"
check_cpu_cflags
=
""
ppc_cflags
=
"
$check_cpu_cflags
"
fi
sparc_cflags
=
""
# be as fast as we can be without losing our ability to backtrace
# Set flags for various build configurations.
# Used in -valgrind builds
valgrind_flags
=
"-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
valgrind_flags
=
"
$valgrind_flags
-DMYSQL_SERVER_SUFFIX=-valgrind-max"
#
# Used in -debug builds
debug_cflags
=
"-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
debug_cflags
=
"
$debug_cflags
-DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
#
# Base C++ flags for all builds
base_cxxflags
=
"-felide-constructors -fno-exceptions -fno-rtti"
#
# Flags for optimizing builds.
# Be as fast as we can be without losing our ability to backtrace.
fast_cflags
=
"-O3 -fno-omit-frame-pointer"
fast_cflags
=
"-O3 -fno-omit-frame-pointer"
# this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags
=
"-O3 -fomit-frame-pointer "
debug_cflags
=
"-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
debug_configs
=
"--with-debug
$full_debug
"
debug_extra_cflags
=
"-O1 -Wuninitialized"
if
[
-z
"
$full_debug
"
]
then
debug_cflags
=
"
$debug_cflags
$debug_extra_cflags
"
fi
base_cxxflags
=
"-felide-constructors -fno-exceptions -fno-rtti"
#
amd64_cxxflags
=
""
# If dropping '--with-big-tables', add here "-DBIG_TABLES"
# Configuration options.
#
base_configs
=
"
$prefix_configs
--enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables"
base_configs
=
"--prefix=
$prefix
--enable-assembler "
static_link
=
"--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
base_configs
=
"
$base_configs
--with-extra-charsets=complex "
amd64_configs
=
""
base_configs
=
"
$base_configs
--enable-thread-safe-client --with-readline "
alpha_configs
=
""
# Not used yet
base_configs
=
"
$base_configs
--with-big-tables"
pentium_configs
=
""
sparc_configs
=
""
static_link
=
"--with-mysqld-ldflags=-all-static "
static_link
=
"
$static_link
--with-client-ldflags=-all-static"
# we need local-infile in all binaries for rpl000001
# we need local-infile in all binaries for rpl000001
# if you need to disable local-infile in the client, write a build script
# if you need to disable local-infile in the client, write a build script
# and unset local_infile_configs
# and unset local_infile_configs
local_infile_configs
=
"--enable-local-infile"
local_infile_configs
=
"--enable-local-infile"
debug_configs
=
"--with-debug
$full_debug
"
if
[
-z
"
$full_debug
"
]
max_configs
=
"--with-innodb --with-berkeley-db"
then
max_configs
=
"
$max_configs
--with-archive-storage-engine"
debug_cflags
=
"
$debug_cflags
$debug_extra_cflags
"
max_configs
=
"
$max_configs
--with-big-tables"
fi
max_configs
=
"
$max_configs
--with-blackhole-storage-engine"
max_configs
=
"
$max_configs
--with-federated-storage-engine"
max_configs
=
"
$max_configs
--with-csv-storage-engine"
max_configs
=
"
$max_configs
--with-example-storage-engine"
max_configs
=
"
$max_configs
--with-partition
$SSL_LIBRARY
"
max_no_embedded_configs
=
"
$max_configs
--with-ndbcluster"
max_no_ndb_configs
=
"
$max_configs
--without-ndbcluster --with-embedded-server"
max_configs
=
"
$max_configs
--with-ndbcluster --with-embedded-server"
#
# CPU and platform specific compilation flags.
#
alpha_cflags
=
"
$check_cpu_cflags
-Wa,-m
$cpu_flag
"
amd64_cflags
=
"
$check_cpu_cflags
"
amd64_cxxflags
=
""
# If dropping '--with-big-tables', add here "-DBIG_TABLES"
pentium64_cflags
=
"
$check_cpu_cflags
-m64"
ppc_cflags
=
"
$check_cpu_cflags
"
sparc_cflags
=
""
if
gmake
--version
>
/dev/null 2>&1
if
gmake
--version
>
/dev/null 2>&1
then
then
...
...
BUILD/compile-pentium-debug-max
View file @
040fc2d3
#! /bin/sh
#! /bin/sh
path
=
`
dirname
$0
`
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
$@
--with-debug
=
full
.
"
$path
/SETUP.sh"
"
$@
"
--with-debug
=
full
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
extra_configs
=
"
$pentium_configs
$debug_configs
$max_configs
"
extra_configs
=
"
$pentium_configs
$debug_configs
$max_configs
"
...
...
BUILD/compile-pentium-debug-max-no-embedded
View file @
040fc2d3
...
@@ -4,6 +4,6 @@ path=`dirname $0`
...
@@ -4,6 +4,6 @@ path=`dirname $0`
.
"
$path
/SETUP.sh"
.
"
$path
/SETUP.sh"
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
extra_flags
=
"
$pentium_cflags
$debug_cflags
"
extra_configs
=
"
$pentium_configs
$debug_configs
$
base_max
_configs
"
extra_configs
=
"
$pentium_configs
$debug_configs
$
max_no_embedded
_configs
"
.
"
$path
/FINISH.sh"
.
"
$path
/FINISH.sh"
BUILD/compile-pentium-valgrind-max
View file @
040fc2d3
#! /bin/sh
#! /bin/sh
path
=
`
dirname
$0
`
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
.
"
$path
/SETUP.sh"
"
$@
"
extra_flags
=
"
$pentium_cflags
$debug_cflags
$valgrind_flags
"
extra_flags
=
"
$pentium_cflags
$debug_cflags
$valgrind_flags
"
extra_configs
=
"
$pentium_configs
$debug_configs
$max_configs
"
extra_configs
=
"
$pentium_configs
$debug_configs
$max_configs
"
...
...
include/my_global.h
View file @
040fc2d3
...
@@ -917,7 +917,7 @@ typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
...
@@ -917,7 +917,7 @@ typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
#error "Neither int or long is of 4 bytes width"
#error "Neither int or long is of 4 bytes width"
#endif
#endif
#if !defined(HAVE_ULONG) && !defined(
TARGET_OS_LINUX) && !defined(
__USE_MISC)
#if !defined(HAVE_ULONG) && !defined(__USE_MISC)
typedef
unsigned
long
ulong
;
/* Short for unsigned long */
typedef
unsigned
long
ulong
;
/* Short for unsigned long */
#endif
#endif
#ifndef longlong_defined
#ifndef longlong_defined
...
...
mysql-test/r/partition_pruning.result
View file @
040fc2d3
...
@@ -597,3 +597,65 @@ NULL
...
@@ -597,3 +597,65 @@ NULL
explain partitions select * from t1 where f_int1 is null;
explain partitions select * from t1 where f_int1 is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 part4_p2sp0 system NULL NULL NULL NULL 1
1 SIMPLE t1 part4_p2sp0 system NULL NULL NULL NULL 1
drop table t1;
create table t1 (a int not null, b int not null)
partition by list(a)
subpartition by hash(b) subpartitions 4
(
partition p0 values in (1),
partition p1 values in (2),
partition p2 values in (3)
);
insert into t1 values (1,1),(1,2),(1,3),(1,4),
(2,1),(2,2),(2,3),(2,4);
explain partitions select * from t1 where a=1 AND (b=1 OR b=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_p0sp1,p0_p0sp2 ALL NULL NULL NULL NULL 2 Using where
drop table t1;
create table t1 (a int, b int not null)
partition by list(a)
subpartition by hash(b) subpartitions 2
(
partition p0 values in (1),
partition p1 values in (2),
partition p2 values in (3),
partition pn values in (NULL)
);
insert into t1 values (1,1),(1,2),(1,3),(1,4),
(2,1),(2,2),(2,3),(2,4), (NULL,1);
explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn_p3sp0,pn_p3sp1 system NULL NULL NULL NULL 1
explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn_p3sp0,pn_p3sp1 system NULL NULL NULL NULL 1
explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_p3sp0,pn_p3sp1 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_p3sp0,pn_p3sp1 ALL NULL NULL NULL NULL 5 Using where
drop table t1;
create table t1 ( a int) partition by list (MOD(a, 10))
( partition p0 values in (0), partition p1 values in (1),
partition p2 values in (2), partition p3 values in (3),
partition p4 values in (4), partition p5 values in (5),
partition p6 values in (6), partition pn values in (NULL)
);
insert into t1 values (NULL), (0),(1),(2),(3),(4),(5),(6);
explain partitions select * from t1 where a is null or a < 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,pn ALL NULL NULL NULL NULL 8 Using where
drop table t1;
create table t1 (s1 int) partition by list (s1)
(partition p1 values in (0),
partition p2 values in (1),
partition p3 values in (null));
insert into t1 values (0),(1),(null);
select count(*) from t1 where s1 < 0 or s1 is null;
count(*)
1
explain partitions select count(*) from t1 where s1 < 0 or s1 is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3 system NULL NULL NULL NULL 1
drop table t1;
mysql-test/t/partition_pruning.test
View file @
040fc2d3
...
@@ -492,6 +492,65 @@ insert into t1 set f_int1 = null;
...
@@ -492,6 +492,65 @@ insert into t1 set f_int1 = null;
select
*
from
t1
where
f_int1
is
null
;
select
*
from
t1
where
f_int1
is
null
;
explain
partitions
select
*
from
t1
where
f_int1
is
null
;
explain
partitions
select
*
from
t1
where
f_int1
is
null
;
drop
table
t1
;
#
# BUG#18558
#
create
table
t1
(
a
int
not
null
,
b
int
not
null
)
partition
by
list
(
a
)
subpartition
by
hash
(
b
)
subpartitions
4
(
partition
p0
values
in
(
1
),
partition
p1
values
in
(
2
),
partition
p2
values
in
(
3
)
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
1
,
4
),
(
2
,
1
),(
2
,
2
),(
2
,
3
),(
2
,
4
);
explain
partitions
select
*
from
t1
where
a
=
1
AND
(
b
=
1
OR
b
=
2
);
drop
table
t1
;
create
table
t1
(
a
int
,
b
int
not
null
)
partition
by
list
(
a
)
subpartition
by
hash
(
b
)
subpartitions
2
(
partition
p0
values
in
(
1
),
partition
p1
values
in
(
2
),
partition
p2
values
in
(
3
),
partition
pn
values
in
(
NULL
)
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
1
,
4
),
(
2
,
1
),(
2
,
2
),(
2
,
3
),(
2
,
4
),
(
NULL
,
1
);
explain
partitions
select
*
from
t1
where
a
IS
NULL
AND
(
b
=
1
OR
b
=
2
);
explain
partitions
select
*
from
t1
where
(
a
IS
NULL
or
a
<
1
)
AND
(
b
=
1
OR
b
=
2
);
explain
partitions
select
*
from
t1
where
(
a
IS
NULL
or
a
<
2
)
AND
(
b
=
1
OR
b
=
2
);
explain
partitions
select
*
from
t1
where
(
a
IS
NULL
or
a
<=
1
)
AND
(
b
=
1
OR
b
=
2
);
drop
table
t1
;
create
table
t1
(
a
int
)
partition
by
list
(
MOD
(
a
,
10
))
(
partition
p0
values
in
(
0
),
partition
p1
values
in
(
1
),
partition
p2
values
in
(
2
),
partition
p3
values
in
(
3
),
partition
p4
values
in
(
4
),
partition
p5
values
in
(
5
),
partition
p6
values
in
(
6
),
partition
pn
values
in
(
NULL
)
);
insert
into
t1
values
(
NULL
),
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
);
explain
partitions
select
*
from
t1
where
a
is
null
or
a
<
2
;
drop
table
t1
;
# Testcase from BUG#18751
create
table
t1
(
s1
int
)
partition
by
list
(
s1
)
(
partition
p1
values
in
(
0
),
partition
p2
values
in
(
1
),
partition
p3
values
in
(
null
));
insert
into
t1
values
(
0
),(
1
),(
null
);
select
count
(
*
)
from
t1
where
s1
<
0
or
s1
is
null
;
explain
partitions
select
count
(
*
)
from
t1
where
s1
<
0
or
s1
is
null
;
drop
table
t1
;
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
# being fixed.
# being fixed.
sql/opt_range.cc
View file @
040fc2d3
...
@@ -2296,8 +2296,6 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
...
@@ -2296,8 +2296,6 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
RANGE_OPT_PARAM
*
range_par
=
&
prune_param
.
range_param
;
RANGE_OPT_PARAM
*
range_par
=
&
prune_param
.
range_param
;
prune_param
.
part_info
=
part_info
;
prune_param
.
part_info
=
part_info
;
prune_param
.
part_iter
.
has_null_value
=
FALSE
;
init_sql_alloc
(
&
alloc
,
thd
->
variables
.
range_alloc_block_size
,
0
);
init_sql_alloc
(
&
alloc
,
thd
->
variables
.
range_alloc_block_size
,
0
);
range_par
->
mem_root
=
&
alloc
;
range_par
->
mem_root
=
&
alloc
;
range_par
->
old_root
=
thd
->
mem_root
;
range_par
->
old_root
=
thd
->
mem_root
;
...
@@ -2730,7 +2728,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
...
@@ -2730,7 +2728,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
key_tree
->
min_flag
|
key_tree
->
max_flag
,
key_tree
->
min_flag
|
key_tree
->
max_flag
,
&
ppar
->
part_iter
);
&
ppar
->
part_iter
);
if
(
!
res
)
if
(
!
res
)
goto
go_right
;
/* res=0 --> no satisfying partitions */
goto
go_right
;
/* res=
=
0 --> no satisfying partitions */
if
(
res
==
-
1
)
if
(
res
==
-
1
)
{
{
//get a full range iterator
//get a full range iterator
...
...
sql/partition_info.h
View file @
040fc2d3
...
@@ -267,7 +267,7 @@ uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
...
@@ -267,7 +267,7 @@ uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
static
inline
void
init_single_partition_iterator
(
uint32
part_id
,
static
inline
void
init_single_partition_iterator
(
uint32
part_id
,
PARTITION_ITERATOR
*
part_iter
)
PARTITION_ITERATOR
*
part_iter
)
{
{
part_iter
->
part_nums
.
start
=
part_id
;
part_iter
->
part_nums
.
start
=
part_i
ter
->
part_nums
.
cur
=
part_i
d
;
part_iter
->
part_nums
.
end
=
part_id
+
1
;
part_iter
->
part_nums
.
end
=
part_id
+
1
;
part_iter
->
get_next
=
get_next_partition_id_range
;
part_iter
->
get_next
=
get_next_partition_id_range
;
}
}
...
@@ -277,7 +277,7 @@ static inline
...
@@ -277,7 +277,7 @@ static inline
void
init_all_partitions_iterator
(
partition_info
*
part_info
,
void
init_all_partitions_iterator
(
partition_info
*
part_info
,
PARTITION_ITERATOR
*
part_iter
)
PARTITION_ITERATOR
*
part_iter
)
{
{
part_iter
->
part_nums
.
start
=
0
;
part_iter
->
part_nums
.
start
=
part_iter
->
part_nums
.
cur
=
0
;
part_iter
->
part_nums
.
end
=
part_info
->
no_parts
;
part_iter
->
part_nums
.
end
=
part_info
->
no_parts
;
part_iter
->
get_next
=
get_next_partition_id_range
;
part_iter
->
get_next
=
get_next_partition_id_range
;
}
}
sql/sql_partition.cc
View file @
040fc2d3
...
@@ -5269,7 +5269,7 @@ static void set_up_range_analysis_info(partition_info *part_info)
...
@@ -5269,7 +5269,7 @@ static void set_up_range_analysis_info(partition_info *part_info)
}
}
/*
/*
Check get_part_iter_for_interval_via_walking() can be used for
Check
if
get_part_iter_for_interval_via_walking() can be used for
partitioning
partitioning
*/
*/
if
(
part_info
->
no_part_fields
==
1
)
if
(
part_info
->
no_part_fields
==
1
)
...
@@ -5291,7 +5291,7 @@ static void set_up_range_analysis_info(partition_info *part_info)
...
@@ -5291,7 +5291,7 @@ static void set_up_range_analysis_info(partition_info *part_info)
setup_subparts:
setup_subparts:
/*
/*
Check get_part_iter_for_interval_via_walking() can be used for
Check
if
get_part_iter_for_interval_via_walking() can be used for
subpartitioning
subpartitioning
*/
*/
if
(
part_info
->
no_subpart_fields
==
1
)
if
(
part_info
->
no_subpart_fields
==
1
)
...
@@ -5374,40 +5374,47 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
...
@@ -5374,40 +5374,47 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
max_endpoint_val
=
part_info
->
no_list_values
;
max_endpoint_val
=
part_info
->
no_list_values
;
part_iter
->
get_next
=
get_next_partition_id_list
;
part_iter
->
get_next
=
get_next_partition_id_list
;
part_iter
->
part_info
=
part_info
;
part_iter
->
part_info
=
part_info
;
part_iter
->
ret_null_part
=
part_iter
->
ret_null_part_orig
=
FALSE
;
}
}
else
else
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
if
(
field
->
real_maybe_null
()
&&
part_info
->
has_null_value
)
/*
Find minimum: Do special handling if the interval has left bound in form
" NULL <= X ":
*/
if
(
field
->
real_maybe_null
()
&&
part_info
->
has_null_value
&&
!
(
flags
&
(
NO_MIN_RANGE
|
NEAR_MIN
))
&&
*
min_value
)
{
{
if
(
*
min_value
)
part_iter
->
ret_null_part
=
part_iter
->
ret_null_part_orig
=
TRUE
;
part_iter
->
part_nums
.
start
=
part_iter
->
part_nums
.
cur
=
0
;
if
(
*
max_value
&&
!
(
flags
&
NO_MAX_RANGE
))
{
{
if
(
*
max_value
&&
!
(
flags
&
(
NO_MIN_RANGE
|
NO_MAX_RANGE
)))
/* The right bound is X <= NULL, i.e. it is a "X IS NULL" interval */
{
part_iter
->
part_nums
.
end
=
0
;
init_single_partition_iterator
(
part_info
->
has_null_part_id
,
part_iter
);
return
1
;
return
1
;
}
if
(
!
(
flags
&
NEAR_MIN
))
part_iter
->
has_null_value
=
TRUE
;
}
}
}
}
/* Find minimum */
if
(
flags
&
NO_MIN_RANGE
)
part_iter
->
part_nums
.
start
=
0
;
else
else
{
{
/*
if
(
flags
&
NO_MIN_RANGE
)
Store the interval edge in the record buffer, and call the
part_iter
->
part_nums
.
start
=
part_iter
->
part_nums
.
cur
=
0
;
function that maps the edge in table-field space to an edge
else
in ordered-set-of-partitions (for RANGE partitioning) or
{
index-in-ordered-array-of-list-constants (for LIST) space.
/*
*/
Store the interval edge in the record buffer, and call the
store_key_image_to_rec
(
field
,
min_value
,
field_len
);
function that maps the edge in table-field space to an edge
bool
include_endp
=
part_info
->
range_analysis_include_bounds
||
in ordered-set-of-partitions (for RANGE partitioning) or
!
test
(
flags
&
NEAR_MIN
);
index-in-ordered-array-of-list-constants (for LIST) space.
part_iter
->
part_nums
.
start
=
get_endpoint
(
part_info
,
1
,
include_endp
);
*/
if
(
part_iter
->
part_nums
.
start
==
max_endpoint_val
)
store_key_image_to_rec
(
field
,
min_value
,
field_len
);
return
0
;
/* No partitions */
bool
include_endp
=
part_info
->
range_analysis_include_bounds
||
!
test
(
flags
&
NEAR_MIN
);
part_iter
->
part_nums
.
start
=
get_endpoint
(
part_info
,
1
,
include_endp
);
part_iter
->
part_nums
.
cur
=
part_iter
->
part_nums
.
start
;
if
(
part_iter
->
part_nums
.
start
==
max_endpoint_val
)
return
0
;
/* No partitions */
}
}
}
/* Find maximum, do the same as above but for right interval bound */
/* Find maximum, do the same as above but for right interval bound */
...
@@ -5419,7 +5426,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
...
@@ -5419,7 +5426,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool
include_endp
=
part_info
->
range_analysis_include_bounds
||
bool
include_endp
=
part_info
->
range_analysis_include_bounds
||
!
test
(
flags
&
NEAR_MAX
);
!
test
(
flags
&
NEAR_MAX
);
part_iter
->
part_nums
.
end
=
get_endpoint
(
part_info
,
0
,
include_endp
);
part_iter
->
part_nums
.
end
=
get_endpoint
(
part_info
,
0
,
include_endp
);
if
(
part_iter
->
part_nums
.
start
==
part_iter
->
part_nums
.
end
)
if
(
part_iter
->
part_nums
.
start
==
part_iter
->
part_nums
.
end
&&
!
part_iter
->
ret_null_part
)
return
0
;
/* No partitions */
return
0
;
/* No partitions */
}
}
return
1
;
/* Ok, iterator initialized */
return
1
;
/* Ok, iterator initialized */
...
@@ -5534,8 +5542,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
...
@@ -5534,8 +5542,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
return
0
;
/* No partitions match */
return
0
;
/* No partitions match */
}
}
if
(
flags
&
(
NO_MIN_RANGE
|
NO_MAX_RANGE
))
if
((
field
->
real_maybe_null
()
&&
((
!
(
flags
&
NO_MIN_RANGE
)
&&
*
min_value
)
||
// NULL <? X
(
!
(
flags
&
NO_MAX_RANGE
)
&&
*
max_value
)))
||
// X <? NULL
(
flags
&
(
NO_MIN_RANGE
|
NO_MAX_RANGE
)))
// -inf at any bound
{
return
-
1
;
/* Can't handle this interval, have to use all partitions */
return
-
1
;
/* Can't handle this interval, have to use all partitions */
}
/* Get integers for left and right interval bound */
/* Get integers for left and right interval bound */
longlong
a
,
b
;
longlong
a
,
b
;
...
@@ -5553,7 +5566,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
...
@@ -5553,7 +5566,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
if
(
n_values
>
total_parts
||
n_values
>
MAX_RANGE_TO_WALK
)
if
(
n_values
>
total_parts
||
n_values
>
MAX_RANGE_TO_WALK
)
return
-
1
;
return
-
1
;
part_iter
->
field_vals
.
start
=
a
;
part_iter
->
field_vals
.
start
=
part_iter
->
field_vals
.
cur
=
a
;
part_iter
->
field_vals
.
end
=
b
;
part_iter
->
field_vals
.
end
=
b
;
part_iter
->
part_info
=
part_info
;
part_iter
->
part_info
=
part_info
;
part_iter
->
get_next
=
get_next_func
;
part_iter
->
get_next
=
get_next_func
;
...
@@ -5565,12 +5578,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
...
@@ -5565,12 +5578,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
PARTITION_ITERATOR::get_next implementation: enumerate partitions in range
PARTITION_ITERATOR::get_next implementation: enumerate partitions in range
SYNOPSIS
SYNOPSIS
get_next_partition_id_
list
()
get_next_partition_id_
range
()
part_iter Partition set iterator structure
part_iter Partition set iterator structure
DESCRIPTION
DESCRIPTION
This is implementation of PARTITION_ITERATOR::get_next() that returns
This is implementation of PARTITION_ITERATOR::get_next() that returns
[sub]partition ids in [min_partition_id, max_partition_id] range.
[sub]partition ids in [min_partition_id, max_partition_id] range.
The function conforms to partition_iter_func type.
RETURN
RETURN
partition id
partition id
...
@@ -5579,10 +5593,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
...
@@ -5579,10 +5593,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
uint32
get_next_partition_id_range
(
PARTITION_ITERATOR
*
part_iter
)
uint32
get_next_partition_id_range
(
PARTITION_ITERATOR
*
part_iter
)
{
{
if
(
part_iter
->
part_nums
.
start
==
part_iter
->
part_nums
.
end
)
if
(
part_iter
->
part_nums
.
cur
==
part_iter
->
part_nums
.
end
)
{
part_iter
->
part_nums
.
cur
=
part_iter
->
part_nums
.
start
;
return
NOT_A_PARTITION_ID
;
return
NOT_A_PARTITION_ID
;
}
else
else
return
part_iter
->
part_nums
.
start
++
;
return
part_iter
->
part_nums
.
cur
++
;
}
}
...
@@ -5597,6 +5614,7 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
...
@@ -5597,6 +5614,7 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
This implementation of PARTITION_ITERATOR::get_next() is special for
This implementation of PARTITION_ITERATOR::get_next() is special for
LIST partitioning: it enumerates partition ids in
LIST partitioning: it enumerates partition ids in
part_info->list_array[i] where i runs over [min_idx, max_idx] interval.
part_info->list_array[i] where i runs over [min_idx, max_idx] interval.
The function conforms to partition_iter_func type.
RETURN
RETURN
partition id
partition id
...
@@ -5605,18 +5623,20 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
...
@@ -5605,18 +5623,20 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
uint32
get_next_partition_id_list
(
PARTITION_ITERATOR
*
part_iter
)
uint32
get_next_partition_id_list
(
PARTITION_ITERATOR
*
part_iter
)
{
{
if
(
part_iter
->
part_nums
.
start
==
part_iter
->
part_nums
.
end
)
if
(
part_iter
->
part_nums
.
cur
==
part_iter
->
part_nums
.
end
)
{
{
if
(
part_iter
->
has_null_value
)
if
(
part_iter
->
ret_null_part
)
{
{
part_iter
->
has_null_value
=
FALSE
;
part_iter
->
ret_null_part
=
FALSE
;
return
part_iter
->
part_info
->
has_null_part_id
;
return
part_iter
->
part_info
->
has_null_part_id
;
}
}
part_iter
->
part_nums
.
cur
=
part_iter
->
part_nums
.
start
;
part_iter
->
ret_null_part
=
part_iter
->
ret_null_part_orig
;
return
NOT_A_PARTITION_ID
;
return
NOT_A_PARTITION_ID
;
}
}
else
else
return
part_iter
->
part_info
->
list_array
[
part_iter
->
return
part_iter
->
part_info
->
list_array
[
part_iter
->
part_nums
.
start
++
].
partition_id
;
part_nums
.
cur
++
].
partition_id
;
}
}
...
@@ -5631,6 +5651,7 @@ uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter)
...
@@ -5631,6 +5651,7 @@ uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter)
This implementation of PARTITION_ITERATOR::get_next() returns ids of
This implementation of PARTITION_ITERATOR::get_next() returns ids of
partitions that contain records with partitioning field value within
partitions that contain records with partitioning field value within
[start_val, end_val] interval.
[start_val, end_val] interval.
The function conforms to partition_iter_func type.
RETURN
RETURN
partition id
partition id
...
@@ -5641,11 +5662,10 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
...
@@ -5641,11 +5662,10 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
{
{
uint32
part_id
;
uint32
part_id
;
Field
*
field
=
part_iter
->
part_info
->
part_field_array
[
0
];
Field
*
field
=
part_iter
->
part_info
->
part_field_array
[
0
];
while
(
part_iter
->
field_vals
.
start
!=
part_iter
->
field_vals
.
end
)
while
(
part_iter
->
field_vals
.
cur
!=
part_iter
->
field_vals
.
end
)
{
{
field
->
store
(
part_iter
->
field_vals
.
start
,
FALSE
);
part_iter
->
field_vals
.
start
++
;
longlong
dummy
;
longlong
dummy
;
field
->
store
(
part_iter
->
field_vals
.
cur
++
,
FALSE
);
if
(
part_iter
->
part_info
->
is_sub_partitioned
()
&&
if
(
part_iter
->
part_info
->
is_sub_partitioned
()
&&
!
part_iter
->
part_info
->
get_part_partition_id
(
part_iter
->
part_info
,
!
part_iter
->
part_info
->
get_part_partition_id
(
part_iter
->
part_info
,
&
part_id
,
&
dummy
)
||
&
part_id
,
&
dummy
)
||
...
@@ -5653,6 +5673,9 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
...
@@ -5653,6 +5673,9 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
&
part_id
,
&
dummy
))
&
part_id
,
&
dummy
))
return
part_id
;
return
part_id
;
}
}
//psergey-todo: return partition(part_func(NULL)) here...
part_iter
->
field_vals
.
cur
=
part_iter
->
field_vals
.
start
;
return
NOT_A_PARTITION_ID
;
return
NOT_A_PARTITION_ID
;
}
}
...
@@ -5663,10 +5686,12 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter)
...
@@ -5663,10 +5686,12 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter)
{
{
uint32
part_id
;
uint32
part_id
;
Field
*
field
=
part_iter
->
part_info
->
subpart_field_array
[
0
];
Field
*
field
=
part_iter
->
part_info
->
subpart_field_array
[
0
];
if
(
part_iter
->
field_vals
.
start
==
part_iter
->
field_vals
.
end
)
if
(
part_iter
->
field_vals
.
cur
==
part_iter
->
field_vals
.
end
)
{
part_iter
->
field_vals
.
cur
=
part_iter
->
field_vals
.
start
;
return
NOT_A_PARTITION_ID
;
return
NOT_A_PARTITION_ID
;
field
->
store
(
part_iter
->
field_vals
.
start
,
FALSE
);
}
part_iter
->
field_vals
.
start
++
;
field
->
store
(
part_iter
->
field_vals
.
cur
++
,
FALSE
)
;
return
part_iter
->
part_info
->
get_subpartition_id
(
part_iter
->
part_info
);
return
part_iter
->
part_info
->
get_subpartition_id
(
part_iter
->
part_info
);
}
}
#endif
#endif
...
...
sql/sql_partition.h
View file @
040fc2d3
...
@@ -94,10 +94,20 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
...
@@ -94,10 +94,20 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
/*
/*
A "Get next" function for partition iterator.
A "Get next" function for partition iterator.
SYNOPSIS
SYNOPSIS
partition_iter_func()
partition_iter_func()
part_iter Partition iterator, you call only "iter.get_next(&iter)"
part_iter Partition iterator, you call only "iter.get_next(&iter)"
DESCRIPTION
Depending on whether partitions or sub-partitions are iterated, the
function returns next subpartition id/partition number. The sequence of
returned numbers is not ordered and may contain duplicates.
When the end of sequence is reached, NOT_A_PARTITION_ID is returned, and
the iterator resets itself (so next get_next() call will start to
enumerate the set all over again).
RETURN
RETURN
NOT_A_PARTITION_ID if there are no more partitions.
NOT_A_PARTITION_ID if there are no more partitions.
[sub]partition_id of the next partition
[sub]partition_id of the next partition
...
@@ -124,16 +134,22 @@ typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter);
...
@@ -124,16 +134,22 @@ typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter);
typedef
struct
st_partition_iter
typedef
struct
st_partition_iter
{
{
partition_iter_func
get_next
;
partition_iter_func
get_next
;
bool
has_null_value
;
/*
Valid for "Interval mapping" in LIST partitioning: if true, let the
iterator also produce id of the partition that contains NULL value.
*/
bool
ret_null_part
,
ret_null_part_orig
;
struct
st_part_num_range
struct
st_part_num_range
{
{
uint32
start
;
uint32
start
;
uint32
cur
;
uint32
end
;
uint32
end
;
};
};
struct
st_field_value_range
struct
st_field_value_range
{
{
longlong
start
;
longlong
start
;
longlong
cur
;
longlong
end
;
longlong
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