~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/srv/srv0start.c

  • Committer: Stewart Smith
  • Date: 2010-11-10 08:10:53 UTC
  • mto: (1819.7.44 update-innobase)
  • mto: This revision was merged to the branch mainline in revision 1926.
  • Revision ID: stewart@flamingspork.com-20101110081053-fz4depckopv167tg
add tset for bug673380: CREATE TABLE AS can create a table with a column type of NULL

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
 
Copyright (c) 2009, Percona Inc.
6
5
 
7
6
Portions of this file contain modifications contributed and copyrighted by
8
7
Google, Inc. Those modifications are gratefully acknowledged and are described
10
9
incorporated with their permission, and subject to the conditions contained in
11
10
the file COPYING.Google.
12
11
 
13
 
Portions of this file contain modifications contributed and copyrighted
14
 
by Percona Inc.. Those modifications are
15
 
gratefully acknowledged and are described briefly in the InnoDB
16
 
documentation. The contributions by Percona Inc. are incorporated with
17
 
their permission, and subject to the conditions contained in the file
18
 
COPYING.Percona.
19
 
 
20
12
This program is free software; you can redistribute it and/or modify it under
21
13
the terms of the GNU General Public License as published by the Free Software
22
14
Foundation; version 2 of the License.
30
22
St, Fifth Floor, Boston, MA 02110-1301 USA
31
23
 
32
24
*****************************************************************************/
 
25
/***********************************************************************
 
26
 
 
27
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
28
Copyright (c) 2009, Percona Inc.
 
29
 
 
30
Portions of this file contain modifications contributed and copyrighted
 
31
by Percona Inc.. Those modifications are
 
32
gratefully acknowledged and are described briefly in the InnoDB
 
33
documentation. The contributions by Percona Inc. are incorporated with
 
34
their permission, and subject to the conditions contained in the file
 
35
COPYING.Percona.
 
36
 
 
37
This program is free software; you can redistribute it and/or modify it
 
38
under the terms of the GNU General Public License as published by the
 
39
Free Software Foundation; version 2 of the License.
 
40
 
 
41
This program is distributed in the hope that it will be useful, but
 
42
WITHOUT ANY WARRANTY; without even the implied warranty of
 
43
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 
44
Public License for more details.
 
45
 
 
46
You should have received a copy of the GNU General Public License along
 
47
with this program; if not, write to the Free Software Foundation, Inc.,
 
48
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
49
 
 
50
***********************************************************************/
33
51
 
34
52
/********************************************************************//**
35
53
@file srv/srv0start.c
87
105
# include "btr0pcur.h"
88
106
# include "thr0loc.h"
89
107
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
90
 
# include "zlib.h" /* for ZLIB_VERSION */
91
108
 
92
109
#include <errno.h>
93
110
#include <unistd.h>
129
146
static ulint            ios;
130
147
 
131
148
/** io_handler_thread parameters for thread identification */
132
 
static ulint            n[SRV_MAX_N_IO_THREADS + 6];
 
149
static ulint            n[SRV_MAX_N_IO_THREADS + 5];
133
150
/** io_handler_thread identifiers */
134
 
static os_thread_id_t   thread_ids[SRV_MAX_N_IO_THREADS + 6];
 
151
static os_thread_id_t   thread_ids[SRV_MAX_N_IO_THREADS + 5];
135
152
 
136
153
/** We use this mutex to test the return value of pthread_mutex_trylock
137
154
   on successful locking. HP-UX does NOT return 0, though Linux et al do. */
466
483
                        the aio array */
467
484
{
468
485
        ulint   segment;
 
486
        ulint   i;
469
487
 
470
488
        segment = *((ulint*)arg);
471
489
 
473
491
        fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
474
492
                os_thread_pf(os_thread_get_curr_id()));
475
493
#endif
476
 
        while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
 
494
        for (i = 0;; i++) {
477
495
                fil_aio_wait(segment);
478
496
 
479
497
                mutex_enter(&ios_mutex);
480
498
                ios++;
481
499
                mutex_exit(&ios_mutex);
482
500
        }
483
 
 
484
 
        thr_local_free(os_thread_get_curr_id());
485
 
 
486
501
        /* We count the number of threads in os_thread_exit(). A created
487
502
        thread should always use that to exit and not use return() to exit.
488
503
        The thread actually never comes here because it is exited in an
489
504
        os_event_wait(). */
 
505
#if (!defined(__SUNPRO_C) && !defined(__SUNPRO_CC))
 
506
        /* This is disabled on SunStudio as it (rightly) gives a warning
 
507
           about this code never being reached. See the loop above? No exit
 
508
           condition. */
 
509
        thr_local_free(os_thread_get_curr_id());
 
510
 
490
511
        return 0;
 
512
#endif
491
513
}
492
514
#endif /* !UNIV_HOTBACKUP */
493
515
 
1056
1078
#ifdef UNIV_IBUF_DEBUG
1057
1079
        fprintf(stderr,
1058
1080
                "InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1059
 
# ifdef UNIV_IBUF_COUNT_DEBUG
1060
 
                "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1061
 
                "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1062
 
# endif
1063
 
                );
 
1081
                "InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n");
1064
1082
#endif
1065
1083
 
1066
1084
#ifdef UNIV_SYNC_DEBUG
1087
1105
                        "InnoDB: The InnoDB memory heap is disabled\n");
1088
1106
        }
1089
1107
 
1090
 
        fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1091
 
              "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1092
 
#ifdef UNIV_ZIP_DEBUG
1093
 
              " with validation"
1094
 
#endif /* UNIV_ZIP_DEBUG */
1095
 
#ifdef UNIV_ZIP_COPY
1096
 
              " and extra copying"
1097
 
#endif /* UNIV_ZIP_COPY */
1098
 
              "\n" , stderr);
1099
 
 
 
1108
        fprintf(stderr, "InnoDB: %s\n", IB_ATOMICS_STARTUP_MSG);
1100
1109
 
1101
1110
        /* Since InnoDB does not currently clean up all its internal data
1102
1111
        structures in MySQL Embedded Server Library server_end(), we
1564
1573
                dict_boot();
1565
1574
                trx_sys_init_at_db_start();
1566
1575
 
1567
 
                /* Initialize the fsp free limit global variable in the log
1568
 
                system */
1569
 
                fsp_header_get_free_limit();
1570
 
 
1571
 
                /* recv_recovery_from_checkpoint_finish needs trx lists which
1572
 
                are initialized in trx_sys_init_at_db_start(). */
1573
 
 
1574
 
                recv_recovery_from_checkpoint_finish();
1575
1576
                if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
1576
1577
                        /* The following call is necessary for the insert
1577
1578
                        buffer to work with multiple tablespaces. We must
1587
1588
                        every table in the InnoDB data dictionary that has
1588
1589
                        an .ibd file.
1589
1590
 
1590
 
                        We also determine the maximum tablespace id used. */
 
1591
                        We also determine the maximum tablespace id used.
 
1592
 
 
1593
                        TODO: We may have incomplete transactions in the
 
1594
                        data dictionary tables. Does that harm the scanning of
 
1595
                        the data dictionary below? */
1591
1596
 
1592
1597
                        dict_check_tablespaces_and_store_max_id(
1593
1598
                                recv_needed_recovery);
1594
1599
                }
1595
1600
 
1596
1601
                srv_startup_is_before_trx_rollback_phase = FALSE;
1597
 
                recv_recovery_rollback_active();
 
1602
 
 
1603
                /* Initialize the fsp free limit global variable in the log
 
1604
                system */
 
1605
                fsp_header_get_free_limit();
 
1606
 
 
1607
                /* recv_recovery_from_checkpoint_finish needs trx lists which
 
1608
                are initialized in trx_sys_init_at_db_start(). */
 
1609
 
 
1610
                recv_recovery_from_checkpoint_finish();
1598
1611
 
1599
1612
                /* It is possible that file_format tag has never
1600
1613
                been set. In this case we initialize it to minimum
1643
1656
        /* fprintf(stderr, "Max allowed record size %lu\n",
1644
1657
        page_get_free_space_of_empty() / 2); */
1645
1658
 
1646
 
        /* Create the thread which watches the timeouts for lock waits */
1647
 
        os_thread_create(&srv_lock_timeout_thread, NULL,
 
1659
        /* Create the thread which watches the timeouts for lock waits
 
1660
        and prints InnoDB monitor info */
 
1661
 
 
1662
        os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL,
1648
1663
                         thread_ids + 2 + SRV_MAX_N_IO_THREADS);
1649
1664
 
1650
1665
        /* Create the thread which warns of long semaphore waits */
1651
1666
        os_thread_create(&srv_error_monitor_thread, NULL,
1652
1667
                         thread_ids + 3 + SRV_MAX_N_IO_THREADS);
1653
 
 
1654
 
        /* Create the thread which prints InnoDB monitor info */
1655
 
        os_thread_create(&srv_monitor_thread, NULL,
1656
 
                         thread_ids + 4 + SRV_MAX_N_IO_THREADS);
1657
 
 
1658
1668
        srv_is_being_started = FALSE;
1659
1669
 
1660
1670
        if (trx_doublewrite == NULL) {