1. 30 Dec, 2016 8 commits
  2. 29 Dec, 2016 11 commits
    • Marko Mäkelä's avatar
      MDEV-11679 Remove redundant function fsp_header_get_crypt_offset() · f2fe6510
      Marko Mäkelä authored
      fsp_header_get_crypt_offset(): Remove.
      
      xdes_arr_size(): Remove.
      
      fsp_header_get_encryption_offset(): Make this an inline function.
      
      The correctness of this change was ensured with the following patch
      that ensures that the two functions returned the same value, only
      differing by FSP_HEADER_OFFSET (38 bytes):
      
      diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
      index f2a4c6bf218..e96c788b7df 100644
      --- a/storage/innobase/fsp/fsp0fsp.cc
      +++ b/storage/innobase/fsp/fsp0fsp.cc
      @@ -850,6 +850,7 @@ fsp_parse_init_file_page(
       	return(ptr);
       }
      
      +static ulint fsp_header_get_encryption_offset(const page_size_t&);
       /**********************************************************************//**
       Initializes the fsp system. */
       void
      @@ -868,6 +869,31 @@ fsp_init(void)
       #endif
      
       	/* Does nothing at the moment */
      +
      +	for (ulint sz = 4096; sz <= 65536; sz *= 2) {
      +		ulint m;
      +		if (sz <= 16384) {
      +			for (ulint ph = 1024; ph <= sz; ph *= 2) {
      +				const page_size_t ps(ph, sz, true);
      +				ulint maria = fsp_header_get_crypt_offset(ps, &m),
      +					oracle = fsp_header_get_encryption_offset(ps);
      +				if (maria != oracle + 38) {
      +					ib::error() << "zip size mismatch: "
      +						    << maria << "!=" << oracle
      +						    << "(" << ph <<","<<sz<<")"
      +						    << m;
      +				}
      +			}
      +		}
      +		const page_size_t p(sz, sz, false);
      +		ulint maria = fsp_header_get_crypt_offset(p, &m),
      +			oracle = fsp_header_get_encryption_offset(p);
      +		if (maria != oracle + 38) {
      +			ib::error() << "size mismatch: "
      +				    << maria << "!=" << oracle
      +				    << "(" <<sz<<")" << m;
      +		}
      +	}
       }
      
       /**********************************************************************//**
      f2fe6510
    • Marko Mäkelä's avatar
      7bcae22b
    • Sergei Golubchik's avatar
      enable tests that were skipped because of have_xtradb · ab89359d
      Sergei Golubchik authored
      * some of these tests run just fine with InnoDB:
         -> s/have_xtradb/have_innodb/
      * sys_var tests did basic tests for xtradb only variables
         -> remove them, they're useless anyway (sysvar_innodb does it better)
      * multi_update had innodb specific tests
         -> move to multi_update_innodb.test
      ab89359d
    • Sergei Golubchik's avatar
      cleanup: binlog.binlog_killed_simulate · b3d6cbc2
      Sergei Golubchik authored
      b3d6cbc2
    • Sergei Golubchik's avatar
      cleanup: binlog.binlog_row_annotate · 0d897c2c
      Sergei Golubchik authored
      0d897c2c
    • Sergei Golubchik's avatar
      Merge branch '10.1' into 10.2 · 4a5d25c3
      Sergei Golubchik authored
      4a5d25c3
    • Sergei Golubchik's avatar
      cleanup: redundant memcmp() · 48dc7cc6
      Sergei Golubchik authored
      48dc7cc6
    • Alexander Barkov's avatar
      09615ca7
    • Alexander Barkov's avatar
      An improvement for the MDEV-11514 patch: adding data type name into debug output · b3706c82
      Alexander Barkov authored
      Now after the patch for MDEV-11478 added a new method Type_handler::name(),
      using the new method in debug output to make test results for MDEV-11514
      more readable (func_debug.result).
      b3706c82
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      MDEV-11672 mysql_list_field() returns wrong default values for VIEW · f6138883
      Alexander Barkov authored
      The problem happened because Item_ident_for_show::field_type() always
      returned MYSQL_TYPE_DOUBLE and ignored the actual data type of the
      referenced Field. As a result, the execution always used
      Item_ident_for_show::val_real() to send the default value of the field,
      so most default values for non-numeric types were displayed as '0'.
      
      This patch:
      1. Cleanup:
         a. Removes Send_field::charsetnr, as it's been unused since
            introduction of Item::charset_for_protocol() in MySQL-5.5.
         b. Adds the "const" qualifier to Field::char_length().
            This is needed for (5.a), see below.
      
      2. Introduces a new virtual method Type_handler::charset_for_protocol(),
         returning item->collation.collation for string data types, or
         &my_charset_bin for non-string data types.
      
      3. Changes Item::charset_for_protocol() from virtual to non-virtual.
         It now calls type_handler()->charset_for_protocol().
         As a good side effect, duplicate code in Item::charset_for_protocol() and
         Item_temporal_hybrid_func::charset_for_protocol() is now gone.
      
      4. Fixes Item_ident_for_show::field_type() to correctly return
         its data type according to the data type of the referenced field.
         This actually fixes the problem reported in MDEV-11672.
         Now the default value is sent using a correct method, e.g.
         val_str() for VARCHAR/TEXT, or val_int() for INT/BIGINT.
         This required additional changes:
         a. in DBUG_ASSERT in Protocol::store(const char *,size_t,CHARSET_INFO),
            This method is now used by mysqld_list_fields(), which
            (unlike normal SELECT queries) does not set
            field_types/field_pos/field_count.
         b. Item_ident_for_show::Item_ident_for_show() now set standard attributes
            (collation, decimals, max_length, unsigned_flag) according to the
            referenced field, to make charset_for_protocol() return the correct
            value and to make mysqld_list_fields() correctly send default
            values.
      
      5. In order to share the code between Item_field::set_field() and
         Item_ident_for_show::Item_ident_for_show():
         a. Introduces a new method Type_std_attributes::set(const Field*)
         b. To make (a) possible, moves Item::fix_char_length() from Item
            to Type_std_attributes, also moves char_to_byte_length_safe()
            from item.h to sql_type.h
         c. Additionally, moves Item::fix_length_and_charset() and
            Item::max_char_length() from Item to Type_std_attributes.
            This is not directly needed for the fix and is done just for symmetry
            with fix_char_length(), as these three methods are directly related
            to each other.
      f6138883
  3. 28 Dec, 2016 4 commits
    • Oleksandr Byelkin's avatar
      MDEV-11584: GRANT inside an SP does not work well on 2nd execution · 23cc1be2
      Oleksandr Byelkin authored
      Allocate password hash in statment memory
      23cc1be2
    • Oleksandr Byelkin's avatar
      MDEV-11584: GRANT inside an SP does not work well on 2nd execution · 100f721c
      Oleksandr Byelkin authored
      Allocate password hash in statment memory
      100f721c
    • Jan Lindström's avatar
      MDEV-11656: 'Data structure corruption' IMPORT TABLESPACE doesn't work for... · 283e9cf4
      Jan Lindström authored
      MDEV-11656: 'Data structure corruption' IMPORT TABLESPACE doesn't work for encrypted InnoDB tables if space_id changed
      
      Problem was that for encryption we use temporary scratch area for
      reading and writing tablespace pages. But if page was not really
      decrypted the correct updated page was not moved to scratch area
      that was then written. This can happen e.g. for page 0 as it is
      newer encrypted even if encryption is enabled and as we write
      the contents of old page 0 to tablespace it contained naturally
      incorrect space_id that is then later noted and error message
      was written. Updated page with correct space_id was lost.
      
      If tablespace is encrypted we use additional
      temporary scratch area where pages are read
      for decrypting readptr == crypt_io_buffer != io_buffer.
      
      Destination for decryption is a buffer pool block
      block->frame == dst == io_buffer that is updated.
      Pages that did not require decryption even when
      tablespace is marked as encrypted are not copied
      instead block->frame is set to src == readptr.
      
      If tablespace was encrypted we copy updated page to
      writeptr != io_buffer. This fixes above bug.
      
      For encryption we again use temporary scratch area
      writeptr != io_buffer == dst
      that is then written to the tablespace
      
      (1) For normal tables src == dst ==  writeptr
      ut_ad(!encrypted && !page_compressed ?
      	src == dst && dst == writeptr + (i * size):1);
      (2) For page compressed tables src == dst == writeptr
      ut_ad(page_compressed && !encrypted ?
      	src == dst && dst == writeptr + (i * size):1);
      (3) For encrypted tables src != dst != writeptr
      ut_ad(encrypted ?
      	src != dst && dst != writeptr + (i * size):1);
      283e9cf4
    • Marko Mäkelä's avatar
      MDEV-9282 Debian: the Lintian complains about "shlib-calls-exit" in ha_innodb.so · d50cf42b
      Marko Mäkelä authored
      Replace all exit() calls in InnoDB with abort() [possibly via ut_a()].
      Calling exit() in a multi-threaded program is problematic also for
      the reason that other threads could see corrupted data structures
      while some data structures are being cleaned up by atexit() handlers
      or similar.
      
      In the long term, all these calls should be replaced with something
      that returns an error all the way up the call stack.
      d50cf42b
  4. 27 Dec, 2016 3 commits
  5. 24 Dec, 2016 4 commits
  6. 23 Dec, 2016 1 commit
    • Marko Mäkelä's avatar
      Follow-up for MDEV-11630 Call mutex_free() before freeing the mutex list · bbb3fb31
      Marko Mäkelä authored
      fil_tablespace_iterate(): Call fil_space_destroy_crypt_data() to
      invoke mutex_free() for the mutex_create() that was done in
      fil_space_read_crypt_data(). Also, remember to free
      iter.crypt_io_buffer.
      
      The failure to call mutex_free() would cause sync_latch_meta_destroy()
      to access freed memory on shutdown. This affected the IMPORT of
      encrypted tablespaces.
      bbb3fb31
  7. 22 Dec, 2016 7 commits
    • Marko Mäkelä's avatar
      MDEV-11635 innodb.innodb_mysql test hangs · 08f79bde
      Marko Mäkelä authored
      Copy and adapt the test from MySQL 5.7.17.
      08f79bde
    • Marko Mäkelä's avatar
      MDEV-11630 Call mutex_free() before freeing the mutex list · d6a1f9f1
      Marko Mäkelä authored
      fil_space_crypt_cleanup(): Call mutex_free() to pair with
      fil_space_crypt_init().
      
      fil_space_destroy_crypt_data(): Call mutex_free() to pair with
      fil_space_create_crypt_data() and fil_space_read_crypt_data().
      
      fil_crypt_threads_cleanup(): Call mutex_free() to pair with
      fil_crypt_threads_init().
      
      fil_space_free_low(): Invoke fil_space_destroy_crypt_data().
      
      fil_close(): Invoke fil_space_crypt_cleanup(), just like
      fil_init() invoked fil_space_crypt_init().
      
      Datafile::shutdown(): Set m_crypt_info=NULL without dereferencing
      the pointer. The object will be freed along with the fil_space_t
      in fil_space_free_low().
      Remove some unnecessary conditions (ut_free(NULL) is OK).
      
      srv_shutdown_all_bg_threads(): Shut down the encryption threads
      by calling fil_crypt_threads_end().
      
      srv_shutdown_bg_undo_sources(): Do not prematurely call
      fil_crypt_threads_end(). Many pages can still be written by
      change buffer merge, rollback of incomplete transactions, and
      purge, especially in slow shutdown (innodb_fast_shutdown=0).
      
      innobase_shutdown_for_mysql(): Call fil_crypt_threads_cleanup()
      also when innodb_read_only=1, because the threads will have been
      created also in that case.
      
      sync_check_close(): Re-enable the invocation of sync_latch_meta_destroy()
      to free the mutex list.
      d6a1f9f1
    • Marko Mäkelä's avatar
      Remove an unnecessary comparison. · 545c9126
      Marko Mäkelä authored
      545c9126
    • Marko Mäkelä's avatar
      MDEV-11630 Call mutex_free() before freeing the mutex list · 7e02fd1f
      Marko Mäkelä authored
      Make some global fil_crypt_ variables static.
      
      fil_close(): Call mutex_free(&fil_system->mutex) also in InnoDB, not
      only in XtraDB. In InnoDB, sync_close() was called before fil_close().
      
      innobase_shutdown_for_mysql(): Call fil_close() before sync_close(),
      similar to XtraDB shutdown.
      
      fil_space_crypt_cleanup(): Call mutex_free() to pair with
      fil_space_crypt_init().
      
      fil_crypt_threads_cleanup(): Call mutex_free() to pair with
      fil_crypt_threads_init().
      7e02fd1f
    • Jan Lindström's avatar
      MDEV-11218: encryption.innodb_encryption_discard_import failed in buildbot · 55eb7120
      Jan Lindström authored
      Try to stabilize test cases. These test behave badly when run in certain order.
      55eb7120
    • Sergey Vojtovich's avatar
      MDEV-11227 - mysqlimport -l doesn't issue UNLOCK TABLES · 0c3791ca
      Sergey Vojtovich authored
      Merged fix for innodb_mysql from 5.7.
      0c3791ca
    • Vladislav Vaintroub's avatar
  8. 21 Dec, 2016 2 commits