~michaeleguo/ubuntu/trusty/percona-xtradb-cluster-5.5/arm64fix

« back to all changes in this revision

Viewing changes to storage/ndb/tools/restore/consumer_restore.hpp

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-10 14:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20140210144423-f2134l2gxuvq2m6l
Tags: upstream-5.5.34-25.9+dfsg
ImportĀ upstreamĀ versionĀ 5.5.34-25.9+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
 
15
 
 
16
#ifndef CONSUMER_RESTORE_HPP
 
17
#define CONSUMER_RESTORE_HPP
 
18
 
 
19
#include "consumer.hpp"
 
20
 
 
21
bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts);
 
22
 
 
23
struct restore_callback_t {
 
24
  class BackupRestore *restore;
 
25
  class TupleS tup;
 
26
  class NdbTransaction *connection;
 
27
  int    retries;
 
28
  int error_code;
 
29
  Uint32 fragId;
 
30
  restore_callback_t *next;
 
31
};
 
32
 
 
33
 
 
34
class BackupRestore : public BackupConsumer 
 
35
{
 
36
public:
 
37
  BackupRestore(NODE_GROUP_MAP *ng_map,
 
38
                uint ng_map_len,
 
39
                Uint32 parallelism=1)
 
40
  {
 
41
    m_ndb = 0;
 
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;
 
46
    m_restore = false;
 
47
    m_restore_meta = false;
 
48
    m_no_restore_disk = false;
 
49
    m_restore_epoch = false;
 
50
    m_parallelism = parallelism;
 
51
    m_callback = 0;
 
52
    m_free_callback = 0;
 
53
    m_temp_error = false;
 
54
    m_no_upgrade = false;
 
55
    m_transactions = 0;
 
56
    m_cache.m_old_table = 0;
 
57
  }
 
58
  
 
59
  virtual ~BackupRestore();
 
60
  virtual bool init();
 
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,
 
84
                      uint *new_data_len);
 
85
  bool map_nodegroups(Uint16 *ng_array, Uint32 no_parts);
 
86
  Uint32 map_ng(Uint32 ng);
 
87
  bool translate_frm(NdbDictionary::Table *table);
 
88
   
 
89
  Ndb * m_ndb;
 
90
  Ndb_cluster_connection * m_cluster_connection;
 
91
  bool m_restore;
 
92
  bool m_restore_meta;
 
93
  bool m_no_restore_disk;
 
94
  bool m_restore_epoch;
 
95
  bool m_no_upgrade; // for upgrade ArrayType from 5.0 backup file.
 
96
  Uint32 m_logCount;
 
97
  Uint32 m_dataCount;
 
98
 
 
99
  Uint32 m_parallelism;
 
100
  volatile Uint32 m_transactions;
 
101
 
 
102
  restore_callback_t *m_callback;
 
103
  restore_callback_t *m_free_callback;
 
104
  bool m_temp_error;
 
105
 
 
106
  /**
 
107
   * m_new_table_ids[X] = Y;
 
108
   *   X - old table id
 
109
   *   Y != 0  - new table
 
110
   */
 
111
  Vector<const NdbDictionary::Table*> m_new_tables;
 
112
  struct {
 
113
    const NdbDictionary::Table* m_old_table;
 
114
    const NdbDictionary::Table* m_new_table;
 
115
  } m_cache;
 
116
  const NdbDictionary::Table* get_table(const NdbDictionary::Table* );
 
117
 
 
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
 
121
};
 
122
 
 
123
#endif