00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef CONSUMER_RESTORE_HPP 00018 #define CONSUMER_RESTORE_HPP 00019 00020 #include "consumer.hpp" 00021 00022 bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts); 00023 00024 struct restore_callback_t { 00025 class BackupRestore *restore; 00026 class TupleS tup; 00027 class NdbTransaction *connection; 00028 int retries; 00029 int error_code; 00030 Uint32 fragId; 00031 restore_callback_t *next; 00032 }; 00033 00034 00035 class BackupRestore : public BackupConsumer 00036 { 00037 public: 00038 BackupRestore(NODE_GROUP_MAP *ng_map, 00039 uint ng_map_len, 00040 Uint32 parallelism=1) 00041 { 00042 m_ndb = 0; 00043 m_cluster_connection = 0; 00044 m_nodegroup_map = ng_map; 00045 m_nodegroup_map_len = ng_map_len; 00046 m_logCount = m_dataCount = 0; 00047 m_restore = false; 00048 m_restore_meta = false; 00049 m_no_restore_disk = false; 00050 m_restore_epoch = false; 00051 m_parallelism = parallelism; 00052 m_callback = 0; 00053 m_free_callback = 0; 00054 m_transactions = 0; 00055 m_cache.m_old_table = 0; 00056 } 00057 00058 virtual ~BackupRestore(); 00059 virtual bool init(); 00060 virtual void release(); 00061 virtual bool object(Uint32 type, const void* ptr); 00062 virtual bool table(const TableS &); 00063 virtual bool endOfTables(); 00064 virtual void tuple(const TupleS &, Uint32 fragId); 00065 virtual void tuple_free(); 00066 virtual void tuple_a(restore_callback_t *cb); 00067 virtual void cback(int result, restore_callback_t *cb); 00068 virtual bool errorHandler(restore_callback_t *cb); 00069 virtual void exitHandler(); 00070 virtual void endOfTuples(); 00071 virtual void logEntry(const LogEntry &); 00072 virtual void endOfLogEntrys(); 00073 virtual bool finalize_table(const TableS &); 00074 virtual bool update_apply_status(const RestoreMetaData &metaData); 00075 void connectToMysql(); 00076 bool map_in_frm(char *new_data, const char *data, 00077 uint data_len, uint *new_data_len); 00078 bool search_replace(char *search_str, char **new_data, 00079 const char **data, const char *end_data, 00080 uint *new_data_len); 00081 bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts); 00082 Uint32 map_ng(Uint32 ng); 00083 bool translate_frm(NdbDictionary::Table *table); 00084 00085 Ndb * m_ndb; 00086 Ndb_cluster_connection * m_cluster_connection; 00087 bool m_restore; 00088 bool m_restore_meta; 00089 bool m_no_restore_disk; 00090 bool m_restore_epoch; 00091 Uint32 m_logCount; 00092 Uint32 m_dataCount; 00093 00094 Uint32 m_parallelism; 00095 volatile Uint32 m_transactions; 00096 00097 restore_callback_t *m_callback; 00098 restore_callback_t *m_free_callback; 00099 00105 Vector<const NdbDictionary::Table*> m_new_tables; 00106 struct { 00107 const NdbDictionary::Table* m_old_table; 00108 const NdbDictionary::Table* m_new_table; 00109 } m_cache; 00110 const NdbDictionary::Table* get_table(const NdbDictionary::Table* ); 00111 00112 Vector<const NdbDictionary::Table*> m_indexes; 00113 Vector<NdbDictionary::Tablespace*> m_tablespaces; // Index by id 00114 Vector<NdbDictionary::LogfileGroup*> m_logfilegroups;// Index by id 00115 }; 00116 00117 #endif
1.4.7

