~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
# include "thr0loc.h"
89
89
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
90
90
# include "zlib.h" /* for ZLIB_VERSION */
 
91
#include "xtrabackup_api.h"
91
92
 
92
93
#include <errno.h>
93
94
#include <unistd.h>
94
95
 
 
96
#include <drizzled/gettext.h> 
 
97
#include <drizzled/errmsg_print.h>
 
98
 
95
99
/** Log sequence number immediately after startup */
96
100
UNIV_INTERN ib_uint64_t srv_start_lsn;
97
101
/** Log sequence number at shutdown */
123
127
/** Files comprising the system tablespace */
124
128
static os_file_t        files[1000];
125
129
 
126
 
/** Mutex protecting the ios count */
127
 
static mutex_t          ios_mutex;
128
 
/** Count of I/O operations in io_handler_thread() */
129
 
static ulint            ios;
130
 
 
131
130
/** io_handler_thread parameters for thread identification */
132
 
static ulint            n[SRV_MAX_N_IO_THREADS + 6];
 
131
static ulint            n[SRV_MAX_N_IO_THREADS + 7];
133
132
/** io_handler_thread identifiers */
134
 
static os_thread_id_t   thread_ids[SRV_MAX_N_IO_THREADS + 6];
 
133
static os_thread_id_t   thread_ids[SRV_MAX_N_IO_THREADS + 7];
135
134
 
136
135
/** We use this mutex to test the return value of pthread_mutex_trylock
137
136
   on successful locking. HP-UX does NOT return 0, though Linux et al do. */
154
153
UNIV_INTERN mysql_pfs_key_t     srv_master_thread_key;
155
154
#endif /* UNIV_PFS_THREAD */
156
155
 
157
 
#ifdef UNIV_PFS_MUTEX
158
 
/* Key to register ios_mutex_key with performance schema */
159
 
UNIV_INTERN mysql_pfs_key_t     ios_mutex_key;
160
 
#endif /* UNIV_PFS_MUTEX */
161
 
 
162
156
/*********************************************************************//**
163
157
Convert a numeric string that optionally ends in G or M, to a number
164
158
containing megabytes.
289
283
                return(FALSE);
290
284
        }
291
285
 
292
 
        srv_data_file_names = malloc(i * sizeof *srv_data_file_names);
293
 
        srv_data_file_sizes = malloc(i * sizeof *srv_data_file_sizes);
294
 
        srv_data_file_is_raw_partition = malloc(
295
 
                i * sizeof *srv_data_file_is_raw_partition);
 
286
        srv_data_file_names = static_cast<char **>(malloc(i * sizeof *srv_data_file_names));
 
287
        srv_data_file_sizes = static_cast<ulint *>(malloc(i * sizeof *srv_data_file_sizes));
 
288
        srv_data_file_is_raw_partition = static_cast<ulint *>(malloc(
 
289
                                                                     i * sizeof *srv_data_file_is_raw_partition));
296
290
 
297
291
        srv_n_data_files = i;
298
292
 
422
416
                return(FALSE);
423
417
        }
424
418
 
425
 
        srv_log_group_home_dirs = malloc(i * sizeof *srv_log_group_home_dirs);
 
419
        srv_log_group_home_dirs = static_cast<char **>(malloc(i * sizeof *srv_log_group_home_dirs));
426
420
 
427
421
        /* Then store the actual values to our array */
428
422
 
471
465
/********************************************************************//**
472
466
I/o-handler thread function.
473
467
@return OS_THREAD_DUMMY_RETURN */
474
 
static
 
468
extern "C"
 
469
os_thread_ret_t
 
470
io_handler_thread(void* arg);
 
471
 
 
472
extern "C"
475
473
os_thread_ret_t
476
474
io_handler_thread(
477
475
/*==============*/
493
491
 
494
492
        while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
495
493
                fil_aio_wait(segment);
496
 
 
497
 
                mutex_enter(&ios_mutex);
498
 
                ios++;
499
 
                mutex_exit(&ios_mutex);
500
494
        }
501
495
 
502
 
        thr_local_free(os_thread_get_curr_id());
503
 
 
504
496
        /* We count the number of threads in os_thread_exit(). A created
505
497
        thread should always use that to exit and not use return() to exit.
506
498
        The thread actually never comes here because it is exited in an
521
513
void
522
514
srv_normalize_path_for_win(
523
515
/*=======================*/
524
 
        char*   str __attribute__((unused)))    /*!< in/out: null-terminated
 
516
        char*   /*str __attribute__((unused))*/)        /*!< in/out: null-terminated
525
517
                                                character string */
526
518
{
527
519
#ifdef __WIN__
564
556
/*********************************************************************//**
565
557
Creates or opens the log files and closes them.
566
558
@return DB_SUCCESS or error code */
567
 
static
568
559
ulint
569
560
open_or_create_log_file(
570
561
/*====================*/
613
604
                    && os_file_get_last_error(FALSE) != 100
614
605
#endif
615
606
                    ) {
616
 
                        fprintf(stderr,
617
 
                                "InnoDB: Error in creating"
618
 
                                " or opening %s\n", name);
 
607
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
608
                                          "InnoDB: Error in creating or opening %s", name);
619
609
 
620
 
                        return(DB_ERROR);
 
610
                  return(DB_ERROR);
621
611
                }
622
612
 
623
613
                files[i] = os_file_create(innodb_file_log_key, name,
624
614
                                          OS_FILE_OPEN, OS_FILE_AIO,
625
615
                                          OS_LOG_FILE, &ret);
626
616
                if (!ret) {
627
 
                        fprintf(stderr,
628
 
                                "InnoDB: Error in opening %s\n", name);
 
617
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
618
                                          "InnoDB: Error in opening %s.", name);
629
619
 
630
620
                        return(DB_ERROR);
631
621
                }
636
626
                if (size != srv_calc_low32(srv_log_file_size)
637
627
                    || size_high != srv_calc_high32(srv_log_file_size)) {
638
628
 
639
 
                        fprintf(stderr,
640
 
                                "InnoDB: Error: log file %s is"
641
 
                                " of different size %lu %lu bytes\n"
642
 
                                "InnoDB: than specified in the .cnf"
643
 
                                " file %lu %lu bytes!\n",
644
 
                                name, (ulong) size_high, (ulong) size,
645
 
                                (ulong) srv_calc_high32(srv_log_file_size),
646
 
                                (ulong) srv_calc_low32(srv_log_file_size));
 
629
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
630
                                          "InnoDB: Error: log file %s is of different size %lu %lu bytes than specified in the .cnf"
 
631
                                          " file %lu %lu bytes!",
 
632
                                          name, (ulong) size_high, (ulong) size,
 
633
                                          (ulong) srv_calc_high32(srv_log_file_size),
 
634
                                          (ulong) srv_calc_low32(srv_log_file_size));
647
635
 
648
636
                        return(DB_ERROR);
649
637
                }
650
638
        } else {
651
639
                *log_file_created = TRUE;
652
640
 
653
 
                ut_print_timestamp(stderr);
654
 
 
655
 
                fprintf(stderr,
656
 
                        "  InnoDB: Log file %s did not exist:"
657
 
                        " new to be created\n",
658
 
                        name);
 
641
                drizzled::errmsg_printf(drizzled::error::INFO,
 
642
                                        "InnoDB: Log file %s did not exist: new to be created",
 
643
                                        name);
659
644
                if (log_file_has_been_opened) {
660
645
 
661
646
                        return(DB_ERROR);
662
647
                }
663
648
 
664
 
                fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n",
665
 
                        name, (ulong) srv_log_file_size
666
 
                        >> (20 - UNIV_PAGE_SIZE_SHIFT));
 
649
                drizzled::errmsg_printf(drizzled::error::INFO,
 
650
                                        "InnoDB: Setting log file %s size to %lu MB",
 
651
                                        name, (ulong) srv_log_file_size
 
652
                                        >> (20 - UNIV_PAGE_SIZE_SHIFT));
667
653
 
668
 
                fprintf(stderr,
669
 
                        "InnoDB: Database physically writes the file"
670
 
                        " full: wait...\n");
 
654
                drizzled::errmsg_printf(drizzled::error::INFO,
 
655
                                        "InnoDB: Database physically writes the file full: wait...\n");
671
656
 
672
657
                ret = os_file_set_size(name, files[i],
673
658
                                       srv_calc_low32(srv_log_file_size),
674
659
                                       srv_calc_high32(srv_log_file_size));
675
660
                if (!ret) {
676
 
                        fprintf(stderr,
677
 
                                "InnoDB: Error in creating %s:"
678
 
                                " probably out of disk space\n",
679
 
                                name);
 
661
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
662
                                          "InnoDB: Error in creating %s: probably out of disk space",
 
663
                                          name);
680
664
 
681
665
                        return(DB_ERROR);
682
666
                }
724
708
/*********************************************************************//**
725
709
Creates or opens database data files and closes them.
726
710
@return DB_SUCCESS or error code */
727
 
static
728
711
ulint
729
712
open_or_create_data_files(
730
713
/*======================*/
753
736
        char    name[10000];
754
737
 
755
738
        if (srv_n_data_files >= 1000) {
756
 
                fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
757
 
                        "InnoDB: you have defined %lu\n",
758
 
                        (ulong) srv_n_data_files);
 
739
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
740
                                  "InnoDB: can only have < 1000 data files you have defined %lu",
 
741
                                  (ulong) srv_n_data_files);
759
742
                return(DB_ERROR);
760
743
        }
761
744
 
800
783
                            && os_file_get_last_error(FALSE) != 100
801
784
#endif
802
785
                            ) {
803
 
                                fprintf(stderr,
804
 
                                        "InnoDB: Error in creating"
805
 
                                        " or opening %s\n",
806
 
                                        name);
 
786
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
787
                                                  "InnoDB: Error in creating or opening %s",
 
788
                                                  name);
807
789
 
808
790
                                return(DB_ERROR);
809
791
                        }
819
801
                                                  OS_FILE_NORMAL,
820
802
                                                  OS_DATA_FILE, &ret);
821
803
                        if (!ret) {
822
 
                                fprintf(stderr,
823
 
                                        "InnoDB: Error in opening %s\n", name);
 
804
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
805
                                                  "InnoDB: Error in opening %s", name);
824
806
 
825
807
                                return(DB_ERROR);
826
808
                        }
836
818
                        /* We open the data file */
837
819
 
838
820
                        if (one_created) {
839
 
                                fprintf(stderr,
840
 
                                        "InnoDB: Error: data files can only"
841
 
                                        " be added at the end\n");
842
 
                                fprintf(stderr,
843
 
                                        "InnoDB: of a tablespace, but"
844
 
                                        " data file %s existed beforehand.\n",
845
 
                                        name);
 
821
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
822
                                        "InnoDB: Error: data files can only be added at the end of a tablespace, but"
 
823
                                        " data file %s existed beforehand.",
 
824
                                        name);
846
825
                                return(DB_ERROR);
847
826
                        }
848
827
 
864
843
                        }
865
844
 
866
845
                        if (!ret) {
867
 
                                fprintf(stderr,
868
 
                                        "InnoDB: Error in opening %s\n", name);
 
846
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
847
                                                  "InnoDB: Error in opening %s", name);
869
848
                                os_file_get_last_error(TRUE);
870
849
 
871
850
                                return(DB_ERROR);
892
871
                                        && srv_last_file_size_max
893
872
                                        < rounded_size_pages)) {
894
873
 
895
 
                                        fprintf(stderr,
896
 
                                                "InnoDB: Error: auto-extending"
897
 
                                                " data file %s is"
898
 
                                                " of a different size\n"
899
 
                                                "InnoDB: %lu pages (rounded"
900
 
                                                " down to MB) than specified"
901
 
                                                " in the .cnf file:\n"
902
 
                                                "InnoDB: initial %lu pages,"
903
 
                                                " max %lu (relevant if"
904
 
                                                " non-zero) pages!\n",
905
 
                                                name,
906
 
                                                (ulong) rounded_size_pages,
907
 
                                                (ulong) srv_data_file_sizes[i],
908
 
                                                (ulong)
909
 
                                                srv_last_file_size_max);
 
874
                                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
875
                                                          "InnoDB: Error: auto-extending data file %s is of a different size. "
 
876
                                                          "%lu pages (rounded down to MB) than specified in the .cnf file: "
 
877
                                                          "initial %lu pages, max %lu (relevant if non-zero) pages!",
 
878
                                                          name,
 
879
                                                          (ulong) rounded_size_pages,
 
880
                                                          (ulong) srv_data_file_sizes[i],
 
881
                                                          (ulong)
 
882
                                                          srv_last_file_size_max);
910
883
 
911
884
                                        return(DB_ERROR);
912
885
                                }
916
889
 
917
890
                        if (rounded_size_pages != srv_data_file_sizes[i]) {
918
891
 
919
 
                                fprintf(stderr,
920
 
                                        "InnoDB: Error: data file %s"
921
 
                                        " is of a different size\n"
922
 
                                        "InnoDB: %lu pages"
923
 
                                        " (rounded down to MB)\n"
924
 
                                        "InnoDB: than specified"
925
 
                                        " in the .cnf file %lu pages!\n",
 
892
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
893
                                        "InnoDB: Error: data file %s is of a different size. "
 
894
                                        "%lu pages (rounded down to MB). "
 
895
                                        "Than specified in the .cnf file %lu pages!",
926
896
                                        name,
927
897
                                        (ulong) rounded_size_pages,
928
898
                                        (ulong) srv_data_file_sizes[i]);
944
914
                        one_created = TRUE;
945
915
 
946
916
                        if (i > 0) {
947
 
                                ut_print_timestamp(stderr);
948
 
                                fprintf(stderr,
949
 
                                        "  InnoDB: Data file %s did not"
950
 
                                        " exist: new to be created\n",
 
917
                                drizzled::errmsg_printf(drizzled::error::INFO,
 
918
                                        "  InnoDB: Data file %s did not exist: new to be created",
951
919
                                        name);
952
920
                        } else {
953
 
                                fprintf(stderr,
954
 
                                        "InnoDB: The first specified"
955
 
                                        " data file %s did not exist:\n"
956
 
                                        "InnoDB: a new database"
957
 
                                        " to be created!\n", name);
 
921
                          drizzled::errmsg_printf(drizzled::error::INFO,
 
922
                                        "InnoDB: The first specified data file %s did not exist. A new database to be created!", name);
958
923
                                *create_new_db = TRUE;
959
924
                        }
960
925
 
961
 
                        ut_print_timestamp(stderr);
962
 
                        fprintf(stderr,
963
 
                                "  InnoDB: Setting file %s size to %lu MB\n",
964
 
                                name,
965
 
                                (ulong) (srv_data_file_sizes[i]
966
 
                                         >> (20 - UNIV_PAGE_SIZE_SHIFT)));
 
926
                        drizzled::errmsg_printf(drizzled::error::INFO,
 
927
                                                "  InnoDB: Setting file %s size to %lu MB",
 
928
                                                name, (ulong) (srv_data_file_sizes[i]
 
929
                                                         >> (20 - UNIV_PAGE_SIZE_SHIFT)));
967
930
 
968
 
                        fprintf(stderr,
969
 
                                "InnoDB: Database physically writes the"
970
 
                                " file full: wait...\n");
 
931
                        drizzled::errmsg_printf(drizzled::error::INFO,
 
932
                                "InnoDB: Database physically writes the file full: wait...");
971
933
 
972
934
                        ret = os_file_set_size(
973
935
                                name, files[i],
975
937
                                srv_calc_high32(srv_data_file_sizes[i]));
976
938
 
977
939
                        if (!ret) {
978
 
                                fprintf(stderr,
979
 
                                        "InnoDB: Error in creating %s:"
980
 
                                        " probably out of disk space\n", name);
 
940
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
941
                                                  "InnoDB: Error in creating %s: probably out of disk space", name);
981
942
 
982
943
                                return(DB_ERROR);
983
944
                        }
999
960
                                srv_data_file_is_raw_partition[i] != 0);
1000
961
        }
1001
962
 
1002
 
        ios = 0;
1003
 
 
1004
 
        mutex_create(ios_mutex_key, &ios_mutex, SYNC_NO_ORDER_CHECK);
1005
 
 
1006
963
        return(DB_SUCCESS);
1007
964
}
1008
965
 
1045
1002
        on Mac OS X 10.3 or later. */
1046
1003
        struct utsname utsname;
1047
1004
        if (uname(&utsname)) {
1048
 
                fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
 
1005
                fputs(_("InnoDB: cannot determine Mac OS X version!\n"), stderr);
1049
1006
        } else {
1050
1007
                srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
1051
1008
        }
1052
1009
        if (!srv_have_fullfsync) {
1053
 
                fputs("InnoDB: On Mac OS X, fsync() may be"
1054
 
                      " broken on internal drives,\n"
1055
 
                      "InnoDB: making transactions unsafe!\n", stderr);
 
1010
                fputs(_("InnoDB: On Mac OS X, fsync() may be"
 
1011
                        " broken on internal drives,\n"
 
1012
                        "InnoDB: making transactions unsafe!\n"), stderr);
1056
1013
        }
1057
1014
# endif /* F_FULLFSYNC */
1058
1015
#endif /* HAVE_DARWIN_THREADS */
1059
1016
 
1060
1017
        if (sizeof(ulint) != sizeof(void*)) {
1061
 
                fprintf(stderr,
1062
 
                        "InnoDB: Error: size of InnoDB's ulint is %lu,"
1063
 
                        " but size of void* is %lu.\n"
1064
 
                        "InnoDB: The sizes should be the same"
1065
 
                        " so that on a 64-bit platform you can\n"
1066
 
                        "InnoDB: allocate more than 4 GB of memory.",
 
1018
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1019
                        _("InnoDB: Error: size of InnoDB's ulint is %lu, but size of void* is %lu. "
 
1020
                          "The sizes should be the same so that on a 64-bit platform you can. Allocate more than 4 GB of memory."),
1067
1021
                        (ulong)sizeof(ulint), (ulong)sizeof(void*));
1068
1022
        }
1069
1023
 
1073
1027
        innodb_file_per_table) until this function has returned. */
1074
1028
        srv_file_per_table = FALSE;
1075
1029
#ifdef UNIV_DEBUG
1076
 
        fprintf(stderr,
1077
 
                "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
 
1030
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1031
                                _("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
1078
1032
#endif
1079
1033
 
1080
1034
#ifdef UNIV_IBUF_DEBUG
1081
 
        fprintf(stderr,
1082
 
                "InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
 
1035
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1036
                _("InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1083
1037
# ifdef UNIV_IBUF_COUNT_DEBUG
1084
 
                "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1085
 
                "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
 
1038
                  "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
 
1039
                  "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1086
1040
# endif
1087
 
                );
 
1041
                ));
1088
1042
#endif
1089
1043
 
1090
1044
#ifdef UNIV_SYNC_DEBUG
1091
 
        fprintf(stderr,
1092
 
                "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
 
1045
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1046
                                _("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
1093
1047
#endif
1094
1048
 
1095
1049
#ifdef UNIV_SEARCH_DEBUG
1096
 
        fprintf(stderr,
1097
 
                "InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
 
1050
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1051
                                _("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
1098
1052
#endif
1099
1053
 
1100
1054
#ifdef UNIV_LOG_LSN_DEBUG
1101
 
        fprintf(stderr,
1102
 
                "InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
 
1055
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1056
                                _("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
1103
1057
#endif /* UNIV_LOG_LSN_DEBUG */
1104
1058
#ifdef UNIV_MEM_DEBUG
1105
 
        fprintf(stderr,
1106
 
                "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
 
1059
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1060
                                _("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
1107
1061
#endif
1108
1062
 
1109
 
        if (UNIV_LIKELY(srv_use_sys_malloc)) {
1110
 
                fprintf(stderr,
1111
 
                        "InnoDB: The InnoDB memory heap is disabled\n");
 
1063
        if (UNIV_LIKELY(srv_use_sys_malloc))
 
1064
        {
 
1065
          drizzled::errmsg_printf(drizzled::error::INFO, _("InnoDB: The InnoDB memory heap is disabled\n"));
1112
1066
        }
1113
1067
 
1114
 
        fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1115
 
              "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
 
1068
        drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: " IB_ATOMICS_STARTUP_MSG
 
1069
                "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1116
1070
#ifdef UNIV_ZIP_DEBUG
1117
1071
              " with validation"
1118
1072
#endif /* UNIV_ZIP_DEBUG */
1119
1073
#ifdef UNIV_ZIP_COPY
1120
1074
              " and extra copying"
1121
1075
#endif /* UNIV_ZIP_COPY */
1122
 
              "\n" , stderr);
 
1076
              " ");
1123
1077
 
1124
1078
 
1125
1079
        /* Since InnoDB does not currently clean up all its internal data
1128
1082
        second time during the process lifetime. */
1129
1083
 
1130
1084
        if (srv_start_has_been_called) {
1131
 
                fprintf(stderr,
1132
 
                        "InnoDB: Error: startup called second time"
1133
 
                        " during the process lifetime.\n"
1134
 
                        "InnoDB: In the MySQL Embedded Server Library"
1135
 
                        " you cannot call server_init()\n"
1136
 
                        "InnoDB: more than once during"
1137
 
                        " the process lifetime.\n");
 
1085
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1086
                        "InnoDB: Error: startup called second time during the process lifetime.\n");
1138
1087
        }
1139
1088
 
1140
1089
        srv_start_has_been_called = TRUE;
1176
1125
#elif defined(LINUX_NATIVE_AIO)
1177
1126
 
1178
1127
        if (srv_use_native_aio) {
1179
 
                ut_print_timestamp(stderr);
1180
 
                fprintf(stderr,
1181
 
                        "  InnoDB: Using Linux native AIO\n");
 
1128
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1129
                                        _("InnoDB: Using Linux native AIO"));
1182
1130
        }
1183
1131
#else
1184
1132
        /* Currently native AIO is supported only on windows and linux
1204
1152
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
1205
1153
                srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
1206
1154
 
 
1155
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) {
 
1156
                srv_unix_file_flush_method = SRV_UNIX_ALL_O_DIRECT;
 
1157
 
1207
1158
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
1208
1159
                srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
1209
1160
 
1223
1174
                srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
1224
1175
#endif
1225
1176
        } else {
1226
 
                fprintf(stderr,
1227
 
                        "InnoDB: Unrecognized value %s for"
1228
 
                        " innodb_flush_method\n",
1229
 
                        srv_file_flush_method_str);
 
1177
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1178
                                  "InnoDB: Unrecognized value %s for innodb_flush_method",
 
1179
                                  srv_file_flush_method_str);
1230
1180
                return(DB_ERROR);
1231
1181
        }
1232
1182
 
1266
1216
                     &srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
1267
1217
 
1268
1218
        if (srv_innodb_status) {
1269
 
                srv_monitor_file_name = mem_alloc(
 
1219
          srv_monitor_file_name = static_cast<char *>(mem_alloc(
1270
1220
                        strlen(fil_path_to_mysql_datadir)
1271
 
                        + 20 + sizeof "/innodb_status.");
 
1221
                        + 20 + sizeof "/innodb_status."));
1272
1222
                sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
1273
1223
                        fil_path_to_mysql_datadir, os_proc_get_number());
1274
1224
                srv_monitor_file = fopen(srv_monitor_file_name, "w+");
1275
1225
                if (!srv_monitor_file) {
1276
 
                        fprintf(stderr, "InnoDB: unable to create %s: %s\n",
1277
 
                                srv_monitor_file_name, strerror(errno));
 
1226
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1227
                                          "InnoDB: unable to create %s: %s\n", srv_monitor_file_name, strerror(errno));
1278
1228
                        return(DB_ERROR);
1279
1229
                }
1280
1230
        } else {
1328
1278
                 srv_max_n_open_files);
1329
1279
 
1330
1280
        /* Print time to initialize the buffer pool */
1331
 
        ut_print_timestamp(stderr);
1332
 
        fprintf(stderr,
1333
 
                "  InnoDB: Initializing buffer pool, size =");
1334
1281
 
1335
1282
        if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
1336
 
                fprintf(stderr,
1337
 
                        " %.1fG\n",
1338
 
                        ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
 
1283
          drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fG",
 
1284
                                  ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1339
1285
        } else {
1340
 
                fprintf(stderr,
1341
 
                        " %.1fM\n",
1342
 
                        ((double) srv_buf_pool_size) / (1024 * 1024));
 
1286
          drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fM",
 
1287
                                  ((double) srv_buf_pool_size) / (1024 * 1024));
1343
1288
        }
1344
1289
 
1345
1290
        err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1346
1291
 
1347
 
        ut_print_timestamp(stderr);
1348
 
        fprintf(stderr,
1349
 
                "  InnoDB: Completed initialization of buffer pool\n");
 
1292
        drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Completed initialization of buffer pool");
1350
1293
 
1351
1294
        if (err != DB_SUCCESS) {
1352
 
                fprintf(stderr,
1353
 
                        "InnoDB: Fatal error: cannot allocate the memory"
1354
 
                        " for the buffer pool\n");
 
1295
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Fatal error: cannot allocate the memory for the buffer pool");
1355
1296
 
1356
 
                return(DB_ERROR);
 
1297
          return(DB_ERROR);
1357
1298
        }
1358
1299
 
1359
1300
#ifdef UNIV_DEBUG
1362
1303
 
1363
1304
        if (srv_buf_pool_size <= 5 * 1024 * 1024) {
1364
1305
 
1365
 
                fprintf(stderr, "InnoDB: Warning: Small buffer pool size "
1366
 
                        "(%luM), the flst_validate() debug function "
1367
 
                        "can cause a deadlock if the buffer pool fills up.\n",
1368
 
                        srv_buf_pool_size / 1024 / 1024);
 
1306
          drizzled::errmsg_printf(drizzled::error::WARN, "InnoDB: Warning: Small buffer pool size "
 
1307
                                  "(%luM), the flst_validate() debug function "
 
1308
                                  "can cause a deadlock if the buffer pool fills up.\n",
 
1309
                                  srv_buf_pool_size / 1024 / 1024);
1369
1310
        }
1370
1311
#endif
1371
1312
 
1384
1325
 
1385
1326
#ifdef UNIV_LOG_ARCHIVE
1386
1327
        if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
1387
 
                fprintf(stderr,
1388
 
                        "InnoDB: Error: you must set the log group"
1389
 
                        " home dir in my.cnf the\n"
1390
 
                        "InnoDB: same as log arch dir.\n");
 
1328
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1329
                                  "InnoDB: Error: you must set the log group home dir in my.cnf the same as log arch dir.");
1391
1330
 
1392
1331
                return(DB_ERROR);
1393
1332
        }
1394
1333
#endif /* UNIV_LOG_ARCHIVE */
1395
1334
 
1396
1335
        if (srv_n_log_files * srv_log_file_size >= 262144) {
1397
 
                fprintf(stderr,
1398
 
                        "InnoDB: Error: combined size of log files"
1399
 
                        " must be < 4 GB\n");
 
1336
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1337
                                  "InnoDB: Error: combined size of log files must be < 4 GB");
1400
1338
 
1401
1339
                return(DB_ERROR);
1402
1340
        }
1406
1344
        for (i = 0; i < srv_n_data_files; i++) {
1407
1345
#ifndef __WIN__
1408
1346
                if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
1409
 
                        fprintf(stderr,
1410
 
                                "InnoDB: Error: file size must be < 4 GB"
1411
 
                                " with this MySQL binary\n"
1412
 
                                "InnoDB: and operating system combination,"
1413
 
                                " in some OS's < 2 GB\n");
 
1347
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1348
                                          "InnoDB: Error: file size must be < 4 GB with this MySQL binary and operating system combination,"
 
1349
                                          " in some OS's < 2 GB\n");
1414
1350
 
1415
1351
                        return(DB_ERROR);
1416
1352
                }
1419
1355
        }
1420
1356
 
1421
1357
        if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
1422
 
                fprintf(stderr,
1423
 
                        "InnoDB: Error: tablespace size must be"
1424
 
                        " at least 10 MB\n");
 
1358
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Error: tablespace size must be at least 10 MB");
1425
1359
 
1426
1360
                return(DB_ERROR);
1427
1361
        }
1433
1367
                                        &min_flushed_lsn, &max_flushed_lsn,
1434
1368
                                        &sum_of_new_sizes);
1435
1369
        if (err != DB_SUCCESS) {
1436
 
                fprintf(stderr,
1437
 
                        "InnoDB: Could not open or create data files.\n"
1438
 
                        "InnoDB: If you tried to add new data files,"
1439
 
                        " and it failed here,\n"
1440
 
                        "InnoDB: you should now edit innodb_data_file_path"
1441
 
                        " in my.cnf back\n"
1442
 
                        "InnoDB: to what it was, and remove the"
1443
 
                        " new ibdata files InnoDB created\n"
1444
 
                        "InnoDB: in this failed attempt. InnoDB only wrote"
1445
 
                        " those files full of\n"
1446
 
                        "InnoDB: zeros, but did not yet use them in any way."
1447
 
                        " But be careful: do not\n"
1448
 
                        "InnoDB: remove old data files"
1449
 
                        " which contain your precious data!\n");
 
1370
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1371
                                  "InnoDB: Could not open or create data files.\n"
 
1372
                                  "InnoDB: If you tried to add new data files, and it failed here,\n"
 
1373
                                  "InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
 
1374
                                  "InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
 
1375
                                  "InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
 
1376
                                  "InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
 
1377
                                  "InnoDB: remove old data files which contain your precious data!\n");
1450
1378
 
1451
1379
                return((int) err);
1452
1380
        }
1471
1399
                }
1472
1400
                if ((log_opened && create_new_db)
1473
1401
                    || (log_opened && log_created)) {
1474
 
                        fprintf(stderr,
1475
 
                                "InnoDB: Error: all log files must be"
1476
 
                                " created at the same time.\n"
1477
 
                                "InnoDB: All log files must be"
1478
 
                                " created also in database creation.\n"
1479
 
                                "InnoDB: If you want bigger or smaller"
1480
 
                                " log files, shut down the\n"
1481
 
                                "InnoDB: database and make sure there"
1482
 
                                " were no errors in shutdown.\n"
1483
 
                                "InnoDB: Then delete the existing log files."
1484
 
                                " Edit the .cnf file\n"
 
1402
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1403
                                "InnoDB: Error: all log files must be created at the same time.\n"
 
1404
                                "InnoDB: All log files must be created also in database creation.\n"
 
1405
                                "InnoDB: If you want bigger or smaller log files, shut down the\n"
 
1406
                                "InnoDB: database and make sure there were no errors in shutdown.\n"
 
1407
                                "InnoDB: Then delete the existing log files. Edit the .cnf file\n"
1485
1408
                                "InnoDB: and start the database again.\n");
1486
1409
 
1487
1410
                        return(DB_ERROR);
1503
1426
                    || max_arch_log_no != min_arch_log_no
1504
1427
#endif /* UNIV_LOG_ARCHIVE */
1505
1428
                    ) {
1506
 
                        fprintf(stderr,
1507
 
                                "InnoDB: Cannot initialize created"
1508
 
                                " log files because\n"
1509
 
                                "InnoDB: data files were not in sync"
1510
 
                                " with each other\n"
 
1429
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1430
                                "InnoDB: Cannot initialize created log files because\n"
 
1431
                                "InnoDB: data files were not in sync with each other\n"
1511
1432
                                "InnoDB: or the data files are corrupt.\n");
1512
1433
 
1513
1434
                        return(DB_ERROR);
1514
1435
                }
1515
1436
 
1516
1437
                if (max_flushed_lsn < (ib_uint64_t) 1000) {
1517
 
                        fprintf(stderr,
1518
 
                                "InnoDB: Cannot initialize created"
1519
 
                                " log files because\n"
1520
 
                                "InnoDB: data files are corrupt,"
1521
 
                                " or new data files were\n"
1522
 
                                "InnoDB: created when the database"
1523
 
                                " was started previous\n"
1524
 
                                "InnoDB: time but the database"
1525
 
                                " was not shut down\n"
1526
 
                                "InnoDB: normally after that.\n");
 
1438
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1439
                                "InnoDB: Cannot initialize created log files because\n"
 
1440
                                "InnoDB: data files are corrupt, or new data files were\n"
 
1441
                                "InnoDB: created when the database was started previous\n"
 
1442
                                "InnoDB: time but the database was not shut down\n"
 
1443
                                "InnoDB: normally after that.\n");
1527
1444
 
1528
1445
                        return(DB_ERROR);
1529
1446
                }
1562
1479
 
1563
1480
#ifdef UNIV_LOG_ARCHIVE
1564
1481
        } else if (srv_archive_recovery) {
1565
 
                fprintf(stderr,
1566
 
                        "InnoDB: Starting archive"
1567
 
                        " recovery from a backup...\n");
 
1482
          drizzled::errmsg_printf(drizzled::error::INFO,
 
1483
                                  "InnoDB: Starting archive recovery from a backup...");
1568
1484
                err = recv_recovery_from_archive_start(
1569
1485
                        min_flushed_lsn, srv_archive_recovery_limit_lsn,
1570
1486
                        min_arch_log_no);
1644
1560
                are initialized in trx_sys_init_at_db_start(). */
1645
1561
 
1646
1562
                recv_recovery_from_checkpoint_finish();
 
1563
 
 
1564
                if (srv_apply_log_only)
 
1565
                  goto skip_processes;
 
1566
 
1647
1567
                if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
1648
1568
                        /* The following call is necessary for the insert
1649
1569
                        buffer to work with multiple tablespaces. We must
1748
1668
        os_thread_create(&srv_monitor_thread, NULL,
1749
1669
                         thread_ids + 4 + SRV_MAX_N_IO_THREADS);
1750
1670
 
 
1671
        /* Create the thread which automaticaly dumps/restore buffer pool */
 
1672
        os_thread_create(&srv_LRU_dump_restore_thread, NULL,
 
1673
                         thread_ids + 5 + SRV_MAX_N_IO_THREADS);
 
1674
 
1751
1675
        srv_is_being_started = FALSE;
1752
1676
 
1753
1677
        err = dict_create_or_check_foreign_constraint_tables();
1785
1709
        if (!srv_auto_extend_last_data_file
1786
1710
            && sum_of_data_file_sizes != tablespace_size_in_header) {
1787
1711
 
1788
 
                fprintf(stderr,
1789
 
                        "InnoDB: Error: tablespace size"
1790
 
                        " stored in header is %lu pages, but\n"
1791
 
                        "InnoDB: the sum of data file sizes is %lu pages\n",
1792
 
                        (ulong) tablespace_size_in_header,
1793
 
                        (ulong) sum_of_data_file_sizes);
 
1712
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1713
                                  "InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes is %lu pages.",
 
1714
                                  (ulong) tablespace_size_in_header,
 
1715
                                  (ulong) sum_of_data_file_sizes);
1794
1716
 
1795
1717
                if (srv_force_recovery == 0
1796
1718
                    && sum_of_data_file_sizes < tablespace_size_in_header) {
1797
1719
                        /* This is a fatal error, the tail of a tablespace is
1798
1720
                        missing */
1799
1721
 
1800
 
                        fprintf(stderr,
1801
 
                                "InnoDB: Cannot start InnoDB."
1802
 
                                " The tail of the system tablespace is\n"
1803
 
                                "InnoDB: missing. Have you edited"
1804
 
                                " innodb_data_file_path in my.cnf in an\n"
1805
 
                                "InnoDB: inappropriate way, removing"
1806
 
                                " ibdata files from there?\n"
1807
 
                                "InnoDB: You can set innodb_force_recovery=1"
1808
 
                                " in my.cnf to force\n"
1809
 
                                "InnoDB: a startup if you are trying"
1810
 
                                " to recover a badly corrupt database.\n");
 
1722
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1723
                                          "InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
 
1724
                                          "missing. Have you edited innodb_data_file_path in my.cnf in an "
 
1725
                                          "inappropriate way, removing ibdata files from there? "
 
1726
                                          "You can set innodb_force_recovery=1 in my.cnf to force "
 
1727
                                          "a startup if you are trying to recover a badly corrupt database.");
1811
1728
 
1812
1729
                        return(DB_ERROR);
1813
1730
                }
1816
1733
        if (srv_auto_extend_last_data_file
1817
1734
            && sum_of_data_file_sizes < tablespace_size_in_header) {
1818
1735
 
1819
 
                fprintf(stderr,
1820
 
                        "InnoDB: Error: tablespace size stored in header"
1821
 
                        " is %lu pages, but\n"
1822
 
                        "InnoDB: the sum of data file sizes"
1823
 
                        " is only %lu pages\n",
1824
 
                        (ulong) tablespace_size_in_header,
1825
 
                        (ulong) sum_of_data_file_sizes);
 
1736
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1737
                                  "InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes"
 
1738
                                  " is only %lu pages\n",
 
1739
                                  (ulong) tablespace_size_in_header,
 
1740
                                  (ulong) sum_of_data_file_sizes);
1826
1741
 
1827
1742
                if (srv_force_recovery == 0) {
1828
1743
 
1829
 
                        fprintf(stderr,
1830
 
                                "InnoDB: Cannot start InnoDB. The tail of"
1831
 
                                " the system tablespace is\n"
1832
 
                                "InnoDB: missing. Have you edited"
1833
 
                                " innodb_data_file_path in my.cnf in an\n"
1834
 
                                "InnoDB: inappropriate way, removing"
1835
 
                                " ibdata files from there?\n"
1836
 
                                "InnoDB: You can set innodb_force_recovery=1"
1837
 
                                " in my.cnf to force\n"
1838
 
                                "InnoDB: a startup if you are trying to"
1839
 
                                " recover a badly corrupt database.\n");
 
1744
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1745
                                "InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
 
1746
                                "missing. Have you edited innodb_data_file_path in my.cnf in an "
 
1747
                                "inappropriate way, removing ibdata files from there? "
 
1748
                                "You can set innodb_force_recovery=1 in my.cnf to force "
 
1749
                                "a startup if you are trying to recover a badly corrupt database.\n");
1840
1750
 
1841
1751
                        return(DB_ERROR);
1842
1752
                }
1846
1756
        os_fast_mutex_init(&srv_os_test_mutex);
1847
1757
 
1848
1758
        if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
1849
 
                fprintf(stderr,
1850
 
                        "InnoDB: Error: pthread_mutex_trylock returns"
1851
 
                        " an unexpected value on\n"
1852
 
                        "InnoDB: success! Cannot continue.\n");
 
1759
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1760
                        "InnoDB: Error: pthread_mutex_trylock returns an unexpected value on success! Cannot continue.\n");
1853
1761
                exit(1);
1854
1762
        }
1855
1763
 
1862
1770
        os_fast_mutex_free(&srv_os_test_mutex);
1863
1771
 
1864
1772
        if (srv_print_verbose_log) {
1865
 
                ut_print_timestamp(stderr);
1866
 
                fprintf(stderr,
1867
 
                        "  InnoDB %s started; "
1868
 
                        "log sequence number %"PRIu64"\n",
1869
 
                        INNODB_VERSION_STR, srv_start_lsn);
 
1773
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1774
                                        "InnoDB %s started; log sequence number %"PRIu64"\n",
 
1775
                                        INNODB_VERSION_STR, srv_start_lsn);
1870
1776
        }
1871
1777
 
1872
1778
        if (srv_force_recovery > 0) {
1873
 
                fprintf(stderr,
1874
 
                        "InnoDB: !!! innodb_force_recovery"
1875
 
                        " is set to %lu !!!\n",
1876
 
                        (ulong) srv_force_recovery);
 
1779
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1780
                                  "InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
 
1781
                                  (ulong) srv_force_recovery);
1877
1782
        }
1878
1783
 
1879
 
        fflush(stderr);
1880
 
 
1881
1784
        if (trx_doublewrite_must_reset_space_ids) {
1882
1785
                /* Actually, we did not change the undo log format between
1883
1786
                4.0 and 4.1.1, and we would not need to run purge to
1892
1795
                4.1.1. It is essential that the insert buffer is emptied
1893
1796
                here! */
1894
1797
 
1895
 
                fprintf(stderr,
1896
 
                        "InnoDB: You are upgrading to an"
1897
 
                        " InnoDB version which allows multiple\n"
1898
 
                        "InnoDB: tablespaces. Wait that purge"
1899
 
                        " and insert buffer merge run to\n"
1900
 
                        "InnoDB: completion...\n");
 
1798
          drizzled::errmsg_printf(drizzled::error::INFO,
 
1799
                                  "InnoDB: You are upgrading to an InnoDB version which allows multiple. "
 
1800
                                  "tablespaces. Wait that purge and insert buffer merge run to completion...");
1901
1801
                for (;;) {
1902
1802
                        os_thread_sleep(1000000);
1903
1803
 
1909
1809
                                break;
1910
1810
                        }
1911
1811
                }
1912
 
                fprintf(stderr,
1913
 
                        "InnoDB: Full purge and insert buffer merge"
1914
 
                        " completed.\n");
 
1812
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1813
                                        "InnoDB: Full purge and insert buffer merge completed.");
1915
1814
 
1916
1815
                trx_sys_mark_upgraded_to_multiple_tablespaces();
1917
1816
 
1918
 
                fprintf(stderr,
1919
 
                        "InnoDB: You have now successfully upgraded"
1920
 
                        " to the multiple tablespaces\n"
1921
 
                        "InnoDB: format. You should NOT DOWNGRADE"
1922
 
                        " to an earlier version of\n"
1923
 
                        "InnoDB: InnoDB! But if you absolutely need to"
1924
 
                        " downgrade, see\n"
1925
 
                        "InnoDB: " REFMAN "multiple-tablespaces.html\n"
1926
 
                        "InnoDB: for instructions.\n");
 
1817
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1818
                                        "InnoDB: You have now successfully upgraded"
 
1819
                                        " to the multiple tablespaces\n"
 
1820
                                        "InnoDB: format. You should NOT DOWNGRADE"
 
1821
                                        " to an earlier version of\n"
 
1822
                                        "InnoDB: InnoDB! But if you absolutely need to"
 
1823
                                        " downgrade, see\n"
 
1824
                                        "InnoDB: " REFMAN "multiple-tablespaces.html\n"
 
1825
                                        "InnoDB: for instructions.\n");
1927
1826
        }
1928
1827
 
1929
1828
        if (srv_force_recovery == 0) {
1935
1834
                ibuf_update_max_tablespace_id();
1936
1835
        }
1937
1836
 
 
1837
skip_processes:
1938
1838
        srv_file_per_table = srv_file_per_table_original_value;
1939
1839
 
1940
1840
        srv_was_started = TRUE;
1953
1853
        ulint   i;
1954
1854
        if (!srv_was_started) {
1955
1855
                if (srv_is_being_started) {
1956
 
                        ut_print_timestamp(stderr);
1957
 
                        fprintf(stderr,
1958
 
                                "  InnoDB: Warning: shutting down"
1959
 
                                " a not properly started\n"
1960
 
                                "InnoDB: or created database!\n");
 
1856
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1857
                                "InnoDB: Warning: shutting down a not properly started or created database!");
1961
1858
                }
1962
1859
 
1963
1860
                return(DB_SUCCESS);
1970
1867
 
1971
1868
 
1972
1869
        if (srv_fast_shutdown == 2) {
1973
 
                ut_print_timestamp(stderr);
1974
 
                fprintf(stderr,
1975
 
                        "  InnoDB: MySQL has requested a very fast shutdown"
1976
 
                        " without flushing "
1977
 
                        "the InnoDB buffer pool to data files."
1978
 
                        " At the next mysqld startup "
1979
 
                        "InnoDB will do a crash recovery!\n");
 
1870
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1871
                                        "InnoDB: MySQL has requested a very fast shutdown without flushing "
 
1872
                                        "the InnoDB buffer pool to data files. At the next mysqld startup "
 
1873
                                        "InnoDB will do a crash recovery!");
1980
1874
        }
1981
1875
 
1982
1876
        logs_empty_and_mark_files_at_shutdown();
1983
1877
 
1984
1878
        if (srv_conc_n_threads != 0) {
1985
 
                fprintf(stderr,
1986
 
                        "InnoDB: Warning: query counter shows %ld queries"
1987
 
                        " still\n"
1988
 
                        "InnoDB: inside InnoDB at shutdown\n",
1989
 
                        srv_conc_n_threads);
 
1879
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1880
                                  "InnoDB: Warning: query counter shows %ld queries still InnoDB: inside InnoDB at shutdown.",
 
1881
                                  srv_conc_n_threads);
1990
1882
        }
1991
1883
 
1992
1884
        /* 2. Make all threads created by InnoDB to exit */
2049
1941
        }
2050
1942
 
2051
1943
        if (i == 1000) {
2052
 
                fprintf(stderr,
2053
 
                        "InnoDB: Warning: %lu threads created by InnoDB"
2054
 
                        " had not exited at shutdown!\n",
 
1944
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1945
                        "InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!",
2055
1946
                        (ulong) os_thread_count);
2056
1947
        }
2057
1948
 
2117
2008
            || os_event_count != 0
2118
2009
            || os_mutex_count != 0
2119
2010
            || os_fast_mutex_count != 0) {
2120
 
                fprintf(stderr,
2121
 
                        "InnoDB: Warning: some resources were not"
2122
 
                        " cleaned up in shutdown:\n"
2123
 
                        "InnoDB: threads %lu, events %lu,"
2124
 
                        " os_mutexes %lu, os_fast_mutexes %lu\n",
2125
 
                        (ulong) os_thread_count, (ulong) os_event_count,
2126
 
                        (ulong) os_mutex_count, (ulong) os_fast_mutex_count);
 
2011
          drizzled::errmsg_printf(drizzled::error::WARN,
 
2012
                                  "InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
 
2013
                                  "InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
 
2014
                                  (ulong) os_thread_count, (ulong) os_event_count,
 
2015
                                  (ulong) os_mutex_count, (ulong) os_fast_mutex_count);
2127
2016
        }
2128
2017
 
2129
2018
        if (dict_foreign_err_file) {
2134
2023
        }
2135
2024
 
2136
2025
        if (srv_print_verbose_log) {
2137
 
                ut_print_timestamp(stderr);
2138
 
                fprintf(stderr,
2139
 
                        "  InnoDB: Shutdown completed;"
2140
 
                        " log sequence number %"PRIu64"\n",
2141
 
                        srv_shutdown_lsn);
 
2026
                drizzled::errmsg_printf(drizzled::error::INFO,
 
2027
                                        "InnoDB: Shutdown completed log sequence number %"PRIu64,
 
2028
                                        srv_shutdown_lsn);
2142
2029
        }
2143
2030
 
2144
2031
        srv_was_started = FALSE;