From 770c5c1c9e213fd7f8b21c9c9a8c4457a1176a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 26 Oct 2017 13:05:11 +0300 Subject: [PATCH] MDEV-14111 Inplace update assert after instant adding column row_upd_changes_field_size_or_external(): Always return TRUE if an instantly added column is being updated such that the column value is absent from the record. Also, avoid some unnecessary computations. --- .../suite/innodb/r/instant_alter.result | Bin 118205 -> 119063 bytes mysql-test/suite/innodb/t/instant_alter.test | 10 +++++++++- storage/innobase/row/row0upd.cc | 17 +++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index 544b30dd0418e3b9eba6c1b208afc9887daec59b..99f08c3c727321672cb6645eb3f6681fd5b9b493 100644 GIT binary patch delta 834 zcmdlxn|=Bs_6?`lCkyoQPHtGt#_s9o;u@imGTCsk(`13=Vywot>gv|h57;wGZ&xs9 zEM)W!4RCP`aaAZWR0wtrQAh#Gr{(9XD};Nv2DvI^rYP7d7+G^+C~|Ria}4zfK~`pB zJ$-@&<9cSG_Q{T1qLX(o%$a;)jpSs9MaTJ^JzSl=6+#@Hd_Xo$?tiH)XvmqIk(!*% zSzMA>Qd-RE?>$|>no(x^0V~GsjQl!WE&5vpF-)VB29Tbh~Mo@TsV%fZJLn$k+K$+1nqQYYO-7Spl Z+mk&Q^KgcUAJg=6ri`51a|0LyY5}y|1`hxL delta 358 zcmbQfh<)#D_6?`lr(bYkRNZX8Fotn*KcB?p?~A5Q7qDfNntY!t2g1-^a%_5`1*6nv zzok1ECr|2d*xb*T$2NJvI%#$z&cvkTl+?)+cZf~ySK!^uvF;Pgnew_val); + if (dfield_is_ext(new_val)) { + return(TRUE); + } new_len = dfield_get_len(new_val); ut_ad(new_len != UNIV_SQL_DEFAULT); @@ -609,11 +612,14 @@ row_upd_changes_field_size_or_external( 0); } - old_len = rec_offs_nth_size(offsets, upd_field->field_no); + if (rec_offs_nth_default(offsets, upd_field->field_no)) { + /* This is an instantly added column that is + at the initial default value. */ + return(TRUE); + } if (rec_offs_comp(offsets) - && rec_offs_nth_sql_null(offsets, - upd_field->field_no)) { + && rec_offs_nth_sql_null(offsets, upd_field->field_no)) { /* Note that in the compact table format, for a variable length field, an SQL NULL will use zero bytes in the offset array at the start of the physical @@ -622,9 +628,12 @@ row_upd_changes_field_size_or_external( if we update an SQL NULL varchar to an empty string! */ old_len = UNIV_SQL_NULL; + } else { + old_len = rec_offs_nth_size(offsets, + upd_field->field_no); } - if (dfield_is_ext(new_val) || old_len != new_len + if (old_len != new_len || rec_offs_nth_extern(offsets, upd_field->field_no)) { return(TRUE);