--source include/have_ndb.inc

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

--echo "testing the bug#31853"

disable_query_log;
call mtr.add_suppression("Could not acquire global schema lock");
call mtr.add_suppression("Tables not available after 60 seconds.");
enable_query_log;

# Restart cluster nodes "nostart"
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all restart -n" >> $NDB_TOOLS_OUTPUT
# Wait for all nodes to enter "nostart"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --not-started >> $NDB_TOOLS_OUTPUT

--error ER_CANT_CREATE_TABLE
create table t1(i int primary key) engine=ndb;

let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc

--error ER_CANT_CREATE_TABLE
create table t2(i int primary key) engine=ndb;

# Start cluster nodes again
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all start" >> $NDB_TOOLS_OUTPUT
# Wait for all nodes to enter "started"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT


#
# Wait until the connection to the
# cluster has been restored or timeout occurs
#
connection default;
--disable_result_log
--disable_query_log
--source include/ndb_not_readonly.inc
--enable_result_log
--enable_query_log

--echo "end of test the bug#31853"
