~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/xid.h

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_XID_H
21
21
#define DRIZZLED_XID_H
22
22
 
23
 
#include <cstring>
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
23
extern uint32_t server_id;
29
24
 
30
25
/**
35
30
 
36
31
*/
37
32
 
38
 
typedef uint64_t my_xid;
 
33
typedef uint64_t my_xid; // this line is the same as in log_event.h
39
34
 
40
35
#define DRIZZLE_XIDDATASIZE 128
41
36
#define DRIZZLE_XID_PREFIX "MySQLXid"
43
38
#define DRIZZLE_XID_OFFSET (DRIZZLE_XID_PREFIX_LEN+sizeof(server_id))
44
39
#define DRIZZLE_XID_GTRID_LEN (DRIZZLE_XID_OFFSET+sizeof(my_xid))
45
40
 
 
41
#define XIDDATASIZE DRIZZLE_XIDDATASIZE
 
42
 
46
43
class XID {
47
44
 
48
45
public:
50
47
  long formatID;
51
48
  long gtrid_length;
52
49
  long bqual_length;
53
 
  char data[DRIZZLE_XIDDATASIZE];  // not \0-terminated !
 
50
  char data[XIDDATASIZE];  // not \0-terminated !
54
51
 
55
 
  XID() :
56
 
    formatID(-1), /* -1 == null */
57
 
    gtrid_length(0),
58
 
    bqual_length(0)
59
 
  {
60
 
    memset(data, 0, DRIZZLE_XIDDATASIZE);
61
 
  }
 
52
  XID();
62
53
  bool eq(XID *xid);
63
54
  bool eq(long g, long b, const char *d);
64
55
  void set(XID *xid);
89
80
};
90
81
typedef struct st_drizzle_xid DRIZZLE_XID;
91
82
 
92
 
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
93
 
extern const char *xa_state_names[];
94
83
 
95
 
/* for recover() plugin::StorageEngine call */
 
84
/* for recover() handlerton call */
96
85
#define MIN_XID_LIST_SIZE  128
97
86
#define MAX_XID_LIST_SIZE  (1024*128)
98
87
 
99
 
class XID_STATE 
100
 
{
101
 
public:
102
 
  XID_STATE() :
103
 
    xid(),
104
 
    xa_state(XA_NOTR),
105
 
    in_session(false)
106
 
  {}
107
 
  /* For now, this is only used to catch duplicated external xids */
108
 
  XID  xid;                           // transaction identifier
109
 
  enum xa_states xa_state;            // used by external XA only
110
 
  bool in_session;
111
 
};
112
 
 
113
 
bool xid_cache_init(void);
114
 
void xid_cache_free(void);
115
 
XID_STATE *xid_cache_search(XID *xid);
116
 
bool xid_cache_insert(XID *xid, enum xa_states xa_state);
117
 
bool xid_cache_insert(XID_STATE *xid_state);
118
 
void xid_cache_delete(XID_STATE *xid_state);
119
 
 
120
 
} /* namespace drizzled */
121
 
 
122
88
#endif /* DRIZZLED_XID_H */