Commit b4f24c74 authored by Monty's avatar Monty

Merge branch '10.4' into 10.5

Fixed also an error in suite/perfschema/t/transaction_nested_events-master.opt
parents f03fee06 689b8d06
...@@ -3510,6 +3510,7 @@ print_field_types(MYSQL_RES *result) ...@@ -3510,6 +3510,7 @@ print_field_types(MYSQL_RES *result)
BinaryStringBuffer<128> data_type_metadata_str; BinaryStringBuffer<128> data_type_metadata_str;
metadata.print_data_type_related_attributes(&data_type_metadata_str); metadata.print_data_type_related_attributes(&data_type_metadata_str);
tee_fprintf(PAGER, "Field %3u: `%s`\n" tee_fprintf(PAGER, "Field %3u: `%s`\n"
"Org_field: `%s`\n"
"Catalog: `%s`\n" "Catalog: `%s`\n"
"Database: `%s`\n" "Database: `%s`\n"
"Table: `%s`\n" "Table: `%s`\n"
...@@ -3521,8 +3522,8 @@ print_field_types(MYSQL_RES *result) ...@@ -3521,8 +3522,8 @@ print_field_types(MYSQL_RES *result)
"Decimals: %u\n" "Decimals: %u\n"
"Flags: %s\n\n", "Flags: %s\n\n",
++i, ++i,
field->name, field->catalog, field->db, field->table, field->name, field->org_name, field->catalog, field->db,
field->org_table, fieldtype2str(field->type), field->table, field->org_table, fieldtype2str(field->type),
data_type_metadata_str.length() ? " (" : "", data_type_metadata_str.length() ? " (" : "",
data_type_metadata_str.length(), data_type_metadata_str.ptr(), data_type_metadata_str.length(), data_type_metadata_str.ptr(),
data_type_metadata_str.length() ? ")" : "", data_type_metadata_str.length() ? ")" : "",
......
...@@ -218,3 +218,22 @@ DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ...@@ -218,3 +218,22 @@ DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1 WHERE 1=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1 WHERE 1=1' at line 1
connection default; connection default;
disconnect c1; disconnect c1;
#
# MDEV-23519
#
create or replace table t1 (a int);
create or replace table t2 (b int);
insert into t1 values(1),(2);
insert into t2 values(1),(2);
select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a1 3 11 1 Y 32768 0 63
a1
1
2
1
2
drop table t1,t2;
#
# End of 10.4 tests
#
This diff is collapsed.
...@@ -13,6 +13,7 @@ SELECT * FROM t1 ...@@ -13,6 +13,7 @@ SELECT * FROM t1
-------------- --------------
Field 1: `js0` Field 1: `js0`
Org_field: `js0`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -25,6 +26,7 @@ Decimals: 0 ...@@ -25,6 +26,7 @@ Decimals: 0
Flags: BLOB BINARY Flags: BLOB BINARY
Field 2: `js1` Field 2: `js1`
Org_field: `js1`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -37,6 +39,7 @@ Decimals: 0 ...@@ -37,6 +39,7 @@ Decimals: 0
Flags: BLOB Flags: BLOB
Field 3: `js2` Field 3: `js2`
Org_field: `js2`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -49,6 +52,7 @@ Decimals: 0 ...@@ -49,6 +52,7 @@ Decimals: 0
Flags: BLOB Flags: BLOB
Field 4: `js3` Field 4: `js3`
Org_field: `js3`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -69,6 +73,7 @@ SELECT JSON_COMPACT(js0) FROM t1 ...@@ -69,6 +73,7 @@ SELECT JSON_COMPACT(js0) FROM t1
-------------- --------------
Field 1: `JSON_COMPACT(js0)` Field 1: `JSON_COMPACT(js0)`
Org_field: ``
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
......
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1;
SET DEBUG_SYNC = "wsrep_before_fragment_removal SIGNAL fragment_removal_reached WAIT_FOR fragment_removal_continue";
START TRANSACTION;
INSERT INTO t1 VALUES(1), (2);
COMMIT;
connect node_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_ctrl;
SET DEBUG_SYNC = "now WAIT_FOR fragment_removal_reached";
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
TRUNCATE TABLE t1;
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_ctrl;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
# Set thread-handling as a workaround to avoid MDEV-26528.
# The file can be removed once fixed.
!include ../galera_2nodes.cnf
[mysqld.1]
thread-handling=pool-of-threads
#
# MDEV-21613 - galera_sr.GCF-1018B MTR failed:
# Failed to open table mysql.wsrep_streaming_log for writing
#
# A BF abort right before fragment removal caused this error to
# be logged to the error log.
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1;
SET DEBUG_SYNC = "wsrep_before_fragment_removal SIGNAL fragment_removal_reached WAIT_FOR fragment_removal_continue";
START TRANSACTION;
INSERT INTO t1 VALUES(1), (2);
--send COMMIT
--connect node_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_ctrl
SET DEBUG_SYNC = "now WAIT_FOR fragment_removal_reached";
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
TRUNCATE TABLE t1;
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
--connection node_ctrl
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
--loose-performance_schema_events_statements_history_size=20 --loose-performance_schema_events_statements_history_size=20
--loose-performance_schema_events_statements_history_long_size=50 --loose-performance_schema_events_statements_history_long_size=50
--loose-performance_schema_events_transactions_history_long_size=50 --loose-performance_schema_events_transactions_history_long_size=50
--loose-performance_schema_max_thread_instances=30 --loose-performance_schema_max_thread_instances=60
--loose-performance-schema-consumer-events-stages-current=OFF --loose-performance-schema-consumer-events-stages-current=OFF
--loose-performance-schema-consumer-events-stages-history=OFF --loose-performance-schema-consumer-events-stages-history=OFF
......
...@@ -121,7 +121,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -121,7 +121,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
/* explictly don't use O_EXCL here has it has a different /* explictly don't use O_EXCL here has it has a different
meaning with O_TMPFILE meaning with O_TMPFILE
*/ */
if ((file= open(dir, mode | O_TMPFILE | O_CLOEXEC, if ((file= open(dir, (mode & ~O_CREAT) | O_TMPFILE | O_CLOEXEC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)) >= 0) S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)) >= 0)
{ {
my_snprintf(to, FN_REFLEN, "%s/#sql/fd=%d", dir, file); my_snprintf(to, FN_REFLEN, "%s/#sql/fd=%d", dir, file);
......
CREATE TABLE t1 (a INET6); CREATE TABLE t1 (a INET6);
Field 1: `a` Field 1: `a`
Org_field: `a`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -12,6 +13,7 @@ Decimals: 0 ...@@ -12,6 +13,7 @@ Decimals: 0
Flags: UNSIGNED BINARY Flags: UNSIGNED BINARY
Field 2: `b` Field 2: `b`
Org_field: ``
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
...@@ -24,6 +26,7 @@ Decimals: 0 ...@@ -24,6 +26,7 @@ Decimals: 0
Flags: NOT_NULL UNSIGNED Flags: NOT_NULL UNSIGNED
Field 3: `c` Field 3: `c`
Org_field: ``
Catalog: `def` Catalog: `def`
Database: `` Database: ``
Table: `` Table: ``
......
CREATE TABLE t1 (a TEST_INT8, b TEST_DOUBLE); CREATE TABLE t1 (a TEST_INT8, b TEST_DOUBLE);
Field 1: `a` Field 1: `a`
Org_field: `a`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
...@@ -12,6 +13,7 @@ Decimals: 0 ...@@ -12,6 +13,7 @@ Decimals: 0
Flags: NUM Flags: NUM
Field 2: `b` Field 2: `b`
Org_field: `b`
Catalog: `def` Catalog: `def`
Database: `test` Database: `test`
Table: `t1` Table: `t1`
......
...@@ -18057,7 +18057,14 @@ Field *Item_sum::create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) ...@@ -18057,7 +18057,14 @@ Field *Item_sum::create_tmp_field(MEM_ROOT *root, bool group, TABLE *table)
/** /**
Create a temporary field for Item_field (or its descendant), Create a temporary field for Item_field (or its descendant),
either direct or referenced by an Item_ref. either direct or referenced by an Item_ref.
param->modify_item is set when we create a field for an internal temporary
table. In this case we have to ensure the new field name is identical to
the original field name as the field will info will be sent to the client.
In other cases, the field name is set from orig_item or name if org_item is
not set.
*/ */
Field * Field *
Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
Item_ref *orig_item, Item_ref *orig_item,
...@@ -18065,6 +18072,10 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, ...@@ -18065,6 +18072,10 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
{ {
DBUG_ASSERT(!is_result_field()); DBUG_ASSERT(!is_result_field());
Field *result; Field *result;
LEX_CSTRING *new_name= (orig_item ? &orig_item->name :
!param->modify_item() ? &name :
&field->field_name);
/* /*
If item have to be able to store NULLs but underlaid field can't do it, If item have to be able to store NULLs but underlaid field can't do it,
create_tmp_field_from_field() can't be used for tmp field creation. create_tmp_field_from_field() can't be used for tmp field creation.
...@@ -18083,8 +18094,7 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, ...@@ -18083,8 +18094,7 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
Record_addr rec(orig_item ? orig_item->maybe_null : maybe_null); Record_addr rec(orig_item ? orig_item->maybe_null : maybe_null);
const Type_handler *handler= type_handler()-> const Type_handler *handler= type_handler()->
type_handler_for_tmp_table(this); type_handler_for_tmp_table(this);
result= handler->make_and_init_table_field(root, result= handler->make_and_init_table_field(root, new_name,
orig_item ? &orig_item->name : &name,
rec, *this, new_table); rec, *this, new_table);
} }
else if (param->table_cant_handle_bit_fields() && else if (param->table_cant_handle_bit_fields() &&
...@@ -18092,18 +18102,17 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, ...@@ -18092,18 +18102,17 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table,
{ {
const Type_handler *handler= const Type_handler *handler=
Type_handler::type_handler_long_or_longlong(max_char_length(), true); Type_handler::type_handler_long_or_longlong(max_char_length(), true);
result= handler->make_and_init_table_field(root, &name, result= handler->make_and_init_table_field(root, new_name,
Record_addr(maybe_null), Record_addr(maybe_null),
*this, new_table); *this, new_table);
} }
else else
{ {
LEX_CSTRING *tmp= orig_item ? &orig_item->name : &name;
bool tmp_maybe_null= param->modify_item() ? maybe_null : bool tmp_maybe_null= param->modify_item() ? maybe_null :
field->maybe_null(); field->maybe_null();
result= field->create_tmp_field(root, new_table, tmp_maybe_null); result= field->create_tmp_field(root, new_table, tmp_maybe_null);
if (result) if (result && ! param->modify_item())
result->field_name= *tmp; result->field_name= *new_name;
} }
if (result && param->modify_item()) if (result && param->modify_item())
result_field= result; result_field= result;
......
...@@ -192,6 +192,7 @@ int Wsrep_client_service::prepare_fragment_for_replication( ...@@ -192,6 +192,7 @@ int Wsrep_client_service::prepare_fragment_for_replication(
int Wsrep_client_service::remove_fragments() int Wsrep_client_service::remove_fragments()
{ {
DBUG_ENTER("Wsrep_client_service::remove_fragments"); DBUG_ENTER("Wsrep_client_service::remove_fragments");
DEBUG_SYNC(m_thd, "wsrep_before_fragment_removal");
if (wsrep_schema->remove_fragments(m_thd, if (wsrep_schema->remove_fragments(m_thd,
Wsrep_server_state::instance().id(), Wsrep_server_state::instance().id(),
m_thd->wsrep_trx().id(), m_thd->wsrep_trx().id(),
......
...@@ -270,13 +270,7 @@ static int open_table(THD* thd, ...@@ -270,13 +270,7 @@ static int open_table(THD* thd,
thd->lex->query_tables_own_last= 0; thd->lex->query_tables_own_last= 0;
if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) { if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) {
if (thd->is_error()) {
WSREP_WARN("Can't lock table %s.%s : %d (%s)",
schema_name->str, table_name->str,
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
}
close_thread_tables(thd); close_thread_tables(thd);
my_error(ER_NO_SUCH_TABLE, MYF(0), schema_name->str, table_name->str);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -292,8 +286,15 @@ static int open_for_write(THD* thd, const char* table_name, TABLE** table) { ...@@ -292,8 +286,15 @@ static int open_for_write(THD* thd, const char* table_name, TABLE** table) {
LEX_CSTRING table_str= { table_name, strlen(table_name) }; LEX_CSTRING table_str= { table_name, strlen(table_name) };
if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE, if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE,
table)) { table)) {
WSREP_ERROR("Failed to open table %s.%s for writing", // No need to log an error if the query was bf aborted,
schema_str.str, table_name); // thd client will get ER_LOCK_DEADLOCK in the end.
const bool interrupted= thd->killed ||
(thd->is_error() &&
(thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED));
if (!interrupted) {
WSREP_ERROR("Failed to open table %s.%s for writing",
schema_str.str, table_name);
}
return 1; return 1;
} }
empty_record(*table); empty_record(*table);
......
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