~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/* Classes in mysql */
25
25
 
26
26
#include <drizzled/plugin/protocol.h>
 
27
#include <drizzled/plugin/scheduler.h>
27
28
#include <drizzled/sql_locale.h>
28
29
#include <drizzled/ha_trx_info.h>
29
30
#include <mysys/my_alloc.h>
41
42
#include <string>
42
43
#include <bitset>
43
44
 
 
45
using namespace drizzled;
 
46
 
44
47
#define MIN_HANDSHAKE_SIZE      6
45
48
 
46
49
class Lex_input_stream;
477
480
  static const char * const DEFAULT_WHERE;
478
481
 
479
482
  MEM_ROOT warn_root; /**< Allocation area for warnings and errors */
480
 
  Protocol *protocol;   /**< Pointer to the current protocol */
 
483
  Protocol *protocol; /**< Pointer to the attached protocol object */
 
484
  plugin::Scheduler *scheduler; /**< Pointer to the attached scheduler object */
 
485
  void *scheduler_arg; /**< Pointer to the optional scheduler argument */
481
486
  HASH user_vars; /**< Hash of user variables defined during the session's lifetime */
482
487
  String packet; /**< dynamic buffer for network I/O */
483
488
  String convert_buffer; /**< A buffer for charset conversions */
496
501
  char process_list_info[PROCESS_LIST_WIDTH+1];
497
502
 
498
503
  /**
499
 
   * A pointer to the stack frame of handle_one_connection(),
 
504
   * A pointer to the stack frame of the scheduler thread
500
505
   * which is called first in the thread for handling a client
501
506
   */
502
507
  char *thread_stack;
782
787
  */
783
788
  Lex_input_stream *m_lip;
784
789
  
785
 
  /** session_scheduler for events */
786
 
  void *scheduler;
787
 
 
788
790
  /** Place to store various things */
789
791
  void *session_marker;
790
792
  /** Keeps a copy of the previous table around in case we are just slamming on particular table */
905
907
  Session(Protocol *protocol_arg);
906
908
  ~Session();
907
909
 
908
 
  /**
909
 
    Initialize memory roots necessary for query processing and (!)
910
 
    pre-allocate memory for it. We can't do that in Session constructor because
911
 
    there are use cases (acl_init, watcher threads,
912
 
    killing mysqld) where it's vital to not allocate excessive and not used
913
 
    memory. Note, that we still don't return error from init_for_queries():
914
 
    if preallocation fails, we should notice that at the first call to
915
 
    alloc_root.
916
 
  */
917
 
  void init_for_queries();
918
910
  void cleanup(void);
919
911
  /**
920
912
   * Cleans up after query.
929
921
   * slave.
930
922
   */
931
923
  void cleanup_after_query();
932
 
  bool store_globals();
 
924
  bool storeGlobals();
933
925
  void awake(Session::killed_state state_to_set);
934
926
  /**
935
927
   * Pulls thread-specific variables into Session state.
943
935
  bool initGlobals();
944
936
 
945
937
  /**
946
 
   * Initializes the Session to handle queries.
947
 
   */
 
938
    Initialize memory roots necessary for query processing and (!)
 
939
    pre-allocate memory for it. We can't do that in Session constructor because
 
940
    there are use cases (acl_init, watcher threads,
 
941
    killing mysqld) where it's vital to not allocate excessive and not used
 
942
    memory. Note, that we still don't return error from init_for_queries():
 
943
    if preallocation fails, we should notice that at the first call to
 
944
    alloc_root.
 
945
  */
948
946
  void prepareForQueries();
949
947
 
950
948
  /**
1000
998
   */
1001
999
  bool authenticate();
1002
1000
 
 
1001
  /**
 
1002
   * Run a session.
 
1003
   *
 
1004
   * This will initialize the session and begin the command loop.
 
1005
   */
 
1006
  void run();
 
1007
 
 
1008
  /**
 
1009
   * Schedule a session to be run on the default scheduler.
 
1010
   */
 
1011
  bool schedule();
 
1012
 
1003
1013
  /*
1004
1014
    For enter_cond() / exit_cond() to work the mutex must be got before
1005
1015
    enter_cond(); this mutex is then released by exit_cond().