1. 27 Mar, 2018 1 commit
    • Alexander Barkov's avatar
      MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger · 902ace09
      Alexander Barkov authored
      The problem resided in this branch of the "option_value_no_option_type" rule:
      
      | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
      
      Summary:
      
      1. internal_variable_name initialized tmp.var to trg_new_row_fake_var (0x01).
      2. The condition "if (tmp.var == NULL)" did not check
         the special case with trg_new_row_fake_var,
         so Lex->set_system_variable(&tmp, $3, $6) was
         called with tmp.var pointing to trg_new_row_fake_var,
         which created a sys_var instance pointing to 0x01 instead of
         a real system variable.
      3. Later, at the trigger invocation time, this method was called:
         sys_var::do_deprecated_warning (this=0x1, thd=0x7ffe6c000a98)
         Notice, "this" is equal to trg_new_row_fake_var (0x01)
      
      Solution:
      
      The old implementation with separate rules
      internal_variable_name (in sql_yacc.yy and sql_yacc_ora.yy) and
      internal_variable_name_directly_assignable (in sql_yacc_ora.yy only)
      was too complex and hard to follow.
      
      Rewriting the code in a more straightforward way.
      
      1. Changing LEX::set_system_variable()
      
      from:
      
      bool set_system_variable(struct sys_var_with_base *, enum_var_type, Item *);
      
      to:
      
      bool set_system_variable(enum_var_type, sys_var *, const LEX_CSTRING *, Item *);
      
      2. Adding new methods in LEX, which operate with variable names:
      
      bool set_trigger_field(const LEX_CSTRING *, const LEX_CSTRING *, Item *);
      bool set_system_variable(enum_var_type var_type, const LEX_CSTRING *name,
                               Item *val);
      bool set_system_variable(THD *thd, enum_var_type var_type,
                               const LEX_CSTRING *name1,
                               const LEX_CSTRING *name2,
                               Item *val);
      bool set_default_system_variable(enum_var_type var_type,
                                       const LEX_CSTRING *name,
                                       Item *val);
      bool set_variable(const LEX_CSTRING *name, Item *item);
      
      3. Changing the grammar to call the new methods directly
         in option_value_no_option_type,
         Removing rules internal_variable_name and
         internal_variable_name_directly_assignable.
      
      4. Removing "struct sys_var_with_base" and trg_new_row_fake_var.
      
      Good side effect:
      
      - The code in /sql reduced from 314 to 183 lines.
      - MDEV-15615 Unexpected syntax error instead of "Unknown system variable" ...
        was also fixed automatically
      902ace09
  2. 24 Mar, 2018 2 commits
  3. 23 Mar, 2018 1 commit
  4. 21 Mar, 2018 2 commits
    • Marko Mäkelä's avatar
      865cec92
    • Teemu Ollakka's avatar
      MDEV-15505 Fixes to compilation without -DWITH_WSREP:BOOL=ON · 33aad1d2
      Teemu Ollakka authored
      Removed including wsrep_api.h from service_wsrep.h. This caused
      various kinds of collisions with definitions when wsrep is
      not supposed to be built in. Defined functions wsrep_xid_seqno()
      and wsrep_xid_uuid() in wsrep_dummy.cc. Replaced wsrep_seqno_t
      with long long where wsrep_api.h is not included.
      
      Removed wsrep_xid_seqno() macro from wsrep_mysqld.h and made
      wsrep code using wsrep_xid_seqno() in handler.cc to be compiled
      in only if WITH_WSREP is ON.
      
      Included wsrep_api.h for mariabackup if WITH_WSREP is ON.
      33aad1d2
  5. 20 Mar, 2018 2 commits
  6. 17 Mar, 2018 1 commit
  7. 16 Mar, 2018 1 commit
  8. 15 Mar, 2018 5 commits
  9. 14 Mar, 2018 1 commit
    • Daniel Black's avatar
      MDEV-8743: where O_CLOEXEC is available, use for innodb buf_dump · fafec1a9
      Daniel Black authored
      As this is the only moderately critical fopened for writing file,
      create an alternate path to use open and fdopen for non-glibc platforms
      that support O_CLOEXEC (BSDs).
      
      Tested on Linux (by modifing the GLIBC defination) to take this
      alternate path:
      
      $ cd /proc/23874
      $ more fdinfo/71
      pos:    0
      flags:  02100001
      mnt_id: 24
      $ ls -la fd/71
      l-wx------. 1 dan dan 64 Mar 14 13:30 fd/71 -> /dev/shm/var_auto_i7rl/mysqld.1/data/ib_buffer_pool.incomplete
      fafec1a9
  10. 13 Mar, 2018 4 commits
  11. 12 Mar, 2018 12 commits
  12. 11 Mar, 2018 1 commit
  13. 10 Mar, 2018 4 commits
    • Marko Mäkelä's avatar
      MDEV-15529 IMPORT TABLESPACE unnecessarily uses the doublewrite buffer · 112df069
      Marko Mäkelä authored
      fil_space_t::atomic_write_supported: Always set this flag for
      TEMPORARY TABLESPACE and during IMPORT TABLESPACE. The page
      writes during these operations are by definition not crash-safe
      because they are not written to the redo log.
      
      fil_space_t::use_doublewrite(): Determine if doublewrite should
      be used.
      
      buf_dblwr_update(): Add assertions, and let the caller check whether
      doublewrite buffering is desired.
      
      buf_flush_write_block_low(): Disable the doublewrite buffer for
      the temporary tablespace and for IMPORT TABLESPACE.
      
      fil_space_set_imported(), fil_node_open_file(), fil_space_create():
      Initialize or revise the space->atomic_write_supported flag.
      
      buf_page_io_complete(), buf_flush_write_complete(): Add the parameter
      dblwr, to indicate whether doublewrite was used for writes.
      
      buf_dblwr_sync_datafiles(): Remove an unnecessary flush of
      persistent tablespaces when flushing temporary tablespaces.
      (Move the call to buf_dblwr_flush_buffered_writes().)
      112df069
    • Marko Mäkelä's avatar
      MDEV-15524 Do not disable page checksums for temporary tables · 54765aaa
      Marko Mäkelä authored
      buf_flush_init_for_writing(): Remove the parameter skip_checksum.
      54765aaa
    • Marko Mäkelä's avatar
      MDEV-15524 Do not write garbage for temporary tables · 4fa18d52
      Marko Mäkelä authored
      fsp_init_file_page_low(): Always initialize the page.
      4fa18d52
    • Marko Mäkelä's avatar
      1e4cb840
  14. 09 Mar, 2018 3 commits