Skip to content

Commit cf52944

Browse files
committed
Bug #29557747: DEBUG-ASSERT WHILE RESTARTING SERVER POST INSTALL COMPONENT
RB#22585 The server was trying to binlog "special tables" creation, i.e. the tables that plugins create that are not exactly tables but rather just a way for DD to get a grip about tables existing in plugins, but not yet in DD. No need to be doing this since this is part of the initialization of all plugins/components. Fixed by turning off binlog for that operation. Test case added.
1 parent 2c2d48c commit cf52944

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Bug #29557747: DEBUG-ASSERT WHILE RESTARTING SERVER POST INSTALL
3+
# COMPONENT
4+
#
5+
INSTALL COMPONENT "file://component_pfs_example_component_population";
6+
include/assert.inc [Nothing was written to the binlog by adding a PFS table]
7+
# Must not crash
8+
# restart
9+
SELECT "it's alive";
10+
it's alive
11+
it's alive
12+
UNINSTALL COMPONENT "file://component_pfs_example_component_population";
13+
include/assert.inc [Nothing was written to the binlog by removing a PFS table]
14+
# End of 8.0 tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$PFS_EXAMPLE_COMPONENT_POPULATION_OPT
2+
--gtid_mode=ON
3+
--enforce_gtid_consistency=true
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--source include/have_binlog_format_row.inc
2+
3+
--echo #
4+
--echo # Bug #29557747: DEBUG-ASSERT WHILE RESTARTING SERVER POST INSTALL
5+
--echo # COMPONENT
6+
--echo #
7+
8+
--let $before=query_get_value('SHOW MASTER STATUS', Position, 1)
9+
INSTALL COMPONENT "file://component_pfs_example_component_population";
10+
--let $after=query_get_value('SHOW MASTER STATUS', Position, 1)
11+
12+
--let $assert_text = Nothing was written to the binlog by adding a PFS table
13+
--let $assert_cond = $before = $after
14+
--source include/assert.inc
15+
16+
--echo # Must not crash
17+
--source include/restart_mysqld.inc
18+
SELECT "it's alive";
19+
20+
--let $beforeu=query_get_value('SHOW MASTER STATUS', Position, 1)
21+
UNINSTALL COMPONENT "file://component_pfs_example_component_population";
22+
--let $afteru=query_get_value('SHOW MASTER STATUS', Position, 1)
23+
24+
--let $assert_text = Nothing was written to the binlog by removing a PFS table
25+
--let $assert_cond = $beforeu = $afteru
26+
--source include/assert.inc
27+
28+
--echo # End of 8.0 tests

Diff for: sql/dd/impl/dictionary_impl.cc

+12-8
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ bool create_native_table(THD *thd, const Plugin_table *pt) {
561561
/*
562562
1. Mark that we are executing a special DDL during
563563
plugin initialization. This will enable DDL to not be
564-
committed. The called of this API would commit the transaction.
564+
committed or binlogged. The called of this API would commit
565+
the transaction.
565566
566567
2. Remove metadata of native table if already exists. This could
567568
happen if server was crashed and restarted.
@@ -578,16 +579,19 @@ bool create_native_table(THD *thd, const Plugin_table *pt) {
578579
thd->mark_plugin_fake_ddl(true);
579580
ulong master_access = thd->security_context()->master_access();
580581
thd->security_context()->set_master_access(~(ulong)0);
582+
{
583+
Disable_binlog_guard guard(thd);
584+
585+
// Drop the table and related dynamic statistics too.
586+
if (table_def) {
587+
error =
588+
client->drop(table_def) || client->remove_table_dynamic_statistics(
589+
pt->get_schema_name(), pt->get_name());
590+
}
581591

582-
// Drop the table and related dynamic statistics too.
583-
if (table_def) {
584-
error =
585-
client->drop(table_def) || client->remove_table_dynamic_statistics(
586-
pt->get_schema_name(), pt->get_name());
592+
if (!error) error = dd::execute_query(thd, pt->get_ddl());
587593
}
588594

589-
if (!error) error = dd::execute_query(thd, pt->get_ddl());
590-
591595
thd->security_context()->set_master_access(master_access);
592596
thd->mark_plugin_fake_ddl(false);
593597

0 commit comments

Comments
 (0)