~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/slave/queue_consumer.h

  • Committer: Lee Bieber
  • Date: 2011-03-28 18:11:45 UTC
  • mfrom: (2254.1.2 build)
  • Revision ID: kalebral@gmail.com-20110328181145-tfsb6s5ozhuvhfoq
Merge Patrick - Tweaked dbqp so that the existing slave tests work.
Merge Stewart - remove over 1000 lines of mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
  QueueConsumer() :
42
42
    QueueThread(),
43
43
    SQLExecutor("slave", "replication"),
44
 
    _check_interval(5)
 
44
    _check_interval(5),
 
45
    _ignore_errors(false)
45
46
  { }
46
47
 
47
48
  bool init();
59
60
  }
60
61
  
61
62
  /**
 
63
   * Determines if we should ignore errors from statements pulled from masters.
 
64
   */
 
65
  void setIgnoreErrors(bool value)
 
66
  {
 
67
    _ignore_errors= value;
 
68
  }
 
69
 
 
70
  /**
62
71
   * Update applier status in state table.
63
72
   *
64
73
   * @param err_msg Error message string
66
75
   */
67
76
  void setApplierState(const std::string &err_msg, bool status);
68
77
 
 
78
  void addMasterId(uint32_t id)
 
79
  {
 
80
    _master_ids.push_back(id);
 
81
  }
 
82
 
 
83
  bool processSingleMaster(const std::string &master_id);
 
84
 
69
85
private:
70
86
  typedef std::vector<uint64_t> TrxIdList;
71
87
 
72
88
  /** Number of seconds to sleep between checking queue for messages */
73
89
  uint32_t _check_interval;
74
90
 
75
 
  bool getListOfCompletedTransactions(TrxIdList &list);
 
91
  std::vector<uint32_t> _master_ids;
 
92
 
 
93
  bool _ignore_errors;
 
94
 
 
95
  /**
 
96
   * Get a list of transaction IDs from the queue that are complete.
 
97
   *
 
98
   * A "complete" transaction is one in which we have received the end
 
99
   * segment of the transaction.
 
100
   *
 
101
   * @param[in] master_id Identifier of the master we are interested in.
 
102
   * @param[out] list The list to populate with transaction IDs.
 
103
   *
 
104
   * @retval true Success
 
105
   * @retval false Error
 
106
   */
 
107
  bool getListOfCompletedTransactions(const std::string &master_id,
 
108
                                      TrxIdList &list);
76
109
 
77
110
  bool getMessage(drizzled::message::Transaction &transaction,
78
111
                  std::string &commit_id,
 
112
                  const std::string &master_id,
79
113
                  uint64_t trx_id,
80
114
                  uint32_t segment_id);
81
115
 
98
132
   *
99
133
   * @param sql Batch of SQL statements to execute.
100
134
   * @param commit_id Commit ID value to store in state table.
 
135
   * @param master_id ID of the master this SQL came from.
101
136
   *
102
137
   * @retval true Success
103
138
   * @retval false Failure
104
139
   */
105
140
  bool executeSQLWithCommitId(std::vector<std::string> &sql,
106
 
                              const std::string &commit_id);
 
141
                              const std::string &commit_id,
 
142
                              const std::string &master_id);
107
143
  
108
144
  /**
109
145
   * Remove messages for a given transaction from the queue.
110
146
   *
111
 
   * @param trx_id Transaction ID for the messages to remove.
 
147
   * @param[in] master_id ID of the master this transaction was on.
 
148
   * @param[in] trx_id Transaction ID for the messages to remove.
112
149
   *
113
150
   * @retval true Success
114
151
   * @retval false Failure
115
152
   */
116
 
  bool deleteFromQueue(uint64_t trx_id);
 
153
  bool deleteFromQueue(const std::string &master_id, uint64_t trx_id);
117
154
 
118
155
  /**
119
156
   * Determine if a Statement message is an end message.