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
drrtuy
fix: replace old storage format with the 1.5.2 to enable advanced compression methods.
Kristian Nielsen
Semi-sync: Implement support for using GTID in semi-sync ACKs

Implement the necessary logic in class Repl_semi_sync_master_gtid and
related code, so that the semi-sync master can request the slave to put the
GTID in the reply ACK packet, instead of the filename/offset.

In GTID mode, when a slave connects (which it should do using a GTID start
position), the latest GTID in the starting position (if any), as determined
by the list of transactions pending acks, is used as the point at which to
implicit ACK anything pending.

The semi-sync logic is otherwise unchanged, in GTID mode it just uses the
GTID as the transaction identifier instead of the file/pos of the end of the
event group.

This patch only enables the GTID-based semisync for binlog-in-engine, but
the mode works with old binlog implementation as well, and passes all tests
(if enabled by code change).

Signed-off-by: Kristian Nielsen <[email protected]>
PranavKTiwari
MDEV-40167: GTT created with the InnoDB incorrectly accept FULLTEXT/VECTOR indexes
Problem:
GLOBAL TEMPORARY tables were not subject to the same option/index restrictions as session TEMPORARY tables. Several InnoDB and server-layer checks tested only tmp_table(), so GLOBAL TEMPORARY tables could bypass validation for VECTOR/FULLTEXT indexes, DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED.

Cause:
global_tmp_table() was added as a separate predicate from tmp_table(), but not all temp-table checks were updated to test both, so GLOBAL TEMPORARY tables fell through to "permanent table" logic in several places.

Fix:
Added global_tmp_table() alongside tmp_table() at each affected check:

Reject VECTOR and FULLTEXT indexes on GLOBAL TEMPORARY tables.
Reject/warn on DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED for GLOBAL TEMPORARY tables, with accurate wording in the DATA DIRECTORY warning.
Fixed zip_allowed and related ut_ad assertions to exclude GLOBAL TEMPORARY tables.
Fixed m_use_file_per_table in set_tablespace_type() to exclude GLOBAL TEMPORARY tables (also fixes m_use_data_dir).
GLOBAL TEMPORARY tables now validate the same as session TEMPORARY tables across these options.
Yuchen Pei
MDEV-37739 Downcase the db part of the new table name in ALTER when lower_case_table_names > 0

When lower_case_table_names > 0 the db part of table names are
downcased in CREATE TABLE or SHOW CREATE TABLE (in
TABLE_LIST::TABLE_LIST). This patch makes ALTER do the same, which
fixes assertion failure caused the inconsistency.
Vladislav Vaintroub
MDEV-37739 Fix remaining test cases in parts suite on case-insensitive FS

1. Relax InnoDB rename assertion for partitions

row_rename_table_for_mysql() asserted that RENAME_IGNORE_FK is never
used to rename a table to a temporary name:

    ut_ad(fk != RENAME_IGNORE_FK || !new_is_tmp);

But EXCHANGE PARTITION renames a partition to a temporary #sql-exchange
name, and during DDL-log recovery with lower_case_table_names=1 this
reaches the partition retry in innobase_rename_table(), which passes
RENAME_IGNORE_FK.  So relax the assertion for partition names.
This fixes an assertion failure in parts.partition_debug_innodb during
crash recovery; debug-only change.

2. Fix diff in parts.alter_table

Guard the lower_case_table_names combinations in include/lcase_names.inc
with the matching include/have_lowercaseN.inc,
so each is skipped unless the server actually ended up in that mode.
mtr can be run (and on one CI machine is run) with a forced
--mysqld=--lower_case_table_names, and the server does not always
honour the request (=2 is reset to 0 on a case-sensitive filesystem).
The "def" combination assumed lower_case_table_names=0; make that
explicit and rename it to lcase0 for symmetry with lcase1/lcase2.  It
stays an empty combination, since an explicit =0 would make the server
refuse to start on a case-insensitive filesystem.

3. Make sure the parts suite is actually tested on CI on case-insensitive
filesystem

add it to buildbot_suites.bat. In addition, test on case-sensitive NTFS
directory (Github Actions builder)
sjaakola
MDEV-39681 delayed BF aborting with multi master load

Reason for the hanging, and occasional crashes turned out
to be orphaned innodb lock wait request of a BF aborted
local transaction, which had arrived in commit stage.

Reason is that wsrep BF-abort marks a transaction a deadlock
victim out-of-band, so (unlike native deadlock resolution)
the victim can still own a live LOCK_WAIT request;
if that orphaned waiter survives into commit/rollback,
another transaction granting it calls lock_wait_end() cross-thread
and corrupts the victim's state — surfacing as the lock_wait_end,
que_thr_step, and rollback_finish assertions.

This commit has fixes for claering lock wait status of BF aborted
transactions.

Commit has also a new mtr test: galera.galera_bf_abort_orphan_lock
to work as regression test for the fix.
Kristian Nielsen
Implement support for semi-sync with --binlog-storage-engine

Call report_binlog_update() when semi-synchronous replication is enabled and
using --binlog-storage-engine.

Only AFTER_COMMIT is available. The AFTER_SYNC in legacy binlog has the
property that changes in a committing transaction does not get visible to
other transactions until the slave has acknowledged, avoiding phantom reads
if the master fails permanently just after. This requires the two-phase
commit between binlog and storage engine so that the binlog is written
before the transaction is engine-committed. However, the whole point of
--binlog-storage-engine is to avoid the expensive two-phase commit.

(The ability to avoid phantom reads could be later implemented as an
AFTER_PREPARE option, which would send binlog to slave and await ack before
it is written/committed into the engine).

Some existing semi-synchronous replication tests are adapted to also run in
the binlog_in_engine suite.

Signed-off-by: Kristian Nielsen <[email protected]>
Vladislav Vaintroub
Use the server's MariaDB::zlib target when built as a submodule (#316)

When Connector/C is built inside the MariaDB server tree, pick up the server's
zlib via the MariaDB::zlib target instead of running FIND_PACKAGE(ZLIB), so the
connector uses exactly the same zlib (bundled or system) as the server and no
longer depends on the FindZLIB result-variable signature. Standalone builds are
unchanged - they still fall back to FIND_PACKAGE(ZLIB).

Also stop adding zlib to CMAKE_REQUIRED_LIBRARIES: ZLIB_LIBRARY may now be an
(ALIAS) target which cannot be used inside try_compile() checks, and none of
those checks need zlib.

Server: MDEV-37996
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
Kristian Nielsen
Fix hang on master when disabling semi-sync

There is a global variable global_ack_signal_fd used to signal the receiver
thread to wake up when disabling semi-sync. This variable was cleared to -1
in the Ack_listener destructor, which ran at the end of the
Ack_receiver::run() function without any locking. If the thread was delayed
at that point, it could end up overwriting the new value set by a new
receiver thread. This would leave the server in a state with an invalid
global_ack_signal_fd and could cause a subsequent disable of semisync to
fail due to the wakeup not arriving at the receiver thread.

This was seen as a sporadic failure of the test case
rpl.rpl_semi_sync_cond_var_per_thd.

Fix by not modifying the global in constructor/destructor; instead set and
clear the global explicitly, allowing to clear the fd with proper locking
while the mutex is still being held.

Also fix a missing pthread_join(), which would leak thread descriptors and
allow to start a new receiver thread before the old one shut down fully.

(Either of these two changes fix the hang bug).

Signed-off-by: Kristian Nielsen <[email protected]>
Georg Richter
Fix MAX_DECIMAL_LENGTH to support internal precision limits

While the maximum definition for a DECIMAL column is limited to a
precision of 65, MariaDB's internal DECIMAL_MAX_STR_LENGTH for
non-column-bound literals/expressions can reach up to 83 characters
(including sign and decimal point).

Example of a large runtime literal causing this:
SELECT 12185184186.000000000000000000000000000024692343000000000000000000000000000000000002333
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
drrtuy
chore(docs): added DuckDB db file space reclaim methods.
Sergei Petrunia
MDEV-39005: Assertion failure on hint-forced Split-Materialized plan

The problem: consider a query in form:
  t1 JOIN (SELECT a FROM t2 GROUP BY a) dt ON dt.a=t1.a

After fix for MDEV-30877, the optimizer computes the number of GROUP BY
groups that we will have in the materialized derived table. It is saved
into TABLE(dt)->used_stat_records and propagates into
TABLE(dt)->opt_range_condition_rows.

On the other hand, the Split-Materialized optimization tries to compute
the number of rows it expects to find in the Split-Materialized derived
table.

These two numbers may come into disagreement: Split-Materialized may
produce a higher number, save it into JOIN_TAB::records and cause this
assertion in apply_selectivity_for_table() to fail:

    double table_records= rows2double(s->records);
    DBUG_ASSERT(table_records == 0 ||
                sel <= s->table->opt_range_condition_rows /
                table_records);

We will have sel=1.0 but opt_range_condition_rows < table_records.

Cardinality computations in Split-Materialized code omit a lot, for example
they omit the fact GROUP BY operation will reduce the number or rows.

For now, use a trivial fix: make sure Split-Materialized's estimate of
JOIN_TAB::records doesn't exceed the derived table size.
Pekka Lampio
MDEV-38389: Galera test failure on galera_3nodes.galera_vote_majority_dml

Fix the broken Galera MTR test galera_3nodes.galera_vote_majority_dml
by restoring the value of the AUTO_INCREMENT_OFFSET at the end of the
test.

Fix also two additional, platform-dependent failure modes were observed on
buildbot (aarch64-debian-12) that did not reproduce locally:

1) The test failed with "Found warnings/errors in server log file"
  on nodes 1 and 2:

    WSREP: Event 3 Write_rows_v1 apply failed: 1, seqno 5

  The mtr suppression only matched apply error code 3, but the
  apply-event return code (exec_res in wsrep_applier.cc) varies by
  platform and timing. Widen the suppression to match any error
  code with "apply failed: .*, seqno".

2) The test failed at:

    ALTER TABLE t1 MODIFY f2 LONGTEXT: ER_NO_SUCH_TABLE

  node_3 turned wsrep_on off and issued the ALTER before the
  CREATE TABLE from node_1 had been applied on node_3. Because
  wsrep_on was already off, no causality wait applied and the ALTER
  raced ahead of replication. Wait for t1 to exist on node_3 (while
  wsrep is still on) before disabling wsrep and altering the table.
diego dupin
Update CI workflow to correct ps-protocol tests
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
Thirunarayanan Balathandayuthapani
MDEV-38842 Server fails to drop .ibd file when vector table creation fails

Problem:
========
When creating tables with vector indexes, if the secondary table
creation fails after the main table is successfully created,
the server was not properly cleaning up the main table's .ibd file.
Stale file exists because create_table_impl() always called
ddl_log_complete() on any error, which disables DDL log entries
instead of executing them for cleanup. The main table would be
left behind even though the overall CREATE TABLE operation failed.

Solution:
=========
ha_create_table(): Make it responsible for cleaning up
everything it created when it returns an error.
On failure of the high level index creation, drop the main
table and shadow table.
Pekka Lampio
MDEV-38389: Fix remaining sporadic failures in
            galera_3nodes.galera_vote_majority_dml

Two additional, platform-dependent failure modes were observed on
buildbot (aarch64-debian-12) that did not reproduce locally:

1) The test failed with "Found warnings/errors in server log file"
  on nodes 1 and 2:

    WSREP: Event 3 Write_rows_v1 apply failed: 1, seqno 5

  The mtr suppression only matched apply error code 3, but the
  apply-event return code (exec_res in wsrep_applier.cc) varies by
  platform and timing. Widen the suppression to match any error
  code with "apply failed: .*, seqno".

2) The test failed at:

    ALTER TABLE t1 MODIFY f2 LONGTEXT: ER_NO_SUCH_TABLE

  node_3 turned wsrep_on off and issued the ALTER before the
  CREATE TABLE from node_1 had been applied on node_3. Because
  wsrep_on was already off, no causality wait applied and the ALTER
  raced ahead of replication. Wait for t1 to exist on node_3 (while
  wsrep is still on) before disabling wsrep and altering the table.
PranavKTiwari
MDEV-40167: GTT created with the InnoDB incorrectly accept FULLTEXT/VECTOR indexes
Problem:
GLOBAL TEMPORARY tables were not subject to the same option/index restrictions as session TEMPORARY tables. Several InnoDB and server-layer checks tested only tmp_table(), so GLOBAL TEMPORARY tables could bypass validation for VECTOR/FULLTEXT indexes, DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED.

Cause:
global_tmp_table() was added as a separate predicate from tmp_table(), but not all temp-table checks were updated to test both, so GLOBAL TEMPORARY tables fell through to "permanent table" logic in several places.

Fix:
Added global_tmp_table() alongside tmp_table() at each affected check:

Reject VECTOR and FULLTEXT indexes on GLOBAL TEMPORARY tables.
Reject/warn on DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED for GLOBAL TEMPORARY tables, with accurate wording in the DATA DIRECTORY warning.
Fixed zip_allowed and related ut_ad assertions to exclude GLOBAL TEMPORARY tables.
Fixed m_use_file_per_table in set_tablespace_type() to exclude GLOBAL TEMPORARY tables (also fixes m_use_data_dir).
GLOBAL TEMPORARY tables now validate the same as session TEMPORARY tables across these options.
Kristian Nielsen
Semi-sync: Some few after-review fixes

Signed-off-by: Kristian Nielsen <[email protected]>
Georg Richter
Merge branch '3.3' into 3.4
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
Sergei Petrunia
MDEV-39005: Assertion failure on hint-forced Split-Materialized plan

The problem: consider a query in form:
  t1 JOIN (SELECT a FROM t2 GROUP BY a) dt ON dt.a=t1.a

After fix for MDEV-30877, the optimizer computes the number of GROUP BY
groups that we will have in the materialized derived table. It is saved
into TABLE(dt)->used_stat_records and propagates into
TABLE(dt)->opt_range_condition_rows.

On the other hand, the Split-Materialized optimization tries to compute
the number of rows it expects to find in the Split-Materialized derived
table.

These two numbers may come into disagreement: Split-Materialized may
produce a higher number, save it into JOIN_TAB::records and cause this
assertion in apply_selectivity_for_table() to fail:

    double table_records= rows2double(s->records);
    DBUG_ASSERT(table_records == 0 ||
                sel <= s->table->opt_range_condition_rows /
                table_records);

We will have sel=1.0 but opt_range_condition_rows < table_records.

Cardinality computations in Split-Materialized code omit a lot, for example
they omit the fact GROUP BY operation will reduce the number or rows.

For now, use a trivial fix: make sure Split-Materialized's estimate of
JOIN_TAB::records doesn't exceed the derived table size.
Vladislav Vaintroub
MDEV-37739 Fix remaining test cases in parts suite on case-insensitive FS

1. Relax InnoDB rename assertion for partitions

row_rename_table_for_mysql() asserted that RENAME_IGNORE_FK is never
used to rename a table to a temporary name:

    ut_ad(fk != RENAME_IGNORE_FK || !new_is_tmp);

But EXCHANGE PARTITION renames a partition to a temporary #sql-exchange
name, and during DDL-log recovery with lower_case_table_names=1 this
reaches the partition retry in innobase_rename_table(), which passes
RENAME_IGNORE_FK.  So relax the assertion for partition names.
This fixes an assertion failure in parts.partition_debug_innodb during
crash recovery; debug-only change.

2. Fix diff in parts.alter_table

Guard the lower_case_table_names combinations in include/lcase_names.inc
with the matching include/have_lowercaseN.inc,
so each is skipped unless the server actually ended up in that mode.
mtr can be run (and on one CI machine is run) with a forced
--mysqld=--lower_case_table_names, and the server does not always
honour the request (=2 is reset to 0 on a case-sensitive filesystem).
The "def" combination assumed lower_case_table_names=0; make that
explicit and rename it to lcase0 for symmetry with lcase1/lcase2.  It
stays an empty combination, since an explicit =0 would make the server
refuse to start on a case-insensitive filesystem.

3. Make sure the parts suite is actually tested on CI on case-insensitive
filesystem

add it to buildbot_suites.bat. In addition, test on case-sensitive NTFS
directory (Github Actions builder)
Georg Richter
Workaround for MDEV-40260

Increase MAX_DECIMAL_SIZE from 83 to 121
(MAX_DECIMAL_STR_LENGTH + DECIMAL_MAX_SCALE).
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
PranavKTiwari
MDEV-40167: GTT created with the InnoDB incorrectly accept FULLTEXT/VECTOR indexes
Problem:
GLOBAL TEMPORARY tables were not subject to the same option/index restrictions as session TEMPORARY tables. Several InnoDB and server-layer checks tested only tmp_table(), so GLOBAL TEMPORARY tables could bypass validation for VECTOR/FULLTEXT indexes, DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED.

Cause:
global_tmp_table() was added as a separate predicate from tmp_table(), but not all temp-table checks were updated to test both, so GLOBAL TEMPORARY tables fell through to "permanent table" logic in several places.

Fix:
Added global_tmp_table() alongside tmp_table() at each affected check:

Reject VECTOR and FULLTEXT indexes on GLOBAL TEMPORARY tables.
Reject/warn on DATA DIRECTORY, KEY_BLOCK_SIZE, and ROW_FORMAT=COMPRESSED for GLOBAL TEMPORARY tables, with accurate wording in the DATA DIRECTORY warning.
Fixed zip_allowed and related ut_ad assertions to exclude GLOBAL TEMPORARY tables.
Fixed m_use_file_per_table in set_tablespace_type() to exclude GLOBAL TEMPORARY tables (also fixes m_use_data_dir).
GLOBAL TEMPORARY tables now validate the same as session TEMPORARY tables across these options.
Vladislav Vaintroub
MDEV-39047 Impossible to create DB grant for long escaped DB name

Reject GRANT if the database name (or pattern) does not fit into the
mysql.db.Db column.

It was silently truncated previously.
While this does not fix users problem, at least it would complain at
"Incorrect database name" with the overlong name listed at GRANT time.
Vladislav Vaintroub
MDEV-37739 Fix remaining test cases in parts suite on case-insensitive FS

1. Relax InnoDB rename assertion for partitions

row_rename_table_for_mysql() asserted that RENAME_IGNORE_FK is never
used to rename a table to a temporary name:

    ut_ad(fk != RENAME_IGNORE_FK || !new_is_tmp);

But EXCHANGE PARTITION renames a partition to a temporary #sql-exchange
name, and during DDL-log recovery with lower_case_table_names=1 this
reaches the partition retry in innobase_rename_table(), which passes
RENAME_IGNORE_FK.  So relax the assertion for partition names.
This fixes an assertion failure in parts.partition_debug_innodb during
crash recovery; debug-only change.

2. Fix diff in parts.alter_table

Guard the lower_case_table_names combinations in include/lcase_names.inc
with the matching include/have_lowercaseN.inc,
so each is skipped unless the server actually ended up in that mode.
mtr can be run (and on one CI machine is run) with a forced
--mysqld=--lower_case_table_names, and the server does not always
honour the request (=2 is reset to 0 on a case-sensitive filesystem).
The "def" combination assumed lower_case_table_names=0; make that
explicit and rename it to lcase0 for symmetry with lcase1/lcase2.  It
stays an empty combination, since an explicit =0 would make the server
refuse to start on a case-insensitive filesystem.

3. Make sure the parts suite is actually tested on CI on case-insensitive
filesystem

add it to buildbot_suites.bat. In addition, test on case-sensitive NTFS
directory (Github Actions builder)
Kristian Nielsen
mysqltest: Implement --enable_sync_gtid option

The --enable_sync_gtid option switches to use GTID-based
--sync_slave_with_master (eg. using MASTER_GTID_WAIT() instead of
MASTER_POS_WAIT()).

This is useful to run adapt existing test cases for use with
--binlog-storage-engine. But it is also useful in general for replication
using GTID (which is the default).

The option is off by default to not randomly break existing tests.

Signed-off-by: Kristian Nielsen <[email protected]>
Vladislav Vaintroub
MDEV-37739 Fix remaining test cases in parts suite on case-insensitive FS

1. Relax InnoDB rename assertion for partitions

row_rename_table_for_mysql() asserted that RENAME_IGNORE_FK is never
used to rename a table to a temporary name:

    ut_ad(fk != RENAME_IGNORE_FK || !new_is_tmp);

But EXCHANGE PARTITION renames a partition to a temporary #sql-exchange
name, and during DDL-log recovery with lower_case_table_names=1 this
reaches the partition retry in innobase_rename_table(), which passes
RENAME_IGNORE_FK.  So relax the assertion for partition names.
This fixes an assertion failure in parts.partition_debug_innodb during
crash recovery; debug-only change.

2. Fix diff in parts.alter_table

Guard the lower_case_table_names combinations in include/lcase_names.inc
with the matching include/have_lowercaseN.inc,
so each is skipped unless the server actually ended up in that mode.
mtr can be run (and on one CI machine is run) with a forced
--mysqld=--lower_case_table_names, and the server does not always
honour the request (=2 is reset to 0 on a case-sensitive filesystem).
The "def" combination assumed lower_case_table_names=0; make that
explicit and rename it to lcase0 for symmetry with lcase1/lcase2.  It
stays an empty combination, since an explicit =0 would make the server
refuse to start on a case-insensitive filesystem.

3. Make sure the parts suite is actually tested on CI on case-insensitive
filesystem

add it to buildbot_suites.bat. In addition, test on case-sensitive NTFS
directory (Github Actions builder)
Georg Richter
Fix ci error introduced by previous merge
Yuchen Pei
MDEV-37739 Move filename canonicalisation out of handlerton method to ha_delete_table

Just like when creating a table, the name canonicalisation happens in
ha_create_table.

This still allows table name canonicalisation to still take place
normally (e.g. in a DROP TABLE statement), but also fixes call the
handlerton method to drop partitions from DDL recovery, as for files
corresponding to partitions, in the format of
<table_name>#P#<partition_name>, consistently only table names are
canonicalised. For example in ha_partition::drop_partitions, first the
table name is canonicalised, before the #P#<partition_name> part is
appended, and the full name is passed to file->delete_table.

Strengthen some previous failing testcases to show that partition
names don't get lowered.
Kristian Nielsen
Implement support for semi-sync with --binlog-storage-engine

Call report_binlog_update() when semi-synchronous replication is enabled and
using --binlog-storage-engine.

Only AFTER_COMMIT is available. The AFTER_SYNC in legacy binlog has the
property that changes in a committing transaction does not get visible to
other transactions until the slave has acknowledged, avoiding phantom reads
if the master fails permanently just after. This requires the two-phase
commit between binlog and storage engine so that the binlog is written
before the transaction is engine-committed. However, the whole point of
--binlog-storage-engine is to avoid the expensive two-phase commit.

(The ability to avoid phantom reads could be later implemented as an
AFTER_PREPARE option, which would send binlog to slave and await ack before
it is written/committed into the engine).

Some existing semi-synchronous replication tests are adapted to also run in
the binlog_in_engine suite.

Signed-off-by: Kristian Nielsen <[email protected]>
Kristian Nielsen
Semi-sync: Clean up incorrect file/pos comparisons

The semi-sync code has a number of places where it compares pairs of
(filename,offset) for which is larger than the other.

The filename comparisons are done using strcmp(), which is wrong. Filenames
will compare wrong when they wrap from eg. bin-999999 to bin-1000000, and
user can also rename log files which can likewise break comparisons.

Further, the comparisons are completely unnecessary, as all the transactions
to be waited for are already stored in a linear list in order _and_ in a
hash table. So the code can simply use the existing hash table look and list
traversal to determine status and sequence of the waited-for transactions.

So this patch removes all the comparisons for larger/smaller, leaving only
comparisons for equality and effectively making the (filename,offset) pairs
just opaque transaction identifiers. And also removes a few other related
pieces of dead/unnecessary code.

Signed-off-by: Kristian Nielsen <[email protected]>
Vladislav Vaintroub
MDEV-39047 Impossible to create DB grant for long escaped DB name

Reject GRANT if the database name (or pattern) does not fit into the
mysql.db.Db column.

It was silently truncated previously.
While this does not fix users problem, at least it would complain at
"Incorrect database name" with the overlong name listed at GRANT time.
Georg Richter
Merge branch '3.3' into 3.4
  • cc-x-codbc-windows: 'dojob pwd if '3.4' == '3.4' ls win32/test SET TEST_DSN=master SET TEST_DRIVER=master SET TEST_PORT=3306 SET TEST_SCHEMA=odbcmaster if '3.4' == '3.4' cd win32/test if '3.4' == '3.4' ctest --output-on-failure' failed -  stdio
Alexander Barkov
MDEV-39587 Package-wide TYPE for variable declarations

SET sql_mode=ORACLE;
DELIMITER $$
CREATE OR REPLACE PACKAGE pkg AS
  -- Declare a package public data type
  TYPE varchar_array IS TABLE OF VARCHAR(2000) INDEX BY INTEGER;
END;
$$
DELIMITER ;
DELIMITER $$

CREATE OR REPLACE PROCEDURE p1 AS
  v pkg.varchar_array; -- Use the package public data type
BEGIN
  v(0):='test';
  SELECT v(0);
END;
$$
DELIMITER ;

Note, the change is done only for sql_mode=ORACLE, because the TYPE
declaration is not available for the default mode.

Where package-wide types are available
--------------------------------------
- Variabe list type:
    DECLARE var pkg1.type1;

- RETURN type for a package routine:
    CREATE FUNCTION .. RETURN pkg1.type1 ...

- Parameter type for a package routine:
    PROCEDURE p1(param1 pkg1.type1);

- Assoc array element type:
    TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- REF CURSOR RETURN type:
    TYPE cur1_t IS REF CURSOR RETURN pkg1.type1;

Change details
--------------

- Adding a member Lex_length_and_dec_st::m_foreign_module_type
  It's set to true when the data type was initialized from a TYPE
  in foreign routine (e.g. in PACKAGE spec).
  It's needed to prevent use of qualified identifiers in public contexts,
  i.e. in schema public routine parameter types and schema publuc function
  RETURN types.
  Adding a helper method sp_head::check_applicability() which prevents
  use of qualified types in public context.

- Adding a helper method sp_head::raise_unknown_data_type().

- Adding methods LEX::set_field_type_typedef_package_spec() for
  2-step and 3-step qualified indentifiers.
  It's used in field_type_all_with_typedefs which covers cases:
  - Variabe list type        : DECLARE var pkg1.type1;
  - RETURN type              : CREATE FUNCTION .. RETURN pkg1.type1 ...
  - Parameter type          : PROCEDURE p1(param1 pkg1.type1);
  - Assoc array element type : TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- Adding a method LEX::declare_type_ref_cursor_return_typedef().
  It handles cases when a new TYPE REF CURSOR RETURN is declared,
  for both for qualified RETURN types and non-qualified RETURN types:
  - TYPE cur0_t IS REF CURSOR RETURN rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN pkg1.rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN db1.pkg1.rec1_t;

  The code was moved from LEX::declare_type_ref_cursor() into
  LEX::declare_type_ref_cursor_return_typedef() and extended
  to cover qualified RETURN types.

- Adding a method Sql_path::find_package_spec_type().
  It iterates through all schemas specified in @@path and searches
  for the given type in the given package.

- Adding a helper method sp_pcontext::type_defs_add_ref_cursor()
  to reuse the code.

- Adding a new method sp_package::get_typedef() to search
  for TYPE definitions in PACKAGE specifications.

- Adding a new method sp_head::get_typedef_package_spec()
  to search for TYPE definitions used by a PROCEDURE or FUNCTION.

- Adding a helper method
    Sp_handler::sp_cache_routine_reentrant_suppress_errors
  Adding a method Sp_handler::find_package_spec().
Kristian Nielsen
Semi-sync: Refactor in preparation for using GTID in semi-sync acks

This is a refactor patch that contains no/little logic changes but a lot of
mostly mechanic code changes to prepare for allowing to use either old-style
filename/offset or new-style GTID to identify an event group in the
semi-sync ack.

The idea is to replace all explicit filename/offset function arguments with
a generic Repl_semi_sync_trx_info *inf to identify an event group (aka
"transaction"). This object can then be used to look up in the semi-sync
hash table by either file/pos or by GTID.

The classes Active_tranx and Repl_semi_sync_master are sub-classed into
Active_tranx_file_pos/Active_tranx_gtid and
Repl_semi_sync_master_file_pos/Repl_semi_sync_master_gtid. Virtual functions
are implemented in each for comparing identifiers and for calculating hash
keys, using either the file/pos or the GTID as appropriate. This way, the
existing logic can now be used with either (only file/pos is actually used
in this patch; adding GTID is for a subsequent patch).

For the binlog writing side, report_binlog_update(), wait_after_sync(), and
THD::semisync_info are extended to also take the GTID of the event group,
which is already available in the calling code.

For the dump thread / slave connection side, update_sync_header() is
extended to take also the GTID. The dump thread code is extended to keep
track of the GTID of the current event group (slightly extending the logic
already there to keep track of event groups). Also, the dump thread now only
passes the last event of an event group into the semisync layer (the other
events are redundant, as they are never semi-sync ack'ed, saving needless
semisync locking and hash lookups).

Signed-off-by: Kristian Nielsen <[email protected]>