~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/xa_resource_manager.cc

  • Committer: Stewart Smith
  • Date: 2011-02-24 07:46:16 UTC
  • mto: (2200.1.2 drizzle-staging)
  • mto: This revision was merged to the branch mainline in revision 2201.
  • Revision ID: stewart@flamingspork.com-20110224074616-l2rmp406vf78x71q
add ER_NO_LOCK_HELD error code, and expect it in case of UNLOCK TABLES without any locks held.

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
#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