[Commits] 5db2195: Merge tag 'mariadb-10.0.28' into 10.0-galera

Nirbhay Choubey nirbhay at mariadb.com
Fri Oct 28 22:50:14 EEST 2016


revision-id: 5db2195a35c0a2ee7703ab603721b2f0987d2585 (mariadb-galera-10.0.27-4-g5db2195)
parent(s): c9ded859a6fad25fc513d3a0c7d17f826e567691 eca8c324e9a02f530853580991b11b587f54b24a
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-10-28 15:50:13 -0400
message:

Merge tag 'mariadb-10.0.28' into 10.0-galera


 CREDITS                                            |   1 +
 VERSION                                            |   2 +-
 client/mysql.cc                                    |  56 +-
 client/mysqldump.c                                 |  60 +-
 client/mysqltest.cc                                |   4 -
 cmake/cpack_rpm.cmake                              |   3 +
 cmake/package_name.cmake                           |   4 +
 extra/innochecksum.cc                              |  55 +-
 extra/yassl/README                                 |  18 +
 extra/yassl/certs/dsa-cert.pem                     |  38 +-
 extra/yassl/include/openssl/ssl.h                  |   2 +-
 extra/yassl/src/ssl.cpp                            |  60 +-
 extra/yassl/taocrypt/include/aes.hpp               |  58 ++
 extra/yassl/taocrypt/include/integer.hpp           |   3 +
 extra/yassl/taocrypt/src/aes.cpp                   | 172 +++--
 extra/yassl/taocrypt/src/asn.cpp                   |  24 +-
 extra/yassl/taocrypt/src/dsa.cpp                   |  16 +-
 extra/yassl/taocrypt/src/integer.cpp               |   5 +-
 extra/yassl/taocrypt/test/test.cpp                 |   3 +
 extra/yassl/testsuite/test.hpp                     |   2 +-
 include/byte_order_generic_x86.h                   |  10 -
 include/byte_order_generic_x86_64.h                |   8 -
 include/my_global.h                                |   3 +-
 include/my_sys.h                                   |   4 +-
 libmysql/libmysql.c                                |   5 +-
 mysql-test/extra/binlog_tests/database.test        |   2 +-
 mysql-test/include/index_merge2.inc                |   1 +
 mysql-test/include/search_pattern_in_file.inc      |  15 +-
 mysql-test/lib/My/CoreDump.pm                      |   6 +-
 mysql-test/lib/My/Platform.pm                      |  49 +-
 mysql-test/lib/mtr_cases.pm                        |   4 +-
 mysql-test/lib/mtr_io.pl                           |   9 +-
 mysql-test/lib/mtr_report.pm                       |   3 +-
 mysql-test/mysql-test-run.pl                       |  10 +-
 mysql-test/r/alter_table.result                    |  55 ++
 mysql-test/r/contributors.result                   |   1 +
 mysql-test/r/create_or_replace.result              |  11 +
 mysql-test/r/ctype_utf32.result                    |   3 +
 mysql-test/r/drop.result                           |   6 +
 mysql-test/r/group_min_max_innodb.result           |  16 +
 mysql-test/r/index_merge_innodb.result             |   3 +
 mysql-test/r/index_merge_myisam.result             |   3 +
 mysql-test/r/information_schema.result             |   8 +-
 mysql-test/r/lowercase_fs_on.result                |   1 +
 mysql-test/r/merge.result                          |  17 +
 mysql-test/r/mysql.result                          |   8 +
 mysql-test/r/mysql_not_windows.result              |   6 +
 mysql-test/r/mysqldump-nl.result                   | 126 ++++
 mysql-test/r/mysqldump.result                      |   3 -
 mysql-test/r/mysqltest.result                      |   6 -
 mysql-test/r/named_pipe.result                     |   1 +
 mysql-test/r/ps.result                             |  33 +-
 mysql-test/r/selectivity.result                    |  71 ++
 mysql-test/r/selectivity_innodb.result             | 113 ++-
 mysql-test/r/type_uint.result                      |  19 +
 mysql-test/r/view.result                           |   1 +
 mysql-test/r/wait_timeout_not_windows.result       |   1 +
 .../innodb/r/innodb-change-buffer-recovery.result  |   1 +
 mysql-test/suite/innodb/r/innodb_bug54044.result   |   3 +-
 mysql-test/suite/innodb/r/system_tables.result     |   8 +
 mysql-test/suite/innodb/t/innodb_bug54044.test     |   6 +-
 mysql-test/suite/innodb/t/system_tables.test       |  12 +
 mysql-test/suite/perfschema/r/aggregate.result     | 121 ---
 mysql-test/suite/perfschema/t/aggregate.test       | 197 -----
 mysql-test/suite/plugins/r/server_audit.result     |   3 -
 .../plugins/r/thread_pool_server_audit.result      |   3 -
 mysql-test/suite/rpl/r/rpl_checksum.result         |   1 +
 mysql-test/suite/rpl/r/rpl_gtid_errorlog.result    |   2 +
 mysql-test/suite/rpl/r/rpl_stop_slave_error.result |   6 +
 mysql-test/suite/rpl/t/rpl_drop_db.test            |   4 +-
 .../suite/rpl/t/rpl_stop_slave_error-slave.opt     |   1 +
 mysql-test/suite/rpl/t/rpl_stop_slave_error.test   |  17 +
 mysql-test/t/alter_table.test                      |  25 +
 mysql-test/t/create_or_replace.test                |  12 +
 mysql-test/t/ctype_utf32.test                      |   5 +
 mysql-test/t/drop.test                             |   9 +
 mysql-test/t/group_min_max_innodb.test             |  13 +
 mysql-test/t/information_schema.test               |   8 +-
 mysql-test/t/merge.test                            |  13 +
 mysql-test/t/mysql.test                            |   8 +
 mysql-test/t/mysql_not_windows.test                |   9 +
 mysql-test/t/mysqldump-nl.test                     |  38 +
 mysql-test/t/mysqltest.test                        |   9 -
 mysql-test/t/ps.test                               |  29 +-
 mysql-test/t/selectivity.test                      |  52 ++
 mysql-test/t/selectivity_innodb.test               |  25 +
 mysql-test/t/type_uint.test                        |   7 +
 mysql-test/unstable-tests                          |  92 +--
 mysql-test/valgrind.supp                           | 121 ++-
 mysys/my_fopen.c                                   |   6 +-
 mysys/my_redel.c                                   |   7 +-
 mysys/my_static.c                                  |   1 +
 plugin/feedback/utils.cc                           |  13 +-
 plugin/server_audit/server_audit.c                 |   5 +-
 scripts/mysqld_safe.sh                             |   6 +-
 sql/contributors.h                                 |   1 +
 sql/field.cc                                       |   2 +-
 sql/item.cc                                        |  23 +-
 sql/item_subselect.cc                              |   4 +-
 sql/log.cc                                         |   2 +-
 sql/mysqld.cc                                      |   1 +
 sql/net_serv.cc                                    |   4 +-
 sql/opt_range.cc                                   |   9 +-
 sql/parse_file.h                                   |   6 +-
 sql/signal_handler.cc                              |   4 +-
 sql/slave.cc                                       |   9 +-
 sql/sql_admin.cc                                   |  14 +-
 sql/sql_base.cc                                    |   1 +
 sql/sql_class.cc                                   |   2 +
 sql/sql_class.h                                    |   8 +-
 sql/sql_db.cc                                      |  26 +-
 sql/sql_parse.cc                                   |  12 -
 sql/sql_plugin.cc                                  | 151 ++--
 sql/sql_select.cc                                  |  30 +-
 sql/sql_statistics.cc                              |  15 +-
 sql/sql_statistics.h                               |   5 +
 sql/sql_table.cc                                   |   4 +-
 sql/table_cache.cc                                 |   2 +
 sql/threadpool_common.cc                           |  98 ++-
 storage/connect/JdbcInterface.java                 |  16 +-
 storage/connect/filamdbf.cpp                       |  86 ++-
 storage/connect/filamdbf.h                         |   2 +-
 storage/connect/ha_connect.cc                      |  84 ++-
 storage/connect/jdbconn.cpp                        | 249 ++----
 storage/connect/jdbconn.h                          |   1 +
 storage/connect/json.cpp                           |   2 +-
 storage/connect/reldef.cpp                         |   8 +-
 storage/connect/tabjdbc.cpp                        |  19 +-
 storage/innobase/dict/dict0stats.cc                |  29 +-
 storage/innobase/fts/fts0fts.cc                    |  31 +
 storage/innobase/handler/ha_innodb.cc              |   9 +-
 storage/innobase/handler/handler0alter.cc          |   9 +-
 storage/innobase/handler/i_s.cc                    |   2 +
 storage/innobase/include/fts0fts.h                 |  10 +
 storage/innobase/include/univ.i                    |   2 +-
 storage/innobase/row/row0log.cc                    |  14 +-
 storage/innobase/row/row0mysql.cc                  |  34 +
 storage/oqgraph/graphcore.cc                       |   2 +-
 storage/oqgraph/oqgraph_shim.h                     |  48 +-
 storage/perfschema/ha_perfschema.cc                |   2 +-
 storage/tokudb/CMakeLists.txt                      |   2 +-
 storage/tokudb/PerconaFT/buildheader/make_tdb.cc   |   7 +-
 .../cmake_modules/TokuFeatureDetection.cmake       |   4 +-
 .../cmake_modules/TokuSetupCompiler.cmake          |   3 +-
 storage/tokudb/PerconaFT/ft/CMakeLists.txt         |   2 +-
 .../PerconaFT/ft/cachetable/cachetable-internal.h  |   2 +
 .../tokudb/PerconaFT/ft/cachetable/cachetable.cc   |  16 +
 .../tokudb/PerconaFT/ft/cachetable/cachetable.h    |   6 +
 storage/tokudb/PerconaFT/ft/ft-flusher.cc          |   4 +-
 storage/tokudb/PerconaFT/ft/ft-ops.cc              | 366 ++++++---
 storage/tokudb/PerconaFT/ft/ft-ops.h               |   2 +
 storage/tokudb/PerconaFT/ft/ft-recount-rows.cc     |  29 +-
 storage/tokudb/PerconaFT/ft/ft.cc                  |  17 +-
 storage/tokudb/PerconaFT/ft/ft.h                   |   6 +
 .../tokudb/PerconaFT/ft/loader/loader-internal.h   |   2 +-
 storage/tokudb/PerconaFT/ft/loader/loader.cc       |   2 +-
 storage/tokudb/PerconaFT/ft/logger/logformat.cc    |   9 +
 storage/tokudb/PerconaFT/ft/logger/recover.cc      |  78 ++
 storage/tokudb/PerconaFT/ft/node.cc                | 125 ++--
 storage/tokudb/PerconaFT/ft/node.h                 |   1 +
 .../PerconaFT/ft/serialize/block_allocator.cc      | 473 ++++--------
 .../PerconaFT/ft/serialize/block_allocator.h       | 162 ++--
 .../ft/serialize/block_allocator_strategy.cc       | 224 ------
 .../ft/serialize/block_allocator_strategy.h        |  65 --
 .../tokudb/PerconaFT/ft/serialize/block_table.cc   | 632 ++++++++++------
 .../tokudb/PerconaFT/ft/serialize/block_table.h    | 143 ++--
 storage/tokudb/PerconaFT/ft/serialize/compress.cc  |   2 +-
 .../tokudb/PerconaFT/ft/serialize/ft-serialize.cc  | 350 +++++----
 .../PerconaFT/ft/serialize/ft_node-serialize.cc    |  69 +-
 .../tokudb/PerconaFT/ft/serialize/rbtree_mhs.cc    | 833 +++++++++++++++++++++
 storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h | 355 +++++++++
 .../ft/tests/block_allocator_strategy_test.cc      | 126 ----
 .../PerconaFT/ft/tests/block_allocator_test.cc     | 380 +++++-----
 .../tokudb/PerconaFT/ft/tests/cachetable-5978.cc   |   2 +-
 .../PerconaFT/ft/tests/cachetable-simple-clone2.cc |   2 +-
 storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc  | 403 +++++-----
 storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc | 281 ++++---
 .../PerconaFT/ft/tests/ft-serialize-benchmark.cc   | 231 +++---
 .../tokudb/PerconaFT/ft/tests/ft-serialize-test.cc | 831 +++++++++++---------
 storage/tokudb/PerconaFT/ft/tests/ft-test.cc       |  11 +-
 storage/tokudb/PerconaFT/ft/tests/pqueue-test.cc   |   4 +-
 .../PerconaFT/ft/tests/test-leafentry-nested.cc    |   2 +-
 .../ft/tests/test-oldest-referenced-xid-flush.cc   |   6 +-
 .../ft/tests/test-rbtree-insert-remove-with-mhs.cc |  97 +++
 .../tests/test-rbtree-insert-remove-without-mhs.cc | 103 +++
 storage/tokudb/PerconaFT/ft/txn/roll.cc            | 120 ++-
 storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc  |   2 +-
 .../PerconaFT/ft/txn/rollback-ct-callbacks.cc      |  23 +-
 storage/tokudb/PerconaFT/ft/ule.cc                 |   4 +-
 .../tokudb/PerconaFT/portability/CMakeLists.txt    |   3 +-
 storage/tokudb/PerconaFT/portability/file.cc       |   6 +
 .../PerconaFT/portability/huge_page_detection.cc   |   6 +
 storage/tokudb/PerconaFT/portability/memory.cc     |   9 +
 storage/tokudb/PerconaFT/portability/memory.h      |   4 +-
 .../tokudb/PerconaFT/portability/portability.cc    |   9 +-
 .../PerconaFT/portability/tests/test-max-data.cc   |   2 +-
 .../tokudb/PerconaFT/portability/tests/test-xid.cc |   9 +-
 .../tokudb/PerconaFT/portability/toku_config.h.in  |   2 +-
 .../PerconaFT/portability/toku_portability.h       |   2 +
 storage/tokudb/PerconaFT/portability/toku_time.h   |   8 +
 storage/tokudb/PerconaFT/src/indexer-internal.h    |   2 +-
 storage/tokudb/PerconaFT/src/indexer-undo-do.cc    |   4 +-
 storage/tokudb/PerconaFT/src/tests/CMakeLists.txt  |  42 +-
 .../tests/hotindexer-undo-do-tests/commit.i0.test  |   2 +-
 .../tokudb/PerconaFT/src/tests/loader-dup-test.cc  |   2 +-
 .../PerconaFT/src/tests/recovery_fileops_unit.cc   | 153 ++--
 .../PerconaFT/src/tests/stat64-root-changes.cc     |   4 +-
 .../PerconaFT/src/tests/test_insert_many_gc.cc     |   2 +-
 storage/tokudb/PerconaFT/src/tests/test_stress0.cc |   2 +-
 .../tokudb/PerconaFT/src/tests/test_txn_abort5a.cc |   3 +-
 storage/tokudb/PerconaFT/src/ydb-internal.h        |   5 +-
 storage/tokudb/PerconaFT/src/ydb.cc                |  50 +-
 storage/tokudb/PerconaFT/src/ydb_db.cc             |  99 ++-
 storage/tokudb/PerconaFT/src/ydb_db.h              |  16 +
 .../xz-4.999.9beta/build-aux/config.guess          | 449 ++++++-----
 storage/tokudb/PerconaFT/tools/CMakeLists.txt      |   3 +-
 storage/tokudb/PerconaFT/tools/ba_replay.cc        | 629 ----------------
 storage/tokudb/PerconaFT/tools/ftverify.cc         |   2 +-
 storage/tokudb/PerconaFT/tools/tokuftdump.cc       |   1 +
 storage/tokudb/PerconaFT/util/tests/x1764-test.cc  |   2 +-
 storage/tokudb/ha_tokudb.cc                        |  26 +-
 storage/tokudb/ha_tokudb_admin.cc                  | 278 ++++---
 storage/tokudb/hatoku_defines.h                    |   7 +-
 storage/tokudb/hatoku_hton.cc                      |   1 +
 .../mysql-test/rpl/r/rpl_foreign_key_tokudb.result |  51 --
 .../mysql-test/rpl/t/rpl_foreign_key_tokudb.test   |   4 -
 storage/tokudb/mysql-test/tokudb/disabled.def      |   1 +
 .../tokudb/include/table_files_replace_pattern.inc |   1 +
 .../tokudb/r/background_job_manager.result         |   2 +-
 .../r/dir-per-db-with-custom-data-dir.result       |  10 +
 .../tokudb/mysql-test/tokudb/r/dir_per_db.result   | 180 +++++
 .../tokudb/r/i_s_tokudb_lock_waits_released.result |  12 +
 .../tokudb/mysql-test/tokudb/r/row_format.result   |  51 ++
 .../tokudb/r/rows-32m-rand-insert.result           |   1 +
 .../t/dir-per-db-with-custom-data-dir-master.opt   |   1 +
 .../tokudb/t/dir-per-db-with-custom-data-dir.test  |  16 +
 storage/tokudb/mysql-test/tokudb/t/dir_per_db.test |  76 ++
 .../tokudb/t/dir_per_db_show_table_files.inc       |   9 +
 .../tokudb/t/i_s_tokudb_lock_waits_released.test   |  29 +-
 storage/tokudb/mysql-test/tokudb/t/row_format.test |  41 +
 .../tokudb/mysql-test/tokudb_bugs/r/db938.result   |   2 +-
 storage/tokudb/mysql-test/tokudb_bugs/t/db938.test |   4 +-
 .../tokudb/mysql-test/tokudb_bugs/t/frm_store.test |  26 +-
 .../mysql-test/tokudb_bugs/t/frm_store2.test       |  26 +-
 .../mysql-test/tokudb_bugs/t/frm_store3.test       |  26 +-
 .../tokudb_bugs/t/tokudb_drop_part_table_668.test  |  41 +-
 .../t/tokudb_drop_simple_table_668.test            |  41 +-
 .../include/table_files_replace_pattern.inc        |   1 +
 .../t/partition_debug_sync_tokudb.test             |   4 +-
 storage/tokudb/tokudb_background.cc                |  27 +-
 storage/tokudb/tokudb_background.h                 |  49 +-
 storage/tokudb/tokudb_information_schema.cc        |  47 +-
 storage/tokudb/tokudb_sysvars.cc                   |  14 +
 storage/tokudb/tokudb_sysvars.h                    |   1 +
 storage/xtradb/btr/btr0btr.cc                      |  16 +-
 storage/xtradb/btr/btr0cur.cc                      |   4 +-
 storage/xtradb/buf/buf0buf.cc                      |   4 +-
 storage/xtradb/buf/buf0dblwr.cc                    |   2 +-
 storage/xtradb/buf/buf0flu.cc                      |   7 +
 storage/xtradb/dict/dict0boot.cc                   |   4 +
 storage/xtradb/dict/dict0crea.cc                   | 583 ++++++++++++++
 storage/xtradb/dict/dict0dict.cc                   | 158 ++++
 storage/xtradb/dict/dict0load.cc                   | 159 +++-
 storage/xtradb/dict/dict0stats.cc                  |  29 +-
 storage/xtradb/fil/fil0fil.cc                      |   8 +
 storage/xtradb/fts/fts0fts.cc                      |  98 ++-
 storage/xtradb/fts/fts0opt.cc                      |   2 +-
 storage/xtradb/handler/ha_innodb.cc                | 571 +++++++++++++-
 storage/xtradb/handler/ha_innodb.h                 |  37 +
 storage/xtradb/handler/handler0alter.cc            |  75 +-
 storage/xtradb/handler/i_s.cc                      |  41 +-
 storage/xtradb/handler/xtradb_i_s.cc               | 354 +++++++++
 storage/xtradb/handler/xtradb_i_s.h                |   2 +
 storage/xtradb/ibuf/ibuf0ibuf.cc                   |   4 +-
 storage/xtradb/include/buf0buf.h                   |  14 +-
 storage/xtradb/include/buf0buf.ic                  |  14 +
 storage/xtradb/include/data0type.h                 |  14 +
 storage/xtradb/include/data0type.ic                |  16 +
 storage/xtradb/include/dict0boot.h                 |  32 +
 storage/xtradb/include/dict0crea.h                 |  91 +++
 storage/xtradb/include/dict0dict.h                 |  46 ++
 storage/xtradb/include/dict0load.h                 |  29 +
 storage/xtradb/include/fts0fts.h                   |  14 +-
 storage/xtradb/include/os0thread.h                 |  15 +-
 storage/xtradb/include/rem0types.h                 |   3 +
 storage/xtradb/include/row0mysql.h                 |  85 ++-
 storage/xtradb/include/srv0srv.h                   |  15 +-
 storage/xtradb/include/univ.i                      |   4 +-
 storage/xtradb/log/log0log.cc                      |  24 +-
 storage/xtradb/log/log0online.cc                   |  45 +-
 storage/xtradb/log/log0recv.cc                     |  17 +-
 storage/xtradb/mach/mach0data.cc                   |  13 +-
 storage/xtradb/os/os0thread.cc                     |  33 +-
 storage/xtradb/rem/rem0rec.cc                      |  23 +-
 storage/xtradb/row/row0ftsort.cc                   |   2 +-
 storage/xtradb/row/row0log.cc                      |  14 +-
 storage/xtradb/row/row0merge.cc                    |  20 +-
 storage/xtradb/row/row0mysql.cc                    | 634 +++++++++++++++-
 storage/xtradb/row/row0sel.cc                      |  45 +-
 storage/xtradb/srv/srv0mon.cc                      |   7 +-
 storage/xtradb/srv/srv0srv.cc                      |  15 +-
 storage/xtradb/srv/srv0start.cc                    |   6 +
 strings/ctype-ucs2.c                               |   2 +-
 strings/ctype-utf8.c                               |   2 +-
 support-files/mysql.server.sh                      |   2 +-
 tests/async_queries.c                              |   2 +-
 win/packaging/CMakeLists.txt                       |  11 +-
 win/packaging/create_msi.cmake.in                  |   1 +
 308 files changed, 10709 insertions(+), 5233 deletions(-)

diff --cc mysql-test/valgrind.supp
index 1cc5d17,77f17cf..5f1af1a
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@@ -1228,233 -1228,122 +1228,352 @@@
    fun:dlopen@@GLIBC_2.2.5
  }
  
+ # 
+ # MDEV-11061: OpenSSL 0.9.8 problems
+ #
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    obj:*/libz.so*
+    ...
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Value8
+    obj:*/libz.so*
+    ...
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Value8
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    obj:*/libssl.so.0.9.8
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Value8
+    obj:*/libssl.so.0.9.8
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    fun:memcpy
+    obj:*/libcrypto.so.0.9.8
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Value8
+    fun:memcpy
+    obj:*/libcrypto.so.0.9.8
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    fun:is_overlap
+    fun:memcpy
+    obj:*/libcrypto.so.0.9.8
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Cond
+    fun:memset
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Value8
+    fun:memset
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
+ {
+    MDEV-11061: OpenSSL 0.9.8
+    Memcheck:Param
+    write(buf)
+    obj:*/libpthread-2.9.so*
+    obj:*/libcrypto.so.0.9.8
+    ...
+    obj:*/libssl.so.0.9.8
+    ...
+ }
+ 
 +{
 +   GitHub codership/galera#330
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:CRYPTO_malloc
 +   fun:sk_new
 +   obj:/usr/lib64/libssl.so.1.0.1e
 +   fun:SSL_COMP_get_compression_methods
 +   fun:SSL_library_init
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EE7do_initC1Ev
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EE7do_init8instanceEv
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EEC1Ev
 +   fun:_Z41__static_initialization_and_destruction_0ii.constprop.120
 +   fun:call_init.part.0
 +   fun:_dl_init
 +   fun:dl_open_worker
 +   fun:_dl_catch_error
 +   fun:_dl_open
 +   fun:dlopen_doit
 +}
 +{
 +   GitHub codership/galera#330
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:CRYPTO_malloc
 +   fun:sk_new
 +   obj:/usr/lib64/libssl.so.1.0.1e
 +   fun:SSL_COMP_get_compression_methods
 +   fun:SSL_library_init
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EE7do_initC1Ev
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EE7do_init8instanceEv
 +   fun:_ZN4asio3ssl6detail12openssl_initILb1EEC1Ev
 +   fun:_Z41__static_initialization_and_destruction_0ii.constprop.120
 +   fun:call_init.part.0
 +   fun:_dl_init
 +   fun:dl_open_worker
 +   fun:_dl_catch_error
 +   fun:_dl_open
 +   fun:dlopen_doit
 +}
 +
 +{
 +   GitHub codership/mysql-wsrep#175
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:calloc
 +   fun:do_lookup_x
 +   fun:_dl_lookup_symbol_x
 +   fun:_dl_relocate_object
 +   fun:dl_open_worker
 +   fun:_dl_catch_error
 +   fun:_dl_open
 +   fun:dlopen_doit
 +   fun:_dl_catch_error
 +   fun:_dlerror_run
 +   fun:dlopen@@GLIBC_2.2.5
 +   fun:wsrep_load
 +   fun:_Z10wsrep_initv
 +   fun:_Z18wsrep_init_startupb
 +   fun:_ZL22init_server_componentsv
 +   fun:_Z11mysqld_mainiPPc
 +}
 +
 +{
 +   galera/mysql-wsrep#147
 +   Memcheck:Leak
 +   match-leak-kinds: possible
 +   fun:malloc
 +   fun:_ZNK6galera13ReplicatorSMM9stats_getEv
 +   fun:_ZL28export_wsrep_status_to_mysqlP3THD
 +   fun:_Z17wsrep_show_statusP3THDP17st_mysql_show_varPc
 +   fun:_ZL17show_status_arrayP3THDPKcP17st_mysql_show_var13enum_var_typeP17system_status_varS2_P5TABLEbP4Item
 +   fun:_Z11fill_statusP3THDP10TABLE_LISTP4Item
 +   fun:_ZL13do_fill_tableP3THDP10TABLE_LISTP13st_join_table
 +   fun:_Z24get_schema_tables_resultP4JOIN23enum_schema_table_state
 +   fun:_ZN4JOIN14prepare_resultEPP4ListI4ItemE
 +   fun:_ZN4JOIN4execEv
 +   fun:_ZL20mysql_execute_selectP3THDP13st_select_lexb
 +   fun:_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex
 +   fun:_Z13handle_selectP3THDP13select_resultm
 +   fun:_ZL21execute_sqlcom_selectP3THDP10TABLE_LIST
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +}
 +
 +{
- g   codership/mysql-wsrep/issues#176
++   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +}
 +
 +{
 +   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:DbugMalloc
 +   fun:ListParse
 +   fun:_gu_db_push_
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +   fun:galera_parameters_set
 +   fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type
 +   fun:_ZN7sys_var6updateEP3THDP7set_var
 +   fun:_ZN7set_var6updateEP3THD
 +   fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +   fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state
 +   fun:_Z16dispatch_command19enum_server_commandP3THDPcj
 +   fun:_Z10do_commandP3THD
 +   fun:_Z24do_handle_one_connectionP3THD
 +}
 +
 +{
 +   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:state_map_insert
 +   fun:code_state
 +   fun:_gu_db_push_
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +   fun:galera_parameters_set
 +   fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type
 +   fun:_ZN7sys_var6updateEP3THDP7set_var
 +   fun:_ZN7set_var6updateEP3THD
 +   fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +   fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state
 +   fun:_Z16dispatch_command19enum_server_commandP3THDPcj
 +   fun:_Z10do_commandP3THD
 +   fun:_Z24do_handle_one_connectionP3THD
 +}
 +
 +{
 +   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:DbugMalloc
 +   fun:StrDup
 +   fun:ListParse
 +   fun:_gu_db_push_
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +   fun:galera_parameters_set
 +   fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type
 +   fun:_ZN7sys_var6updateEP3THDP7set_var
 +   fun:_ZN7set_var6updateEP3THD
 +   fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +   fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state
 +   fun:_Z16dispatch_command19enum_server_commandP3THDPcj
 +   fun:_Z10do_commandP3THD
 +}
 +
 +{
 +   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:code_state
 +   fun:_gu_db_push_
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +   fun:galera_parameters_set
 +   fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type
 +   fun:_ZN7sys_var6updateEP3THDP7set_var
 +   fun:_ZN7set_var6updateEP3THD
 +   fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +   fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state
 +   fun:_Z16dispatch_command19enum_server_commandP3THDPcj
 +   fun:_Z10do_commandP3THD
 +   fun:_Z24do_handle_one_connectionP3THD
 +   fun:handle_one_connection
 +}
 +
 +{
 +   codership/mysql-wsrep/issues#176
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:DbugMalloc
 +   fun:PushState
 +   fun:_gu_db_push_
 +   fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc
 +   fun:galera_parameters_set
 +   fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type
 +   fun:_ZN7sys_var6updateEP3THDP7set_var
 +   fun:_ZN7set_var6updateEP3THD
 +   fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE
 +   fun:_Z21mysql_execute_commandP3THD
 +   fun:_Z11mysql_parseP3THDPcjP12Parser_state
 +   fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state
 +   fun:_Z16dispatch_command19enum_server_commandP3THDPcj
 +   fun:_Z10do_commandP3THD
 +   fun:_Z24do_handle_one_connectionP3THD
 +}
 +
 +{
 +   codership/galera#331
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:state_map_insert
 +   fun:code_state
 +   fun:_gu_db_keyword_
 +   fun:_ZN6galera3ist6Sender4sendEll
 +   fun:run_async_sender
 +   fun:start_thread
 +   fun:clone
 +}
 +
 +{
 +   codership/galera#331
 +   Memcheck:Leak
 +   match-leak-kinds: reachable
 +   fun:malloc
 +   fun:code_state
 +   fun:_gu_db_keyword_
 +   fun:_ZN6galera3ist6Sender4sendEll
 +   fun:run_async_sender
 +   fun:start_thread
 +   fun:clone
 +}
 +
diff --cc storage/xtradb/handler/ha_innodb.cc
index ceb489c,35ca879..66d2ae4
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@@ -3600,13 -3586,10 +3645,17 @@@ innobase_init
          if (srv_file_per_table)
            innobase_hton->tablefile_extensions = ha_innobase_exts;
  
 +#ifdef WITH_WSREP
 +        innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction;
 +        innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint;
 +        innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint;
 +        innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id;
 +#endif /* WITH_WSREP */
 +
+ #ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
+ 	innobase_hton->create_zip_dict = innobase_create_zip_dict;
+ 	innobase_hton->drop_zip_dict = innobase_drop_zip_dict;
+ #endif
  	ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
  
  #ifndef DBUG_OFF
@@@ -7149,312 -7123,6 +7364,322 @@@ innobase_read_from_2_little_endian
  	return((uint) ((ulint)(buf[0]) + 256 * ((ulint)(buf[1]))));
  }
  
 +#ifdef WITH_WSREP
 +/*******************************************************************//**
 +Stores a key value for a row to a buffer.
 + at return	key value length as stored in buff */
 +UNIV_INTERN
 +uint
 +wsrep_store_key_val_for_row(
 +/*===============================*/
 +	THD* 		thd,
 +	TABLE*		table,
 +	uint		keynr,	/*!< in: key number */
 +	char*		buff,	/*!< in/out: buffer for the key value (in MySQL
 +				format) */
 +	uint		buff_len,/*!< in: buffer length */
 +	const uchar*	record,
++	row_prebuilt_t*	prebuilt,	/*!< in: InnoDB prebuilt struct */
 +	ibool*          key_is_null)/*!< out: full key was null */
 +{
 +	KEY*		key_info	= table->key_info + keynr;
 +	KEY_PART_INFO*	key_part	= key_info->key_part;
 +	KEY_PART_INFO*	end		= key_part + key_info->user_defined_key_parts;
 +	char*		buff_start	= buff;
 +	enum_field_types mysql_type;
 +	Field*		field;
 +	uint buff_space = buff_len;
 +
 +	DBUG_ENTER("wsrep_store_key_val_for_row");
 +
 +	memset(buff, 0, buff_len);
 +	*key_is_null = TRUE;
 +
 +	for (; key_part != end; key_part++) {
 +
 +		uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
 +		ibool part_is_null = FALSE;
 +
 +		if (key_part->null_bit) {
 +			if (buff_space > 0) {
 +				if (record[key_part->null_offset] 
 +				    & key_part->null_bit) {
 +					*buff = 1;
 +					part_is_null = TRUE;
 +				} else {
 +					*buff = 0;
 +				}
 +				buff++;
 +				buff_space--;
 +			} else {
 +				fprintf (stderr, "WSREP: key truncated: %s\n",
 +					 wsrep_thd_query(thd));
 +			}
 +		}
 +		if (!part_is_null)  *key_is_null = FALSE;
 +
 +		field = key_part->field;
 +		mysql_type = field->type();
 +
 +		if (mysql_type == MYSQL_TYPE_VARCHAR) {
 +						/* >= 5.0.3 true VARCHAR */
 +			ulint		lenlen;
 +			ulint		len;
 +			const byte*	data;
 +			ulint		key_len;
 +			ulint		true_len;
 +			const CHARSET_INFO* cs;
 +			int		error=0;
 +
 +			key_len = key_part->length;
 +
 +			if (part_is_null) {
 +				true_len = key_len + 2;
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len = buff_space;
 +				}
 +				buff       += true_len;
 +				buff_space -= true_len;
 +				continue;
 +			}
 +			cs = field->charset();
 +
 +			lenlen = (ulint)
 +				(((Field_varstring*)field)->length_bytes);
 +
 +			data = row_mysql_read_true_varchar(&len,
 +				(byte*) (record
 +				+ (ulint)get_field_offset(table, field)),
 +				lenlen);
 +
 +			true_len = len;
 +
 +			/* For multi byte character sets we need to calculate
 +			the true length of the key */
 +
 +			if (len > 0 && cs->mbmaxlen > 1) {
 +				true_len = (ulint) cs->cset->well_formed_len(cs,
 +						(const char *) data,
 +						(const char *) data + len,
 +                                                (uint) (key_len /
 +                                                        cs->mbmaxlen),
 +						&error);
 +			}
 +
 +			/* In a column prefix index, we may need to truncate
 +			the stored value: */
 +
 +			if (true_len > key_len) {
 +				true_len = key_len;
 +			}
 +
 +			memcpy(sorted, data, true_len);
 +			true_len = wsrep_innobase_mysql_sort(
 +				mysql_type, cs->number, sorted, true_len, 
 +				REC_VERSION_56_MAX_INDEX_COL_LEN);
 +
 +			if (wsrep_protocol_version > 1) {
 +			/* Note that we always reserve the maximum possible
 +			   length of the true VARCHAR in the key value, though
 +			   only len first bytes after the 2 length bytes contain
 +			   actual data. The rest of the space was reset to zero
 +			   in the bzero() call above. */
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len = buff_space;
 +				}
 + 				memcpy(buff, sorted, true_len);
 +                                buff       += true_len;
 +				buff_space -= true_len;
 +                        } else {
 +                                buff += key_len;
 +                        }
 +		} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
 +			|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
 +			|| mysql_type == MYSQL_TYPE_BLOB
 +			|| mysql_type == MYSQL_TYPE_LONG_BLOB
 +			/* MYSQL_TYPE_GEOMETRY data is treated
 +			as BLOB data in innodb. */
 +			|| mysql_type == MYSQL_TYPE_GEOMETRY) {
 +
 +			const CHARSET_INFO* cs;
 +			ulint		key_len;
 +			ulint		true_len;
 +			int		error=0;
 +			ulint		blob_len;
 +			const byte*	blob_data;
 +
 +			ut_a(key_part->key_part_flag & HA_PART_KEY_SEG);
 +
 +			key_len = key_part->length;
 +
 +			if (part_is_null) {
 +				true_len = key_len + 2;
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len = buff_space;
 +				}
 +				buff       += true_len;
 +				buff_space -= true_len;
 +
 +				continue;
 +			}
 +
 +			cs = field->charset();
 +
 +			blob_data = row_mysql_read_blob_ref(&blob_len,
 +				(byte*) (record
- 				+ (ulint)get_field_offset(table, field)),
- 					(ulint) field->pack_length());
++				+ (ulint) get_field_offset(table, field)),
++				(ulint) field->pack_length(),
++#ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
++				field->column_format() ==
++					COLUMN_FORMAT_TYPE_COMPRESSED,
++				reinterpret_cast<const byte*>(
++					field->zip_dict_data.str),
++				field->zip_dict_data.length, prebuilt);
++#else
++                                0, 0, 0, prebuilt);
++#endif
 +
 +			true_len = blob_len;
 +
 +			ut_a(get_field_offset(table, field)
 +				== key_part->offset);
 +
 +			/* For multi byte character sets we need to calculate
 +			the true length of the key */
 +
 +			if (blob_len > 0 && cs->mbmaxlen > 1) {
 +				true_len = (ulint) cs->cset->well_formed_len(cs,
 +						(const char *) blob_data,
 +						(const char *) blob_data
 +							+ blob_len,
 +                                                (uint) (key_len /
 +                                                        cs->mbmaxlen),
 +						&error);
 +			}
 +
 +			/* All indexes on BLOB and TEXT are column prefix
 +			indexes, and we may need to truncate the data to be
 +			stored in the key value: */
 +
 +			if (true_len > key_len) {
 +				true_len = key_len;
 +			}
 +
 +			memcpy(sorted, blob_data, true_len);
 +			true_len = wsrep_innobase_mysql_sort(
 +				mysql_type, cs->number, sorted, true_len,
 +				REC_VERSION_56_MAX_INDEX_COL_LEN);
 +
 +
 +			/* Note that we always reserve the maximum possible
 +			length of the BLOB prefix in the key value. */
 +                        if (wsrep_protocol_version > 1) {
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len = buff_space;
 +				}
 +				buff       += true_len;
 +				buff_space -= true_len;
 +			} else {
 +				buff += key_len;
 +			}
 +			memcpy(buff, sorted, true_len);
 +		} else {
 +			/* Here we handle all other data types except the
 +			true VARCHAR, BLOB and TEXT. Note that the column
 +			value we store may be also in a column prefix
 +			index. */
 +
 +			const CHARSET_INFO*	cs = NULL;
 +			ulint			true_len;
 +			ulint			key_len;
 +			const uchar*		src_start;
 +			int			error=0;
 +			enum_field_types	real_type;
 +
 +			key_len = key_part->length;
 +
 +			if (part_is_null) {
 +				true_len = key_len;
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len = buff_space;
 +				}
 +				buff       += true_len;
 +				buff_space -= true_len;
 +
 +				continue;
 +			}
 +
 +			src_start = record + key_part->offset;
 +			real_type = field->real_type();
 +			true_len = key_len;
 +
 +			/* Character set for the field is defined only
 +			to fields whose type is string and real field
 +			type is not enum or set. For these fields check
 +			if character set is multi byte. */
 +
 +			if (real_type != MYSQL_TYPE_ENUM
 +				&& real_type != MYSQL_TYPE_SET
 +				&& ( mysql_type == MYSQL_TYPE_VAR_STRING
 +					|| mysql_type == MYSQL_TYPE_STRING)) {
 +
 +				cs = field->charset();
 +
 +				/* For multi byte character sets we need to
 +				calculate the true length of the key */
 +
 +				if (key_len > 0 && cs->mbmaxlen > 1) {
 +
 +					true_len = (ulint)
 +						cs->cset->well_formed_len(cs,
 +							(const char *)src_start,
 +							(const char *)src_start
 +								+ key_len,
 +                                                        (uint) (key_len /
 +                                                                cs->mbmaxlen),
 +							&error);
 +				}
 +				memcpy(sorted, src_start, true_len);
 +				true_len = wsrep_innobase_mysql_sort(
 +					mysql_type, cs->number, sorted, true_len,
 +					REC_VERSION_56_MAX_INDEX_COL_LEN);
 +
 +				if (true_len > buff_space) {
 +					fprintf (stderr,
 +						 "WSREP: key truncated: %s\n",
 +						 wsrep_thd_query(thd));
 +					true_len   = buff_space;
 +				}
 +				memcpy(buff, sorted, true_len);
 +			} else {
 +				memcpy(buff, src_start, true_len);
 +			}
 +			buff       += true_len;
 +			buff_space -= true_len;
 +		}
 +	}
 +
 +	ut_a(buff <= buff_start + buff_len);
 +
 +	DBUG_RETURN((uint)(buff - buff_start));
 +}
 +#endif /* WITH_WSREP */
 +
  /*******************************************************************//**
  Stores a key value for a row to a buffer.
  @return	key value length as stored in buff */
@@@ -8978,87 -8565,6 +9236,88 @@@ calc_row_difference
  	return(DB_SUCCESS);
  }
  
 +#ifdef WITH_WSREP
 +static
 +int
 +wsrep_calc_row_hash(
 +/*================*/
 +	byte*		digest,		/*!< in/out: md5 sum */
 +	const uchar*	row,		/*!< in: row in MySQL format */
 +	TABLE*		table,		/*!< in: table in MySQL data
 +					dictionary */
 +	row_prebuilt_t*	prebuilt,	/*!< in: InnoDB prebuilt struct */
 +	THD*		thd)		/*!< in: user thread */
 +{
 +	Field*		field;
 +	enum_field_types field_mysql_type;
 +	uint		n_fields;
 +	ulint		len;
 +	const byte*	ptr;
 +	ulint		col_type;
 +	uint		i;
 +
 +	void *ctx = wsrep_md5_init();
 +
 +	n_fields = table->s->fields;
 +
 +	for (i = 0; i < n_fields; i++) {
 +		byte null_byte=0;
 +		byte true_byte=1;
 +
 +		field = table->field[i];
 +
 +		ptr = (const byte*) row + get_field_offset(table, field);
 +		len = field->pack_length();
 +
 +		field_mysql_type = field->type();
 +
 +		col_type = prebuilt->table->cols[i].mtype;
 +
 +		switch (col_type) {
 +
 +		case DATA_BLOB:
- 			ptr = row_mysql_read_blob_ref(&len, ptr, len);
++			ptr = row_mysql_read_blob_ref(&len, ptr, len,
++				false, 0, 0, prebuilt);
 +
 +			break;
 +
 +		case DATA_VARCHAR:
 +		case DATA_BINARY:
 +		case DATA_VARMYSQL:
 +			if (field_mysql_type == MYSQL_TYPE_VARCHAR) {
 +				/* This is a >= 5.0.3 type true VARCHAR where
 +				the real payload data length is stored in
 +				1 or 2 bytes */
 +
 +				ptr = row_mysql_read_true_varchar(
 +					&len, ptr,
 +					(ulint)
 +					(((Field_varstring*)field)->length_bytes));
 +
 +			}
 +
 +			break;
 +		default:
 +			;
 +		}
 +		/*
 +		if (field->null_ptr &&
 +		    field_in_record_is_null(table, field, (char*) row)) {
 +		*/
 +
 +		if (field->is_null_in_record(row)) {
 +			wsrep_md5_update(ctx, (char*)&null_byte, 1);
 +		} else {
 +			wsrep_md5_update(ctx, (char*)&true_byte, 1);
 +			wsrep_md5_update(ctx, (char*)ptr, len);
 +		}
 +	}
 +
 +	wsrep_compute_md5_hash((char*)digest, ctx);
 +
 +	return(0);
 +}
 +#endif /* WITH_WSREP */
  /**********************************************************************//**
  Updates a row given as a parameter to a new value. Note that we are given
  whole rows, not just the fields which are updated: this incurs some
@@@ -10536,415 -10009,6 +10795,415 @@@ ha_innobase::ft_end(
  
  	rnd_end();
  }
 +#ifdef WITH_WSREP
 +extern dict_index_t*
 +wsrep_dict_foreign_find_index(
 +	dict_table_t*	table,
 +	const char**	col_names,
 +	const char**	columns,
 +	ulint		n_cols,
 +	dict_index_t*	types_idx,
 +	ibool		check_charsets,
 +	ulint		check_null);
 +
 +
 +extern dberr_t
 +wsrep_append_foreign_key(
 +/*===========================*/
 +	trx_t*		trx,		/*!< in: trx */
 +	dict_foreign_t*	foreign,	/*!< in: foreign key constraint */
 +	const rec_t*	rec,		/*!<in: clustered index record */
 +	dict_index_t*	index,		/*!<in: clustered index */
 +	ibool		referenced,	/*!<in: is check for referenced table */
 +	ibool		shared)		/*!<in: is shared access */
 +{
 +	ut_a(trx);
 +	THD*  thd = (THD*)trx->mysql_thd;
 +	ulint rcode = DB_SUCCESS;
 +	char  cache_key[513] = {'\0'};
 +	int   cache_key_len;
 +    bool const copy = true;
 +
 +	if (!wsrep_on(trx->mysql_thd) ||
 +	    wsrep_thd_exec_mode(thd) != LOCAL_STATE)
 +		return DB_SUCCESS;
 +
 +	if (!thd || !foreign ||
 +	    (!foreign->referenced_table && !foreign->foreign_table))
 +	{
 +		WSREP_INFO("FK: %s missing in: %s",
 +			(!thd)      ?  "thread"     :
 +			((!foreign) ?  "constraint" :
 +			((!foreign->referenced_table) ?
 +			     "referenced table" : "foreign table")),
 +			   (thd && wsrep_thd_query(thd)) ?
 +			   wsrep_thd_query(thd) : "void");
 +		return DB_ERROR;
 +	}
 +
 +	if ( !((referenced) ?
 +		foreign->referenced_table : foreign->foreign_table))
 +	{
 +		WSREP_DEBUG("pulling %s table into cache",
 +			    (referenced) ? "referenced" : "foreign");
 +		mutex_enter(&(dict_sys->mutex));
 +		if (referenced)
 +		{
 +			foreign->referenced_table =
 +				dict_table_get_low(
 +					foreign->referenced_table_name_lookup);
 +			if (foreign->referenced_table)
 +			{
 +				foreign->referenced_index =
 +					wsrep_dict_foreign_find_index(
 +						foreign->referenced_table, NULL,
 +						foreign->referenced_col_names,
 +						foreign->n_fields, 
 +						foreign->foreign_index,
 +						TRUE, FALSE);
 +			}
 +		}
 +		else
 +		{
 +	  		foreign->foreign_table =
 +				dict_table_get_low(
 +					foreign->foreign_table_name_lookup);
 +			if (foreign->foreign_table)
 +			{
 +				foreign->foreign_index =
 +					wsrep_dict_foreign_find_index(
 +						foreign->foreign_table, NULL,
 +						foreign->foreign_col_names,
 +						foreign->n_fields,
 +						foreign->referenced_index, 
 +						TRUE, FALSE);
 +			}
 +		}
 +		mutex_exit(&(dict_sys->mutex));
 +	}
 +
 +	if ( !((referenced) ?
 +		foreign->referenced_table : foreign->foreign_table))
 +	{
 +		WSREP_WARN("FK: %s missing in query: %s",
 +			   (!foreign->referenced_table) ?
 +			   "referenced table" : "foreign table",
 +			   (wsrep_thd_query(thd)) ?
 +			   wsrep_thd_query(thd) : "void");
 +		return DB_ERROR;
 +	}
 +	byte  key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
 +	ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH;
 +
 +	dict_index_t *idx_target = (referenced) ?
 +		foreign->referenced_index : index;
 +	dict_index_t *idx = (referenced) ?
 +		UT_LIST_GET_FIRST(foreign->referenced_table->indexes) :
 +		UT_LIST_GET_FIRST(foreign->foreign_table->indexes);
 +	int i = 0;
 +	while (idx != NULL && idx != idx_target) {
 +		if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) {
 +			i++;
 +		}
 +		idx = UT_LIST_GET_NEXT(indexes, idx);
 +	}
 +	ut_a(idx);
 +	key[0] = (char)i;
 +
 +	rcode = wsrep_rec_get_foreign_key(
 +		&key[1], &len, rec, index, idx,
 +		wsrep_protocol_version > 1);
 +	if (rcode != DB_SUCCESS) {
 +		WSREP_ERROR(
 +			"FK key set failed: %lu (%lu %lu), index: %s %s, %s",
 +			rcode, referenced, shared,
 +			(index && index->name)       ? index->name :
 +				"void index",
 +			(index && index->table_name) ? index->table_name :
 +				"void table",
 +			wsrep_thd_query(thd));
 +		return DB_ERROR;
 +	}
 +	strncpy(cache_key,
 +		(wsrep_protocol_version > 1) ?
 +		((referenced) ?
 +			foreign->referenced_table->name :
 +			foreign->foreign_table->name) :
 +		foreign->foreign_table->name, sizeof(cache_key) - 1);
 +	cache_key_len = strlen(cache_key);
 +#ifdef WSREP_DEBUG_PRINT
 +	ulint j;
 +	fprintf(stderr, "FK parent key, table: %s %s len: %lu ",
 +		cache_key, (shared) ? "shared" : "exclusive", len+1);
 +	for (j=0; j<len+1; j++) {
 +		fprintf(stderr, " %hhX, ", key[j]);
 +	}
 +	fprintf(stderr, "\n");
 +#endif
 +	char *p = strchr(cache_key, '/');
 +	if (p) {
 +		*p = '\0';
 +	} else {
 +		WSREP_WARN("unexpected foreign key table %s %s",
 +			   foreign->referenced_table->name,
 +			   foreign->foreign_table->name);
 +	}
 +
 +	wsrep_buf_t wkey_part[3];
 +        wsrep_key_t wkey = {wkey_part, 3};
 +	if (!wsrep_prepare_key_for_innodb(
 +		(const uchar*)cache_key,
 +		cache_key_len +  1,
 +		(const uchar*)key, len+1,
 +		wkey_part,
 +		(size_t*)&wkey.key_parts_num)) {
 +		WSREP_WARN("key prepare failed for cascaded FK: %s",
 +			   (wsrep_thd_query(thd)) ?
 +			    wsrep_thd_query(thd) : "void");
 +		return DB_ERROR;
 +	}
 +	rcode = (int)wsrep->append_key(
 +		wsrep,
 +		wsrep_ws_handle(thd, trx),
 +		&wkey,
 +		1,
 +		shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE,
 +                copy);
 +	if (rcode) {
 +		DBUG_PRINT("wsrep", ("row key failed: %lu", rcode));
 +		WSREP_ERROR("Appending cascaded fk row key failed: %s, %lu",
 +			    (wsrep_thd_query(thd)) ?
 +			    wsrep_thd_query(thd) : "void", rcode);
 +		return DB_ERROR;
 +	}
 +
 +	return DB_SUCCESS;
 +}
 +
 +static int
 +wsrep_append_key(
 +/*==================*/
 +	THD		*thd,
 +	trx_t 		*trx,
 +	TABLE_SHARE 	*table_share,
 +	TABLE 		*table,
 +	const char*	key,
 +	uint16_t        key_len,
 +	bool            shared
 +)
 +{
 +	DBUG_ENTER("wsrep_append_key");
 +	bool const copy = true;
 +#ifdef WSREP_DEBUG_PRINT
 +	fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
 +		(shared) ? "Shared" : "Exclusive",
 +		wsrep_thd_thread_id(thd), (long long)trx->id, key_len,
 +		table_share->table_name.str, wsrep_thd_query(thd));
 +	for (int i=0; i<key_len; i++) {
 +		fprintf(stderr, "%hhX, ", key[i]);
 +	}
 +	fprintf(stderr, "\n");
 +#endif
 +	wsrep_buf_t wkey_part[3];
 +        wsrep_key_t wkey = {wkey_part, 3};
 +	if (!wsrep_prepare_key_for_innodb(
 +			(const uchar*)table_share->table_cache_key.str,
 +			table_share->table_cache_key.length,
 +			(const uchar*)key, key_len,
 +			wkey_part,
 +			(size_t*)&wkey.key_parts_num)) {
 +		WSREP_WARN("key prepare failed for: %s",
 +			   (wsrep_thd_query(thd)) ?
 +			   wsrep_thd_query(thd) : "void");
 +		DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
 +	}
 +
 +	int rcode = (int)wsrep->append_key(
 +			       wsrep,
 +			       wsrep_ws_handle(thd, trx),
 +			       &wkey,
 +			       1,
 +			       shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE,
 +                               copy);
 +	if (rcode) {
 +		DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
 +		WSREP_WARN("Appending row key failed: %s, %d",
 +			   (wsrep_thd_query(thd)) ?
 +			   wsrep_thd_query(thd) : "void", rcode);
 +		DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
 +	}
 +	DBUG_RETURN(0);
 +}
 +
 +extern void compute_md5_hash(char *digest, const char *buf, int len);
 +#define MD5_HASH compute_md5_hash
 +
 +static bool
 +referenced_by_foreign_key2(dict_table_t* table,
 +	                   dict_index_t* index) {
 +	ut_ad(table != NULL);
 +	ut_ad(index != NULL);
 +
 +	const dict_foreign_set* fks = &table->referenced_set;
 +	for (dict_foreign_set::const_iterator it = fks->begin();
 +	     it != fks->end();
 +	     ++it)
 +	{
 +		dict_foreign_t* foreign = *it;
 +		if (foreign->referenced_index != index) {
 +			continue;
 +		}
 +		ut_ad(table == foreign->referenced_table);
 +		return true;
 +	}
 +	return false;
 +}
 +
 +int
 +ha_innobase::wsrep_append_keys(
 +/*==================*/
 +	THD 		*thd,
 +	bool		shared,
 +	const uchar*	record0,	/* in: row in MySQL format */
 +	const uchar*	record1)	/* in: row in MySQL format */
 +{
 +	int rcode;
 +	DBUG_ENTER("wsrep_append_keys");
 +
 +	bool key_appended = false;
 +	trx_t *trx = thd_to_trx(thd);
 +
 +	if (table_share && table_share->tmp_table  != NO_TMP_TABLE) {
 +		WSREP_DEBUG("skipping tmp table DML: THD: %lu tmp: %d SQL: %s", 
 +			    wsrep_thd_thread_id(thd),
 +			    table_share->tmp_table,
 +			    (wsrep_thd_query(thd)) ? 
 +			    wsrep_thd_query(thd) : "void");
 +		DBUG_RETURN(0);
 +	}
 +
 +	if (wsrep_protocol_version == 0) {
 +		uint	len;
 +		char 	keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
 +		char 	*key 		= &keyval[0];
 +		ibool    is_null;
 +
 +		len = wsrep_store_key_val_for_row(
 +			thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH,
- 			record0, &is_null);
++			record0, prebuilt, &is_null);
 +
 +		if (!is_null) {
 +			rcode = wsrep_append_key(
 +				thd, trx, table_share, table, keyval, 
 +				len, shared);
 +			if (rcode) DBUG_RETURN(rcode);
 +		}
 +		else
 +		{
 +			WSREP_DEBUG("NULL key skipped (proto 0): %s", 
 +				    wsrep_thd_query(thd));
 +		}
 +	} else {
 +		ut_a(table->s->keys <= 256);
 +		uint i;
 +                bool hasPK= false;
 +
 +		for (i=0; i<table->s->keys; ++i) {
 +			KEY*  key_info	= table->key_info + i;
 +			if (key_info->flags & HA_NOSAME) {
 +				hasPK = true;
 +			}
 +		}
 +
 +		for (i=0; i<table->s->keys; ++i) {
 +			uint  len;
 +			char  keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
 +			char  keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
 +			char* key0 		= &keyval0[1];
 +			char* key1 		= &keyval1[1];
 +			KEY*  key_info	= table->key_info + i;
 +			ibool is_null;
 +
 +			dict_index_t* idx  = innobase_get_index(i);
 +			dict_table_t* tab  = (idx) ? idx->table : NULL;
 +
 +			keyval0[0] = (char)i;
 +			keyval1[0] = (char)i;
 +
 +			if (!tab) {
 +				WSREP_WARN("MySQL-InnoDB key mismatch %s %s",
 +					   table->s->table_name.str, 
 +					   key_info->name);
 +			}
 +			/* !hasPK == table with no PK, must append all non-unique keys */
 +			if (!hasPK || key_info->flags & HA_NOSAME ||
 +			    ((tab &&
 +			      referenced_by_foreign_key2(tab, idx)) ||
 +			     (!tab && referenced_by_foreign_key()))) {
 +
 +				len = wsrep_store_key_val_for_row(
 +					thd, table, i, key0, 
 +					WSREP_MAX_SUPPORTED_KEY_LENGTH, 
- 					record0, &is_null);
++					record0, prebuilt, &is_null);
 +				if (!is_null) {
 +					rcode = wsrep_append_key(
 +						thd, trx, table_share, table, 
 +						keyval0, len+1, shared);
 +					if (rcode) DBUG_RETURN(rcode);
 +
 +				if (key_info->flags & HA_NOSAME || shared)
 +			  		key_appended = true;
 +				}
 +				else
 +				{
 +					WSREP_DEBUG("NULL key skipped: %s", 
 +						    wsrep_thd_query(thd));
 +				}
 +				if (record1) {
 +					len = wsrep_store_key_val_for_row(
 +						thd, table, i, key1, 
 +						WSREP_MAX_SUPPORTED_KEY_LENGTH,
- 						record1, &is_null);
++						record1, prebuilt, &is_null);
 +					if (!is_null && memcmp(key0, key1, len)) {
 +						rcode = wsrep_append_key(
 +							thd, trx, table_share, 
 +							table, 
 +							keyval1, len+1, shared);
 +						if (rcode) DBUG_RETURN(rcode);
 +					}
 +				}
 +			}
 +		}
 +	}
 +
 +	/* if no PK, calculate hash of full row, to be the key value */
 +	if (!key_appended && wsrep_certify_nonPK) {
 +		uchar digest[16];
 +		int rcode;
 +
 +		wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
 +		if ((rcode = wsrep_append_key(thd, trx, table_share, table, 
 +					      (const char*) digest, 16, 
 +					      shared))) {
 +			DBUG_RETURN(rcode);
 +		}
 +
 +		if (record1) {
 +			wsrep_calc_row_hash(
 +				digest, record1, table, prebuilt, thd);
 +			if ((rcode = wsrep_append_key(thd, trx, table_share, 
 +						      table,
 +						      (const char*) digest, 
 +						      16, shared))) {
 +				DBUG_RETURN(rcode);
 +			}
 +		}
 +		DBUG_RETURN(0);
 +	}
 +
 +	DBUG_RETURN(0);
 +}
 +#endif /* WITH_WSREP */
  
  /*********************************************************************//**
  Stores a reference to the current row to 'ref' field of the handle. Note


More information about the commits mailing list