MDEV-34855 Bootstrap hangs while shrinking the system tablespace

Reason:
=======
- During bootstrap, InnoDB shrinks the system tablespace while purge is
still active on system tablespace. This could lead to deadlock.

Fix:
====
Avoid System tablespace shrinking during bootstrap.
Move the shrinking logic of system tablespace after purge gets shutdown.
parent e91a7994
......@@ -40,6 +40,9 @@ Created 11/29/1995 Heikki Tuuri
#include "dict0mem.h"
#include "fsp0types.h"
#include "log.h"
#ifndef DBUG_OFF
# include "trx0purge.h"
#endif
/** Returns the first extent descriptor for a segment.
We think of the extent lists of the segment catenated in the order
......@@ -3576,6 +3579,8 @@ dberr_t fsp_sys_tablespace_validate()
void fsp_system_tablespace_truncate()
{
ut_ad(!purge_sys.enabled());
ut_ad(!srv_undo_sources);
uint32_t last_used_extent= 0;
fil_space_t *space= fil_system.sys_space;
mtr_t mtr;
......
......@@ -4283,12 +4283,6 @@ innobase_end(handlerton*, ha_panic_function)
}
}
/* Do system tablespace truncation during slow shutdown */
if (!srv_fast_shutdown && !high_level_read_only
&& srv_operation == SRV_OPERATION_NORMAL) {
fsp_system_tablespace_truncate();
}
innodb_shutdown();
mysql_mutex_destroy(&log_requests.mutex);
}
......
......@@ -1577,5 +1577,8 @@ void srv_purge_shutdown()
}
purge_sys.coordinator_shutdown();
srv_shutdown_purge_tasks();
if (!srv_fast_shutdown && !high_level_read_only && srv_was_started &&
!opt_bootstrap && srv_operation == SRV_OPERATION_NORMAL)
fsp_system_tablespace_truncate();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment