[MDEV-15370] Upgrade fails when both insert_undo and update_undo exist for recovered transactions Created: 2018-02-20  Updated: 2018-07-25  Resolved: 2018-02-22

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.3.1
Fix Version/s: 10.3.5

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-15912 InnoDB: Failing assertion: purge_sys.... Closed
is caused by MDEV-12288 Reset DB_TRX_ID when the history is r... Closed

 Description   

Note: filing on behalf of marko.

To reproduce, run the MTR test below on the version. 10.2 is the easiest choice, because crash-upgrade from 10.1 has additional limitations. After the test fails, take the datadir and start 10.3 server on it.

--source include/have_innodb.inc
 
--connect(con1, localhost, root)
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t VALUES(1);
BEGIN;
INSERT INTO t VALUES(2);
DELETE FROM t WHERE a=2;
 
--connection default
BEGIN;
INSERT INTO t VALUES(0);
ROLLBACK;
--shutdown_server 0
die "Die is unimportant for the scenario, but helps to avoid post-test checks";

10.3 d23fcc427cb40

2018-02-21 00:19:44 0x7f08b7fff700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/trx/trx0purge.cc line 154
InnoDB: Failing assertion: purge_sys->iter.trx_no <= purge_sys->rseg->last_trx_no
 
#6  0x00005562e5e2587c in ut_dbg_assertion_failed (expr=0x5562e63e2778 "purge_sys->iter.trx_no <= purge_sys->rseg->last_trx_no", file=0x5562e63e2658 "/data/src/10.3/storage/innobase/trx/trx0purge.cc", line=154) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:61
#7  0x00005562e5df3ef3 in TrxUndoRsegsIterator::set_next (this=0x5562e9e1e7d0) at /data/src/10.3/storage/innobase/trx/trx0purge.cc:154
#8  0x00005562e5df1c60 in trx_purge_choose_next_log () at /data/src/10.3/storage/innobase/trx/trx0purge.cc:1266
#9  0x00005562e5df1f17 in trx_purge_get_next_rec (n_pages_handled=0x7f08b7ffede8, heap=0x5562ea0c7720) at /data/src/10.3/storage/innobase/trx/trx0purge.cc:1339
#10 0x00005562e5df21c5 in trx_purge_fetch_next_rec (roll_ptr=0x7f08ac015ff8, n_pages_handled=0x7f08b7ffede8, heap=0x5562ea0c7720) at /data/src/10.3/storage/innobase/trx/trx0purge.cc:1410
#11 0x00005562e5df24f4 in trx_purge_attach_undo_recs (n_purge_threads=4, purge_sys=0x5562e9e1e5f0, batch_size=300) at /data/src/10.3/storage/innobase/trx/trx0purge.cc:1485
#12 0x00005562e5df2a20 in trx_purge (n_purge_threads=4, batch_size=300, truncate=false) at /data/src/10.3/storage/innobase/trx/trx0purge.cc:1624
#13 0x00005562e5dc2a60 in srv_do_purge (n_total_purged=0x7f08b7ffeee8) at /data/src/10.3/storage/innobase/srv/srv0srv.cc:2659
#14 0x00005562e5dc2fef in srv_purge_coordinator_thread (arg=0x0) at /data/src/10.3/storage/innobase/srv/srv0srv.cc:2802
#15 0x00007f090328d494 in start_thread (arg=0x7f08b7fff700) at pthread_create.c:333
#16 0x00007f090167393f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Same happens on a non-debug build.

10.3.4 release build also fails, but with a different assertion failure:

10.3.4 release

2018-02-21 00:20:45 0x7f854ebfc740  InnoDB: Assertion failure in file /home/buildbot/buildbot/build/storage/innobase/include/trx0sys.h line 683
InnoDB: Failing assertion: res == 0
 
#5  0x0000563cb40daa53 in ut_dbg_assertion_failed (expr=expr@entry=0x563cb4a83b8a "res == 0", file=file@entry=0x563cb4a6d0b0 "/home/buildbot/buildbot/build/storage/innobase/include/trx0sys.h", line=line@entry=683) at /home/buildbot/buildbot/build/storage/innobase/ut/ut0dbg.cc:61
#6  0x0000563cb40da7bc in rw_trx_hash_t::insert (trx=<optimized out>, this=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/include/trx0sys.h:683
#7  0x0000563cb464bbeb in mem_heap_alloc (n=<optimized out>, heap=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/include/mem0mem.ic:207
#8  ib_heap_allocator_create (heap=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/include/ut0vec.ic:90
#9  trx_create_low () at /home/buildbot/buildbot/build/storage/innobase/trx/trx0trx.cc:474
#10 trx_allocate_for_background () at /home/buildbot/buildbot/build/storage/innobase/trx/trx0trx.cc:533
#11 trx_resurrect_insert (rseg=<optimized out>, undo=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/trx/trx0trx.cc:831
#12 trx_lists_init_at_db_start () at /home/buildbot/buildbot/build/storage/innobase/trx/trx0trx.cc:1067
#13 0x0000563cb4640e79 in trx_sys_init_at_db_start () at /home/buildbot/buildbot/build/storage/innobase/trx/trx0sys.cc:455
#14 0x0000563cb4613396 in innobase_start_or_create_for_mysql () at /home/buildbot/buildbot/build/storage/innobase/srv/srv0start.cc:2230
#15 0x0000563cb44ff79c in innobase_init (p=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/handler/ha_innodb.cc:4196
#16 0x0000563cb4352348 in ha_initialize_handlerton (plugin=0x563cb68ca360) at /home/buildbot/buildbot/build/sql/handler.cc:522
#17 0x0000563cb41a98b0 in plugin_initialize (tmp_root=tmp_root@entry=0x7fffd5c92780, plugin=plugin@entry=0x563cb68ca360, argc=argc@entry=0x563cb5282470 <remaining_argc>, argv=argv@entry=0x563cb6881838, options_only=options_only@entry=false) at /home/buildbot/buildbot/build/sql/sql_plugin.cc:1447
#18 0x0000563cb41aabfa in plugin_init (argc=argc@entry=0x563cb5282470 <remaining_argc>, argv=0x563cb6881838, flags=2) at /home/buildbot/buildbot/build/sql/sql_plugin.cc:1730
#19 0x0000563cb4101338 in init_server_components () at /home/buildbot/buildbot/build/sql/mysqld.cc:5350
#20 0x0000563cb4103db3 in mysqld_main (argc=11, argv=0x563cb6881838) at /home/buildbot/buildbot/build/sql/mysqld.cc:5943
#21 0x00007f854d3882b1 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#22 0x0000563cb40f8dad in _start ()

I cannot track it further back to the origin, because 10.3.3 didn't allow crash-upgrade, it just returns the error:

2018-02-21  0:21:59 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.2.14.
2018-02-21  0:21:59 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-02-21  0:22:00 0 [Note] InnoDB: Starting shutdown...


Generated at Thu Feb 08 08:20:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.