~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/xa_resource_manager.cc

  • Committer: patrick crews
  • Date: 2011-02-23 17:17:25 UTC
  • mto: (2195.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2196.
  • Revision ID: gleebix@gmail.com-20110223171725-4tgewemxhsw1m7q8
Integrated randgen with dbqp.  We now have mode=randgen and a set of randgen test suites (very basic now).  Output = same as dtr : )  We also have mode=cleanup to kill any servers we have started.  Docs updates too.  Gendata utility allows us to populate test servers 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *  Copyright (c) 2010 Jay Pipes <jaypipes@gmail.com>
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
5
 *  Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
8
8
 *  it under the terms of the GNU General Public License as published by
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
 
23
 
#include "drizzled/cached_directory.h"
 
23
#include <drizzled/cached_directory.h>
24
24
 
25
25
#include <drizzled/definitions.h>
26
26
#include <drizzled/session.h>
27
27
#include <drizzled/error.h>
28
28
#include <drizzled/gettext.h>
29
29
#include <drizzled/plugin/xa_resource_manager.h>
30
 
#include "drizzled/xid.h"
 
30
#include <drizzled/xid.h>
31
31
 
32
32
 
33
33
#include <string>
111
111
  
112
112
    while ((got= resource_manager->xaRecover(trans_list, trans_len)) > 0 )
113
113
    {
114
 
      errmsg_printf(ERRMSG_LVL_INFO,
 
114
      errmsg_printf(error::INFO,
115
115
                    _("Found %d prepared transaction(s) in resource manager."),
116
116
                    got);
117
117
      for (int i=0; i < got; i ++)
174
174
  }
175
175
  if (!trans_list)
176
176
  {
177
 
    errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), trans_len*sizeof(XID));
 
177
    errmsg_printf(error::ERROR, ER(ER_OUTOFMEMORY), trans_len*sizeof(XID));
178
178
    return(1);
179
179
  }
180
180
 
181
181
  if (commit_list.size())
182
 
    errmsg_printf(ERRMSG_LVL_INFO, _("Starting crash recovery..."));
 
182
    errmsg_printf(error::INFO, _("Starting crash recovery..."));
183
183
 
184
184
  XaRecover recover_func(trans_list, trans_len, commit_list, dry_run);
185
185
  std::for_each(xa_resource_managers.begin(),
188
188
  free(trans_list);
189
189
 
190
190
  if (recover_func.getForeignXIDs())
191
 
    errmsg_printf(ERRMSG_LVL_WARN,
 
191
    errmsg_printf(error::WARN,
192
192
                  _("Found %d prepared XA transactions"),
193
193
                  recover_func.getForeignXIDs());
 
194
 
194
195
  if (dry_run && recover_func.getMyXIDs())
195
196
  {
196
 
    errmsg_printf(ERRMSG_LVL_ERROR,
 
197
    errmsg_printf(error::ERROR,
197
198
                  _("Found %d prepared transactions! It means that drizzled "
198
199
                    "was not shut down properly last time and critical "
199
200
                    "recovery information (last binlog or %s file) was "
203
204
                    recover_func.getMyXIDs(), opt_tc_log_file);
204
205
    return(1);
205
206
  }
 
207
 
206
208
  if (commit_list.size())
207
 
    errmsg_printf(ERRMSG_LVL_INFO, _("Crash recovery finished."));
 
209
    errmsg_printf(error::INFO, _("Crash recovery finished."));
 
210
 
208
211
  return(0);
209
212
}
210
213