~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/replication_services.cc

  • Committer: Brian Aker
  • Date: 2010-04-06 06:50:19 UTC
  • mfrom: (1405.3.9 replication-api)
  • Revision ID: brian@gaz-20100406065019-n387mztxp1i75qel
Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "drizzled/plugin/transaction_replicator.h"
40
40
#include "drizzled/plugin/transaction_applier.h"
41
41
#include "drizzled/message/transaction.pb.h"
42
 
#include "drizzled/message/table.pb.h"
43
 
#include "drizzled/message/statement_transform.h"
44
42
#include "drizzled/gettext.h"
45
43
#include "drizzled/session.h"
46
44
#include "drizzled/error.h"
145
143
  return is_active;
146
144
}
147
145
 
148
 
void ReplicationServices::pushTransactionMessage(message::Transaction &to_push)
 
146
plugin::ReplicationReturnCode ReplicationServices::pushTransactionMessage(Session &in_session,
 
147
                                                                          message::Transaction &to_push)
149
148
{
150
149
  vector<plugin::TransactionReplicator *>::iterator repl_iter= replicators.begin();
151
150
  vector<plugin::TransactionApplier *>::iterator appl_start_iter, appl_iter;
154
153
  plugin::TransactionReplicator *cur_repl;
155
154
  plugin::TransactionApplier *cur_appl;
156
155
 
 
156
  plugin::ReplicationReturnCode result= plugin::SUCCESS;
 
157
 
157
158
  while (repl_iter != replicators.end())
158
159
  {
159
160
    cur_repl= *repl_iter;
174
175
        continue;
175
176
      }
176
177
 
177
 
      cur_repl->replicate(cur_appl, to_push);
178
 
      
179
 
      /* 
180
 
       * We update the timestamp for the last applied Transaction so that
181
 
       * publisher plugins can ask the replication services when the
182
 
       * last known applied Transaction was using the getLastAppliedTimestamp()
183
 
       * method.
184
 
       */
185
 
      last_applied_timestamp.fetch_and_store(to_push.transaction_context().end_timestamp());
186
 
      ++appl_iter;
 
178
      result= cur_repl->replicate(cur_appl, in_session, to_push);
 
179
 
 
180
      if (result == plugin::SUCCESS)
 
181
      {
 
182
        /* 
 
183
         * We update the timestamp for the last applied Transaction so that
 
184
         * publisher plugins can ask the replication services when the
 
185
         * last known applied Transaction was using the getLastAppliedTimestamp()
 
186
         * method.
 
187
         */
 
188
        last_applied_timestamp.fetch_and_store(to_push.transaction_context().end_timestamp());
 
189
        ++appl_iter;
 
190
      }
 
191
      else
 
192
        return result;
187
193
    }
188
194
    ++repl_iter;
189
195
  }
 
196
  return result;
190
197
}
191
198
 
192
199
} /* namespace drizzled */