Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Console View


Categories: connectors experimental galera main
Legend:   Passed Failed Warnings Failed Again Running Exception Offline No data

connectors experimental galera main
Nikita Malyavin
MDEV-37660 Make Global Temporary Tables DDL errors more specific

Add ER_TABLE_IN_USE code.
Use it for ALTER, DROP and RENAME when a child Global temporary table
exists in the same connection (effectively blocking the statement)

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38468 GTT: use-after-free after failed BINLOG event in XA mode

Deny setting pseudo_slave_mode for GTT even when rli_fake is set.

Parent issue:
MDEV-35915 Implement Global temporary tables
Christian Hesse
MDEV-35969 wsrep: add more details in service manager status (10.11)

Let's show the difference between donor and joiner.

Signed-off-by: Julius Goryavsky <[email protected]>
Nikita Malyavin
MDEV-38603 GTT: Failing assertion prebuilt->template_type == ROW_MYSQL_WHOLE_ROW

FLUSH TABLES WITH READ LOCK differs from FLUSH TABLES in that the latter
doesn't open the tables. FLUSH TABLES works fine with temporary tables,
while FLUSH TABLES WITH READ LOCK results in ER_NO_SUCH_TABLE.

So we also shouldn't allow FLUSH TABLES WITH READ LOCK open a child GTT.
Doing so would result in many unpredicted problems, like this assertion.

Particularly: m_prebuilt->select_lock_type stays LOCK_S after
FLUSH TABLE WITH READ LOCK, and then is not reset by
handler::external_lock or handler::start_stmt. However, innodb would
expect LOCK_X in SERIALIZABLE isolation.

In this commit:
Always submit parent GTT to FLUSH TABLES. Since FLUSH TABLES doesn't
open tables, there'll be no difference for it, and FLUSH TABLES WITH
READ LOCK will use a parent table.

Parent issue:
MDEV-35915 Implement Global temporary tables
Rex Johnston
MDEV-29360 Crash when pushing condition with always false IS NULL into derived

When a condition containing an always FALSE range part is pushed
down into a derived table, an enclosed outer reference can cause
a null pointer crash.  An example

SELECT * FROM (SELECT id  FROM t1 GROUP BY id) dt1, (SELECT id FROM t2) dt2, t3
  WHERE dt2.id = t3.id AND dt1.id BETWEEN 0 AND (dt2.id IS NULL);

is considered as one that can be pushed into the derived table dt1
because the expression (dt2.id IS NULL) is identified as always false.
On the on other hand the condition still contains a reference to a
column of the table dt2. When pushing the condition to the where clause
of the derived table dt1 a copy of it is created and this copy is
transformed to be used in the new where clause. When the transformation
procedure encounters a reference dt2.id it crashes the server as only
the references to the columns used in the group by list of the
specification of dt1 or those equal to them are expected in the
condition that can be pushed into the where clause of the derived table.

The fix here is transform the argument to the function Item_func_isnull
from something that may be a column reference, but cannot be null to
an Item_literal that also cannot be null (1).

Based on patch by Igor Babaev.
Nikita Malyavin
MDEV-37929 Assertion !thd->rgi_slave' failed on REPAIR TABLE on replica

1. REPAIR TABLES is logged even if open_table is failed. In this case,
we cannot determine whether it was opened for a global temporary table,
so we cannot make sure it is not replicated.

2. Also REPAIR/ANALYZE/CHECK can include more that one table, and has no
ability co control statement logging per-table, so anyway relying on
that it's not logged is incorrect.

Hence, enable writing to binlog for these three statements. Keep replica
to be able to handle these commands.
As such, force REPAIR/ANALYZE/CHECK to open a parent handle of global
temporary table.

Extract sql_command_flags flag CF_USE_PARENT_GTT_SHARE for global
temporary tables, as a critical mass of statements has been reached.

Also fixes:
MDEV-37929 Assertion !thd->rgi_slave' failed on REPAIR TABLE on replica

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38937 GTT: 1944 Error executing row event with trigger replication

Row events prelock tables for triggers even if those triggers are not
accessed.

If the table in trigger doesn't exist though, the error wouldn't be
triggered.

Make the same for GTT:
ignore its open denials on slave if it's meant so.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38481 GTT: Assertion failed in ha_maria::start_stmt on ANALYZE

Assertion 'file->trn == trn' failed in ha_maria::start_stmt on
ANALYZE TABLE, also assertion 'trn' failed in another test.

file->trn is NULL for a newly opened table and is normally assigned by
st_thr_lock::start_trans in mysql_lock_tables.

Same for thd->ha_data[maria_hton->slot].ha_ptr aka 'trn', which is
NULLed when the old table is dropped as part of OR REPLACE action, if
that was the only table in the aria locked tables. Similarly, it is
restored back on st_thr_lock::start_trans in mysql_lock_tables.

Since ANALYZE is registered as operating on the parent table,
open_only_one_table opens and locks the latter. lock_tables doesn't
issue a table lock in locked tables mode, but issues
table->file->start_stmt(...), which asserts for ha_maria.

Solution: lock the parent GTT table as well in
select_create::create_table_from_items. It will be unlocked altogether
within the lock saved in select_create as m_plock.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38568 GTT: Assertion thd->mdl_context.is_lock_owner failed in CoR

The crash happens on the junction of GTT, CREATE OR REPLACE...SELECT,
LOCK TABLES, and error during select.

1. The parent table should be dropped with drop_open_table, not
quick_rm_table, because it should first be closed.
2. In select_create::abort_result_set, drop the parent table as well.
3. Store parent parent GTT in select_create -- this improves readability
  and access hugely.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38125 Assertion !thd->rgi_slave failed on INSERT under LOCK TABLES

Locking a global temporary table causes a crash on slave,
even if the table wasn't used in the statement, but just locked.

The crash, and an inappropriate open of global temporary table happens
because its table mapping was replicated. Rows_log_event opens all the
tables that were aggregated by Table_map_log_event.

THD::binlog_write_table_maps aggressively logs all the tables that
were write-locked, even if they will never be used.

Solution: We should never log table maps for global temporary tables

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37660 Make Global Temporary Tables DDL errors more specific

Add ER_TABLE_IN_USE code.
Use it for ALTER, DROP and RENAME when a child Global temporary table
exists in the same connection (effectively blocking the statement)

Parent issue:
MDEV-35915 Implement Global temporary tables
Rex Johnston
MDEV-29360 Crash when pushing condition with always false IS NULL into derived

When a condition containing an always FALSE range part is pushed
down into a derived table, an enclosed outer reference can cause
a null pointer crash.  An example

SELECT * FROM (SELECT id  FROM t1 GROUP BY id) dt1, (SELECT id FROM t2) dt2, t3
  WHERE dt2.id = t3.id AND dt1.id BETWEEN 0 AND (dt2.id IS NULL);

is considered as one that can be pushed into the derived table dt1
because the expression (dt2.id IS NULL) is identified as always false.
On the on other hand the condition still contains a reference to a
column of the table dt2. When pushing the condition to the where clause
of the derived table dt1 a copy of it is created and this copy is
transformed to be used in the new where clause. When the transformation
procedure encounters a reference dt2.id it crashes the server as only
the references to the columns used in the group by list of the
specification of dt1 or those equal to them are expected in the
condition that can be pushed into the where clause of the derived table.

The fix here is transform the argument to the function Item_func_isnull
from something that may be a column reference, but cannot be null to
an Item_literal that also cannot be null (1).

Based on patch by Igor Babaev.
Nikita Malyavin
MDEV-38937 GTT: 1944 Error executing row event with trigger replication

Row events prelock tables for triggers even if those triggers are not
accessed. Write_row event is known to trigger any kind of row operation:

uint8 Write_rows_log_event::get_trg_event_map() const
{
  return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
          trg2bit(TRG_EVENT_DELETE);
}
So no surprise that AFTER UPDATE trigger is prepared for insert event.

If the table in trigger doesn't exist though, the error wouldn't be
triggered.

Make the same for GTT:
ignore its open denials on slave if it's meant so.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37896 global_temporary_table tests are not stable on 2nd run

replace con_id and purge logs

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38603 GTT: Failing assertion prebuilt->template_type == ROW_MYSQL_WHOLE_ROW

FLUSH TABLES WITH READ LOCK differs from FLUSH TABLES in that the latter
doesn't open the tables. FLUSH TABLES works fine with temporary tables,
while FLUSH TABLES WITH READ LOCK results in ER_NO_SUCH_TABLE.

So we also shouldn't allow FLUSH TABLES WITH READ LOCK open a child GTT.
Doing so would result in many unpredicted problems, like this assertion.

Particularly: m_prebuilt->select_lock_type stays LOCK_S after
FLUSH TABLE WITH READ LOCK, and then is not reset by
handler::external_lock or handler::start_stmt. However, innodb would
expect LOCK_X in SERIALIZABLE isolation.

In this commit:
Always submit parent GTT to FLUSH TABLES. Since FLUSH TABLES doesn't
open tables, there'll be no difference for it, and FLUSH TABLES WITH
READ LOCK will use a parent table.

Parent issue:
MDEV-35915 Implement Global temporary tables
Christian Hesse
MDEV-35969 wsrep: set new status for service manager (10.11 backport)

On WSREP state transfer the status in service manager changes to:

    WSREP state transfer (role ...) ongoing...

This status was not changed after state transfer was complete. Let's
change it again to reflect now situation:

    WSREP state transfer (role ...) comleted.

Signed-off-by: Julius Goryavsky <[email protected]>
Nikita Malyavin
Revert "MDEV-38683 SIGSEGV (dbg), SIGABRT or ER_EMPTY_QUERY when using ROWS EXAMINED with log_output=TABLE"

This reverts commit 5d26d515fc316c1509e22b00eb5453aa288ee7ad.
Nikita Malyavin
MDEV-37850 Wrong error on DROP TABLE GTT after DROP DATABASE

Turns out that temporary tables are not dropped as part of DROP
DATABASE.

This patch implements dropping child global temporary tables for the
currently dropping database.

That is, if the child table was opened in this connection, it will be
dropped together with the parent table.

If another connection attempts to drop the database, it will wait while
the table is in use.

Parent issue:
MDEV-35915 Implement Global temporary tables
Rex Johnston
MDEV-29360 Crash when pushing condition with always false IS NULL into derived

When a condition containing an always FALSE range part is pushed
down into a derived table, an enclosed outer reference can cause
a null pointer crash.  An example

SELECT * FROM (SELECT id  FROM t1 GROUP BY id) dt1, (SELECT id FROM t2) dt2, t3
  WHERE dt2.id = t3.id AND dt1.id BETWEEN 0 AND (dt2.id IS NULL);

is considered as one that can be pushed into the derived table dt1
because the expression (dt2.id IS NULL) is identified as always false.
On the on other hand the condition still contains a reference to a
column of the table dt2. When pushing the condition to the where clause
of the derived table dt1 a copy of it is created and this copy is
transformed to be used in the new where clause. When the transformation
procedure encounters a reference dt2.id it crashes the server as only
the references to the columns used in the group by list of the
specification of dt1 or those equal to them are expected in the
condition that can be pushed into the where clause of the derived table.

The fix here is transform the argument to the function Item_func_isnull
from something that may be a column reference, but cannot be null to
an Item_literal that also cannot be null (1).

Based on patch by Igor Babaev.
Nikita Malyavin
MDEV-38448 assertion ...tdc->ref_count > 0 failed on LOCK gtt+open error

If open_global_temporary_table failed, a goto was to an incorrect place.
In locked_tables_mode, an extra acquire didn't happen, so a release on
error shouldn't have happened as well (i.e. goto err_lock).
That is, in locked_tables_mode, just return immediately on error.

The easiest way to reproduce it was with DML while pseudo_slave_mode=1,
but actually any error inside open_global_temporary_table would do.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38937 GTT: 1944 Error executing row event with trigger replication

Row events prelock tables for triggers even if those triggers are not
accessed. Write_row event is known to trigger a wider set of row
operations. In IDEMPOTENT mode it is

  trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_DELETE);

So no surprise that AFTER DELETE trigger is prepared for insert event.

If the table in trigger doesn't exist though, the error wouldn't be
triggered.

Make the same for GTT:
ignore its open denials on slave if it's meant so.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38937 GTT: 1944 Error executing row event with trigger replication

Row events prelock tables for triggers even if those triggers are not
accessed. Write_row event is known to trigger any kind of row operation:

uint8 Write_rows_log_event::get_trg_event_map() const
{
  return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
          trg2bit(TRG_EVENT_DELETE);
}
So no surprise that AFTER UPDATE trigger is prepared for insert event.

If the table in trigger doesn't exist though, the error wouldn't be
triggered.

Make the same for GTT:
ignore its open denials on slave if it's meant so.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38480 GTT: Aria gets error HA_ERR_CRASHED_ON_USAGE after TRUNCATE

Do not call HA_EXTRA_PREPARE_FOR_DROP for the parent table

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37798 Incomplete savepoint support with global temporary tables

Add empty savepoint support callbacks to global_temporary_tp
Nikita Malyavin
MDEV-37720 use-after-free on CREATE OR REPLACE GTT under pseudo_slave_mode

... and LOCK TABLES.

Global temporary tables data is not replicated, and pseudo_slave_mode is
used internally for partial replication testing.

Hence forbid opening GTT (i.e. create child GTT handles) under
pseudo_slave_mode, and forbid setting pseudo_slave_mode=1 whenever child
GTT handles are open.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38266 Infinite loop after LOCK+REPAIR

Case:
1. Two tables are locked, one of them is GTT
2. Invoke REPAIR on the last table in the list (not GTT)
3. SELECT from gtt

How the bug works:
1. REPAIR sets tdc->flushed=true
2. LOCK TABLE will prevent eviction
3. In SELECT, open_table will go by locked_tables_mode path
4. GTT is found, goto get_new_table (bug!).
5. This is true: thd->open_tables && thd->open_tables->s->tdc->flushed
6. ot_ctx->request_backoff_action
7. open_table retry (infinite).

Fix:
Straighten the flow.
We shouldn't check thd->open_tables->s->tdc->flushed in LTM, but
actually we should do none under get_new_table label right until
open_global_temporary_table.

get_new_table would access tdc and search for TABLE_SHARE, but actually
we already have it. We also shouldn't configure it from scratch - it's
already done. Overall, we can jump directly to opening GTT, with setting
a few variables.

Because TABLE_SHARE will not be opened through tdc (where acquire would
happen), we shouldn't release it in open_global_temporary_table under
locked_tables_mode+MYSQL_OPEN_GET_NEW_TABLE.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37872 SIGSEGV on some GTT operations under pseudo_thread_id changed

Deny pseudo_thread_id changing when there are some GTTs are open.
pseudo_thread_id is only used for replication testing. Since GTT child
tables are never opened on replicas, it's fine to do so -- there is no
case to test.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38151 GTT: missing FUNCTION support

open_temporary_table[s] defaulted to searching only local temporary
tables (Tmp_table_kind::TMP). When in function, a temporary table was
"carefully re-opened": it was closed and then opened again, with
open_temporary_table. This resulted in "table not found".

The correct key in most cases is Tmp_table_kind::ANY.
In some cases it should be Tmp_table_kind::TMP:
* When operation is not supported for GTT (ANALYZE/REPAIR)
* When a global handle should be opened (CREATE VIEW)
* If it's a re-open

Apart from this bug, it caused a global temporary table to be always
opened through open_tables, meaning that tdc was queried first. This
means that the earlier code never relied on pre-opening
temporary tables.

This means that all the commands that follow the default
open_temporary_tables path in mysql_execute_command (the standard
temporary tables pre-opening) should be able to handle child GTT share.

This wasn't so for TRUNCATE, hence the changes in sql_truncate.cc.

Also, this broke the lookup order: first a local temporary table should
be looked up. If it doesn't exist, only then a global temporary table
should be looked up.
To fix the latter -- push back global temporary tables' local shares and
push front local temporary tables.

To support push_front, All_tmp_tables_list declaration is changed. It
should use I_P_List_fast_push_back adapter, which adds T **m_last to the
list body.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37934 Assertion `thd->transaction->stmt.is_empty()...' in GRANT

...on GTT failed

Open a parent handle for GTT on GRANT.
ON COMMIT PRESERVE ROWS does not register handlerton, so it will work
fine.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37817 DROP TABLE GTT doesn't succeed for ON COMMIT DELETE ROWS

Drop child GTTs on pre-statement impllicit commit stage.

We can't do that inside trans_commit_implicit, because some implicit
commits are fake and part of a bigger logic, where we'd want to preserve
open GTTs.

We can't call mark_tmp_tables_as_free_for_reuse either, since there
could be tables just opened for this transaction, so only drop
exactly what's needed, assuming that tables were marked for reuse in
prev statement, but not dropped yet. One place where mark for reuse is
still required is after closing HANDLER tables.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37941 Assertion !thd->rgi_slave failed on INSERT w/ parallel slave

Replicas can't crash on the incorrect/unexpected data. It should react
with an error.

Change the assertion to if and return error if the relay log contains
query with GTT access.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37871 SIGSEGV in I_P_List_iterator on DROP DATABASE test

Happens on dropping the database on a newly created conneciton.

temporary_tables can be NULL in THD::global_tmp_drop_database.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37956 use-after-free in mysql_ha_close_table on DROP DATABASE

Drop global temporary tables after dropping handlers.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38567 GTT Context corruption on repeated SQL when autocommit=0

Always reset temporary_tables->committed when
drop_on_commit_delete_tables is called. Do it right in that function.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37958 SIGSEGV in ha_mroonga::storage_create_foreign_key on INSERT

More a mroonga bug, but doesn't reproduce otherwise.
Use a correct alter_info, not the one stored in lex.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37718 Assertion '!thd->rgi_slave' failed on GTT DML

Assertion '!thd->rgi_slave' failed in open_global_temporary_table on
CREATE/ANALYZE GTT, also a SIGSEGV in the release build.

This is a result of a fact that some operations led to opening a child
table on slave. The bug can be split in two parts:

1. SELECT part of CREATE...SELECT is replicated. It was binlogged,
despite table_creation_was_logged=0 explicitly set. To avoid, fall to
the row logging path of create_select, i.e. log SHOW CREATE output, but
don't actually log rows.
The relevant changes are in sql_insert.cc

2. Admin commands like ANALYZE TABLE still create a child table on open,
but are binlogged. Binlogging them would be otherwise harmless, but
better to avoid it, until the commands are fully supported and make
sense.
For now, avoid binlogging them with lex->no_write_to_binlog=false.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38567 GTT Context corruption on repeated SQL when autocommit=0

Always reset temporary_tables->committed when
drop_on_commit_delete_tables is called. Do it right in that function.

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37898 No release GTT MTR tests due to debug_sync injection

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-37957 Assertion lock_type >= TL_READ_SKIP_LOCKED failed on HANDLER

...READ

Don't set lock_type to TL_IGNORE: open_temporary_table intentionally
sets it to TL_WRITE to "simulate locking".

Parent issue:
MDEV-35915 Implement Global temporary tables
Nikita Malyavin
MDEV-38568 GTT: Assertion thd->mdl_context.is_lock_owner failed in CoR

The crash happens on the junction of GTT, CREATE OR REPLACE...SELECT,
LOCK TABLES, and error during select.

1. The parent table should be dropped with drop_open_table, not
quick_rm_table, because it should first be closed.
2. In select_create::abort_result_set, drop the parent table as well.
3. Store parent parent GTT in select_create -- this improves readability
  and access hugely.

Parent issue:
MDEV-35915 Implement Global temporary tables