~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/que/que0que.cc

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
29
29
#include "que0que.ic"
30
30
#endif
31
31
 
32
 
#include "srv0que.h"
33
32
#include "usr0sess.h"
34
33
#include "trx0trx.h"
35
34
#include "trx0roll.h"
167
166
 
168
167
        ut_ad(heap);
169
168
 
170
 
        fork = mem_heap_alloc(heap, sizeof(que_fork_t));
 
169
        fork = static_cast<que_fork_t *>(mem_heap_alloc(heap, sizeof(que_fork_t)));
171
170
 
172
171
        fork->common.type = QUE_NODE_FORK;
173
172
        fork->n_active_thrs = 0;
209
208
 
210
209
        ut_ad(parent && heap);
211
210
 
212
 
        thr = mem_heap_alloc(heap, sizeof(que_thr_t));
 
211
        thr = static_cast<que_thr_t *>(mem_heap_alloc(heap, sizeof(que_thr_t)));
213
212
 
214
213
        thr->common.type = QUE_NODE_THR;
215
214
        thr->common.parent = parent;
426
425
void
427
426
que_fork_error_handle(
428
427
/*==================*/
429
 
        trx_t*  trx __attribute__((unused)),    /*!< in: trx */
 
428
        trx_t*  /*trx __attribute__((unused))*/,        /*!< in: trx */
430
429
        que_t*  fork)   /*!< in: query graph which was run before signal
431
430
                        handling started, NULL not allowed */
432
431
{
518
517
        upd_node_t*     upd;
519
518
        tab_node_t*     cre_tab;
520
519
        ind_node_t*     cre_ind;
 
520
        purge_node_t*   purge;
521
521
 
522
522
        if (node == NULL) {
523
523
 
527
527
        switch (que_node_get_type(node)) {
528
528
 
529
529
        case QUE_NODE_FORK:
530
 
                fork = node;
 
530
                fork = static_cast<que_fork_t *>(node);
531
531
 
532
532
                thr = UT_LIST_GET_FIRST(fork->thrs);
533
533
 
540
540
                break;
541
541
        case QUE_NODE_THR:
542
542
 
543
 
                thr = node;
 
543
                thr = static_cast<que_thr_t *>(node);
544
544
 
545
545
                if (thr->magic_n != QUE_THR_MAGIC_N) {
546
546
                        fprintf(stderr,
558
558
                break;
559
559
        case QUE_NODE_UNDO:
560
560
 
561
 
                undo = node;
 
561
                undo = static_cast<undo_node_t *>(node);
562
562
 
563
563
                mem_heap_free(undo->heap);
564
564
 
565
565
                break;
566
566
        case QUE_NODE_SELECT:
567
567
 
568
 
                sel = node;
 
568
                sel = static_cast<sel_node_t *>(node);
569
569
 
570
570
                sel_node_free_private(sel);
571
571
 
572
572
                break;
573
573
        case QUE_NODE_INSERT:
574
574
 
575
 
                ins = node;
 
575
                ins = static_cast<ins_node_t *>(node);
576
576
 
577
577
                que_graph_free_recursive(ins->select);
578
578
 
579
579
                mem_heap_free(ins->entry_sys_heap);
580
580
 
581
581
                break;
 
582
        case QUE_NODE_PURGE:
 
583
                purge = static_cast<purge_node_t *>(node);
 
584
 
 
585
                mem_heap_free(purge->heap);
 
586
 
 
587
                break;
 
588
 
582
589
        case QUE_NODE_UPDATE:
583
590
 
584
 
                upd = node;
 
591
                upd = static_cast<upd_node_t *>(node);
585
592
 
586
593
                if (upd->in_mysql_interface) {
587
594
 
600
607
 
601
608
                break;
602
609
        case QUE_NODE_CREATE_TABLE:
603
 
                cre_tab = node;
 
610
                cre_tab = static_cast<tab_node_t *>(node);
604
611
 
605
612
                que_graph_free_recursive(cre_tab->tab_def);
606
613
                que_graph_free_recursive(cre_tab->col_def);
610
617
 
611
618
                break;
612
619
        case QUE_NODE_CREATE_INDEX:
613
 
                cre_ind = node;
 
620
                cre_ind = static_cast<ind_node_t *>(node);
614
621
 
615
622
                que_graph_free_recursive(cre_ind->ind_def);
616
623
                que_graph_free_recursive(cre_ind->field_def);
792
799
        ulint           fork_type;
793
800
        ibool           stopped;
794
801
 
795
 
        fork = thr->common.parent;
 
802
        fork = static_cast<que_fork_t *>(thr->common.parent);
796
803
        trx = thr_get_trx(thr);
797
804
 
798
805
        mutex_enter(&kernel_mutex);
1276
1283
        que_thr_t*      thr)    /*!< in: query thread */
1277
1284
{
1278
1285
        que_thr_t*      next_thr;
1279
 
        ulint           cumul_resource;
1280
1286
        ulint           loop_count;
1281
1287
 
1282
1288
        ut_ad(thr->state == QUE_THR_RUNNING);
1283
1289
        ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
1284
1290
        ut_ad(!mutex_own(&kernel_mutex));
1285
1291
 
1286
 
        /* cumul_resource counts how much resources the OS thread (NOT the
1287
 
        query thread) has spent in this function */
1288
 
 
1289
1292
        loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
1290
 
        cumul_resource = 0;
1291
1293
loop:
1292
1294
        /* Check that there is enough space in the log to accommodate
1293
1295
        possible log entries by this query step; if the operation can touch