Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
que0que.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
4
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
8
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
17
*****************************************************************************/
18
19
/**************************************************/
26
#pragma once
27
#ifndef que0que_h
28
#define que0que_h
29
30
#include "univ.i"
31
#include "
data0data.h
"
32
#include "
dict0types.h
"
33
#include "
trx0trx.h
"
34
#include "
trx0roll.h
"
35
#include "
srv0srv.h
"
36
#include "
usr0types.h
"
37
#include "
que0types.h
"
38
#include "
row0types.h
"
39
#include "
pars0types.h
"
40
41
/* If the following flag is set TRUE, the module will print trace info
42
of SQL execution in the UNIV_SQL_DEBUG version */
43
extern
ibool que_trace_on;
44
45
/***********************************************************************/
47
UNIV_INTERN
48
void
49
que_graph_publish
(
50
/*==============*/
51
que_t
* graph,
52
sess_t
* sess);
53
/***********************************************************************/
56
UNIV_INTERN
57
que_fork_t
*
58
que_fork_create
(
59
/*============*/
60
que_t
* graph,
63
que_node_t* parent,
64
ulint fork_type,
65
mem_heap_t
* heap);
66
/***********************************************************************/
68
UNIV_INLINE
69
que_thr_t
*
70
que_fork_get_first_thr
(
71
/*===================*/
72
que_fork_t
* fork);
73
/***********************************************************************/
75
UNIV_INLINE
76
que_node_t*
77
que_fork_get_child
(
78
/*===============*/
79
que_fork_t
* fork);
80
/***********************************************************************/
82
UNIV_INLINE
83
void
84
que_node_set_parent
(
85
/*================*/
86
que_node_t* node,
87
que_node_t* parent);
88
/***********************************************************************/
91
UNIV_INTERN
92
que_thr_t
*
93
que_thr_create
(
94
/*===========*/
95
que_fork_t
* parent,
96
mem_heap_t
* heap);
97
/**********************************************************************/
100
UNIV_INTERN
101
void
102
que_graph_free_recursive
(
103
/*=====================*/
104
que_node_t* node);
105
/**********************************************************************/
107
UNIV_INTERN
108
void
109
que_graph_free
(
110
/*===========*/
111
que_t
* graph);
116
/**********************************************************************/
121
UNIV_INTERN
122
ibool
123
que_thr_stop
(
124
/*=========*/
125
que_thr_t
* thr);
126
/**********************************************************************/
129
UNIV_INTERN
130
void
131
que_thr_move_to_run_state_for_mysql
(
132
/*================================*/
133
que_thr_t
* thr,
134
trx_t
* trx);
135
/**********************************************************************/
138
UNIV_INTERN
139
void
140
que_thr_stop_for_mysql_no_error
(
141
/*============================*/
142
que_thr_t
* thr,
143
trx_t
* trx);
144
/**********************************************************************/
149
UNIV_INTERN
150
void
151
que_thr_stop_for_mysql
(
152
/*===================*/
153
que_thr_t
* thr);
154
/**********************************************************************/
156
UNIV_INTERN
157
void
158
que_run_threads
(
159
/*============*/
160
que_thr_t
* thr);
161
/**********************************************************************/
165
UNIV_INTERN
166
void
167
que_fork_error_handle
(
168
/*==================*/
169
trx_t
* trx,
170
que_t
* fork);
172
/**********************************************************************/
177
UNIV_INTERN
178
void
179
que_thr_end_wait
(
180
/*=============*/
181
que_thr_t
* thr,
185
que_thr_t
** next_thr);
190
/**********************************************************************/
192
UNIV_INTERN
193
void
194
que_thr_end_wait_no_next_thr
(
195
/*=========================*/
196
que_thr_t
* thr);
200
/**********************************************************************/
208
UNIV_INTERN
209
que_thr_t
*
210
que_fork_start_command
(
211
/*===================*/
212
que_fork_t
* fork);
213
/***********************************************************************/
215
UNIV_INLINE
216
trx_t
*
217
thr_get_trx
(
218
/*========*/
219
que_thr_t
* thr);
220
/*******************************************************************/
225
UNIV_INLINE
226
ibool
227
thr_is_recv
(
228
/*========*/
229
const
que_thr_t
* thr);
230
/***********************************************************************/
232
UNIV_INLINE
233
ulint
234
que_node_get_type
(
235
/*==============*/
236
que_node_t* node);
237
/***********************************************************************/
239
UNIV_INLINE
240
dtype_t
*
241
que_node_get_data_type
(
242
/*===================*/
243
que_node_t* node);
244
/***********************************************************************/
246
UNIV_INLINE
247
dfield_t
*
248
que_node_get_val
(
249
/*=============*/
250
que_node_t* node);
251
/***********************************************************************/
254
UNIV_INLINE
255
ulint
256
que_node_get_val_buf_size
(
257
/*======================*/
258
que_node_t* node);
259
/***********************************************************************/
261
UNIV_INLINE
262
void
263
que_node_set_val_buf_size
(
264
/*======================*/
265
que_node_t* node,
266
ulint size);
267
/*********************************************************************/
269
UNIV_INLINE
270
que_node_t*
271
que_node_get_next
(
272
/*==============*/
273
que_node_t* node);
274
/*********************************************************************/
277
UNIV_INLINE
278
que_node_t*
279
que_node_get_parent
(
280
/*================*/
281
que_node_t* node);
282
/****************************************************************/
286
UNIV_INTERN
287
que_node_t*
288
que_node_get_containing_loop_node
(
289
/*==============================*/
290
que_node_t* node);
291
/*********************************************************************/
294
UNIV_INLINE
295
que_node_t*
296
que_node_list_add_last
(
297
/*===================*/
298
que_node_t* node_list,
299
que_node_t* node);
300
/*********************************************************************/
303
UNIV_INLINE
304
ulint
305
que_node_list_get_len
(
306
/*==================*/
307
que_node_t* node_list);
308
/**********************************************************************/
314
UNIV_INLINE
315
ibool
316
que_thr_peek_stop
(
317
/*==============*/
318
que_thr_t
* thr);
319
/***********************************************************************/
322
UNIV_INLINE
323
ibool
324
que_graph_is_select
(
325
/*================*/
326
que_t
* graph);
327
/**********************************************************************/
329
UNIV_INTERN
330
void
331
que_node_print_info
(
332
/*================*/
333
que_node_t* node);
334
/*********************************************************************/
337
UNIV_INTERN
338
ulint
339
que_eval_sql
(
340
/*=========*/
341
pars_info_t
* info,
342
const
char
* sql,
343
ibool reserve_dict_mutex,
346
trx_t
* trx);
348
/* Query graph query thread node: the fields are protected by the kernel
349
mutex with the exceptions named below */
350
351
struct
que_thr_struct
{
352
que_common_t
common
;
353
ulint
magic_n
;
355
que_node_t*
child
;
356
que_t
*
graph
;
357
ibool
is_active
;
362
ulint
state
;
363
UT_LIST_NODE_T
(
que_thr_t
)
364
thrs
;
366
UT_LIST_NODE_T
(
que_thr_t
)
367
trx_thrs
;
369
UT_LIST_NODE_T
(
que_thr_t
)
370
queue
;
372
/*------------------------------*/
373
/* The following fields are private to the OS thread executing the
374
query thread, and are not protected by the kernel mutex: */
375
376
que_node_t*
run_node
;
379
que_node_t*
prev_node
;
381
ulint
resource
;
383
ulint
lock_state
;
385
ulint
fk_cascade_depth
;
388
};
389
390
#define QUE_THR_MAGIC_N 8476583
391
#define QUE_THR_MAGIC_FREED 123461526
392
393
/* Query graph fork node: its fields are protected by the kernel mutex */
394
struct
que_fork_struct
{
395
que_common_t
common
;
396
que_t
*
graph
;
397
ulint
fork_type
;
398
ulint
n_active_thrs
;
403
trx_t
*
trx
;
405
ulint
state
;
406
que_thr_t
*
caller
;
408
UT_LIST_BASE_NODE_T
(
que_thr_t
)
409
thrs
;
410
/*------------------------------*/
411
/* The fields in this section are defined only in the root node */
412
sym_tab_t
* sym_tab;
415
pars_info_t
* info;
416
/* The following cur_... fields are relevant only in a select graph */
417
418
ulint cur_end;
420
ulint cur_pos;
425
ibool cur_on_row;
428
sel_node_t
* last_sel_node;
430
UT_LIST_NODE_T
(
que_fork_t
)
431
graphs;
433
/*------------------------------*/
434
mem_heap_t
* heap;
437
};
438
439
/* Query fork (or graph) types */
440
#define QUE_FORK_SELECT_NON_SCROLL 1
/* forward-only cursor */
441
#define QUE_FORK_SELECT_SCROLL 2
/* scrollable cursor */
442
#define QUE_FORK_INSERT 3
443
#define QUE_FORK_UPDATE 4
444
#define QUE_FORK_ROLLBACK 5
445
/* This is really the undo graph used in rollback,
446
no signal-sending roll_node in this graph */
447
#define QUE_FORK_PURGE 6
448
#define QUE_FORK_EXECUTE 7
449
#define QUE_FORK_PROCEDURE 8
450
#define QUE_FORK_PROCEDURE_CALL 9
451
#define QUE_FORK_MYSQL_INTERFACE 10
452
#define QUE_FORK_RECOVERY 11
453
454
/* Query fork (or graph) states */
455
#define QUE_FORK_ACTIVE 1
456
#define QUE_FORK_COMMAND_WAIT 2
457
#define QUE_FORK_INVALID 3
458
#define QUE_FORK_BEING_FREED 4
459
460
/* Flag which is ORed to control structure statement node types */
461
#define QUE_NODE_CONTROL_STAT 1024
462
463
/* Query graph node types */
464
#define QUE_NODE_LOCK 1
465
#define QUE_NODE_INSERT 2
466
#define QUE_NODE_UPDATE 4
467
#define QUE_NODE_CURSOR 5
468
#define QUE_NODE_SELECT 6
469
#define QUE_NODE_AGGREGATE 7
470
#define QUE_NODE_FORK 8
471
#define QUE_NODE_THR 9
472
#define QUE_NODE_UNDO 10
473
#define QUE_NODE_COMMIT 11
474
#define QUE_NODE_ROLLBACK 12
475
#define QUE_NODE_PURGE 13
476
#define QUE_NODE_CREATE_TABLE 14
477
#define QUE_NODE_CREATE_INDEX 15
478
#define QUE_NODE_SYMBOL 16
479
#define QUE_NODE_RES_WORD 17
480
#define QUE_NODE_FUNC 18
481
#define QUE_NODE_ORDER 19
482
#define QUE_NODE_PROC (20 + QUE_NODE_CONTROL_STAT)
483
#define QUE_NODE_IF (21 + QUE_NODE_CONTROL_STAT)
484
#define QUE_NODE_WHILE (22 + QUE_NODE_CONTROL_STAT)
485
#define QUE_NODE_ASSIGNMENT 23
486
#define QUE_NODE_FETCH 24
487
#define QUE_NODE_OPEN 25
488
#define QUE_NODE_COL_ASSIGNMENT 26
489
#define QUE_NODE_FOR (27 + QUE_NODE_CONTROL_STAT)
490
#define QUE_NODE_RETURN 28
491
#define QUE_NODE_ROW_PRINTF 29
492
#define QUE_NODE_ELSIF 30
493
#define QUE_NODE_CALL 31
494
#define QUE_NODE_EXIT 32
495
496
/* Query thread states */
497
#define QUE_THR_RUNNING 1
498
#define QUE_THR_PROCEDURE_WAIT 2
499
#define QUE_THR_COMPLETED 3
/* in selects this means that the
500
thread is at the end of its result set
501
(or start, in case of a scroll cursor);
502
in other statements, this means the
503
thread has done its task */
504
#define QUE_THR_COMMAND_WAIT 4
505
#define QUE_THR_LOCK_WAIT 5
506
#define QUE_THR_SIG_REPLY_WAIT 6
507
#define QUE_THR_SUSPENDED 7
508
#define QUE_THR_ERROR 8
509
510
/* Query thread lock states */
511
#define QUE_THR_LOCK_NOLOCK 0
512
#define QUE_THR_LOCK_ROW 1
513
#define QUE_THR_LOCK_TABLE 2
514
515
/* From where the cursor position is counted */
516
#define QUE_CUR_NOT_DEFINED 1
517
#define QUE_CUR_START 2
518
#define QUE_CUR_END 3
519
520
521
#ifndef UNIV_NONINL
522
#include "que0que.ic"
523
#endif
524
525
#endif
plugin
innobase
include
que0que.h
Generated on Thu Aug 29 2013 10:00:32 for drizzle by
1.8.4