~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/xa_resource_manager.cc

[patch 112/129] Merge patch for revision 1925 from InnoDB SVN:
revno: 1925
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6169
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6163
committer: calvin
timestamp: Thu 2009-11-12 12:40:43 +0000
message:
  branches/zip: add test case for bug#46676
  
  This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
  But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
  Add test case to catch future regression.
added:
  mysql-test/innodb_bug46676.result 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.result
  mysql-test/innodb_bug46676.test 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.test
diff:
=== added file 'mysql-test/innodb_bug46676.result'

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <algorithm>
36
36
#include <functional>
37
37
 
 
38
using namespace std;
 
39
 
38
40
namespace drizzled
39
41
{
40
42
 
41
43
namespace plugin
42
44
{
43
45
 
44
 
static std::vector<XaResourceManager *> xa_resource_managers;
 
46
static vector<XaResourceManager *> xa_resource_managers;
45
47
 
46
48
int XaResourceManager::commitOrRollbackXID(XID *xid, bool commit)
47
49
{
48
 
  std::vector<int> results;
 
50
  vector<int> results;
49
51
  
50
52
  if (commit)
51
53
    transform(xa_resource_managers.begin(), xa_resource_managers.end(), results.begin(),
52
 
              std::bind2nd(std::mem_fun(&XaResourceManager::xaCommitXid), xid));
 
54
              bind2nd(mem_fun(&XaResourceManager::xaCommitXid), xid));
53
55
  else
54
56
    transform(xa_resource_managers.begin(), xa_resource_managers.end(), results.begin(),
55
 
              std::bind2nd(std::mem_fun(&XaResourceManager::xaRollbackXid), xid));
 
57
              bind2nd(mem_fun(&XaResourceManager::xaRollbackXid), xid));
56
58
 
57
 
  if (std::find_if(results.begin(), results.end(), std::bind2nd(std::equal_to<int>(),0)) == results.end())
 
59
  if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0))
 
60
         == results.end())
58
61
    return 1;
59
 
 
60
62
  return 0;
61
63
}
62
64
 
76
78
    in this case commit_list.size()==0, tc_heuristic_recover == 0
77
79
    there should be no prepared transactions in this case.
78
80
*/
79
 
class XaRecover : std::unary_function<XaResourceManager *, void>
 
81
class XaRecover : unary_function<XaResourceManager *, void>
80
82
{
81
83
private:
82
84
  int trans_len, found_foreign_xids, found_my_xids;
182
184
    errmsg_printf(ERRMSG_LVL_INFO, _("Starting crash recovery..."));
183
185
 
184
186
  XaRecover recover_func(trans_list, trans_len, commit_list, dry_run);
185
 
  std::for_each(xa_resource_managers.begin(),
186
 
                xa_resource_managers.end(),
187
 
                recover_func);
 
187
  for_each(xa_resource_managers.begin(),
 
188
           xa_resource_managers.end(),
 
189
           recover_func);
188
190
  free(trans_list);
189
191
 
190
192
  if (recover_func.getForeignXIDs())