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
f421d8f5
Commit
f421d8f5
authored
Jun 22, 2022
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.8 into 10.9
parents
707f2aa2
3a66c015
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
4 deletions
+96
-4
configure.cmake
configure.cmake
+8
-1
include/aligned.h
include/aligned.h
+7
-0
mysql-test/main/statistics_json.result
mysql-test/main/statistics_json.result
+31
-0
mysql-test/main/statistics_json.test
mysql-test/main/statistics_json.test
+16
-0
sql/opt_histogram_json.cc
sql/opt_histogram_json.cc
+20
-1
storage/innobase/buf/buf0flu.cc
storage/innobase/buf/buf0flu.cc
+11
-1
storage/perfschema/unittest/stub_pfs_global.h
storage/perfschema/unittest/stub_pfs_global.h
+3
-1
No files found.
configure.cmake
View file @
f421d8f5
...
...
@@ -324,7 +324,14 @@ ENDIF()
CHECK_FUNCTION_EXISTS
(
accept4 HAVE_ACCEPT4
)
CHECK_FUNCTION_EXISTS
(
access HAVE_ACCESS
)
CHECK_FUNCTION_EXISTS
(
alarm HAVE_ALARM
)
CHECK_FUNCTION_EXISTS
(
aligned_alloc HAVE_ALIGNED_ALLOC
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
AND NOT WITH_ASAN
)
# When an old custom memory allocator library is used, aligned_alloc()
# could invoke the built-in allocator in libc, not matching
# the overriden free() in the custom memory allocator.
SET
(
HAVE_ALIGNED_ALLOC 0
)
ELSE
()
CHECK_FUNCTION_EXISTS
(
aligned_alloc HAVE_ALIGNED_ALLOC
)
ENDIF
()
SET
(
HAVE_ALLOCA 1
)
CHECK_FUNCTION_EXISTS
(
backtrace HAVE_BACKTRACE
)
CHECK_FUNCTION_EXISTS
(
backtrace_symbols HAVE_BACKTRACE_SYMBOLS
)
...
...
include/aligned.h
View file @
f421d8f5
...
...
@@ -14,12 +14,19 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#ifdef HAVE_ALIGNED_ALLOC
#elif defined __linux__
# include <malloc.h>
#endif
inline
void
*
aligned_malloc
(
size_t
size
,
size_t
alignment
)
{
#ifdef _WIN32
return
_aligned_malloc
(
size
,
alignment
);
#elif defined HAVE_ALIGNED_ALLOC
return
aligned_alloc
(
alignment
,
size
);
#elif defined __linux__
return
memalign
(
alignment
,
size
);
#else
void
*
result
;
if
(
posix_memalign
(
&
result
,
alignment
,
size
))
...
...
mysql-test/main/statistics_json.result
View file @
f421d8f5
...
...
@@ -8322,3 +8322,34 @@ histogram
]
}
drop table t1;
#
# MDEV-28882: Assertion `tmp >= 0' failed in best_access_path
#
CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('o'),('s'),('j'),('s'),('y'),('s'),('l'),
('q'),('x'),('m'),('t'),('d'),('v'),('j'),('p'),('t'),('b'),('q');
set histogram_type=json_hb;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# filtered must not be negative:
explain format=json select * from t1 where a > 'y';
EXPLAIN
{
"query_block": {
"select_id": 1,
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 18,
"filtered": 5.555555344,
"attached_condition": "t1.a > 'y'"
}
}
]
}
}
drop table t1;
mysql-test/main/statistics_json.test
View file @
f421d8f5
...
...
@@ -460,3 +460,19 @@ from mysql.column_stats where table_name='t1' and db_name=database();
drop
table
t1
;
--
echo
#
--
echo
# MDEV-28882: Assertion `tmp >= 0' failed in best_access_path
--
echo
#
CREATE
TABLE
t1
(
a
varchar
(
1
));
INSERT
INTO
t1
VALUES
(
'o'
),(
's'
),(
'j'
),(
's'
),(
'y'
),(
's'
),(
'l'
),
(
'q'
),(
'x'
),(
'm'
),(
't'
),(
'd'
),(
'v'
),(
'j'
),(
'p'
),(
't'
),(
'b'
),(
'q'
);
set
histogram_type
=
json_hb
;
analyze
table
t1
persistent
for
all
;
--
echo
# filtered must not be negative:
explain
format
=
json
select
*
from
t1
where
a
>
'y'
;
drop
table
t1
;
sql/opt_histogram_json.cc
View file @
f421d8f5
...
...
@@ -959,9 +959,16 @@ std::string& Histogram_json_hb::get_end_value(int idx)
@param field The table field histogram is for. We don't care about the
field's current value, we only need its virtual functions to
perform various operations
@param min_endp Left endpoint, or NULL if there is none
@param max_endp Right endpoint, or NULL if there is none
@param avg_sel Average selectivity of "field=const" equality for this field
@return
Range selectivity: a number between 0.0 and 1.0.
@note
This may return 0.0. Adjustments to avoid multiply-by-zero meltdown are
made elsewhere.
*/
double
Histogram_json_hb
::
range_selectivity
(
Field
*
field
,
key_range
*
min_endp
,
...
...
@@ -1062,6 +1069,18 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp,
else
max
=
1.0
;
if
(
min
>
max
)
{
/*
This can happen due to rounding errors.
What is the acceptable error size? Json_writer::add_double() uses
%.11lg format. This gives 9 digits after the dot. A histogram may have
hundreds of buckets, let's multiply the error by 1000. 9-3=6
*/
DBUG_ASSERT
(
max
<
min
+
1e-6
);
max
=
min
;
}
return
max
-
min
;
}
...
...
storage/innobase/buf/buf0flu.cc
View file @
f421d8f5
...
...
@@ -544,9 +544,19 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot)
buffer be bigger than input buffer. Adjust the allocated size. */
ulint
size
=
srv_page_size
;
if
(
provider_service_lzo
->
is_loaded
)
size
+=
LZO1X_1_15_MEM_COMPRESS
;
{
size
=
LZO1X_1_15_MEM_COMPRESS
;
#ifdef HAVE_ALIGNED_ALLOC
size
=
MY_ALIGN
(
size
,
srv_page_size
);
#endif
}
else
if
(
provider_service_snappy
->
is_loaded
)
{
size
=
snappy_max_compressed_length
(
size
);
#ifdef HAVE_ALIGNED_ALLOC
size
=
MY_ALIGN
(
size
,
srv_page_size
);
#endif
}
slot
->
comp_buf
=
static_cast
<
byte
*>
(
aligned_malloc
(
size
,
srv_page_size
));
}
...
...
storage/perfschema/unittest/stub_pfs_global.h
View file @
f421d8f5
...
...
@@ -26,6 +26,7 @@
#include <pfs_global.h>
#include <string.h>
#include "aligned.h"
#include "assume_aligned.h"
bool
pfs_initialized
=
false
;
size_t
pfs_allocated_memory_size
=
0
;
...
...
@@ -47,9 +48,10 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf)
if
(
--
stub_alloc_fails_after_count
<=
0
)
return
NULL
;
size
=
MY_ALIGN
(
size
,
CPU_LEVEL1_DCACHE_LINESIZE
);
void
*
ptr
=
aligned_malloc
(
size
,
CPU_LEVEL1_DCACHE_LINESIZE
);
if
(
ptr
!=
NULL
)
memset
(
ptr
,
0
,
size
);
memset
_aligned
<
CPU_LEVEL1_DCACHE_LINESIZE
>
(
ptr
,
0
,
size
);
return
ptr
;
}
...
...
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