From a3b4f575b966ff91035fd8104eadd4df366574c1 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 22 Oct 2017 20:06:01 +0300 Subject: [PATCH] Reset table->record[1] early for sequences to fix comparision of innodb row Added also suppression of openssl warnings from valgrind --- mysql-test/valgrind.supp | 31 +++++++++++++++++++++++++++++++ sql/ha_sequence.cc | 6 ++++++ sql/handler.cc | 2 +- sql/sql_sequence.cc | 6 ------ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 74c755aa669..2b54554923c 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1737,3 +1737,34 @@ ... } +# +# OpenSSL 1.0.1k problems +# + +{ + OPENSSL 1.0.1k crypto leak + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:CRYPTO_malloc + fun:ENGINE_ADD +} +{ + OPENSSL 1.0.1k crypto leak + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:CRYPTO_malloc + fun:ENGINE_new +} + +{ + OPENSSL 1.0.1k crypto leak2 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:CRYPTO_malloc + fun:sk_new + obj:/lib64/libcrypto.so* + fun:ENGINE_ADD +} diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 7f2248bf3cb..6923997cf07 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -112,6 +112,12 @@ int ha_sequence::open(const char *name, int mode, uint flags) } else table->m_needs_reopen= true; + + /* + The following is needed to fix comparison of rows in + ha_update_first_row() for InnoDB + */ + memcpy(table->record[1], table->s->default_values, table->s->reclength); } DBUG_RETURN(error); } diff --git a/sql/handler.cc b/sql/handler.cc index d072e750e09..553daa7e7e7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6066,7 +6066,7 @@ int handler::update_first_row(uchar *new_data) /* We have to do the memcmp as otherwise we may get error 169 from InnoDB */ - if (memcmp(table->record[0], table->record[1], table->s->reclength)) + if (memcmp(new_data, table->record[1], table->s->reclength)) error= update_row(table->record[1], new_data); } end_error= ha_rnd_end(); diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index c454d6267d4..ec40dc5a507 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -594,12 +594,6 @@ int sequence_definition::write(TABLE *table, bool all_fields) else table->rpl_write_set= &table->s->all_set; - /* - The following is needed to fix comparison of rows in - ha_update_first_row() for InnoDB - */ - memcpy(table->record[1],table->s->default_values, table->s->reclength); - /* Update table */ save_write_set= table->write_set; save_read_set= table->read_set;