1. 21 Feb, 2018 4 commits
    • Daniel Black's avatar
      MDEV-15356: tp_timeout_handler needs to call set_killed_no_mutex as it has the mutex · 868bca5c
      Daniel Black authored
      Regression introducted in c2118a08 where LOCK_thd_data was moveed
      to LOCK_thd_kill
      868bca5c
    • Vladislav Vaintroub's avatar
      Fix truncation warning on Windows. · 23d7b773
      Vladislav Vaintroub authored
      23d7b773
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      A cleanup for MDEV-15340 + fix MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME) · 5417002d
      Alexander Barkov authored
      The change N7 in MDEV-15340 (see the commit message) introduced
      a regression in how CAST(AS TIME), HOUR(), TIME_TO_SEC() treat datetimes
      '0000-00-DD mm:hh:ss' (i.e. with zero YYYYMM part and a non-zero day).
      These functions historically do not mix days to hours on datetime-to-time
      conversion. Implementations of the underlying methods used get_arg0_time()
      to fetch MYSQL_TIME. After MDEV-15340, get_arg0_time() went through the
      Time() constructor, which always adds '0000-00-DD' to hours automatically
      (as in all other places in the code we do mix days to hours).
      
      Changes:
      1. Extending Time() to make it possible to choose a desired way of treating
         '0000-00-DD' (ignore or mix to hours) on datetime-to-time conversion.
         Adding a helper class Time::Options for this, which now describes two aspects
         of Time() creation:
         1. Flags for get_date()
         2. Days/hours mixing behavior.
      
      2. Removing Item_func::get_arg0_time(). Using Time() directly
         in all affected classes. Forcing Time() to ignore (rather than mix)
         '0000-00-DD' in these affected classes by passing a suitable Options value.
      
      3. Adding Time::to_seconds(), to reuse the code between
         Item_func_time_to_sec::decimal_op() and Item_func_time_to_sec::int_op().
      
      4. Item_func::get_arg0_date() now returns only a datetime value,
         with automatic time-to-datetime conversion if needed. An assert was
         added to catch attempts to pass TIME_TIME_ONLY to get_arg0_date().
         All callers were checked not to pass TIME_TIME_ONLY, this revealed
         a bug MDEV-15363.
      
      5. Changing Item_func_last_day::get_date() to remove the TIME_TIME_ONLY flag
         before calling get_arg0_date(). This fixes MDEV-15363.
      5417002d
  2. 19 Feb, 2018 7 commits
    • Alexander Barkov's avatar
      MDEV-15340 Wrong result HOUR(case_expression_with_time_and_datetime) · aef530bb
      Alexander Barkov authored
      The problem was that Item_func_hybrid_field_type::get_date() did not
      convert the result to the correct data type, so MYSQL_TIME::time_type
      of the get_date() result could be not in sync with field_type().
      
      Changes:
      1. Adding two new classes Datetime and Date to store MYSQL_TIMESTAMP_DATETIME
         and MYSQL_TIMESTAMP_DATE values respectively
         (in addition to earlier added class Time, for MYSQL_TIMESTAMP_TIME values).
      2. Adding Item_func_hybrid_field_type::time_op().
         It performs the operation using TIME representation,
         and always returns a MYSQL_TIME value with time_type=MYSQL_TIMESTAMP_TIME.
         Implementing time_op() for all affected children classes.
      3. Fixing all implementations of date_op() to perform the operation
         using strictly DATETIME representation. Now they always return a MYSQL_TIME
         value with time_type=MYSQL_TIMESTAMP_{DATE|DATETIME},
         according to the result data type.
      4. Removing assignment of ltime.time_type to mysql_timestamp_type()
         from all val_xxx_from_date_op(), because now date_op() makes sure
         to return a proper MYSQL_TIME value with a good time_type (and other member)
      5. Adding Item_func_hybrid_field_type::val_xxx_from_time_op().
      6. Overriding Type_handler_time_common::Item_func_hybrid_field_type_val_xxx()
         to call val_xxx_from_time_op() instead of val_xxx_from_date_op().
      7. Modified Item_func::get_arg0_date() to return strictly a TIME value
         if TIME_TIME_ONLY is passed, or return strictly a DATETIME value otherwise.
         If args[0] returned a value of a different temporal type,
         (for example a TIME value when TIME_TIME_ONLY was not passed,
          or a DATETIME value when TIME_TIME_ONLY was passed), the conversion
         is automatically applied.
         Earlier, get_arg0_date() did not guarantee a result in
         accordance to TIME_TIME_ONLY flag.
      aef530bb
    • Hartmut Holzgraefe's avatar
    • Monty's avatar
      Fix for MDEV-15105 (memory loss with LOCK sequence) · ef3147b1
      Monty authored
      MDEV 15105 "Bytes lost and Assertion `global_status_var.global_memory_used == 0' fails on shutdown after attempts
      to LOCK/RENAME sequence"
      ef3147b1
    • Monty's avatar
      Test case for MDEV-12887 (bug fixed long ago) · 06ba07c2
      Monty authored
      MDEV-12887 UT_LIST_GET_LEN(trx->lock.trx_locks) == 0 when mysqldump
      sequence
      06ba07c2
    • Marko Mäkelä's avatar
      Merge 10.2 into bb-10.2-ext · 278c0362
      Marko Mäkelä authored
      278c0362
    • Marko Mäkelä's avatar
      112cb561
    • Marko Mäkelä's avatar
      Cleanup after commit ac8e3c85 · 3c419fde
      Marko Mäkelä authored
      srv_conc_t::n_active: Correct the comment, and remove an
      assertion that trivially holds now that the type is unsigned.
      3c419fde
  3. 18 Feb, 2018 2 commits
  4. 17 Feb, 2018 3 commits
    • Alexander Barkov's avatar
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 970ce270
      Marko Mäkelä authored
      Disable the test encryption.innodb_encryption-page-compression
      because the wait_condition would seem to time out deterministically.
      MDEV-14814 has to be addressed in 10.2 separately.
      
      Datafile::validate_first_page(): Do not invoke
      page_size_t::page_size_t(flags) before validating the tablespace flags.
      This avoids a crash in MDEV-15333 innodb.restart test case.
      FIXME: Reduce the number of error messages. The first one is enough.
      970ce270
    • Marko Mäkelä's avatar
      MDEV-15333 MariaDB (still) slow start · 9a46d971
      Marko Mäkelä authored
      This performance regression was introduced in the MariaDB 10.1
      file format incompatibility bug fix MDEV-11623 (MariaDB 10.1.21
      and MariaDB 10.2.4) and partially fixed in MariaDB 10.1.25 in
      MDEV-12610 without adding a regression test case.
      
      On a normal startup (without crash recovery), InnoDB should not read
      every .ibd data file, because this is slow. Like in MySQL, for now,
      InnoDB will still open every data file (without reading), and it
      will read every .ibd file for which an .isl file exists, or the
      DATA DIRECTORY attribute has been specified for the table.
      
      The test case shuts down InnoDB, moves data files, replaces them
      with garbage, and then restarts InnoDB, expecting no messages to
      be issued for the garbage files. (Some messages will for now be
      issued for the table that uses the DATA DIRECTORY attribute.)
      Finally, the test shuts down the server, restores the old data files,
      and restarts again to drop the tables.
      
      fil_open_single_table_tablespace(): Remove the condition on flags,
      and only call fsp_flags_try_adjust() if validate==true
      (reading the first page has been requested). The only caller with
      validate==false is at server startup when we are processing all
      records from SYS_TABLES. The flags passed to this function are
      actually derived from SYS_TABLES.TYPE and SYS_TABLES.N_COLS,
      and there never was any problem with SYS_TABLES in MariaDB 10.1.
      The problem that MDEV-11623 was that incorrect tablespace flags
      were computed and written to FSP_SPACE_FLAGS.
      9a46d971
  5. 16 Feb, 2018 6 commits
  6. 15 Feb, 2018 18 commits
    • Monty's avatar
      Don't run sql_sequence.grant for embeddes server · 14461603
      Monty authored
      14461603
    • Vladislav Vaintroub's avatar
    • Vladislav Vaintroub's avatar
      MDEV-14997 mariabackup crashes with invalid --innodb-flush-method · a08121c9
      Vladislav Vaintroub authored
      Avoid NULL pointer dereference when shutting down after invalid parameters
      were parsed.
      a08121c9
    • Elena Stepanova's avatar
    • Marko Mäkelä's avatar
      MDEV-15323 Follow-up to MDEV-14905: Skip FTS processing if innodb_read_only · 2bb19230
      Marko Mäkelä authored
      fts_cmp_set_sync_doc_id(), fts_load_stopword(): Start the transaction
      in read-only mode if innodb_read_only is set.
      
      fts_update_sync_doc_id(), fts_commit_table(), fts_sync(),
      fts_optimize_table(): Return DB_READ_ONLY if innodb_read_only is set.
      
      fts_doc_fetch_by_doc_id(), fts_table_fetch_doc_ids():
      Remove the code to start an internal transaction or to roll back,
      because this is a read-only operation.
      2bb19230
    • Marko Mäkelä's avatar
      Dead code removal: sess_t · 03400d97
      Marko Mäkelä authored
      The session object is not really needed for anything.
      We can directly create and free the dummy purge_sys->query->trx.
      03400d97
    • Marko Mäkelä's avatar
      MDEV-14905 Fulltext index modification committed during shutdown · 37af958d
      Marko Mäkelä authored
      If CREATE TABLE...FULLTEXT INDEX was initiated right before shutdown,
      then the function fts_load_stopword() could commit modifications
      after shutdown was initiated, causing an assertion failure in
      the function trx_purge_add_update_undo_to_history().
      
      Mark as internal all the read/write transactions that
      modify fulltext indexes, so that they will be ignored by
      the assertion that guards against transaction commits
      after shutdown has been initiated.
      
      fts_optimize_free(): Invoke trx_commit_for_mysql() just in case,
      because in fts_optimize_create() we started the transaction as
      internal, and fts_free_for_backgruond() would assert that the
      flag is clear. Transaction commit would clear the flag.
      37af958d
    • Marko Mäkelä's avatar
      MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow... · 6f314eda
      Marko Mäkelä authored
      MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow the storage engine to cleanup open connections
      
      Also, allow the MariaDB 10.2 server to link InnoDB dynamically
      against ha_innodb.so (which is what mysql-test-run.pl expects
      to exist, instead of the default name ha_innobase.so).
      
      wsrep_load_data_split(): Instead of referring to innodb_hton_ptr,
      check the handlerton::db_type. This was recently broken by me in
      MDEV-11415.
      
      innodb_lock_schedule_algorithm: Define as a weak global symbol,
      so that WITH_WSREP will not depend on InnoDB being linked statically.
      I tested this manually. Notably, running a test that only does
      	SET GLOBAL wsrep_on=1;
      with a static or dynamic InnoDB and
      	./mtr --mysqld=--loose-innodb-lock-schedule-algorithm=fcfs
      will crash with SIGSEGV at shutdown. With the default VATS
      combination the wsrep_on is properly refused for both the
      static and dynamic InnoDB.
      
      ha_close_connection(): Do invoke the method also for plugins
      for which UNINSTALL PLUGIN was deferred due to open connections.
      Thanks to @svoj for pointing this out.
      
      thd_to_trx(): Return a pointer, not a reference to a pointer.
      
      check_trx_exists(): Invoke thd_set_ha_data() for assigning a transaction.
      
      log_write_checkpoint_info(): Remove an unused DEBUG_SYNC point
      that would cause an assertion failure on shutdown after deferred
      UNINSTALL PLUGIN.
      
      This was tested as follows:
      
      cmake -DWITH_WSREP=1 -DPLUGIN_INNOBASE:STRING=DYNAMIC \
      -DWITH_MARIABACKUP:BOOL=OFF ...
      make
      cd mysql-test
      ./mtr innodb.innodb_uninstall
      6f314eda
    • Sauron's avatar
      Prevent building WSREP without INNODB · 54e66eef
      Sauron authored
      54e66eef
    • Vladislav Vaintroub's avatar
      743b073c
    • Marko Mäkelä's avatar
      Merge 10.2 into bb-10.2-ext · 4074c745
      Marko Mäkelä authored
      4074c745
    • Marko Mäkelä's avatar
      MDEV-15323 Follow-up to MDEV-14905: Skip FTS processing if innodb_read_only · 5ab46028
      Marko Mäkelä authored
      fts_cmp_set_sync_doc_id(), fts_load_stopword(): Start the transaction
      in read-only mode if innodb_read_only is set.
      
      fts_update_sync_doc_id(), fts_commit_table(), fts_sync(),
      fts_optimize_table(): Return DB_READ_ONLY if innodb_read_only is set.
      
      fts_doc_fetch_by_doc_id(), fts_table_fetch_doc_ids():
      Remove the code to start an internal transaction or to roll back,
      because this is a read-only operation.
      5ab46028
    • Vladislav Vaintroub's avatar
      f082c755
    • Marko Mäkelä's avatar
      Merge 10.2 into bb-10.2-ext · 22770a9f
      Marko Mäkelä authored
      22770a9f
    • Monty's avatar
      Crash when giving error message for ALTER SEQUENCE · 7bd81c72
      Monty authored
      Fixes MDEV-14761 "Assertion `!mysql_parse_status || thd->is_error() ||
      thd->get_internal_handler()' failed in parse_sql"
      7bd81c72
    • Marko Mäkelä's avatar
      Dead code removal: sess_t · 27ea2963
      Marko Mäkelä authored
      The session object is not really needed for anything.
      We can directly create and free the dummy purge_sys->query->trx.
      27ea2963
    • Marko Mäkelä's avatar
      MDEV-14905 Fulltext index modification committed during shutdown · 7baea2ef
      Marko Mäkelä authored
      If CREATE TABLE...FULLTEXT INDEX was initiated right before shutdown,
      then the function fts_load_stopword() could commit modifications
      after shutdown was initiated, causing an assertion failure in
      the function trx_purge_add_update_undo_to_history().
      
      Mark as internal all the read/write transactions that
      modify fulltext indexes, so that they will be ignored by
      the assertion that guards against transaction commits
      after shutdown has been initiated.
      
      fts_optimize_free(): Invoke trx_commit_for_mysql() just in case,
      because in fts_optimize_create() we started the transaction as
      internal, and fts_free_for_backgruond() would assert that the
      flag is clear. Transaction commit would clear the flag.
      7baea2ef
    • Marko Mäkelä's avatar
      MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow... · 5fe9b4a7
      Marko Mäkelä authored
      MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow the storage engine to cleanup open connections
      
      Also, allow the MariaDB 10.2 server to link InnoDB dynamically
      against ha_innodb.so (which is what mysql-test-run.pl expects
      to exist, instead of the default name ha_innobase.so).
      
      wsrep_load_data_split(): Instead of referring to innodb_hton_ptr,
      check the handlerton::db_type. This was recently broken by me in
      MDEV-11415.
      
      innodb_lock_schedule_algorithm: Define as a weak global symbol,
      so that WITH_WSREP will not depend on InnoDB being linked statically.
      I tested this manually. Notably, running a test that only does
      	SET GLOBAL wsrep_on=1;
      with a static or dynamic InnoDB and
      	./mtr --mysqld=--loose-innodb-lock-schedule-algorithm=fcfs
      will crash with SIGSEGV at shutdown. With the default VATS
      combination the wsrep_on is properly refused for both the
      static and dynamic InnoDB.
      
      ha_close_connection(): Do invoke the method also for plugins
      for which UNINSTALL PLUGIN was deferred due to open connections.
      Thanks to @svoj for pointing this out.
      
      thd_to_trx(): Return a pointer, not a reference to a pointer.
      
      check_trx_exists(): Invoke thd_set_ha_data() for assigning a transaction.
      
      log_write_checkpoint_info(): Remove an unused DEBUG_SYNC point
      that would cause an assertion failure on shutdown after deferred
      UNINSTALL PLUGIN.
      
      This was tested as follows:
      
      cmake -DWITH_WSREP=1 -DPLUGIN_INNOBASE:STRING=DYNAMIC \
      -DWITH_MARIABACKUP:BOOL=OFF ...
      make
      cd mysql-test
      ./mtr innodb.innodb_uninstall
      5fe9b4a7