~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/usr0sess.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-06-29 17:24:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1081.
  • Revision ID: osullivan.padraig@gmail.com-20090629172402-9c5n1kr7ry7xgau7
Removed the dependency on knowing the position of an I_S table in the
schema_tables array defined in show.cc. This issue crops up in
prepare_schema_table. An issue with my design is that it increases the time
complexity from O(1) to O(n) in numerous places to determine an I_S table to
work on since we don't have an explicit index into the array and instead
need to search by name. However, as n is the number of I_S tables and this
number is quite small (at the moment n is < 30), we don't see this causing
any issue. This design makes the code much more maintainable and easier to
understand. Previously, modifying anything to do with the I_S tables meant
having to tip-toe around the issue of hard-coded indexes into the
schema_tables array.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************
2
 
Sessions
3
 
 
4
 
(c) 1996 Innobase Oy
5
 
 
6
 
Created 6/25/1996 Heikki Tuuri
7
 
*******************************************************/
8
 
 
9
 
#ifndef usr0sess_h
10
 
#define usr0sess_h
11
 
 
12
 
#include "univ.i"
13
 
#include "ut0byte.h"
14
 
#include "trx0types.h"
15
 
#include "srv0srv.h"
16
 
#include "trx0types.h"
17
 
#include "usr0types.h"
18
 
#include "que0types.h"
19
 
#include "data0data.h"
20
 
#include "rem0rec.h"
21
 
 
22
 
/*************************************************************************
23
 
Opens a session. */
24
 
 
25
 
sess_t*
26
 
sess_open(void);
27
 
/*============*/
28
 
                                        /* out, own: session object */
29
 
/*************************************************************************
30
 
Closes a session, freeing the memory occupied by it, if it is in a state
31
 
where it should be closed. */
32
 
 
33
 
ibool
34
 
sess_try_close(
35
 
/*===========*/
36
 
                                /* out: TRUE if closed */
37
 
        sess_t*         sess);  /* in, own: session object */
38
 
 
39
 
/* The session handle. All fields are protected by the kernel mutex */
40
 
struct sess_struct{
41
 
        ulint           state;          /* state of the session */
42
 
        trx_t*          trx;            /* transaction object permanently
43
 
                                        assigned for the session: the
44
 
                                        transaction instance designated by the
45
 
                                        trx id changes, but the memory
46
 
                                        structure is preserved */
47
 
        UT_LIST_BASE_NODE_T(que_t)
48
 
                        graphs;         /* query graphs belonging to this
49
 
                                        session */
50
 
};
51
 
 
52
 
/* Session states */
53
 
#define SESS_ACTIVE             1
54
 
#define SESS_ERROR              2       /* session contains an error message
55
 
                                        which has not yet been communicated
56
 
                                        to the client */
57
 
#ifndef UNIV_NONINL
58
 
#include "usr0sess.ic"
59
 
#endif
60
 
 
61
 
#endif