Compare commits

...

21 Commits

Author SHA1 Message Date
drrtuy
d5580feab7 New getter to read Engine Independent JSON histogram buckets directly
This would allow Columnstore to leverage EI data in its cost-based and rewrite optimizer parts
2025-06-12 22:15:54 +01:00
Vladislav Vaintroub
9bf0492b7d MDEV-36904 Improve runtime dependency packaging on Windows
Background:
In MDEV-33474, we introduced runtime dependency packaging primarily to
support libcurl and other potential third-party dependencies from vcpkg.

Problem:
The INSTALL(RUNTIME_DEPENDENCY_SET) command was failing at packaging step
unless shared libraries from the same build were explicitly excluded via
PRE_EXCLUDE_REGEXES. While initially only server.dll was excluded this way,
this turned out insufficient for users compiling their own plugins

Solution:
Exclude all linked shared libraries from the same build via
PRE_EXCLUDE_REGEXES. Move dependency detection and install to the end of
CMake processing, after all add_library/add_executable calls, when all
targets are known.

Also made the INSTALL_RUNTIME_DEPENDENCIES variable independent of vcpkg
detection, for simplicity.
2025-06-10 13:23:54 +02:00
Vladislav Vaintroub
8c6cbb3360 MDEV-25870 followup : pmull support on Windows ARM64
casting vmull_p64 is possible on MSVC, although with much more
verbose code. The reason are missing neon types (no compiler support for
128bit ints).
2025-05-30 18:33:10 +02:00
Vladislav Vaintroub
fe10645eb7 MDEV-26713 post-fix: don't run charset_client_win_utf8mb4.test in parallel mtr
chcp command affects console codepage, console is shared among all mtr
processes.
2025-05-27 10:24:58 +02:00
Vladislav Vaintroub
aaccf99fdb MDEV-36885 Windows/ARM64 - build and test on CI
Add corresponding workflow for Github Actions.
2025-05-26 23:07:57 +03:00
Vladislav Vaintroub
d665810cf0 Windows/ARM64 - fix build with clang-cl 2025-05-26 12:40:30 +02:00
Vladislav Vaintroub
be48b3ee59 Fix mariadb-upgrade-service crash on Windows/ARM64
Properly align stack buffer struct alignment
Fixes crash on Windows with clang/ARM64
2025-05-26 12:02:50 +02:00
Vladislav Vaintroub
4af231b1d1 Windows/ARM64 - workaround compiler bug
Follow-up 9e1c1d429f51042

Item_func_hybrid_field_type::val_real_from_int_op() might return wrong
result. This makes mtr fail on Windows/ARM , at least in main.func_format
and main.sp-vars

Many to Chengya/coneco-cy  for debugging the issue and finding the cause.
2025-05-26 12:02:04 +02:00
Vladislav Vaintroub
59ee33e14e MDEV-32189 follow-up: Properly initialize UErrorCode for ucal_getDefaultTimeZone()
Initialize UErrorCode to U_ZERO_ERROR before passing it to
ucal_getDefaultTimeZone(), as required by the ICU conventions.

Passing an uninitialized status variable  leads to undefined behavior and
non-deterministic failures.

This issue was not observed on x64 builds, but appeared during
Windows/ARM64 CI testing. The lack of initialization led to
inconsistent fallback between ICU and  native Windows time zone.

mtr tests with restarts showed the alternation of system_time_zone,
as reported by check_testcase after the test.

-SYSTEM_TIME_ZONE	Coordinated Universal Time
+SYSTEM_TIME_ZONE	Etc/UTC
2025-05-26 11:59:59 +02:00
chengya
9e1c1d429f crc32 compatibility on Windows on ARM64 2025-05-23 10:03:15 +03:00
Daniel Bartholomew
6c6941c9ba
bump the VERSION 2025-05-22 10:25:29 -04:00
Marko Mäkelä
118cfcf821 Merge 10.11 into 11.4 2025-05-13 13:44:58 +03:00
Marko Mäkelä
f5b5de9cf9 bump the VERSION 2025-05-13 13:43:53 +03:00
Marko Mäkelä
8fb09426b9 MDEV-36759: Huge performance drop
In commit b6923420f326ac030e4f3ef89a2acddb45eccb30 (MDEV-29445)
some hash tables were accidentally created with the minimum size
(101 entries) instead of correctly deriving the size from the
initial innodb_buffer_pool_size. This led to very long hash bucket
chains, which are very slow to traverse.

ut_find_prime(): Assert that the size is nonzero in order to catch
this type of regression in the future.

innodb_init_params(): Do not bother reading buf_pool.curr_size()
when it is known to be 0,

srv_start(): Correctly initialize srv_lock_table_size to 5 times
buf_pool.curr_size(), that is, the buffer pool size in pages,
between invoking buf_pool.create() and lock_sys.create().

btr_search_enable(), dict_sys_t::create(), dict_sys_t::resize():
Correctly refer to buf_pool.curr_pool_size(), that is,
innodb_buffer_pool_size in bytes, when calculating the hash table size.
In MDEV-29445 the expressions buf_pool_get_curr_size() were
accidentally replaced with buf_pool.curr_size().
2025-05-13 12:27:50 +03:00
Marko Mäkelä
bb48d7bc81 MDEV-36781: Assertion i < BUF_BUDDY_SIZES failed in buf_buddy_shrink()
buf_buddy_shrink(): Properly cover the case when KEY_BLOCK_SIZE
corresponds to the innodb_page_size, that is, the ROW_FORMAT=COMPRESSED
page frame is directly allocated from the buffer pool, not via the
binary buddy allocator.

buf_LRU_check_size_of_non_data_objects(): Avoid a crash when the
buffer pool is being shrunk.

buf_pool_t::shrink(): Abort if over 95% of the shrunk buffer pool
would be occupied by the adaptive hash index or record locks.
2025-05-13 12:27:46 +03:00
Marko Mäkelä
56e0be34bc MDEV-36780: InnoDB buffer pool reserves all assigned memory
In commit b6923420f326ac030e4f3ef89a2acddb45eccb30 (MDEV-29445)
we started to specify the MAP_POPULATE flag for allocating the
InnoDB buffer pool. This would cause a lot of time to be spent
on __mm_populate() inside the Linux kernel, such as 16 seconds
to pre-fault or commit innodb_buffer_pool_size=64G.

Let us revert to the previous way of allocating the buffer pool
at startup. Note: An attempt to increase the buffer pool size by
SET GLOBAL innodb_buffer_pool_size (up to innodb_buffer_pool_size_max)
will invoke my_virtual_mem_commit(), which will use MAP_POPULATE
to zero-fill and prefault the requested additional memory area, blocking
buf_pool.mutex.

Before MDEV-29445 we allocated the InnoDB buffer pool by invoking
mmap(2) once (via my_large_malloc()). After the change, we would
invoke mmap(2) twice, first via my_virtual_mem_reserve() and then
via my_virtual_mem_commit(). Outside Microsoft Windows, we are
reverting back to my_large_malloc() like allocation.

my_virtual_mem_reserve(): Define only for Microsoft Windows.
Other platforms should invoke my_large_virtual_alloc() and
update_malloc_size() instead of my_virtual_mem_reserve() and
my_virtual_mem_commit().

my_large_virtual_alloc(): Define only outside Microsoft Windows.
Do not specify MAP_NORESERVE nor MAP_POPULATE, to preserve compatibility
with my_large_malloc(). Were MAP_POPULATE specified, the mmap()
system call would be significantly slower, for example 18 seconds
to reserve 64 GiB upfront.
2025-05-13 12:27:42 +03:00
Marko Mäkelä
0c18e5a292 MDEV-36760 log_t::append_prepare_wait(): Bogus assertion on write_lsn
log_t::append_prepare_wait(): Do not attempt to read log_sys.write_lsn
because it is not protected by log_sys.latch but by write_lock, which
we cannot hold here. The assertion could fail if log_t::write_buf()
is executing concurrently, and it has not yet executed log_write_buf()
or updated log_sys.write_lsn.

Fixes up commit acd071f599f416ddb4821dec485c4d912844213f (MDEV-21923)
2025-05-13 12:27:41 +03:00
Brandon Nesterenko
a7278a3024 MDEV-36663: Testcase Fixup
There were two issues with the test:

 1. A race between a race_condition.inc and status variable, where the
    status variable Rpl_semi_sync_master_status could be ON before the
    semi-sync connection finished establishing, resulting in
    Rpl_semi_sync_master_clients showing 0 (instead of 1). To fix this,
    we simply instead wait for Rpl_semi_sync_master_clients to be 1
    before proceeding.

 2. Another race between a race_condition.inc and status variable,
    where the wait_condition waited on a process_list command of
    'BINLOG DUMP' to disappear to infer the binlog dump thread was
    killed, to where we then verified semi-sync state was correct
    using status variables. However, the 'BINLOG DUMP' command is
    overridden with a killed status before the semi-sync tear-down
    happens, and thereby we could see invalid values. The fix for
    this is to change the wait_condition to instead wait for the
    connection with the replication user is gone, because that stays
    through the binlog dump thread tear-down life-cycle
2025-05-13 12:27:41 +03:00
Marko Mäkelä
791fcea1d7 bump the VERSION 2025-05-13 12:27:36 +03:00
Daniel Black
da5a4d05b9 MDEV-35850 make HOSTNAME a cmake configure variable
As seen with openwrt and some other distros, the
determination of hostname can sometime need alternate
commmands.

This provides a cmake option HOSTNAME for non-windows machines
for the mariadb-install-db and mariadbd-safe scripts
and the support-files init scripts..
2025-05-01 18:09:45 +10:00
bsrikanth-mariadb
c94133a71d MDEV-21510: In Optimizer Trace, print index name in chosen_access_method 2025-04-27 22:16:17 -04:00
38 changed files with 322 additions and 165 deletions

51
.github/workflows/windows-arm64.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Build on Windows ARM64
on:
push:
branches:
- 'main'
- 'bb-*'
- '[0-9]+.[0-9]+'
- '*wlad*'
pull_request:
jobs:
build:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: windows-11-arm
steps:
- name: Configure git
run: |
# We won't be able to successfully run mtr
# unless we configure autocrlf.
git config --global core.autocrlf input
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
# Install bison to compile
choco install winflexbison3
- name: Build
run: |
# speedup checkout by excluding uninteresting modules
git config submodule.storage/columnstore/columnstore.update none
git config submodule.storage/maria/libmarias3.update none
git config submodule.storage/rocksdb/rocksdb.update none
git config submodule.wsrep-lib.update none
mkdir bld
cd bld
cmake .. -DWITH_SSL=bundled
cmake --build . --config RelWithDebinfo --verbose -- -m
- name: Test MTR
run: |
$env:PATH = "C:\Strawberry\perl\bin;$env:PATH;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64"
#Calculate parallel as 4 * number of processors
$parallel = 4 * [int]$env:NUMBER_OF_PROCESSORS
perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main --mysqld=--loose-innodb-flush-log-at-trx-commit=2

View File

@ -126,15 +126,7 @@ ENDIF()
FIND_PACKAGE(Git)
IF(WIN32 AND (CMAKE_VERSION VERSION_GREATER "3.21"))
# Install runtime dependency by default, when using vcpkg
IF(NOT DEFINED INSTALL_RUNTIME_DEPENDENCIES_DEFAULT)
IF("${VCPKG_INSTALLED_DIR}")
SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT OFF)
ELSE()
SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT ON)
ENDIF()
ENDIF()
OPTION(INSTALL_RUNTIME_DEPENDENCIES "Install runtime dependencies" "${INSTALL_RUNTIME_DEPENDENCIES_DEFAULT}")
OPTION(INSTALL_RUNTIME_DEPENDENCIES "Install runtime dependencies" ON)
ENDIF()
# Following autotools tradition, add preprocessor definitions
@ -379,6 +371,7 @@ IF(WIN32)
ELSE()
SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
SET(SHAREDIR ${INSTALL_MYSQLSHAREDIRABS})
SET(HOSTNAME "uname -n" CACHE STRING "Command for determining hostname")
ENDIF()
SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
@ -595,6 +588,7 @@ ENDIF()
INCLUDE(build_depends)
INSTALL_RUNTIME_DEPS()
INCLUDE(CPack)
IF(WIN32 AND SIGNCODE)

View File

@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=11
MYSQL_VERSION_MINOR=4
MYSQL_VERSION_PATCH=6
MYSQL_VERSION_PATCH=8
SERVER_MATURITY=stable

View File

@ -228,26 +228,58 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
IF(SIGNCODE)
SIGN_TARGET(${target} ${COMP})
ENDIF()
IF(INSTALL_RUNTIME_DEPENDENCIES)
# Populate INSTALLED_TARGETS list (stored as global property)
# The list is used in INSTALL_RUNTIME_DEPS
GET_PROPERTY(installed_targets GLOBAL PROPERTY INSTALLED_TARGETS)
IF(NOT installed_targets)
SET(installed_targets)
ENDIF()
LIST(APPEND installed_targets "${target}")
SET_PROPERTY(GLOBAL PROPERTY INSTALLED_TARGETS "${installed_targets}")
SET(RUNTIME_DEPS RUNTIME_DEPENDENCY_SET ${target})
ENDIF()
INSTALL(TARGETS ${target} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS})
INSTALL_DEBUG_SYMBOLS(${target} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION})
ENDFOREACH()
ENDFUNCTION()
IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
STRING(JOIN "." runtime_deps_set_name ${TARGETS})
SET(RUNTIME_DEPS RUNTIME_DEPENDENCY_SET "${runtime_deps_set_name}")
# On Windows, installs runtime dependency for all targets
FUNCTION(INSTALL_RUNTIME_DEPS)
IF(NOT WIN32 OR NOT INSTALL_RUNTIME_DEPENDENCIES)
RETURN()
ENDIF()
# Install all runtime dependencies
INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS})
INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION})
GET_PROPERTY(installed_targets GLOBAL PROPERTY INSTALLED_TARGETS)
# Exclude all dependencies that are shared libraries from the
# same build.
FOREACH(tgt ${installed_targets})
SET(exclude_libs)
GET_TARGET_PROPERTY(link_libraries ${tgt} LINK_LIBRARIES)
IF(link_libraries)
FOREACH(lib ${link_libraries})
IF(TARGET ${lib})
GET_TARGET_PROPERTY(type ${lib} TYPE)
IF(type MATCHES "SHARED")
LIST(APPEND exclude_libs "$<TARGET_FILE_BASE_NAME:${lib}>\\.dll")
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
INSTALL(
RUNTIME_DEPENDENCY_SET
"${runtime_deps_set_name}"
${tgt}
COMPONENT RuntimeDeps
DESTINATION ${INSTALL_BINDIR}
PRE_EXCLUDE_REGEXES
"api-ms-" # Windows stuff
"ext-ms-"
"server\\.dll" # main server DLL, installed separately
"icuuc\\.dll" # Old Windows 10 (1809)
"icuin\\.dll"
${exclude_libs}
"clang_rt" # ASAN libraries
"vcruntime"
POST_EXCLUDE_REGEXES
@ -257,7 +289,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin
$<$<CONFIG:Debug>:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin>
)
ENDIF()
ENDFOREACH()
ENDFUNCTION()
# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir

View File

@ -174,10 +174,9 @@ if(MSVC)
-Wno-unused-local-typedef
-Wno-microsoft-static-assert
-Wno-c++17-extensions
-msse4.2
)
if((CMAKE_SIZEOF_VOID_P MATCHES 8) AND MSVC_INTEL)
add_compile_options(-mpclmul)
add_compile_options(-mpclmul -msse4.2)
endif()
endif()

View File

@ -178,7 +178,9 @@ extern my_bool my_use_large_pages;
int my_init_large_pages(void);
uchar *my_large_malloc(size_t *size, myf my_flags);
#if defined _WIN32 || defined HAVE_MMAP
#ifdef _WIN32
/* On Windows, use my_virtual_mem_reserve() and my_virtual_mem_commit(). */
#else
char *my_large_virtual_alloc(size_t *size);
#endif
void my_large_free(void *ptr, size_t size);

View File

@ -24,7 +24,9 @@
extern "C" {
#endif
# ifdef _WIN32
char *my_virtual_mem_reserve(size_t *size);
# endif
char *my_virtual_mem_commit(char *ptr, size_t size);
void my_virtual_mem_decommit(char *ptr, size_t size);
void my_virtual_mem_release(char *ptr, size_t size);

View File

@ -1,5 +1,11 @@
--source include/windows.inc
--source include/check_utf8_cli.inc
if(!`select $MTR_PARALLEL = 1`)
{
skip race condition with parallel tests;
}
--exec $MYSQL --default-character-set=auto -e "select @@character_set_client"
# Test that a user with old, non-UTF8 password can still connect

View File

@ -1285,6 +1285,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
],
"chosen_access_method": {
"type": "ref",
"index": "a",
"rows_read": 1,
"rows_out": 1,
"cost": 0.1821659,
@ -1340,6 +1341,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
],
"chosen_access_method": {
"type": "ref",
"index": "a",
"rows_read": 1,
"rows_out": 1,
"cost": 0.1821659,
@ -2533,6 +2535,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
],
"chosen_access_method": {
"type": "ref",
"index": "a_b",
"rows_read": 41,
"rows_out": 41,
"cost": 0.051379171,
@ -3012,6 +3015,7 @@ explain select * from t1 left join t2 on t2.a=t1.a {
],
"chosen_access_method": {
"type": "eq_ref",
"index": "PRIMARY",
"rows_read": 1,
"rows_out": 1,
"cost": 0.007120904,
@ -3980,6 +3984,7 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
],
"chosen_access_method": {
"type": "ref",
"index": "pk_a_b",
"rows_read": 1,
"rows_out": 1,
"cost": 0.000928812,
@ -4676,6 +4681,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
],
"chosen_access_method": {
"type": "range",
"index": "a",
"rows_read": 3,
"rows_out": 3,
"cost": 0.001755494,
@ -4702,6 +4708,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
],
"chosen_access_method": {
"type": "range",
"index": "a",
"rows_read": 3,
"rows_out": 3,
"cost": 0.001755494,
@ -4744,6 +4751,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
],
"chosen_access_method": {
"type": "ref",
"index": "a",
"rows_read": 1,
"rows_out": 1,
"cost": 0.002376836,
@ -4795,6 +4803,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
],
"chosen_access_method": {
"type": "ref",
"index": "a",
"rows_read": 1.166666667,
"rows_out": 1.166666667,
"cost": 0.002392836,
@ -11275,6 +11284,7 @@ JS
"chosen_access_method":
{
"type": "ref",
"index": "b",
"rows_read": 1,
"rows_out": 1,
"cost": 0.01901531,
@ -11521,6 +11531,7 @@ JS
"chosen_access_method":
{
"type": "ref",
"index": "a",
"rows_read": 1,
"rows_out": 1,
"cost": 0.01840091,
@ -12906,6 +12917,7 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"chosen_access_method":
{
"type": "ref",
"index": "idx_a",
"rows_read": 1.8367,
"rows_out": 1.8367,
"cost": 0.002051185,
@ -13201,6 +13213,7 @@ explain select * from t1 where a<10 and b between 10 and 50 and c < 10 {
],
"chosen_access_method": {
"type": "range",
"index": "a",
"rows_read": 0.189,
"rows_out": 0.017766,
"cost": 0.006364199,

View File

@ -227,6 +227,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
],
"chosen_access_method": {
"type": "ref",
"index": "key1",
"rows_read": 1,
"rows_out": 1,
"cost": 0.00345856,

View File

@ -186,6 +186,7 @@ JS
"chosen_access_method":
{
"type": "ref",
"index": "a",
"rows_read": 6,
"rows_out": 0.6,
"cost": 0.005388489,

View File

@ -298,6 +298,7 @@ JS
"chosen_access_method":
{
"type": "range",
"index": "PRIMARY",
"rows_read": 5,
"rows_out": 2.490196078,
"cost": 0.00948507,

View File

@ -293,6 +293,7 @@ JS
"chosen_access_method":
{
"type": "range",
"index": "PRIMARY",
"rows_read": 5,
"rows_out": 2.490196078,
"cost": 0.010014472,

View File

@ -12,12 +12,19 @@ select @@innodb_buffer_pool_size;
10485760
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
count(val)
262144
select count(val) from t2;
count(val)
16384
set global innodb_adaptive_hash_index=OFF;
set global innodb_buffer_pool_size = 24117248;
set global innodb_buffer_pool_size = 26214400;
@ -29,7 +36,10 @@ select @@innodb_buffer_pool_size;
select count(val) from t1;
count(val)
262144
drop table t1;
select count(val) from t2;
count(val)
16384
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;

View File

@ -21,6 +21,7 @@ set global innodb_buffer_pool_size = 9437184;
set global innodb_buffer_pool_size = 10485760;
select @@innodb_buffer_pool_size;
let $kbs=`SELECT CAST(@@innodb_page_size / 1024 AS INT)`;
# fill buffer pool
--disable_query_log
@ -29,9 +30,13 @@ SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
evalp create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
@ -42,6 +47,7 @@ SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
select count(val) from t2;
set global innodb_adaptive_hash_index=OFF;
@ -52,8 +58,9 @@ set global innodb_buffer_pool_size = 26214400;
select @@innodb_buffer_pool_size;
select count(val) from t1;
select count(val) from t2;
drop table t1;
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
@ -66,8 +73,6 @@ SELECT variable_value = 0
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
--source include/wait_condition.inc
# this may occasionally be aborted on a heavily loaded builder
--error 0,ER_WRONG_USAGE
SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
SET GLOBAL innodb_max_dirty_pages_pct = @save_pct;

View File

@ -49,8 +49,8 @@ SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
--connection master
--echo # Verify Semi-Sync is active
--let $status_var= Rpl_semi_sync_master_status
--let $status_var_value= ON
--let $status_var= Rpl_semi_sync_master_clients
--let $status_var_value= 1
--source include/wait_for_status_var.inc
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
@ -67,7 +67,7 @@ STOP SLAVE;
--echo # MDEV-36663: Verifying dump thread connection is killed..
# Prior to MDEV-36663 fixes, this would time out and
# Rpl_semi_sync_master_clients would remain 1.
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump'
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE USER = 'replssl'
--source include/wait_condition.inc
--let $n_master_clients= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_master_clients', Value, 1)

View File

@ -68,7 +68,14 @@ IF(MSVC_INTEL)
ENDIF()
ELSEIF(MSVC_ARM64)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_arm64.c)
ADD_DEFINITIONS(-DHAVE_ARMV8_CRC -DHAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
ADD_DEFINITIONS(-DHAVE_ARMV8_CRC -DHAVE_ARMV8_CRC_CRYPTO_INTRINSICS -DHAVE_ARMV8_CRYPTO)
IF(CLANG_CL)
SET_SOURCE_FILES_PROPERTIES(
crc32/crc32_arm64.c
PROPERTIES
COMPILE_FLAGS "-march=armv8-a+crc+crypto"
)
ENDIF()
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686")
SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c crc32/crc32c_x86.cc)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5")

View File

@ -4,31 +4,40 @@
#include <stddef.h>
typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t);
unsigned crc32_aarch64(unsigned, const void *, size_t);
#ifdef HAVE_ARMV8_CRC
#ifdef _WIN32
#include <windows.h>
# ifdef HAVE_ARMV8_CRYPTO
static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t);
# endif
# ifdef _WIN32
# include <windows.h>
# ifdef __clang__
# include <arm_acle.h>
# include <arm_neon.h>
# endif
int crc32_aarch64_available(void)
{
return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
}
const char *crc32c_aarch64_available(void)
unsigned crc32c_aarch64(unsigned, const void *, size_t);
my_crc32_t crc32c_aarch64_available(void)
{
if (crc32_aarch64_available() == 0)
return NULL;
/* TODO : pmull seems supported, but does not compile*/
return "Using ARMv8 crc32 instructions";
if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE))
return crc32c_aarch64_pmull;
return crc32c_aarch64;
}
#endif /* _WIN32 */
#ifdef HAVE_ARMV8_CRYPTO
static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t);
# endif
# ifdef __APPLE__
# include <sys/sysctl.h>
# else /* _WIN32 */
# ifdef __APPLE__
# include <sys/sysctl.h>
int crc32_aarch64_available(void)
{
@ -41,16 +50,16 @@ int crc32_aarch64_available(void)
my_crc32_t crc32c_aarch64_available(void)
{
# ifdef HAVE_ARMV8_CRYPTO
# ifdef HAVE_ARMV8_CRYPTO
if (crc32_aarch64_available())
return crc32c_aarch64_pmull;
# endif
# endif
return NULL;
}
# else /* __APPLE__ */
# include <sys/auxv.h>
# ifdef __FreeBSD__
# else /* __APPLE__ */
# include <sys/auxv.h>
# ifdef __FreeBSD__
static unsigned long getauxval(unsigned int key)
{
unsigned long val;
@ -58,17 +67,17 @@ static unsigned long getauxval(unsigned int key)
return 0ul;
return val;
}
# else
# include <asm/hwcap.h>
# endif
# else
# include <asm/hwcap.h>
# endif
# ifndef HWCAP_CRC32
# define HWCAP_CRC32 (1 << 7)
# endif
# ifndef HWCAP_CRC32
# define HWCAP_CRC32 (1 << 7)
# endif
# ifndef HWCAP_PMULL
# define HWCAP_PMULL (1 << 4)
# endif
# ifndef HWCAP_PMULL
# define HWCAP_PMULL (1 << 4)
# endif
/* ARM made crc32 default from ARMv8.1 but optional in ARMv8A
* Runtime check API.
@ -78,9 +87,9 @@ int crc32_aarch64_available(void)
unsigned long auxv= getauxval(AT_HWCAP);
return (auxv & HWCAP_CRC32) != 0;
}
# endif /* __APPLE__ */
# endif /* __APPLE__ */
# ifndef __APPLE__
# ifndef __APPLE__
static unsigned crc32c_aarch64(unsigned, const void *, size_t);
my_crc32_t crc32c_aarch64_available(void)
@ -88,14 +97,15 @@ my_crc32_t crc32c_aarch64_available(void)
unsigned long auxv= getauxval(AT_HWCAP);
if (!(auxv & HWCAP_CRC32))
return NULL;
# ifdef HAVE_ARMV8_CRYPTO
# ifdef HAVE_ARMV8_CRYPTO
/* Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030). */
if (auxv & HWCAP_PMULL)
return crc32c_aarch64_pmull;
# endif
# endif
return crc32c_aarch64;
}
# endif /* __APPLE__ */
# endif /* __APPLE__ */
# endif /* _WIN32 */
const char *crc32c_aarch64_impl(my_crc32_t c)
{
@ -173,11 +183,19 @@ asm(".arch_extension crypto");
CRC32C3X8(buffer, ((ITR) * 7 + 6)) \
} while(0)
#if defined _MSC_VER && !defined __clang__
#define PREF4X64L1(buffer, offset, itr)\
__prefetch(buffer + (offset) + ((itr) + 0)*64);\
__prefetch(buffer + (offset) + ((itr) + 1)*64);\
__prefetch(buffer + (offset) + ((itr) + 2)*64);\
__prefetch(buffer + (offset) + ((itr) + 3)*64);
#else
#define PREF4X64L1(buffer, PREF_OFFSET, ITR) \
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64));
#endif
#define PREF1KL1(buffer, PREF_OFFSET) \
PREF4X64L1(buffer,(PREF_OFFSET), 0) \
@ -185,11 +203,20 @@ asm(".arch_extension crypto");
PREF4X64L1(buffer,(PREF_OFFSET), 8) \
PREF4X64L1(buffer,(PREF_OFFSET), 12)
#if defined _MSC_VER && !defined __clang__
#define MY_PLDL2KEEP 2 /* PLDL2KEEP is 2 in ARMv8 */
#define PREF4X64L2(buffer,offset,itr)\
__prefetch2(buffer + offset + ((itr) + 0) * 64, MY_PLDL2KEEP);\
__prefetch2(buffer + offset + ((itr) + 1) * 64, MY_PLDL2KEEP);\
__prefetch2(buffer + offset + ((itr) + 2) * 64, MY_PLDL2KEEP);\
__prefetch2(buffer + offset + ((itr) + 3) * 64, MY_PLDL2KEEP);
#else
#define PREF4X64L2(buffer, PREF_OFFSET, ITR) \
__asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\
__asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\
__asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\
__asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64));
#endif
#define PREF1KL2(buffer, PREF_OFFSET) \
PREF4X64L2(buffer,(PREF_OFFSET), 0) \
@ -232,6 +259,16 @@ static unsigned crc32c_aarch64(unsigned crc, const void *buf, size_t len)
#endif
#ifdef HAVE_ARMV8_CRYPTO
static inline uint64_t poly_mul(uint64_t a, uint64_t b)
{
#if defined _MSC_VER && !defined __clang__
return vgetq_lane_u64(vreinterpretq_u64_p128(neon_pmull_64(vcreate_p64(a), vcreate_p64(b))),0);
#else
return (uint64_t) vmull_p64(a, b);
#endif
}
static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len)
{
int64_t length= (int64_t)len;
@ -278,8 +315,8 @@ static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len)
* crc1 multiply by K2
* crc0 multiply by K1
*/
t1= (uint64_t)vmull_p64(crc1, k2);
t0= (uint64_t)vmull_p64(crc0, k1);
t1= poly_mul(crc1, k2);
t0= poly_mul(crc0, k1);
crc= __crc32cd(crc2, *(const uint64_t *)buffer);
crc1= __crc32cd(0, t1);
crc^= crc1;
@ -370,7 +407,7 @@ static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len)
/* There are multiple approaches to calculate crc.
Approach-1: Process 8 bytes then 4 bytes then 2 bytes and then 1 bytes
Approach-2: Process 8 bytes and remaining workload using 1 bytes
Apporach-3: Process 64 bytes at once by issuing 8 crc call and remaining
Approach-3: Process 64 bytes at once by issuing 8 crc call and remaining
using 8/1 combination.
Based on micro-benchmark testing we found that Approach-2 works best especially

View File

@ -423,7 +423,7 @@ uchar *my_large_malloc(size_t *size, myf my_flags)
DBUG_RETURN(ptr);
}
#ifdef _WIN32
#ifndef _WIN32
/**
Special large pages allocator, with possibility to commit to allocating
more memory later.
@ -434,37 +434,10 @@ char *my_large_virtual_alloc(size_t *size)
char *ptr;
DBUG_ENTER("my_large_virtual_alloc");
if (my_use_large_pages)
{
size_t s= *size;
s= MY_ALIGN(s, (size_t) my_large_page_size);
ptr= VirtualAlloc(NULL, s, MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES,
PAGE_READWRITE);
if (ptr)
{
*size= s;
DBUG_RETURN(ptr);
}
}
DBUG_RETURN(VirtualAlloc(NULL, *size, MEM_RESERVE, PAGE_READWRITE));
}
#elif defined HAVE_MMAP
/**
Special large pages allocator, with possibility to commit to allocating
more memory later.
Every implementation returns a zero filled buffer here.
*/
char *my_large_mmap(size_t *size, int prot)
{
char *ptr;
DBUG_ENTER("my_large_virtual_alloc");
if (my_use_large_pages)
{
size_t large_page_size;
int page_i= 0;
prot= PROT_READ | PROT_WRITE;
while ((large_page_size= my_next_large_page_size(*size, &page_i)) != 0)
{
@ -488,7 +461,7 @@ char *my_large_mmap(size_t *size, int prot)
OS_MAP_ANON;
size_t aligned_size= MY_ALIGN(*size, (size_t) large_page_size);
ptr= mmap(NULL, aligned_size, prot, mapflag, -1, 0);
ptr= mmap(NULL, aligned_size, PROT_READ | PROT_WRITE, mapflag, -1, 0);
if (ptr == (void*) -1)
{
ptr= NULL;
@ -511,10 +484,7 @@ char *my_large_mmap(size_t *size, int prot)
}
}
ptr= mmap(NULL, *size, prot,
# ifdef MAP_NORESERVE
MAP_NORESERVE |
# endif
ptr= mmap(NULL, *size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | OS_MAP_ANON, -1, 0);
if (ptr == MAP_FAILED)
{
@ -524,16 +494,6 @@ char *my_large_mmap(size_t *size, int prot)
DBUG_RETURN(ptr);
}
/**
Special large pages allocator, with possibility to commit to allocating
more memory later.
Every implementation returns a zero filled buffer here.
*/
char *my_large_virtual_alloc(size_t *size)
{
return my_large_mmap(size, PROT_READ | PROT_WRITE);
}
#endif
/**

View File

@ -159,7 +159,7 @@ extern "C" void my_tzname(char* sys_timezone, size_t size)
{
/* TZ environment variable not set - return default timezone name*/
UChar default_tzname[MAX_TIMEZONE_LEN];
UErrorCode ec;
UErrorCode ec= U_ZERO_ERROR;
int32_t len=
ucal_getDefaultTimeZone(default_tzname, MAX_TIMEZONE_LEN, &ec);
if (U_SUCCESS(ec))

View File

@ -34,13 +34,9 @@
We try to respect use_large_pages setting, on Windows and Linux
*/
#ifndef _WIN32
char *my_large_mmap(size_t *size, int prot);
#endif
#ifdef _WIN32
char *my_virtual_mem_reserve(size_t *size)
{
#ifdef _WIN32
DWORD flags= my_use_large_pages
? MEM_LARGE_PAGES | MEM_RESERVE | MEM_COMMIT
: MEM_RESERVE;
@ -53,10 +49,8 @@ char *my_virtual_mem_reserve(size_t *size)
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), *size);
}
return ptr;
#else
return my_large_mmap(size, PROT_NONE);
#endif
}
#endif
#if defined _WIN32 && !defined DBUG_OFF
static my_bool is_memory_committed(char *ptr, size_t size)
@ -88,7 +82,7 @@ char *my_virtual_mem_commit(char *ptr, size_t size)
}
#else
if (my_use_large_pages)
/* my_large_mmap() already created a read/write mapping. */;
/* my_large_virtual_alloc() already created a read/write mapping. */;
else
{
# ifdef _AIX

View File

@ -177,7 +177,6 @@ ELSE()
SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null")
ENDIF()
SET(HOSTNAME "uname -n")
SET(MYSQLD_USER "mysql")
SET(MYSQLD_GROUP "mysql")
ENDIF(UNIX)

View File

@ -843,12 +843,22 @@ String *Item_func_hybrid_field_type::val_str_from_int_op(String *str)
return str;
}
#ifdef _M_ARM64
/* MSVC on ARM incorrectly optimizes the code in val_real_from_int_op() */
#pragma optimize("", off)
#endif
double Item_func_hybrid_field_type::val_real_from_int_op()
{
longlong result= int_op();
return unsigned_flag ? (double) ((ulonglong) result) : (double) result;
}
#ifdef _M_ARM64
#pragma optimize("", on)
#endif
my_decimal *
Item_func_hybrid_field_type::val_decimal_from_int_op(my_decimal *dec)
{

View File

@ -343,7 +343,7 @@ static void get_service_config()
if (!service)
die("OpenService failed with %u", GetLastError());
BYTE config_buffer[8 * 1024];
alignas(QUERY_SERVICE_CONFIGW) BYTE config_buffer[8 * 1024];
LPQUERY_SERVICE_CONFIGW config = (LPQUERY_SERVICE_CONFIGW)config_buffer;
DWORD size = sizeof(config_buffer);
DWORD needed;

View File

@ -71,21 +71,7 @@ class Histogram_json_hb final : public Histogram_base
/* Collection-time only: collected histogram in the JSON form. */
std::string json_text;
struct Bucket
{
// The left endpoint in KeyTupleFormat. The endpoint is inclusive, this
// value is in this bucket.
std::string start_value;
// Cumulative fraction: The fraction of table rows that fall into this
// and preceding buckets.
double cum_fract;
// Number of distinct values in the bucket.
longlong ndv;
};
std::vector<Bucket> buckets;
std::vector<Histogram_bucket> buckets;
std::string last_bucket_end_endp;
@ -129,6 +115,11 @@ public:
double range_selectivity(Field *field, key_range *min_endp,
key_range *max_endp, double avg_sel) override;
std::vector<Histogram_bucket> get_histogram() override
{
return buckets;
}
void set_json_text(ulonglong sz, const char *json_text_arg,
size_t json_text_len)
{

View File

@ -712,12 +712,25 @@ void print_best_access_for_table(THD *thd, POSITION *pos)
DBUG_ASSERT(thd->trace_started());
Json_writer_object obj(thd, "chosen_access_method");
obj.
add("type", pos->type == JT_ALL ? "scan" : join_type_str[pos->type]).
add("rows_read", pos->records_read).
add("rows_out", pos->records_out).
add("cost", pos->read_time).
add("uses_join_buffering", pos->use_join_buffer);
obj.add("type", pos->type == JT_ALL ? "scan" : join_type_str[pos->type]);
if (pos->type == JT_EQ_REF || pos->type == JT_REF || pos->type == JT_FT)
{
obj.add("index", pos->key->table->key_info[pos->key->key].name);
}
if (pos->type == JT_RANGE)
{
obj.add("index",
pos->table->table->key_info[pos->table->quick->index].name);
}
obj.add("rows_read", pos->records_read)
.add("rows_out", pos->records_out)
.add("cost", pos->read_time)
.add("uses_join_buffering", pos->use_join_buffer);
if (pos->range_rowid_filter_info)
{
uint key_no= pos->range_rowid_filter_info->get_key_no();

View File

@ -152,6 +152,19 @@ bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table);
bool is_eits_usable(Field* field);
class Histogram_builder;
struct Histogram_bucket
{
// The left endpoint in KeyTupleFormat. The endpoint is inclusive, this
// value is in this bucket.
std::string start_value;
// Cumulative fraction: The fraction of table rows that fall into this
// and preceding buckets.
double cum_fract;
// Number of distinct values in the bucket.
longlong ndv;
};
/*
Common base for all histograms
@ -199,6 +212,8 @@ public:
double avg_sel)=0;
virtual double range_selectivity(Field *field, key_range *min_endp,
key_range *max_endp, double avg_sel)=0;
virtual std::vector<Histogram_bucket> get_histogram()=0;
/*
Legacy: return the size of the histogram on disk.
@ -355,6 +370,11 @@ public:
*/
double point_selectivity(Field *field, key_range *endpoint,
double avg_sel) override;
std::vector<Histogram_bucket> get_histogram() override
{
return {};
}
};

View File

@ -276,7 +276,7 @@ ATTRIBUTE_COLD void btr_search_enable(bool resize)
}
btr_search_x_lock_all();
ulint hash_size = buf_pool.curr_size() / sizeof(void *) / 64;
ulint hash_size = buf_pool.curr_pool_size() / sizeof(void *) / 64;
if (btr_search_sys.parts[0].heap) {
ut_ad(btr_search_enabled);

View File

@ -637,7 +637,7 @@ func_exit:
buf_buddy_add_to_free(reinterpret_cast<buf_buddy_free_t*>(buf), i);
}
/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize().
/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::shrink().
@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page
@param block uncompressed block for storage
@return block
@ -672,10 +672,9 @@ buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept
bpage->zip.data= static_cast<page_zip_t*>(dst);
buf_pool.buddy_stat[i].relocated++;
for (;;)
while (i < BUF_BUDDY_SIZES)
{
MEM_UNDEFINED(src, BUF_BUDDY_LOW << i);
ut_ad(i < BUF_BUDDY_SIZES);
/* Try to combine adjacent blocks. */
buf_buddy_free_t *buddy= reinterpret_cast<buf_buddy_free_t*>
(buf_buddy_get(static_cast<byte*>(src), BUF_BUDDY_LOW << i));
@ -684,20 +683,16 @@ buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept
{
ut_ad(!buf_pool.contains_zip(src, BUF_BUDDY_LOW_SHIFT + i));
buf_buddy_add_to_free(static_cast<buf_buddy_free_t*>(src), i);
break;
return block;
}
/* The buddy is free: recombine */
buf_buddy_remove_from_free(buddy, i);
i++;
src= ut_align_down(src, BUF_BUDDY_LOW << i);
if (i == BUF_BUDDY_SIZES)
{
buf_buddy_block_free(src);
break;
}
}
buf_buddy_block_free(src);
return block;
}

View File

@ -1334,7 +1334,11 @@ bool buf_pool_t::create() noexcept
retry:
{
NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE;
#ifdef _WIN32
memory_unaligned= my_virtual_mem_reserve(&size);
#else
memory_unaligned= my_large_virtual_alloc(&size);
#endif
}
if (!memory_unaligned)
@ -1368,6 +1372,7 @@ bool buf_pool_t::create() noexcept
#ifdef UNIV_PFS_MEMORY
PSI_MEMORY_CALL(memory_alloc)(mem_key_buf_buf_pool, actual_size, &owner);
#endif
#ifdef _WIN32
if (!my_virtual_mem_commit(memory, actual_size))
{
my_virtual_mem_release(memory_unaligned, size_unaligned);
@ -1375,6 +1380,9 @@ bool buf_pool_t::create() noexcept
memory_unaligned= nullptr;
goto oom;
}
#else
update_malloc_size(actual_size, 0);
#endif
#ifdef HAVE_LIBNUMA
if (srv_numa_interleave)
@ -1786,6 +1794,9 @@ ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size)
goto next;
}
if (UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < usable_size() / 20)
return SHRINK_ABORT;
mysql_mutex_lock(&flush_list_mutex);
if (LRU_warned && !UT_LIST_GET_FIRST(free))

View File

@ -276,7 +276,10 @@ static void buf_LRU_check_size_of_non_data_objects() noexcept
auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU);
if (s < curr_size / 20)
if (s >= curr_size / 20);
else if (buf_pool.is_shrinking())
buf_pool.LRU_warn();
else
{
sql_print_error("[FATAL] InnoDB: Over 95 percent of the buffer pool is"
" occupied by lock heaps"

View File

@ -933,7 +933,7 @@ void dict_sys_t::create() noexcept
UT_LIST_INIT(table_LRU, &dict_table_t::table_LRU);
UT_LIST_INIT(table_non_LRU, &dict_table_t::table_LRU);
const ulint hash_size = buf_pool.curr_size()
const ulint hash_size = buf_pool.curr_pool_size()
/ (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE);
table_hash.create(hash_size);
@ -4364,7 +4364,7 @@ void dict_sys_t::resize() noexcept
table_id_hash.free();
temp_id_hash.free();
const ulint hash_size = buf_pool.curr_size()
const ulint hash_size = buf_pool.curr_pool_size()
/ (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE);
table_hash.create(hash_size);
table_id_hash.create(hash_size);

View File

@ -4040,7 +4040,6 @@ skip_buffering_tweak:
srv_use_native_aio= FALSE;
#endif
srv_lock_table_size= 5 * buf_pool.curr_size();
DBUG_RETURN(0);
}

View File

@ -76,7 +76,7 @@ inline void buf_buddy_free(void* buf, ulint size) noexcept
}
ATTRIBUTE_COLD MY_ATTRIBUTE((nonnull, warn_unused_result))
/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize().
/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::shrink().
@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page
@param block uncompressed block for storage
@return block

View File

@ -918,17 +918,16 @@ ATTRIBUTE_COLD void log_t::append_prepare_wait(bool late, bool ex) noexcept
{
got_ex:
const uint64_t l= write_lsn_offset.load(std::memory_order_relaxed);
const lsn_t lsn{base_lsn.load(std::memory_order_relaxed)};
ut_d(lsn_t ll= lsn + (l & (WRITE_BACKOFF - 1)));
ut_ad(is_mmap()
? ll - get_flushed_lsn(std::memory_order_relaxed) < capacity()
: ll - write_lsn - ((write_size - 1) & (write_lsn - first_lsn)) <
buf_size);
const lsn_t lsn= base_lsn.load(std::memory_order_relaxed) +
(l & (WRITE_BACKOFF - 1));
waits++;
#ifdef HAVE_PMEM
const bool is_pmem{is_mmap()};
if (is_pmem)
persist(lsn + (l & (WRITE_BACKOFF - 1)));
{
ut_ad(lsn - get_flushed_lsn(std::memory_order_relaxed) < capacity());
persist(lsn);
}
#endif
latch.wr_unlock();
/* write_buf() or persist() will clear the WRITE_BACKOFF flag,
@ -936,7 +935,7 @@ ATTRIBUTE_COLD void log_t::append_prepare_wait(bool late, bool ex) noexcept
#ifdef HAVE_PMEM
if (!is_pmem)
#endif
log_write_up_to(lsn + (l & (WRITE_BACKOFF - 1)), false);
log_write_up_to(lsn, false);
if (ex)
{
latch.wr_lock(SRW_LOCK_CALL);

View File

@ -1396,7 +1396,7 @@ dberr_t srv_start(bool create_new_db)
log_sys.create();
recv_sys.create();
lock_sys.create(srv_lock_table_size);
lock_sys.create(srv_lock_table_size = 5 * buf_pool.curr_size());
srv_startup_is_before_trx_rollback_phase = true;

View File

@ -48,6 +48,8 @@ ut_find_prime(
ulint pow2;
ulint i;
ut_ad(n);
n += 100;
pow2 = 1;

View File

@ -31,7 +31,6 @@ ELSE()
SET(MYSQLD_USER "mysql")
SET(MYSQLD_GROUP "mysql")
SET(ini_file_extension "cnf")
SET(HOSTNAME "uname -n")
# Define directly here, as cmake/install_layout.cmake has no LOGDIR to be inherited
SET(su_user "su mysql mysql")