Skip to content

Commit 43623f0

Browse files
committed
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
1 parent 73de06c commit 43623f0

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

sql/sql_delete.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,7 @@ int TABLE::delete_row()
254254

255255
store_record(this, record[1]);
256256
vers_update_end();
257-
int res;
258-
if ((res= file->extra(HA_EXTRA_REMEMBER_POS)))
259-
return res;
260-
if ((res= file->ha_update_row(record[1], record[0])))
261-
return res;
262-
return file->extra(HA_EXTRA_RESTORE_POS);
257+
return file->ha_update_row(record[1], record[0]);
263258
}
264259

265260

storage/heap/hp_write.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ int heap_write(HP_INFO *info, const uchar *record)
5858
if (++share->records == share->blength)
5959
share->blength+= share->blength;
6060
info->s->key_version++;
61-
info->current_ptr=pos;
62-
info->current_hash_ptr=0;
6361
info->update|=HA_STATE_AKTIV;
6462
#if !defined(DBUG_OFF) && defined(EXTRA_HEAP_DEBUG)
6563
DBUG_EXECUTE("check_heap",heap_check_heap(info, 0););

storage/maria/ma_write.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int maria_write(MARIA_HA *info, uchar *record)
8888
MARIA_SHARE *share= info->s;
8989
uint i;
9090
int save_errno;
91-
MARIA_RECORD_POS filepos;
91+
MARIA_RECORD_POS filepos, oldpos= info->cur_row.lastpos;
9292
uchar *buff;
9393
my_bool lock_tree= share->lock_key_trees;
9494
my_bool fatal_error;
@@ -302,7 +302,7 @@ int maria_write(MARIA_HA *info, uchar *record)
302302
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
303303
info->state->changed= 1;
304304

305-
info->cur_row.lastpos= filepos;
305+
info->cur_row.lastpos= oldpos;
306306
_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
307307
if (info->invalidator != 0)
308308
{

storage/myisam/mi_write.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ int mi_write(MI_INFO *info, uchar *record)
153153
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
154154
HA_STATE_ROW_CHANGED);
155155
info->state->records++;
156-
info->lastpos=filepos;
157156
myisam_log_record(MI_LOG_WRITE,info,record,filepos,0);
158157
(void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
159158
if (info->invalidator != 0)

0 commit comments

Comments
 (0)