mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
new apply_status table test adoption
new apply_status table ndb_restore adoption
This commit is contained in:
parent
afdbe36a3f
commit
f81ff454f0
4 changed files with 69 additions and 34 deletions
|
@ -45,8 +45,8 @@ SYSTEM_VALUES_ID VALUE
|
|||
0 2039
|
||||
1 3
|
||||
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
|
||||
server_id epoch
|
||||
0 151
|
||||
server_id epoch log_name start_pos end_pos
|
||||
0 151 0 0
|
||||
TRUNCATE GL;
|
||||
TRUNCATE ACCOUNT;
|
||||
TRUNCATE TRANSACTION;
|
||||
|
@ -99,6 +99,6 @@ SYSTEM_VALUES_ID VALUE
|
|||
0 2297
|
||||
1 5
|
||||
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
|
||||
server_id epoch
|
||||
0 331
|
||||
server_id epoch log_name start_pos end_pos
|
||||
0 331 0 0
|
||||
DROP DATABASE BANK;
|
||||
|
|
|
@ -87,12 +87,12 @@ master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
|||
master-bin.000002 # Query 1 # COMMIT
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000001 1702
|
||||
master-bin.000002 593
|
||||
master-bin.000001 1740
|
||||
master-bin.000002 612
|
||||
start slave;
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
slave-bin.000001 1797
|
||||
slave-bin.000001 1835
|
||||
slave-bin.000002 198
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
@ -126,7 +126,7 @@ slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F
|
|||
slave-bin.000002 # Query 2 # COMMIT
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 593 # # master-bin.000002 Yes Yes # 0 0 593 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 612 # # master-bin.000002 Yes Yes # 0 0 612 # None 0 No #
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -33,12 +33,12 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
|
|||
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 219 Query 1 283 BEGIN
|
||||
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 378 Write_rows 1 137 table_id: #
|
||||
master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 467 Query 1 532 COMMIT
|
||||
master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
|
||||
master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 381 Write_rows 1 156 table_id: #
|
||||
master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 486 Query 1 551 COMMIT
|
||||
master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
|
@ -69,23 +69,23 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
|
|||
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 219 Query 1 283 BEGIN
|
||||
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 378 Write_rows 1 137 table_id: #
|
||||
master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 467 Query 1 532 COMMIT
|
||||
master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
|
||||
master-bin.000001 688 Query 1 805 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 805 Query 1 869 BEGIN
|
||||
master-bin.000001 869 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 909 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 964 Write_rows 1 137 table_id: #
|
||||
master-bin.000001 1006 Write_rows 1 184 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1053 Query 1 1118 COMMIT
|
||||
master-bin.000001 1118 Query 1 1182 BEGIN
|
||||
master-bin.000001 1182 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 1222 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 1277 Write_rows 1 137 table_id: #
|
||||
master-bin.000001 1319 Delete_rows 1 176 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1358 Query 1 1423 COMMIT
|
||||
master-bin.000001 1423 Query 1 1499 use `test`; DROP TABLE t1
|
||||
master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 381 Write_rows 1 156 table_id: #
|
||||
master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 486 Query 1 551 COMMIT
|
||||
master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1
|
||||
master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1
|
||||
master-bin.000001 707 Query 1 824 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
|
||||
master-bin.000001 824 Query 1 888 BEGIN
|
||||
master-bin.000001 888 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 928 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 986 Write_rows 1 156 table_id: #
|
||||
master-bin.000001 1044 Write_rows 1 203 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1091 Query 1 1156 COMMIT
|
||||
master-bin.000001 1156 Query 1 1220 BEGIN
|
||||
master-bin.000001 1220 Table_map 1 40 table_id: # (test.t1)
|
||||
master-bin.000001 1260 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
|
||||
master-bin.000001 1318 Write_rows 1 156 table_id: #
|
||||
master-bin.000001 1376 Delete_rows 1 195 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 1415 Query 1 1480 COMMIT
|
||||
master-bin.000001 1480 Query 1 1556 use `test`; DROP TABLE t1
|
||||
|
|
|
@ -617,6 +617,7 @@ BackupRestore::update_apply_status(const RestoreMetaData &metaData)
|
|||
return true;
|
||||
|
||||
bool result= false;
|
||||
unsigned apply_table_format= 0;
|
||||
|
||||
m_ndb->setDatabaseName(NDB_REP_DB);
|
||||
m_ndb->setSchemaName("def");
|
||||
|
@ -629,8 +630,33 @@ BackupRestore::update_apply_status(const RestoreMetaData &metaData)
|
|||
<< dict->getNdbError() << endl;
|
||||
return false;
|
||||
}
|
||||
if
|
||||
(ndbtab->getColumn(0)->getType() == NdbDictionary::Column::Unsigned &&
|
||||
ndbtab->getColumn(1)->getType() == NdbDictionary::Column::Bigunsigned)
|
||||
{
|
||||
if (ndbtab->getNoOfColumns() == 2)
|
||||
{
|
||||
apply_table_format= 1;
|
||||
}
|
||||
else if
|
||||
(ndbtab->getColumn(2)->getType() == NdbDictionary::Column::Varchar &&
|
||||
ndbtab->getColumn(3)->getType() == NdbDictionary::Column::Bigunsigned &&
|
||||
ndbtab->getColumn(4)->getType() == NdbDictionary::Column::Bigunsigned)
|
||||
{
|
||||
apply_table_format= 2;
|
||||
}
|
||||
}
|
||||
if (apply_table_format == 0)
|
||||
{
|
||||
err << Ndb_apply_table << " has wrong format\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
Uint32 server_id= 0;
|
||||
Uint64 epoch= metaData.getStopGCP();
|
||||
Uint64 zero= 0;
|
||||
char empty_string[1];
|
||||
empty_string[0]= 0;
|
||||
NdbTransaction * trans= m_ndb->startTransaction();
|
||||
if (!trans)
|
||||
{
|
||||
|
@ -653,6 +679,15 @@ BackupRestore::update_apply_status(const RestoreMetaData &metaData)
|
|||
<< op->getNdbError() << endl;
|
||||
goto err;
|
||||
}
|
||||
if ((apply_table_format == 2) &&
|
||||
(op->setValue(2u, (const char *)&empty_string, 1) ||
|
||||
op->setValue(3u, (const char *)&zero, sizeof(zero)) ||
|
||||
op->setValue(4u, (const char *)&zero, sizeof(zero))))
|
||||
{
|
||||
err << Ndb_apply_table << ": "
|
||||
<< op->getNdbError() << endl;
|
||||
goto err;
|
||||
}
|
||||
if (trans->execute(NdbTransaction::Commit))
|
||||
{
|
||||
err << Ndb_apply_table << ": "
|
||||
|
|
Loading…
Add table
Reference in a new issue