1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16
#ifndef CONSUMER_RESTORE_HPP
17
#define CONSUMER_RESTORE_HPP
19
#include "consumer.hpp"
21
bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts);
23
struct restore_callback_t {
24
class BackupRestore *restore;
26
class NdbTransaction *connection;
30
restore_callback_t *next;
34
class BackupRestore : public BackupConsumer
37
BackupRestore(NODE_GROUP_MAP *ng_map,
42
m_cluster_connection = 0;
43
m_nodegroup_map = ng_map;
44
m_nodegroup_map_len = ng_map_len;
45
m_logCount = m_dataCount = 0;
47
m_restore_meta = false;
48
m_no_restore_disk = false;
49
m_restore_epoch = false;
50
m_parallelism = parallelism;
56
m_cache.m_old_table = 0;
59
virtual ~BackupRestore();
61
virtual void release();
62
virtual bool object(Uint32 type, const void* ptr);
63
virtual bool table(const TableS &);
64
virtual bool endOfTables();
65
virtual void tuple(const TupleS &, Uint32 fragId);
66
virtual void tuple_free();
67
virtual void tuple_a(restore_callback_t *cb);
68
virtual void cback(int result, restore_callback_t *cb);
69
virtual bool errorHandler(restore_callback_t *cb);
70
virtual void exitHandler();
71
virtual void endOfTuples();
72
virtual void logEntry(const LogEntry &);
73
virtual void endOfLogEntrys();
74
virtual bool finalize_table(const TableS &);
75
virtual bool has_temp_error();
76
virtual bool createSystable(const TableS & table);
77
virtual bool table_equal(const TableS & table);
78
virtual bool update_apply_status(const RestoreMetaData &metaData);
79
void connectToMysql();
80
bool map_in_frm(char *new_data, const char *data,
81
uint data_len, uint *new_data_len);
82
bool search_replace(char *search_str, char **new_data,
83
const char **data, const char *end_data,
85
bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts);
86
Uint32 map_ng(Uint32 ng);
87
bool translate_frm(NdbDictionary::Table *table);
90
Ndb_cluster_connection * m_cluster_connection;
93
bool m_no_restore_disk;
95
bool m_no_upgrade; // for upgrade ArrayType from 5.0 backup file.
100
volatile Uint32 m_transactions;
102
restore_callback_t *m_callback;
103
restore_callback_t *m_free_callback;
107
* m_new_table_ids[X] = Y;
111
Vector<const NdbDictionary::Table*> m_new_tables;
113
const NdbDictionary::Table* m_old_table;
114
const NdbDictionary::Table* m_new_table;
116
const NdbDictionary::Table* get_table(const NdbDictionary::Table* );
118
Vector<const NdbDictionary::Table*> m_indexes;
119
Vector<NdbDictionary::Tablespace*> m_tablespaces; // Index by id
120
Vector<NdbDictionary::LogfileGroup*> m_logfilegroups;// Index by id