Merge branch '10.6' into 10.7

This commit is contained in:
Sergei Golubchik 2021-12-08 10:33:36 +01:00
commit ef77c05126
18 changed files with 391 additions and 81 deletions

View file

@ -23,7 +23,8 @@ macro(restore WHAT)
endmacro() endmacro()
foreach (WHAT SUMMARY DESCRIPTION) foreach (WHAT SUMMARY DESCRIPTION)
if(NOT CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT}) if(CPACK_RPM_PACKAGE_COMPONENT AND
NOT CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT})
message(FATAL_ERROR "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT} is not defined") message(FATAL_ERROR "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT} is not defined")
endif() endif()
endforeach() endforeach()

View file

@ -105,8 +105,7 @@ ELSEIF(RPM)
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "")
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "") SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
# not yet, SLES 12.3 doesn't provide pcre2 SET(WITH_PCRE system CACHE STRING "")
#SET(WITH_PCRE system CACHE STRING "")
IF(RPM MATCHES "fedora|centos|rhel") IF(RPM MATCHES "fedora|centos|rhel")
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "") SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
ENDIF() ENDIF()
@ -129,7 +128,6 @@ ELSE()
SET(WITH_JEMALLOC static CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "") SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
SET(WITH_STRIPPED_CLIENT ON CACHE BOOL "Strip all client binaries") SET(WITH_STRIPPED_CLIENT ON CACHE BOOL "Strip all client binaries")
SET(WITH_PCRE bundled CACHE STRING "")
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "") SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "") SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "")
ENDIF() ENDIF()

View file

@ -3280,6 +3280,30 @@ pk i v a b
2 2 4 2 4 2 2 4 2 4
drop table t1, t2; drop table t1, t2;
# #
# MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
#
create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);
create table t2 (c int);
insert into t2 values (5), (2), (3), (4);
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));
1
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);
1
select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));
c
5
2
3
4
drop table t1,t2;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View file

@ -2239,6 +2239,30 @@ select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
--echo #
create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);
create table t2 (c int);
insert into t2 values (5), (2), (3), (4);
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);
select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));
drop table t1,t2;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View file

@ -3269,6 +3269,30 @@ pk i v a b
2 2 4 2 4 2 2 4 2 4
drop table t1, t2; drop table t1, t2;
# #
# MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
#
create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);
create table t2 (c int);
insert into t2 values (5), (2), (3), (4);
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));
1
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);
1
select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));
c
5
2
3
4
drop table t1,t2;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View file

@ -5084,7 +5084,7 @@ sub mysqld_start ($$) {
$mysqld->{'started_opts'}= $extra_opts; $mysqld->{'started_opts'}= $extra_opts;
my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect"; my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect";
my $rc= $oldexe eq $exe || my $rc= $oldexe eq ($exe || '') ||
sleep_until_file_created($mysqld->value('pid-file'), $expect_file, sleep_until_file_created($mysqld->value('pid-file'), $expect_file,
$opt_start_timeout, $mysqld->{'proc'}, $warn_seconds); $opt_start_timeout, $mysqld->{'proc'}, $warn_seconds);
if (!$rc) if (!$rc)

View file

@ -0,0 +1,144 @@
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);
CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
EXPLAIN EXTENDED SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1`
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1` where `test`.`v1`.`a` = 1
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1` where `test`.`v1`.`b` > 100
EXPLAIN EXTENDED SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1`
EXPLAIN EXTENDED SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`b` AS `b`,`test`.`v1`.`a` AS `a` from `test`.`v1`
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON TABLE
#
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test EXPLAIN EXTENDED SELECT `a` , `b` FROM `test` . `v1` 1
test EXPLAIN EXTENDED SELECT `b` , `a` FROM `test` . `v1` 1
test SELECT * FROM `test` . `v1` 1
test SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test SELECT `a` , `b` FROM `test` . `v1` 1
test SELECT `b` , `a` FROM `test` . `v1` 1
test SHOW WARNINGS 5
test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN EXTENDED SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 1
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` > 100
EXPLAIN EXTENDED SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
EXPLAIN EXTENDED SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1`
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON VIEW
#
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
test CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test DROP TABLE `test` . `v1` 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` 2
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test EXPLAIN EXTENDED SELECT `a` , `b` FROM `test` . `v1` 2
test EXPLAIN EXTENDED SELECT `b` , `a` FROM `test` . `v1` 2
test SELECT * FROM `test` . `v1` 2
test SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test SELECT SCHEMA_NAME , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test SELECT `a` , `b` FROM `test` . `v1` 2
test SELECT `b` , `a` FROM `test` . `v1` 2
test SHOW WARNINGS 10
test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;

View file

@ -0,0 +1,76 @@
# ----------------------------------------------------
# Tests for the performance schema statement Digests.
# ----------------------------------------------------
# Test case to show behavior of statements digest when
# using a view
# Test requires: sp-protocol/ps-protocol/view-protocol/cursor-protocol disabled
--source include/no_protocol.inc
--source include/not_embedded.inc
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);
CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
#
# test.v1 is a table.
# Every query here is different, and should have a different digest.
#
EXPLAIN EXTENDED SELECT * from test.v1;
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
EXPLAIN EXTENDED SELECT a, b from test.v1;
EXPLAIN EXTENDED SELECT b, a from test.v1;
SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;
--echo #
--echo # DIGESTS SEEN ON TABLE
--echo #
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
#
# test.v1 is now a view.
# the query digests should be unchanged.
#
EXPLAIN EXTENDED SELECT * from test.v1;
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
EXPLAIN EXTENDED SELECT a, b from test.v1;
EXPLAIN EXTENDED SELECT b, a from test.v1;
SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;
--echo #
--echo # DIGESTS SEEN ON VIEW
--echo #
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
DROP VIEW test.v1;
DROP TABLE test.t1;

View file

@ -5753,6 +5753,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (!s->const_keys.is_clear_all()) if (!s->const_keys.is_clear_all())
{ {
sargable_cond= get_sargable_cond(join, s->table); sargable_cond= get_sargable_cond(join, s->table);
bool is_sargable_cond_of_where= sargable_cond == &join->conds;
select= make_select(s->table, found_const_table_map, select= make_select(s->table, found_const_table_map,
found_const_table_map, found_const_table_map,
@ -5769,6 +5770,12 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
*/ */
*sargable_cond= select->cond; *sargable_cond= select->cond;
if (is_sargable_cond_of_where &&
join->conds && join->conds->type() == Item::COND_ITEM &&
((Item_cond*) (join->conds))->functype() ==
Item_func::COND_AND_FUNC)
join->cond_equal= &((Item_cond_and*) (join->conds))->m_cond_equal;
s->quick=select->quick; s->quick=select->quick;
s->needed_reg=select->needed_reg; s->needed_reg=select->needed_reg;
select->quick=0; select->quick=0;

View file

@ -31,6 +31,8 @@ CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
SET(CPACK_RPM_columnstore-engine_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/columnstore/build/postInstall_storage_engine.sh PARENT_SCOPE) SET(CPACK_RPM_columnstore-engine_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/columnstore/build/postInstall_storage_engine.sh PARENT_SCOPE)
SET(CPACK_RPM_columnstore-engine_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/columnstore/build/preUn_storage_engine.sh PARENT_SCOPE) SET(CPACK_RPM_columnstore-engine_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/columnstore/build/preUn_storage_engine.sh PARENT_SCOPE)
APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_VERSION "") APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_VERSION "")
SET(CPACK_RPM_columnstore-engine_PACKAGE_SUMMARY "MariaDB ColumnStore storage engine" PARENT_SCOPE)
SET(CPACK_RPM_columnstore-engine_PACKAGE_DESCRIPTION "The MariaDB ColumnStore storage engine is a high-performance columnar analytical engine, aimed at rapid processing of analytical queries on very large amounts of data." PARENT_SCOPE)
ENDIF() ENDIF()
INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/" "plugin/columnstore") INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/" "plugin/columnstore")
ENDIF() ENDIF()

View file

@ -352,26 +352,6 @@ or the MySQL version that created the redo log file. */
header */ header */
#define LOG_FILE_HDR_SIZE (4 * OS_FILE_LOG_BLOCK_SIZE) #define LOG_FILE_HDR_SIZE (4 * OS_FILE_LOG_BLOCK_SIZE)
/** Memory mapped file */
class mapped_file_t
{
public:
mapped_file_t()= default;
mapped_file_t(const mapped_file_t &)= delete;
mapped_file_t &operator=(const mapped_file_t &)= delete;
mapped_file_t(mapped_file_t &&)= delete;
mapped_file_t &operator=(mapped_file_t &&)= delete;
~mapped_file_t() noexcept;
dberr_t map(const char *path, bool read_only= false,
bool nvme= false) noexcept;
dberr_t unmap() noexcept;
byte *data() noexcept { return m_area.data(); }
private:
span<byte> m_area;
};
/** Abstraction for reading, writing and flushing file cache to disk */ /** Abstraction for reading, writing and flushing file cache to disk */
class file_io class file_io
{ {

View file

@ -336,12 +336,12 @@ public:
bool is_initialised() const { return last_stored_lsn != 0; } bool is_initialised() const { return last_stored_lsn != 0; }
/** Register a redo log snippet for a page. /** Register a redo log snippet for a page.
@param page_id page identifier @param it page iterator
@param start_lsn start LSN of the mini-transaction @param start_lsn start LSN of the mini-transaction
@param lsn @see mtr_t::commit_lsn() @param lsn @see mtr_t::commit_lsn()
@param l redo log snippet @see log_t::FORMAT_10_5 @param l redo log snippet @see log_t::FORMAT_10_5
@param len length of l, in bytes */ @param len length of l, in bytes */
inline void add(const page_id_t page_id, lsn_t start_lsn, lsn_t lsn, inline void add(map::iterator it, lsn_t start_lsn, lsn_t lsn,
const byte *l, size_t len); const byte *l, size_t len);
/** Parse and register one mini-transaction in log_t::FORMAT_10_5. /** Parse and register one mini-transaction in log_t::FORMAT_10_5.

View file

@ -224,47 +224,6 @@ void log_t::create()
(aligned_malloc(OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE)); (aligned_malloc(OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE));
} }
mapped_file_t::~mapped_file_t() noexcept
{
if (!m_area.empty())
unmap();
}
dberr_t mapped_file_t::map(const char *path, bool read_only,
bool nvme) noexcept
{
auto fd= mysql_file_open(innodb_log_file_key, path,
read_only ? O_RDONLY : O_RDWR, MYF(MY_WME));
if (fd == -1)
return DB_ERROR;
const auto file_size= os_file_get_size(path).m_total_size;
const int nvme_flag= nvme ? MAP_SYNC : 0;
void *ptr= my_mmap(0, static_cast<size_t>(file_size),
read_only ? PROT_READ : PROT_READ | PROT_WRITE,
MAP_SHARED_VALIDATE | nvme_flag, fd, 0);
mysql_file_close(fd, MYF(MY_WME));
if (ptr == MAP_FAILED)
return DB_ERROR;
m_area= {static_cast<byte *>(ptr),
static_cast<span<byte>::size_type>(file_size)};
return DB_SUCCESS;
}
dberr_t mapped_file_t::unmap() noexcept
{
ut_ad(!m_area.empty());
if (my_munmap(m_area.data(), m_area.size()))
return DB_ERROR;
m_area= {};
return DB_SUCCESS;
}
file_os_io::file_os_io(file_os_io &&rhs) : m_fd(rhs.m_fd) file_os_io::file_os_io(file_os_io &&rhs) : m_fd(rhs.m_fd)
{ {
rhs.m_fd= OS_FILE_CLOSED; rhs.m_fd= OS_FILE_CLOSED;
@ -334,6 +293,66 @@ dberr_t file_os_io::flush() noexcept
#include <libpmem.h> #include <libpmem.h>
/** Memory mapped file */
class mapped_file_t
{
public:
mapped_file_t()= default;
mapped_file_t(const mapped_file_t &)= delete;
mapped_file_t &operator=(const mapped_file_t &)= delete;
mapped_file_t(mapped_file_t &&)= delete;
mapped_file_t &operator=(mapped_file_t &&)= delete;
~mapped_file_t() noexcept;
dberr_t map(const char *path, bool read_only= false,
bool nvme= false) noexcept;
dberr_t unmap() noexcept;
byte *data() noexcept { return m_area.data(); }
private:
span<byte> m_area;
};
mapped_file_t::~mapped_file_t() noexcept
{
if (!m_area.empty())
unmap();
}
dberr_t mapped_file_t::map(const char *path, bool read_only,
bool nvme) noexcept
{
auto fd= mysql_file_open(innodb_log_file_key, path,
read_only ? O_RDONLY : O_RDWR, MYF(MY_WME));
if (fd == -1)
return DB_ERROR;
const auto file_size= size_t{os_file_get_size(path).m_total_size};
const int nvme_flag= nvme ? MAP_SYNC : 0;
void *ptr=
my_mmap(0, file_size, read_only ? PROT_READ : PROT_READ | PROT_WRITE,
MAP_SHARED_VALIDATE | nvme_flag, fd, 0);
mysql_file_close(fd, MYF(MY_WME));
if (ptr == MAP_FAILED)
return DB_ERROR;
m_area= {static_cast<byte *>(ptr), file_size};
return DB_SUCCESS;
}
dberr_t mapped_file_t::unmap() noexcept
{
ut_ad(!m_area.empty());
if (my_munmap(m_area.data(), m_area.size()))
return DB_ERROR;
m_area= {};
return DB_SUCCESS;
}
static bool is_pmem(const char *path) noexcept static bool is_pmem(const char *path) noexcept
{ {
mapped_file_t mf; mapped_file_t mf;

View file

@ -1971,20 +1971,17 @@ inline void page_recv_t::will_not_read()
/** Register a redo log snippet for a page. /** Register a redo log snippet for a page.
@param page_id page identifier @param it page iterator
@param start_lsn start LSN of the mini-transaction @param start_lsn start LSN of the mini-transaction
@param lsn @see mtr_t::commit_lsn() @param lsn @see mtr_t::commit_lsn()
@param recs redo log snippet @see log_t::FORMAT_10_5 @param recs redo log snippet @see log_t::FORMAT_10_5
@param len length of l, in bytes */ @param len length of l, in bytes */
inline void recv_sys_t::add(const page_id_t page_id, inline void recv_sys_t::add(map::iterator it, lsn_t start_lsn, lsn_t lsn,
lsn_t start_lsn, lsn_t lsn, const byte *l, const byte *l, size_t len)
size_t len)
{ {
mysql_mutex_assert_owner(&mutex); mysql_mutex_assert_owner(&mutex);
std::pair<map::iterator, bool> p= pages.emplace(map::value_type page_id_t page_id = it->first;
(page_id, page_recv_t())); page_recv_t &recs= it->second;
page_recv_t& recs= p.first->second;
ut_ad(p.second == recs.log.empty());
switch (*l & 0x70) { switch (*l & 0x70) {
case FREE_PAGE: case INIT_PAGE: case FREE_PAGE: case INIT_PAGE:
@ -2078,6 +2075,7 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply)
loop: loop:
const byte *const log= buf + recovered_offset; const byte *const log= buf + recovered_offset;
const lsn_t start_lsn= recovered_lsn; const lsn_t start_lsn= recovered_lsn;
map::iterator cached_pages_it = pages.end();
/* Check that the entire mini-transaction is included within the buffer */ /* Check that the entire mini-transaction is included within the buffer */
const byte *l; const byte *l;
@ -2401,8 +2399,12 @@ same_page:
/* fall through */ /* fall through */
case STORE_YES: case STORE_YES:
if (!mlog_init.will_avoid_read(id, start_lsn)) if (!mlog_init.will_avoid_read(id, start_lsn))
add(id, start_lsn, end_lsn, recs, {
if (cached_pages_it == pages.end() || cached_pages_it->first != id)
cached_pages_it= pages.emplace(id, page_recv_t()).first;
add(cached_pages_it, start_lsn, end_lsn, recs,
static_cast<size_t>(l + rlen - recs)); static_cast<size_t>(l + rlen - recs));
}
continue; continue;
case STORE_NO: case STORE_NO:
if (!is_init) if (!is_init)
@ -4123,7 +4125,9 @@ completed:
log_sys.last_checkpoint_lsn = checkpoint_lsn; log_sys.last_checkpoint_lsn = checkpoint_lsn;
if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL) { if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL
&& (~log_t::FORMAT_ENCRYPTED & log_sys.log.format)
== log_t::FORMAT_10_5) {
/* Write a FILE_CHECKPOINT marker as the first thing, /* Write a FILE_CHECKPOINT marker as the first thing,
before generating any other redo log. This ensures before generating any other redo log. This ensures
that subsequent crash recovery will be possible even that subsequent crash recovery will be possible even

View file

@ -128,6 +128,9 @@ IF (CURL_FOUND)
LINK_LIBRARIES curl z STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf) LINK_LIBRARIES curl z STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf)
ENDIF() ENDIF()
SET(CPACK_RPM_s3-engine_PACKAGE_SUMMARY "Amazon S3 archival storage engine for MariaDB" PARENT_SCOPE)
SET(CPACK_RPM_s3-engine_PACKAGE_DESCRIPTION "The S3 storage engine allows one to archive MariaDB tables in Amazon S3 (or any third-party public or private cloud that implements S3 API), but still have them accessible in MariaDB in read-only mode." PARENT_SCOPE)
IF(TARGET s3) IF(TARGET s3)
MYSQL_ADD_EXECUTABLE(aria_s3_copy aria_s3_copy.cc ${S3_SOURCES} COMPONENT s3-engine) MYSQL_ADD_EXECUTABLE(aria_s3_copy aria_s3_copy.cc ${S3_SOURCES} COMPONENT s3-engine)
TARGET_LINK_LIBRARIES(aria_s3_copy aria myisam mysys mysys_ssl curl z) TARGET_LINK_LIBRARIES(aria_s3_copy aria myisam mysys mysys_ssl curl z)

View file

@ -86,7 +86,9 @@ set(LIB_DIR "lib")
set(INCLUDE_DIR "include") set(INCLUDE_DIR "include")
set(GRN_INCLUDE_DIR "include/groonga") set(GRN_INCLUDE_DIR "include/groonga")
set(DATA_DIR "share") set(DATA_DIR "share")
set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}") if(NOT DEFINED GRN_DATA_DIR)
set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}")
endif()
set(CONFIG_DIR "etc") set(CONFIG_DIR "etc")
set(GRN_CONFIG_DIR "${CONFIG_DIR}/${GRN_PROJECT_NAME}") set(GRN_CONFIG_DIR "${CONFIG_DIR}/${GRN_PROJECT_NAME}")
set(GRN_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GRN_CONFIG_DIR}/groonga.conf") set(GRN_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GRN_CONFIG_DIR}/groonga.conf")

View file

@ -16,7 +16,9 @@
# MA 02110-1335 USA # MA 02110-1335 USA
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
set(GROONGA_NORMALIZER_MYSQL_PROJECT_NAME "groonga-normalizer-mysql") if(NOT DEFINED GROONGA_NORMALIZER_MYSQL_PROJECT_NAME)
set(GROONGA_NORMALIZER_MYSQL_PROJECT_NAME "groonga-normalizer-mysql")
endif()
project("${GROONGA_NORMALIZER_MYSQL_PROJECT_NAME}") project("${GROONGA_NORMALIZER_MYSQL_PROJECT_NAME}")
if(DEFINED GROONGA_NORMALIZER_MYSQL_EMBED) if(DEFINED GROONGA_NORMALIZER_MYSQL_EMBED)

View file

@ -59,7 +59,7 @@ int main(int argc __attribute__((unused)), char **argv)
pthread_mutex_init(&mutex, 0); pthread_mutex_init(&mutex, 0);
#define CYCLES 3000 #define CYCLES 30000
#define THREADS 30 #define THREADS 30
diag("N CPUs: %d", my_getncpus()); diag("N CPUs: %d", my_getncpus());