-- source include/have_ndb.inc
-- source include/not_embedded.inc
-- source include/have_case_sensitive_file_system.inc

# This test currently requires case sensitive file system as the tables
# are originally stored with uppercase

#
# Bug #18594 ndb_restore log boken in 5.1
#

--disable_warnings
DROP DATABASE IF EXISTS BANK;
--enable_warnings
CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
USE BANK;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
SHOW TABLES;
SELECT * FROM GL            ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT       ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION;
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;

#
# verify restore of 5.0 backup
# here we must use the already created tables as restoring the old
# table definitions will not work
#
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
TRUNCATE SYSTEM_VALUES;
TRUNCATE ACCOUNT_TYPE;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
SELECT * FROM GL            ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT       ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION;
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
DROP DATABASE BANK;
