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
Sergei Golubchik
MDEV-37815 field and index engine attributes in partitioning are broken

just like table attributes, field and index attributes must
be parsed using the underlying engine, not ha_partition.
Sergei Golubchik
use standard SET PATH syntax in tests
Sergei Golubchik
fix name resolution of name1.name2()

only search in thd->db if the path includes CURRENT_SCHEMA

Also, fix a bug with recursive function calls.
Sergei Golubchik
parsing of table/index/field attributes: auto-alias all boolean values

also allow TRUE/FALSE for booleans
Sergei Golubchik
old view doesn't store the path, need the same fallback as for triggers
Yuchen Pei
MDEV-9826 More hash algorithms for PARTITION BY [LINEAR] KEY

PARTITION BY [LINEAR] KEY ALGORITHM={MYSQL51|MYSQL55|BASE31|CRC32C|XXH32|XXH3}

- The MYSQL5X algorithms are the existing algorithms, with MYSQL55
  being the default
- The BASE31 algorithm uses a base-31 representation of the bytes, see
  Modular hashing in https://algs4.cs.princeton.edu/34hash/. It serves
  as a simple baseline that distributes better than the old mysql5x
  algorithms
- CRC32C uses my_crc32c.
- XXH32 and XXH3 are xxhash algorithms - xxhash.h copied from latest
  release (0.8.3) of https://github.com/Cyan4973/xxHash

For performance (esp. xxh) we use one-shot hash functions in binary
hash_sort, and streaming hash function otherwise for byte-by-byte
hashing. XXH is the only stateful hash function. The other hash
algorithms are stateless and homomorphic, so streaming and one-shot
functions are identical.

Also updated the columnstore hash due to the change of MY_HASH_ADD
signature.

The following testing commands were run at an earlier version of the
patch with the following patch that changes the default algorithm from
MYSQL55 to CRC32C, and XXH32 (changing the patch accordingly)

mtr --suite main --do-test=.*partition
mtr --suite parts

modified  sql/ha_partition.cc
@@ -10336,6 +10336,8 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
  switch ((*field_array)->table->part_info->key_algorithm)
  {
  case partition_info::KEY_ALGORITHM_NONE:
+    hasher.set_algorithm(HASH_ALGORITHM_CRC32C);
+    break;
  case partition_info::KEY_ALGORITHM_55:
    /* Hasher default to mysql55 */
    break;
modified  sql/partition_info.cc
@@ -2328,7 +2328,7 @@ bool partition_info::fix_parser_data(THD *thd)
      if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
            thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
          key_algorithm == KEY_ALGORITHM_NONE)
-        key_algorithm= KEY_ALGORITHM_55;
+        key_algorithm= PARTITION_INFO_DEFAULT_ALGORITHM;
    }
    DBUG_RETURN(FALSE);
  }
@@ -2344,7 +2344,7 @@ bool partition_info::fix_parser_data(THD *thd)
    if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
          thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
        key_algorithm == KEY_ALGORITHM_NONE)
-      key_algorithm= KEY_ALGORITHM_55;
+      key_algorithm= PARTITION_INFO_DEFAULT_ALGORITHM;
  }
  defined_max_value= FALSE; // in case it already set (CREATE TABLE LIKE)
  do
modified  sql/partition_info.h
@@ -446,6 +446,8 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc
  int gen_part_type(THD *thd, String *str) const;
};

+#define PARTITION_INFO_DEFAULT_ALGORITHM partition_info::KEY_ALGORITHM_CRC32C
+
void part_type_error(THD *thd, partition_info *work_part_info,
                      const char *part_type, partition_info *tab_part_info);

modified  sql/sql_partition.cc
@@ -2471,7 +2471,7 @@ static int add_key_with_algorithm(String *str, const partition_info *part_info)
  err+= str->append(STRING_WITH_LEN("KEY "));

  if (part_info->key_algorithm != partition_info::KEY_ALGORITHM_NONE &&
-      part_info->key_algorithm != partition_info::KEY_ALGORITHM_55)
+      part_info->key_algorithm != PARTITION_INFO_DEFAULT_ALGORITHM)
  {
    err+= str->append(STRING_WITH_LEN("ALGORITHM = "));
    switch (part_info->key_algorithm)
@@ -2479,6 +2479,9 @@ static int add_key_with_algorithm(String *str, const partition_info *part_info)
      case partition_info::KEY_ALGORITHM_51:
        err+= str->append(STRING_WITH_LEN("MYSQL51"));
        break;
+      case partition_info::KEY_ALGORITHM_55:
+        err+= str->append(STRING_WITH_LEN("MYSQL55"));
+        break;
      case partition_info::KEY_ALGORITHM_BASE31:
        err+= str->append(STRING_WITH_LEN("BASE31"));
        break;
Sergei Golubchik
MDEV-38523 Freeing unallocated data THD::set_db when path-resolved routine in trigger

add a test case
Sergei Golubchik
Don't implicitly search in CURRENT_SCHEMA

the intention was not to, but some code paths weren't fixed yet
Sergei Golubchik
PATH is not a chistic, it's like sql_mode, remembered implicitly per routine
Sergei Golubchik
improve test readability

fix confusing duplicate lines like

Invoke from Db: test, Rt: proc
Invoke from Db: test, Rt: proc
Sergei Golubchik
free Sql_path in the destructor, perform cleanup in cleanup()
Sergei Golubchik
consistency in error message naming
Sergei Golubchik
more tests for duplicate values in path
Sergei Golubchik
mysql.proc.path DEFAULT 'CURRENT_SCHEMA' NOT NULL
Sergei Golubchik
remove unused arguments
Sergei Golubchik
remove LEX::make_sp_name_sql_path()

it confusingly didn't have anything to do with sql path,
so merged into LEX::make_sp_name()
Yuchen Pei
MDEV-24813 Signal full table scan to storage engines

Will work in the following minimal example

--source include/have_innodb.inc
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB;
insert into t values (42);

BEGIN;
SELECT * FROM t LOCK IN SHARE MODE; # will acquire S lock
COMMIT;

DROP TABLE t;
Sergei Golubchik
allocate Sql_path in one memory chunk, not one per schema

because it's always allocated and freed as a whole, there is
no operation "replace one name in the middle of the path"

this needed a reworked parser to create the whole list
of names, not append one name at a time.

Fixed a bug where Sql_path::from_text() pretended it can take
a string in any charset, but was always implicitly
assuming it's in my_charset_utf8mb3_general_ci.
Sergei Golubchik
do NOT prefer itself in seemingly recursive calls, follow the path
Sergei Golubchik
merge ErrConvMDQName into ErrConvDQName

and remove incorrect thd->db behavior
Sergei Golubchik
MDEV-37815 table engine attributes in partitioning is broken

remove copying of part_elem->option_struct to table->s->option_struct.
It meant that most of the time a handler had no access to its options
(that's why some handlers resorted to a complex process of guessing the
correct partition) and couldn't work concurrenty. Instead

* introduce handler::option_struct which will point to
  table->s->option_struct or part_elem->option_struct as appropriate,
  the handler can use it any time as needed. A handler should not use
  table->s->option_struct unless it really knows what it's doing and has
  verified that it doesn't break partitioning
* rename option_struct in table->s to option_struct_table and in
  part_elem to option_struct_part to emphasize it's semantics and
  prevent incorrect usage.
* fix engines accordingly.
Sergei Golubchik
cleanup: remove #ifdef MYSQL_VERSION_ID

remove conditional compilation for old MariaDB versions.
Some were as old as MYSQL_VERSION_ID > 32300

Didn't touch engines hosted externally, like connect, mroonga,
and columnstore
Sergei Golubchik
disallow SET PATH DEFAULT in stored routines and triggers

also fix Sys_var_charset_collation_map where this bug was copied from
Sergei Golubchik
MDEV-37815 connect_string in partitioning is broken

let's simplify the code by removing copying of part_elem->connect_string
to table->s->connect_string. Move CONNECTION support from he server into
engines, engines define TOPTION("CONNECTION") if they want to support it,
it's stored in the option_struct and handled by the option_struct fix.
Problems:

* Mroonga used CONNECTION for something but there were no tests for it.
  Removed Mroonga support for CONNECTION as requested by the maintainer
  in MDEV-38530
* DROP/ALTER SERVER command used to close all tables using the server
  in question, avoiding the need for FLUSH TABLES. This functionality
  never worked for partitioned tables anyway and is now removed. Will be
  done properly in MDEV-37827.
Sergei Golubchik
cleanup: partition_element_iterator

reduce code duplication by introducing an iterator that
walks all partitions and subpartitions
Sergei Golubchik
change Sql_path::from_text() to take a String, not LEX_CSTRING

* use str->c_ptr() for the error message
* pass correct charset
* remove redundant parsing Table_triggers_list::check_n_load
Sergei Golubchik
fix printing of per-partition engine options

paritioning has its own method for printing engine options,
it wasn't consistent with how table options were printed - didn't
use quotes, ignored sql_mode, so wasn't future and dump/import safe.

let's get rid of it and use the same method that prints per-table
engine options.
Sergei Golubchik
fix --path to work

complex object sysvars (plugins, time zone, path) cannot be
set by my_getopt, they have to use NO_CMD_LINE and special
code in mysqld.cc
Sergei Golubchik
reserve PATH_SYM in the same way as NAMES_SYM
Sergei Golubchik
clarify the test for triggers with different paths
Sergei Golubchik
disallow SET PATH in sf or trg while parsing

but also when executing, of course
Sergei Golubchik
don't backtick-quote CURRENT_SCHEMA
Sergei Golubchik
cleanup

* rename to follow the standard vprintf name convention
* remove `(LEX_CSTRING*) &lex_string` casts
* remove some redundant casts too
* LEX_CSTRING -> Lex_ident_db in path
* Hash_set<Sroutine_hash_entry>
* move assert out of the loop
* some comments and whitespace changes
Sergei Golubchik
cleanup: remove HTON_CAN_READ_CONNECT_STRING_IN_PARTITION

only set in spider, but not used even there.
no behavior changes.
Sergei Golubchik
fix error message for assoc arrays
Sergei Golubchik
remove Sql_path_stack and Sql_path_push

don't create a permanent stack of paths on the heap and in THD.

Do it on the stack like for sql_mode, sctx, abort_on_warning, and
other THD properties that often need to be changed temporarily.

Fix Sql_path constructor.
Sergei Golubchik
bug: `current_schema` is not current_schema

quoted `current_schema` is literally a schema name and must
but treated as such. because Sql_path stores all names unquoted
let's store the current_schema as an empty name, length=0.
No valid schema name can be empty.
Marko Mäkelä
MDEV-37949: Implement innodb_log_archive

The InnoDB write-ahead log file (ib_logfile0) is pre-allocated to
innodb_log_file_size and written as a ring buffer. This is good for
write performance and space management, but unsuitable for arbitrary
point-in-time recovery or for facilitating incremental backup.

TODO: Implement multi-file recovery (currently, only 2-file)

TODO: Implement a test to show that specifying innodb_log_recovery_target
makes InnoDB read-only.

TODO: Test and fix the crash-safety and recovery of SET GLOBAL
innodb_log_archive. Implement proper recovery when the file header of
ib_%016x.log is in the innodb_log_archive=OFF format. Ensure that
the start LSN of the ib_logfile0 will be written in a way that
is compatible with the already written log_sys.get_sequence_bit().

TODO: Enforce a reasonable maximum innodb_log_file_size for the
innodb_log_archive=ON format. 4 GiB, perhaps? Maybe, store straight
32-bit file offsets in the checkpoint header.

innodb_log_archive=ON: A new format where InnoDB will create and
preallocate files ib_%016x.log instead of writing a circular file
ib_logfile0. The file name includes the log sequence number (LSN) at
file offset 12288 (log_t::START_OFFSET). Each file will be
pre-allocated to innodb_log_file_size. Once the log fills up, we will
create and pre-allocate another log file, to which log records will be
written. Upon the completion of the first log checkpoint in a recently
created log file, the old log file will be marked read-only, signaling
that there will be no further writes to that file, and that the file
may safely be moved to long-term storage.

innodb_log_recovery_start: The checkpoint LSN to start recovery from.
This will be useful when recovering from an archived log. This is useful
for restoring an incremental backup (applying InnoDB log files that were
copied since the previous restore).

innodb_log_recovery_target: The requested LSN to end recovery at.
This will be useful when recovering data files that were copied
as of a time that is before end of the available log. When this
parameter is set, InnoDB will be read-only.

The status variable innodb_lsn_archived will reflect the LSN
since when a complete InnoDB log archive is available. Its initial
value will be that of the new parameter innodb_log_archive_start.
If that variable is 0 (the default), the innodb_lsn_archived will
be recovered from the available log files. If innodb_log_archive=OFF,
innodb_lsn_archived will be adjusted to the latest checkpoint every
time a log checkpoint is executed. If innodb_log_archive=ON, the value
should not change.

The new setting SET GLOBAL innodb_log_archive=ON will enable log
archiving as soon as the current ib_logfile0 is about to wrap around.

SET GLOBAL innodb_log_archive=OFF will immediately rewrite the
checkpoint header in the latest ib_%016x.log and rename the file
to ib_logfile0.

When innodb_log_archive=ON, the setting SET GLOBAL innodb_log_file_size
will affect subsequently created log files when the file that is being
currently written is running out.

no_checkpoint_prepare.inc: A new file, to prepare for subsequent
inclusion of no_checkpoint_end.inc. We will invoke the server to
parse the log and to determine the latest checkpoint.

All --suite=encryption tests that use innodb_encrypt_log
will be skipped for innodb_log_encrypt=ON, because enabling
or disabling encryption on the log is not possible without
temporarily setting innodb_log_archive=OFF and restarting
the server. The idea is to add the following arguments to an
invocation of mysql-test/mtr:

--mysqld=--loose-innodb-log-archive --skip-test=mariabackup

The mariabackup test suite must be skipped when using the
innodb_log_archive=ON format, because mariadb-backup will only
support the old ib_logfile0 format (innodb_log_archive=OFF).

log_sys.first_lsn: The start of the current log file, to be consulted
in log_t::write_checkpoint() when renaming files.

log_sys.archived_lsn: New field: The value of innodb_lsn_archived.

log_sys.end_lsn: New field: The log_sys.get_lsn() when the latest
checkpoint was initiated. That is, the start LSN of a possibly empty
sequence of FILE_MODIFY records followed by FILE_CHECKPOINT.

log_sys.resize_target: The value of innodb_log_file_size that will be
used for creating the next archive log file once the current file (of
log_sys.file_size) fills up.

log_sys.archive: New field: The value of innodb_log_archive.

log_sys.next_checkpoint_no: Widen to uint16_t. There may be up to
12288/4=3072 checkpoints in the header.

log_sys.log: If innodb_log_archive=ON, this file handle will be kept
open also in the PMEM code path.

log_sys.resize_log: If innodb_log_archive=ON, we may have two log
files open both during normal operation and when parsing the log. This
will store the other handle (old or new file).

log_sys.resize_buf: In the memory-mapped code path, this will point
to the file resize_log when innodb_log_archive=ON.

log_t::archive_new_write(): Create and allocate a new log file, and
write the outstanding data to both the current and the new file.

log_t::archived_mmap_switch_prepare(): Create and memory-map a new log
file, and update file_size to resize_target. Remember the file handle
of the current log in resize_log, so that write_checkpoint() will be
able to make it read-only.

log_t::archived_mmap_switch_complete(): Switch to the buffer that was
created in archived_mmap_switch_prepare().

log_t::write_checkpoint(): Allow an old checkpoint to be completed in
the old log file even after a new one has been created. If we are
writing the first checkpoint in a new log file, we will mark the old
log file read-only. We will also update log_sys.first_lsn unless it
was already updated in ARCHIVED_MMAP code path. In that code path,
there is the special case where log_sys.resize_buf == nullptr and
log_sys.checkpoint_buf points to log_sys.resize_log (the old log file
that is about to be made read-only). In this case, log_sys.first_lsn
will already point to the start of the current log_sys.log, even
though the switch has not been fully completed yet.

log_t::header_rewrite(my_bool): Rewrite the log file header before or
after renaming the log file. The recovery of the last ib_%016%.log
file must tolerate also the ib_logfile0 format.

log_t::set_archive(my_bool): Implement SET GLOBAL innodb_log_archive.
An error will be returned if non-archived SET GLOBAL innodb_log_file_size
(log file resizing) is in progress. The current log file will be renamed
to either ib_logfile0 or ib_%016x.log, as appropriate.

log_t::archive_set_size(): A new function, to ensure that
log_sys.resize_target is set on startup.

log_checkpoint_low(): Do not prevent a checkpoint at the start of a file.
We want the first innodb_log_archive=ON file to start with a checkpoint.

log_t::create(lsn_t): Initialize last_checkpoint_lsn. Initialize the
log header as specified by log_sys.archive (innodb_log_archive).

log_write_buf(): Add the parameter max_length, the file wrap limit.

mtr_t::finish_writer(): Specialize for innodb_log_archive=ON

log_t::append_prepare<log_t::ARCHIVED_MMAP>(): Special case.

log_t::get_path(): Get the name of the current log file.

log_t::get_circular_path(size_t): Get the path name of a circular file.
Replaces get_log_file_path().

log_t::get_archive_path(lsn_t): Return a name of an archived log file.

log_t::get_next_archive_path(): Return the name of the next archived log.

log_t::append_archive_name(): Append the archive log file name
to a path string.

mtr_t::finish_writer(): Invoke log_close() only if innodb_log_archive=OFF.
In the innodb_log_archive=ON, we only force log checkpoints after creating
a new archive file, to ensure that the first checkpoint will be written
as soon as possible.

log_t::checkpoint_margin(): Replaces log_checkpoint_margin().
If a new archived log file has been created, wait for the
first checkpoint in that file.

srv_log_rebuild_if_needed(): Never rebuild if innodb_log_archive=ON.
The setting innodb_log_file_size will affect the creation of
subsequent log files. The parameter innodb_encrypt_log cannot be
changed while the log is in the innodb_log_archive=ON format.

log_t::attach(), log_mmap(): Add the parameter bool read_only.

recv_sys_t::find_checkpoint(): If the circular ib_logfile0 is missing,
determine the oldest archived log file with contiguous LSN.
If innodb_log_archive=ON, refuse to start if ib_logfile0 exists.
Open non-last archived log files in read-only mode.

recv_sys_t::find_checkpoint_archived(): Validate each checkpoint in
the current file header, and by default aim to recover from the last
valid one. Terminate the search if the last validated checkpoint
spanned two files.

log_parse_file(): Do not invoke fil_name_process() during
recv_sys_t::find_checkpoint_archived(), when we tolerate FILE_MODIFY
records while looking for a FILE_CHECKPOINT record.

recv_scan_log(): Invoke log_t::archived_switch_recovery() upon
reaching the end of the current archived log file.

log_t::archived_switch_recovery(): Switch files in the pread() code path.

log_t::archived_mmap_switch_recovery_complete(): Switch files in the
memory-mapped code path.

recv_warp: A pointer wrapper for memory-mapped parsing that spans two
archive log files.

recv_sys_t::parse_mmap(): Use recv_warp for innodb_log_archive=ON.

recv_sys_t::parse(): Tweak some logic for innodb_log_archive=ON.

log_t::set_recovered_checkpoint(): Set the checkpoint on recovery.
Updates also the end_lsn.

log_t::clear_mmap(): Clean up the logic.

log_t::persist(): Even if the flushed_to_disk_lsn does not change,
we may want to reset the write_lsn_offset.
Sergei Golubchik
relax assert to account for recursive RETURNS TEXT functions