summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-05-13 14:22:49 +0200
committerSergei Golubchik <serg@mariadb.org>2019-05-17 13:53:22 +0200
commit43623f04a98263301b302961be092a0244494ec3 (patch)
treebe088f8102f483b19ba7e2ed512c176e30b721d9
parent73de06c48ff26070cabcd408ebc3d888da88110f (diff)
downloadmariadb-git-43623f04a98263301b302961be092a0244494ec3.tar.gz
MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
handler::write_row() should not destroy the state of the running index_search/index_next/... or rnd_init/rnd_next/... scan
-rw-r--r--sql/sql_delete.cc7
-rw-r--r--storage/heap/hp_write.c2
-rw-r--r--storage/maria/ma_write.c4
-rw-r--r--storage/myisam/mi_write.c1
4 files changed, 3 insertions, 11 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 642f60e7ba6..0ab80fe7cb8 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -254,12 +254,7 @@ int TABLE::delete_row()
store_record(this, record[1]);
vers_update_end();
- int res;
- if ((res= file->extra(HA_EXTRA_REMEMBER_POS)))
- return res;
- if ((res= file->ha_update_row(record[1], record[0])))
- return res;
- return file->extra(HA_EXTRA_RESTORE_POS);
+ return file->ha_update_row(record[1], record[0]);
}
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index 9ddbb40b706..877c1bcecb6 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -58,8 +58,6 @@ int heap_write(HP_INFO *info, const uchar *record)
if (++share->records == share->blength)
share->blength+= share->blength;
info->s->key_version++;
- info->current_ptr=pos;
- info->current_hash_ptr=0;
info->update|=HA_STATE_AKTIV;
#if !defined(DBUG_OFF) && defined(EXTRA_HEAP_DEBUG)
DBUG_EXECUTE("check_heap",heap_check_heap(info, 0););
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 92555bc3045..faf47929973 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -88,7 +88,7 @@ int maria_write(MARIA_HA *info, uchar *record)
MARIA_SHARE *share= info->s;
uint i;
int save_errno;
- MARIA_RECORD_POS filepos;
+ MARIA_RECORD_POS filepos, oldpos= info->cur_row.lastpos;
uchar *buff;
my_bool lock_tree= share->lock_key_trees;
my_bool fatal_error;
@@ -302,7 +302,7 @@ int maria_write(MARIA_HA *info, uchar *record)
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
info->state->changed= 1;
- info->cur_row.lastpos= filepos;
+ info->cur_row.lastpos= oldpos;
_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
if (info->invalidator != 0)
{
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index f6a1cebb3a8..f08dea77354 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -153,7 +153,6 @@ int mi_write(MI_INFO *info, uchar *record)
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
HA_STATE_ROW_CHANGED);
info->state->records++;
- info->lastpos=filepos;
myisam_log_record(MI_LOG_WRITE,info,record,filepos,0);
(void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
if (info->invalidator != 0)