Commit 1abc476f authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 343f695c e44439ab
......@@ -211,6 +211,6 @@ maria_declare_plugin(type_mysql_json)
NULL,
NULL,
"0.1",
MariaDB_PLUGIN_MATURITY_ALPHA
MariaDB_PLUGIN_MATURITY_BETA
}
maria_declare_plugin_end;
......@@ -262,7 +262,7 @@ static int example_init_func(void *p)
example_hton->table_options= example_table_option_list;
example_hton->field_options= example_field_option_list;
example_hton->tablefile_extensions= ha_example_exts;
example_hton->drop_table= [](handlerton *, const char*) { return 0; };
example_hton->drop_table= [](handlerton *, const char*) { return -1; };
DBUG_RETURN(0);
}
......
......@@ -1316,6 +1316,9 @@ inline bool buf_pool_t::realloc(buf_block_t *block)
new_block = buf_LRU_get_free_only();
if (new_block == NULL) {
mysql_mutex_lock(&buf_pool.flush_list_mutex);
page_cleaner_wakeup();
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
return(false); /* free list was not enough */
}
......
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2021, MariaDB Corporation.
Copyright (c) 2013, 2022, MariaDB Corporation.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
......@@ -1797,11 +1797,6 @@ static void buf_flush_wait(lsn_t lsn)
my_cond_wait(&buf_pool.done_flush_list,
&buf_pool.flush_list_mutex.m_mutex);
}
/* Wait for the checkpoint. */
while (buf_flush_sync_lsn)
my_cond_wait(&buf_pool.done_flush_list,
&buf_pool.flush_list_mutex.m_mutex);
}
/** Wait until all persistent pages are flushed up to a limit.
......
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation.
Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -112,13 +112,9 @@ If same_page=1 is set in a record that follows a same_page=0 record
in a mini-transaction, the tablespace identifier and page number
fields will be omitted.
(For some file-oriented records (if same_page=1 for the first records
of a mini-transaction), we will write tablespace identifier using the
same 1-to-5-byte encoding. TBD: describe the exact format of
file-oriented records. With MDEV-14425, we could write file-level log
records to a separate file, not interleaved with page-level redo log
at all. We could reserve the file ib_logfile0 for checkpoint information
and for file-level redo log records.)
For FILE_ records (if same_page=1 for the first record
of a mini-transaction), we will write a tablespace identifier and
a page number (always 0) using the same 1-to-5-byte encoding.
For FREE_PAGE or INIT_PAGE, if same_page=1, the record will be treated
as corrupted (or reserved for future extension). The type code must
......@@ -301,18 +297,14 @@ enum mfile_type_t
FILE_RENAME = 0xa0,
/** Modify a file. Followed by tablespace ID and the file name. */
FILE_MODIFY = 0xb0,
#if 1 /* MDEV-14425 FIXME: Remove this! */
/** End-of-checkpoint marker. Followed by 2 dummy bytes of page identifier,
8 bytes of LSN, and padded with a NUL; @see SIZE_OF_FILE_CHECKPOINT. */
FILE_CHECKPOINT = 0xf0
#endif
};
#if 1 /* MDEV-14425 FIXME: Remove this! */
/** Size of a FILE_CHECKPOINT record, including the trailing byte to
terminate the mini-transaction. */
constexpr byte SIZE_OF_FILE_CHECKPOINT= 3/*type,page_id*/ + 8/*LSN*/ + 1;
#endif
#ifndef UNIV_INNOCHECKSUM
/** Types for the mlock objects to store in the mtr_t::m_memo */
......
......@@ -2212,9 +2212,7 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply)
#endif
uint32_t space_id= 0, page_no= 0, last_offset= 0;
#if 1 /* MDEV-14425 FIXME: remove this */
bool got_page_op= false;
#endif
for (l= log; l < end; l+= rlen)
{
const byte *const recs= l;
......@@ -2484,11 +2482,9 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply)
pages.erase(i);
}
}
#if 1 /* MDEV-14425 FIXME: this must be in the checkpoint file only! */
else if (rlen)
{
switch (b & 0xf0) {
# if 1 /* MDEV-14425 FIXME: Remove this! */
case FILE_CHECKPOINT:
if (space_id == 0 && page_no == 0 && rlen == 8)
{
......@@ -2519,7 +2515,6 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply)
}
continue;
}
# endif
/* fall through */
default:
if (!srv_force_recovery)
......@@ -2598,7 +2593,6 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply)
return true;
}
}
#endif
else
goto malformed;
}
......
......@@ -194,7 +194,7 @@ static int oqgraph_init(void *p)
hton->discover_table_structure= oqgraph_discover_table_structure;
hton->close_connection = oqgraph_close_connection;
hton->drop_table= [](handlerton *, const char*) { return 0; };
hton->drop_table= [](handlerton *, const char*) { return -1; };
oqgraph_init_done= TRUE;
return 0;
......
......@@ -30,3 +30,14 @@ update graph set origid=123;
ERROR HY000: Table 'graph' is read only
DROP TABLE graph_base;
DROP TABLE graph;
#
# End of 10.0 tests
#
#
# MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server
#
drop table foobar;
ERROR 42S02: Unknown table 'test.foobar'
#
# End of 10.5 tests
#
......@@ -48,3 +48,16 @@ update graph set origid=123;
DROP TABLE graph_base;
DROP TABLE graph;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server
--echo #
--error 1051
drop table foobar;
--echo #
--echo # End of 10.5 tests
--echo #
This diff is collapsed.
/* Copyright (C) 2008-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp
Copyright (C) 2019-2022 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -92,8 +92,7 @@ class ha_spider final : public handler
SPIDER_POSITION *pushed_pos;
SPIDER_POSITION pushed_pos_buf;
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool pt_handler_share_owner = FALSE;
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share;
SPIDER_PARTITION_HANDLER *partition_handler;
#endif
bool wide_handler_owner = FALSE;
SPIDER_WIDE_HANDLER *wide_handler = NULL;
......
for master_1
for child2
for child3
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER;
SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z;
ERROR 42S22: Unknown column 'a.z' in 'field list'
ALTER TABLE tbl_a CHANGE c c INT;
ERROR 42S22: Unknown column 'c' in 'tbl_a'
LOCK TABLE tbl_a READ;
ERROR HY000: Unable to connect to foreign data source: localhost
DROP DATABASE auto_test_local;
for master_1
for child2
for child3
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
--disable_warnings
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER;
--error ER_BAD_FIELD_ERROR
SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z;
--error ER_BAD_FIELD_ERROR
ALTER TABLE tbl_a CHANGE c c INT;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
LOCK TABLE tbl_a READ;
DROP DATABASE auto_test_local;
--disable_warnings
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
/* Copyright (C) 2008-2020 Kentoku Shiba
Copyright (C) 2019-2020 MariaDB corp
Copyright (C) 2019-2022 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -688,18 +688,15 @@ typedef struct st_spider_lgtm_tblhnd_share
} SPIDER_LGTM_TBLHND_SHARE;
#ifdef WITH_PARTITION_STORAGE_ENGINE
typedef struct st_spider_patition_handler_share
typedef struct st_spider_patition_handler
{
bool clone_bitmap_init;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_hash_value;
#endif
query_id_t parallel_search_query_id;
uint no_parts;
TABLE *table;
ha_spider *owner;
ha_spider **handlers;
} SPIDER_PARTITION_HANDLER_SHARE;
} SPIDER_PARTITION_HANDLER;
#endif
typedef struct st_spider_wide_share
......@@ -713,12 +710,6 @@ typedef struct st_spider_wide_share
THR_LOCK lock;
pthread_mutex_t sts_mutex;
pthread_mutex_t crd_mutex;
pthread_mutex_t pt_handler_mutex;
HASH pt_handler_hash;
uint pt_handler_hash_id;
const char *pt_handler_hash_func_name;
const char *pt_handler_hash_file_name;
ulong pt_handler_hash_line_no;
volatile bool sts_init;
volatile bool crd_init;
......@@ -763,7 +754,7 @@ typedef struct st_spider_wide_handler
#endif
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share;
SPIDER_PARTITION_HANDLER *partition_handler;
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
List<Item> *direct_update_fields;
......
/* Copyright (C) 2008-2020 Kentoku Shiba
Copyright (C) 2019-2020 MariaDB corp
Copyright (C) 2019-2022 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -184,7 +184,6 @@ PSI_mutex_key spd_key_mutex_share_auto_increment;
#ifdef WITH_PARTITION_STORAGE_ENGINE
PSI_mutex_key spd_key_mutex_wide_share_sts;
PSI_mutex_key spd_key_mutex_wide_share_crd;
PSI_mutex_key spd_key_mutex_pt_handler;
#endif
PSI_mutex_key spd_key_mutex_udf_table;
PSI_mutex_key spd_key_mutex_mem_calc;
......@@ -244,7 +243,6 @@ static PSI_mutex_info all_spider_mutexes[]=
#ifdef WITH_PARTITION_STORAGE_ENGINE
{ &spd_key_mutex_wide_share_sts, "wide_share_sts", 0},
{ &spd_key_mutex_wide_share_crd, "wide_share_crd", 0},
{ &spd_key_mutex_pt_handler, "pt_handler", 0},
#endif
{ &spd_key_mutex_udf_table, "udf_table", 0},
{ &spd_key_mutex_conn_loop_check, "conn_loop_check", 0},
......@@ -430,18 +428,6 @@ uchar *spider_wide_share_get_key(
DBUG_RETURN((uchar*) share->table_name);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
uchar *spider_pt_handler_share_get_key(
SPIDER_PARTITION_HANDLER_SHARE *share,
size_t *length,
my_bool not_used __attribute__ ((unused))
) {
DBUG_ENTER("spider_pt_handler_share_get_key");
*length = sizeof(ha_spider *);
DBUG_RETURN((uchar*) share->owner);
}
#endif
uchar *spider_lgtm_tblhnd_share_hash_get_key(
SPIDER_LGTM_TBLHND_SHARE *share,
size_t *length,
......@@ -6609,34 +6595,8 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
goto error_init_crd_mutex;
}
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&wide_share->pt_handler_mutex,
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_pt_handler,
&wide_share->pt_handler_mutex, MY_MUTEX_INIT_FAST))
#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_pt_handler_mutex;
}
if(
my_hash_init(PSI_INSTRUMENT_ME, &wide_share->pt_handler_hash, spd_charset_utf8mb3_bin,
32, 0, 0, (my_hash_get_key) spider_pt_handler_share_get_key, 0, 0)
) {
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_pt_handler_hash;
}
thr_lock_init(&wide_share->lock);
spider_alloc_calc_mem_init(wide_share->pt_handler_hash, 142);
spider_alloc_calc_mem(spider_current_trx,
wide_share->pt_handler_hash,
wide_share->pt_handler_hash.array.max_element *
wide_share->pt_handler_hash.array.size_of_element);
uint old_elements = spider_open_wide_share.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&spider_open_wide_share,
......@@ -6664,14 +6624,6 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
DBUG_RETURN(wide_share);
error_hash_insert:
spider_free_mem_calc(spider_current_trx,
wide_share->pt_handler_hash_id,
wide_share->pt_handler_hash.array.max_element *
wide_share->pt_handler_hash.array.size_of_element);
my_hash_free(&wide_share->pt_handler_hash);
error_init_pt_handler_hash:
pthread_mutex_destroy(&wide_share->pt_handler_mutex);
error_init_pt_handler_mutex:
pthread_mutex_destroy(&wide_share->crd_mutex);
error_init_crd_mutex:
pthread_mutex_destroy(&wide_share->sts_mutex);
......@@ -6696,12 +6648,6 @@ int spider_free_wide_share(
#else
my_hash_delete(&spider_open_wide_share, (uchar*) wide_share);
#endif
spider_free_mem_calc(spider_current_trx,
wide_share->pt_handler_hash_id,
wide_share->pt_handler_hash.array.max_element *
wide_share->pt_handler_hash.array.size_of_element);
my_hash_free(&wide_share->pt_handler_hash);
pthread_mutex_destroy(&wide_share->pt_handler_mutex);
pthread_mutex_destroy(&wide_share->crd_mutex);
pthread_mutex_destroy(&wide_share->sts_mutex);
spider_free(spider_current_trx, wide_share, MYF(0));
......@@ -8210,15 +8156,15 @@ int spider_get_sts(
if (error_num)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share =
spider->partition_handler_share;
SPIDER_PARTITION_HANDLER *partition_handler =
spider->partition_handler;
if (
!share->wide_share->sts_init &&
sts_sync >= sts_sync_level &&
get_type > 1 &&
partition_handler_share &&
partition_handler_share->handlers &&
partition_handler_share->handlers[0] == spider
partition_handler &&
partition_handler->handlers &&
partition_handler->handlers[0] == spider
) {
int roop_count;
ha_spider *tmp_spider;
......@@ -8228,11 +8174,11 @@ int spider_get_sts(
int tmp_sts_sync;
THD *thd = spider->wide_handler->trx->thd;
for (roop_count = 1;
roop_count < (int) partition_handler_share->no_parts;
roop_count < (int) partition_handler->no_parts;
roop_count++)
{
tmp_spider =
(ha_spider *) partition_handler_share->handlers[roop_count];
(ha_spider *) partition_handler->handlers[roop_count];
tmp_share = tmp_spider->share;
tmp_sts_interval = spider_param_sts_interval(thd, share->sts_interval);
tmp_sts_mode = spider_param_sts_mode(thd, share->sts_mode);
......@@ -8362,15 +8308,15 @@ int spider_get_crd(
if (error_num)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share =
spider->partition_handler_share;
SPIDER_PARTITION_HANDLER *partition_handler =
spider->partition_handler;
if (
!share->wide_share->crd_init &&
crd_sync >= crd_sync_level &&
get_type > 1 &&
partition_handler_share &&
partition_handler_share->handlers &&
partition_handler_share->handlers[0] == spider
partition_handler &&
partition_handler->handlers &&
partition_handler->handlers[0] == spider
) {
int roop_count;
ha_spider *tmp_spider;
......@@ -8380,11 +8326,11 @@ int spider_get_crd(
int tmp_crd_sync;
THD *thd = spider->wide_handler->trx->thd;
for (roop_count = 1;
roop_count < (int) partition_handler_share->no_parts;
roop_count < (int) partition_handler->no_parts;
roop_count++)
{
tmp_spider =
(ha_spider *) partition_handler_share->handlers[roop_count];
(ha_spider *) partition_handler->handlers[roop_count];
tmp_share = tmp_spider->share;
tmp_crd_interval = spider_param_crd_interval(thd, share->crd_interval);
tmp_crd_mode = spider_param_crd_mode(thd, share->crd_mode);
......@@ -9529,10 +9475,10 @@ int spider_set_direct_limit_offset(
DBUG_RETURN(TRUE);
if (
spider->partition_handler_share &&
!spider->pt_handler_share_owner
spider->partition_handler &&
!spider->wide_handler_owner
) {
if (spider->partition_handler_share->owner->
if (spider->partition_handler->owner->
result_list.direct_limit_offset == TRUE)
{
spider->result_list.direct_limit_offset = TRUE;
......
/* Copyright (C) 2008-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp
Copyright (C) 2019-2022 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -319,14 +319,6 @@ uchar *spider_wide_share_get_key(
my_bool not_used __attribute__ ((unused))
);
#ifdef WITH_PARTITION_STORAGE_ENGINE
uchar *spider_pt_handler_share_get_key(
SPIDER_PARTITION_HANDLER_SHARE *share,
size_t *length,
my_bool not_used __attribute__ ((unused))
);
#endif
uchar *spider_link_get_key(
SPIDER_LINK_FOR_HASH *link_for_hash,
size_t *length,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment