~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/slave/queue_producer.cc

  • Committer: Lee Bieber
  • Date: 2011-04-02 03:51:56 UTC
  • mfrom: (2260.1.1 revert_slave)
  • Revision ID: kalebral@gmail.com-20110402035156-lhfvo7o6yqtli0xs
Merge Shrews - Revert the multi-master slave plugin changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
 
21
#include <config.h>
21
22
#include <plugin/slave/queue_producer.h>
22
23
#include <drizzled/errmsg_print.h>
23
24
#include <drizzled/sql/result_set.h>
26
27
#include <drizzled/message/transaction.pb.h>
27
28
#include <boost/lexical_cast.hpp>
28
29
#include <google/protobuf/text_format.h>
29
 
#include <string>
30
 
#include <vector>
31
30
 
32
31
using namespace std;
33
32
using namespace drizzled;
200
199
   */
201
200
  string sql("SELECT MAX(x.cid) FROM"
202
201
             " (SELECT MAX(`commit_order`) AS cid FROM `sys_replication`.`queue`"
203
 
             "  WHERE `master_id` = "
204
 
             + boost::lexical_cast<string>(masterId())
205
 
             + "  UNION ALL SELECT `last_applied_commit_id` AS cid"
206
 
             + "  FROM `sys_replication`.`applier_state` WHERE `master_id` = "
207
 
             + boost::lexical_cast<string>(masterId())
208
 
             + ") AS x");
 
202
             "  UNION ALL SELECT `last_applied_commit_id` AS cid"
 
203
             "  FROM `sys_replication`.`applier_state`) AS x");
209
204
 
210
205
  sql::ResultSet result_set(1);
211
206
  Execute execute(*(_session.get()), true);
307
302
   * The SQL to insert our results into the local queue.
308
303
   */
309
304
  string sql= "INSERT INTO `sys_replication`.`queue`"
310
 
              " (`master_id`, `trx_id`, `seg_id`, `commit_order`, `msg`) VALUES (";
311
 
  sql.append(boost::lexical_cast<string>(masterId()));
312
 
  sql.append(", ", 2);
 
305
              " (`trx_id`, `seg_id`, `commit_order`, `msg`) VALUES (";
313
306
  sql.append(trx_id);
314
307
  sql.append(", ", 2);
315
308
  sql.append(seg_id);
488
481
  }
489
482
  
490
483
  sql.append(msg);
491
 
  sql.append("' WHERE `master_id` = ");
492
 
  sql.append(boost::lexical_cast<string>(masterId()));
 
484
  sql.append("'", 1);
493
485
 
494
486
  statements.push_back(sql);
495
487
  executeSQL(statements);