~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2011-02-05 20:07:57 UTC
  • mto: (2147.1.1 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2148.
  • Revision ID: brian@tangent.org-20110205200757-nulqm7u4ggnme70k
Error log messages from Inno, most, not all are sent to the correct error
log.
We now remove the error log plugins last.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
#include <unistd.h>
94
94
 
95
95
#include <drizzled/gettext.h> 
 
96
#include <drizzled/errmsg_print.h>
96
97
 
97
98
/** Log sequence number immediately after startup */
98
99
UNIV_INTERN ib_uint64_t srv_start_lsn;
603
604
                    && os_file_get_last_error(FALSE) != 100
604
605
#endif
605
606
                    ) {
606
 
                        fprintf(stderr,
607
 
                                "InnoDB: Error in creating"
608
 
                                " or opening %s\n", name);
 
607
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
608
                                          "InnoDB: Error in creating or opening %s", name);
609
609
 
610
 
                        return(DB_ERROR);
 
610
                  return(DB_ERROR);
611
611
                }
612
612
 
613
613
                files[i] = os_file_create(innodb_file_log_key, name,
614
614
                                          OS_FILE_OPEN, OS_FILE_AIO,
615
615
                                          OS_LOG_FILE, &ret);
616
616
                if (!ret) {
617
 
                        fprintf(stderr,
618
 
                                "InnoDB: Error in opening %s\n", name);
 
617
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
618
                                          "InnoDB: Error in opening %s.", name);
619
619
 
620
620
                        return(DB_ERROR);
621
621
                }
626
626
                if (size != srv_calc_low32(srv_log_file_size)
627
627
                    || size_high != srv_calc_high32(srv_log_file_size)) {
628
628
 
629
 
                        fprintf(stderr,
630
 
                                "InnoDB: Error: log file %s is"
631
 
                                " of different size %lu %lu bytes\n"
632
 
                                "InnoDB: than specified in the .cnf"
633
 
                                " file %lu %lu bytes!\n",
634
 
                                name, (ulong) size_high, (ulong) size,
635
 
                                (ulong) srv_calc_high32(srv_log_file_size),
636
 
                                (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));
637
635
 
638
636
                        return(DB_ERROR);
639
637
                }
640
638
        } else {
641
639
                *log_file_created = TRUE;
642
640
 
643
 
                ut_print_timestamp(stderr);
644
 
 
645
 
                fprintf(stderr,
646
 
                        "  InnoDB: Log file %s did not exist:"
647
 
                        " new to be created\n",
648
 
                        name);
 
641
                drizzled::errmsg_printf(drizzled::error::INFO,
 
642
                                        "InnoDB: Log file %s did not exist: new to be created",
 
643
                                        name);
649
644
                if (log_file_has_been_opened) {
650
645
 
651
646
                        return(DB_ERROR);
652
647
                }
653
648
 
654
 
                fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n",
655
 
                        name, (ulong) srv_log_file_size
656
 
                        >> (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));
657
653
 
658
 
                fprintf(stderr,
659
 
                        "InnoDB: Database physically writes the file"
660
 
                        " full: wait...\n");
 
654
                drizzled::errmsg_printf(drizzled::error::INFO,
 
655
                                        "InnoDB: Database physically writes the file full: wait...\n");
661
656
 
662
657
                ret = os_file_set_size(name, files[i],
663
658
                                       srv_calc_low32(srv_log_file_size),
664
659
                                       srv_calc_high32(srv_log_file_size));
665
660
                if (!ret) {
666
 
                        fprintf(stderr,
667
 
                                "InnoDB: Error in creating %s:"
668
 
                                " probably out of disk space\n",
669
 
                                name);
 
661
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
662
                                          "InnoDB: Error in creating %s: probably out of disk space",
 
663
                                          name);
670
664
 
671
665
                        return(DB_ERROR);
672
666
                }
743
737
        char    name[10000];
744
738
 
745
739
        if (srv_n_data_files >= 1000) {
746
 
                fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
747
 
                        "InnoDB: you have defined %lu\n",
748
 
                        (ulong) srv_n_data_files);
 
740
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
741
                                  "InnoDB: can only have < 1000 data files you have defined %lu",
 
742
                                  (ulong) srv_n_data_files);
749
743
                return(DB_ERROR);
750
744
        }
751
745
 
790
784
                            && os_file_get_last_error(FALSE) != 100
791
785
#endif
792
786
                            ) {
793
 
                                fprintf(stderr,
794
 
                                        "InnoDB: Error in creating"
795
 
                                        " or opening %s\n",
796
 
                                        name);
 
787
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
788
                                                  "InnoDB: Error in creating or opening %s",
 
789
                                                  name);
797
790
 
798
791
                                return(DB_ERROR);
799
792
                        }
809
802
                                                  OS_FILE_NORMAL,
810
803
                                                  OS_DATA_FILE, &ret);
811
804
                        if (!ret) {
812
 
                                fprintf(stderr,
813
 
                                        "InnoDB: Error in opening %s\n", name);
 
805
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
806
                                                  "InnoDB: Error in opening %s", name);
814
807
 
815
808
                                return(DB_ERROR);
816
809
                        }
826
819
                        /* We open the data file */
827
820
 
828
821
                        if (one_created) {
829
 
                                fprintf(stderr,
830
 
                                        "InnoDB: Error: data files can only"
831
 
                                        " be added at the end\n");
832
 
                                fprintf(stderr,
833
 
                                        "InnoDB: of a tablespace, but"
834
 
                                        " data file %s existed beforehand.\n",
835
 
                                        name);
 
822
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
823
                                        "InnoDB: Error: data files can only be added at the end of a tablespace, but"
 
824
                                        " data file %s existed beforehand.",
 
825
                                        name);
836
826
                                return(DB_ERROR);
837
827
                        }
838
828
 
854
844
                        }
855
845
 
856
846
                        if (!ret) {
857
 
                                fprintf(stderr,
858
 
                                        "InnoDB: Error in opening %s\n", name);
 
847
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
848
                                                  "InnoDB: Error in opening %s", name);
859
849
                                os_file_get_last_error(TRUE);
860
850
 
861
851
                                return(DB_ERROR);
882
872
                                        && srv_last_file_size_max
883
873
                                        < rounded_size_pages)) {
884
874
 
885
 
                                        fprintf(stderr,
886
 
                                                "InnoDB: Error: auto-extending"
887
 
                                                " data file %s is"
888
 
                                                " of a different size\n"
889
 
                                                "InnoDB: %lu pages (rounded"
890
 
                                                " down to MB) than specified"
891
 
                                                " in the .cnf file:\n"
892
 
                                                "InnoDB: initial %lu pages,"
893
 
                                                " max %lu (relevant if"
894
 
                                                " non-zero) pages!\n",
895
 
                                                name,
896
 
                                                (ulong) rounded_size_pages,
897
 
                                                (ulong) srv_data_file_sizes[i],
898
 
                                                (ulong)
899
 
                                                srv_last_file_size_max);
 
875
                                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
876
                                                          "InnoDB: Error: auto-extending data file %s is of a different size. "
 
877
                                                          "%lu pages (rounded down to MB) than specified in the .cnf file: "
 
878
                                                          "initial %lu pages, max %lu (relevant if non-zero) pages!",
 
879
                                                          name,
 
880
                                                          (ulong) rounded_size_pages,
 
881
                                                          (ulong) srv_data_file_sizes[i],
 
882
                                                          (ulong)
 
883
                                                          srv_last_file_size_max);
900
884
 
901
885
                                        return(DB_ERROR);
902
886
                                }
906
890
 
907
891
                        if (rounded_size_pages != srv_data_file_sizes[i]) {
908
892
 
909
 
                                fprintf(stderr,
910
 
                                        "InnoDB: Error: data file %s"
911
 
                                        " is of a different size\n"
912
 
                                        "InnoDB: %lu pages"
913
 
                                        " (rounded down to MB)\n"
914
 
                                        "InnoDB: than specified"
915
 
                                        " in the .cnf file %lu pages!\n",
 
893
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
894
                                        "InnoDB: Error: data file %s is of a different size. "
 
895
                                        "%lu pages (rounded down to MB). "
 
896
                                        "Than specified in the .cnf file %lu pages!",
916
897
                                        name,
917
898
                                        (ulong) rounded_size_pages,
918
899
                                        (ulong) srv_data_file_sizes[i]);
934
915
                        one_created = TRUE;
935
916
 
936
917
                        if (i > 0) {
937
 
                                ut_print_timestamp(stderr);
938
 
                                fprintf(stderr,
939
 
                                        "  InnoDB: Data file %s did not"
940
 
                                        " exist: new to be created\n",
 
918
                                drizzled::errmsg_printf(drizzled::error::INFO,
 
919
                                        "  InnoDB: Data file %s did not exist: new to be created",
941
920
                                        name);
942
921
                        } else {
943
 
                                fprintf(stderr,
944
 
                                        "InnoDB: The first specified"
945
 
                                        " data file %s did not exist:\n"
946
 
                                        "InnoDB: a new database"
947
 
                                        " to be created!\n", name);
 
922
                          drizzled::errmsg_printf(drizzled::error::INFO,
 
923
                                        "InnoDB: The first specified data file %s did not exist. A new database to be created!", name);
948
924
                                *create_new_db = TRUE;
949
925
                        }
950
926
 
951
 
                        ut_print_timestamp(stderr);
952
 
                        fprintf(stderr,
953
 
                                "  InnoDB: Setting file %s size to %lu MB\n",
954
 
                                name,
955
 
                                (ulong) (srv_data_file_sizes[i]
956
 
                                         >> (20 - UNIV_PAGE_SIZE_SHIFT)));
 
927
                        drizzled::errmsg_printf(drizzled::error::INFO,
 
928
                                                "  InnoDB: Setting file %s size to %lu MB",
 
929
                                                name, (ulong) (srv_data_file_sizes[i]
 
930
                                                         >> (20 - UNIV_PAGE_SIZE_SHIFT)));
957
931
 
958
 
                        fprintf(stderr,
959
 
                                "InnoDB: Database physically writes the"
960
 
                                " file full: wait...\n");
 
932
                        drizzled::errmsg_printf(drizzled::error::INFO,
 
933
                                "InnoDB: Database physically writes the file full: wait...");
961
934
 
962
935
                        ret = os_file_set_size(
963
936
                                name, files[i],
965
938
                                srv_calc_high32(srv_data_file_sizes[i]));
966
939
 
967
940
                        if (!ret) {
968
 
                                fprintf(stderr,
969
 
                                        "InnoDB: Error in creating %s:"
970
 
                                        " probably out of disk space\n", name);
 
941
                          drizzled::errmsg_printf(drizzled::error::ERROR,
 
942
                                                  "InnoDB: Error in creating %s: probably out of disk space", name);
971
943
 
972
944
                                return(DB_ERROR);
973
945
                        }
1044
1016
#endif /* HAVE_DARWIN_THREADS */
1045
1017
 
1046
1018
        if (sizeof(ulint) != sizeof(void*)) {
1047
 
                fprintf(stderr,
1048
 
                        _("InnoDB: Error: size of InnoDB's ulint is %lu,"
1049
 
                          " but size of void* is %lu.\n"
1050
 
                          "InnoDB: The sizes should be the same"
1051
 
                          " so that on a 64-bit platform you can\n"
1052
 
                          "InnoDB: allocate more than 4 GB of memory."),
 
1019
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1020
                        _("InnoDB: Error: size of InnoDB's ulint is %lu, but size of void* is %lu. "
 
1021
                          "The sizes should be the same so that on a 64-bit platform you can. Allocate more than 4 GB of memory."),
1053
1022
                        (ulong)sizeof(ulint), (ulong)sizeof(void*));
1054
1023
        }
1055
1024
 
1059
1028
        innodb_file_per_table) until this function has returned. */
1060
1029
        srv_file_per_table = FALSE;
1061
1030
#ifdef UNIV_DEBUG
1062
 
        fprintf(stderr,
1063
 
                _("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
 
1031
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1032
                                _("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
1064
1033
#endif
1065
1034
 
1066
1035
#ifdef UNIV_IBUF_DEBUG
1067
 
        fprintf(stderr,
 
1036
        drizzled::errmsg_printf(drizzled::error::INFO,
1068
1037
                _("InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1069
1038
# ifdef UNIV_IBUF_COUNT_DEBUG
1070
1039
                  "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1074
1043
#endif
1075
1044
 
1076
1045
#ifdef UNIV_SYNC_DEBUG
1077
 
        fprintf(stderr,
1078
 
                _("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
 
1046
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1047
                                _("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
1079
1048
#endif
1080
1049
 
1081
1050
#ifdef UNIV_SEARCH_DEBUG
1082
 
        fprintf(stderr,
1083
 
                _("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
 
1051
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1052
                                _("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
1084
1053
#endif
1085
1054
 
1086
1055
#ifdef UNIV_LOG_LSN_DEBUG
1087
 
        fprintf(stderr,
1088
 
                _("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
 
1056
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1057
                                _("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
1089
1058
#endif /* UNIV_LOG_LSN_DEBUG */
1090
1059
#ifdef UNIV_MEM_DEBUG
1091
 
        fprintf(stderr,
1092
 
                _("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
 
1060
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1061
                                _("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
1093
1062
#endif
1094
1063
 
1095
 
        if (UNIV_LIKELY(srv_use_sys_malloc)) {
1096
 
                fprintf(stderr,
1097
 
                        _("InnoDB: The InnoDB memory heap is disabled\n"));
 
1064
        if (UNIV_LIKELY(srv_use_sys_malloc))
 
1065
        {
 
1066
          drizzled::errmsg_printf(drizzled::error::ERROR, _("InnoDB: The InnoDB memory heap is disabled\n"));
1098
1067
        }
1099
1068
 
1100
1069
        fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1114
1083
        second time during the process lifetime. */
1115
1084
 
1116
1085
        if (srv_start_has_been_called) {
1117
 
                fprintf(stderr,
1118
 
                        "InnoDB: Error: startup called second time"
1119
 
                        " during the process lifetime.\n"
1120
 
                        "InnoDB: In the MySQL Embedded Server Library"
1121
 
                        " you cannot call server_init()\n"
1122
 
                        "InnoDB: more than once during"
1123
 
                        " the process lifetime.\n");
 
1086
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1087
                        "InnoDB: Error: startup called second time during the process lifetime.\n");
1124
1088
        }
1125
1089
 
1126
1090
        srv_start_has_been_called = TRUE;
1162
1126
#elif defined(LINUX_NATIVE_AIO)
1163
1127
 
1164
1128
        if (srv_use_native_aio) {
1165
 
                ut_print_timestamp(stderr);
1166
 
                fprintf(stderr,
1167
 
                        _("  InnoDB: Using Linux native AIO\n"));
 
1129
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1130
                                        _("InnoDB: Using Linux native AIO"));
1168
1131
        }
1169
1132
#else
1170
1133
        /* Currently native AIO is supported only on windows and linux
1209
1172
                srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
1210
1173
#endif
1211
1174
        } else {
1212
 
                fprintf(stderr,
1213
 
                        "InnoDB: Unrecognized value %s for"
1214
 
                        " innodb_flush_method\n",
1215
 
                        srv_file_flush_method_str);
 
1175
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1176
                                  "InnoDB: Unrecognized value %s for innodb_flush_method",
 
1177
                                  srv_file_flush_method_str);
1216
1178
                return(DB_ERROR);
1217
1179
        }
1218
1180
 
1259
1221
                        fil_path_to_mysql_datadir, os_proc_get_number());
1260
1222
                srv_monitor_file = fopen(srv_monitor_file_name, "w+");
1261
1223
                if (!srv_monitor_file) {
1262
 
                        fprintf(stderr, "InnoDB: unable to create %s: %s\n",
1263
 
                                srv_monitor_file_name, strerror(errno));
 
1224
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1225
                                          "InnoDB: unable to create %s: %s\n", srv_monitor_file_name, strerror(errno));
1264
1226
                        return(DB_ERROR);
1265
1227
                }
1266
1228
        } else {
1314
1276
                 srv_max_n_open_files);
1315
1277
 
1316
1278
        /* Print time to initialize the buffer pool */
1317
 
        ut_print_timestamp(stderr);
1318
 
        fprintf(stderr,
1319
 
                "  InnoDB: Initializing buffer pool, size =");
1320
1279
 
1321
1280
        if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
1322
 
                fprintf(stderr,
1323
 
                        " %.1fG\n",
1324
 
                        ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
 
1281
          drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fG",
 
1282
                                  ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1325
1283
        } else {
1326
 
                fprintf(stderr,
1327
 
                        " %.1fM\n",
1328
 
                        ((double) srv_buf_pool_size) / (1024 * 1024));
 
1284
          drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fM",
 
1285
                                  ((double) srv_buf_pool_size) / (1024 * 1024));
1329
1286
        }
1330
1287
 
1331
1288
        err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1332
1289
 
1333
 
        ut_print_timestamp(stderr);
1334
 
        fprintf(stderr,
1335
 
                "  InnoDB: Completed initialization of buffer pool\n");
 
1290
        drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Completed initialization of buffer pool");
1336
1291
 
1337
1292
        if (err != DB_SUCCESS) {
1338
 
                fprintf(stderr,
1339
 
                        "InnoDB: Fatal error: cannot allocate the memory"
1340
 
                        " for the buffer pool\n");
 
1293
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Fatal error: cannot allocate the memory for the buffer pool");
1341
1294
 
1342
 
                return(DB_ERROR);
 
1295
          return(DB_ERROR);
1343
1296
        }
1344
1297
 
1345
1298
#ifdef UNIV_DEBUG
1348
1301
 
1349
1302
        if (srv_buf_pool_size <= 5 * 1024 * 1024) {
1350
1303
 
1351
 
                fprintf(stderr, "InnoDB: Warning: Small buffer pool size "
1352
 
                        "(%luM), the flst_validate() debug function "
1353
 
                        "can cause a deadlock if the buffer pool fills up.\n",
1354
 
                        srv_buf_pool_size / 1024 / 1024);
 
1304
          drizzled::errmsg_printf(drizzled::error::WARN, "InnoDB: Warning: Small buffer pool size "
 
1305
                                  "(%luM), the flst_validate() debug function "
 
1306
                                  "can cause a deadlock if the buffer pool fills up.\n",
 
1307
                                  srv_buf_pool_size / 1024 / 1024);
1355
1308
        }
1356
1309
#endif
1357
1310
 
1370
1323
 
1371
1324
#ifdef UNIV_LOG_ARCHIVE
1372
1325
        if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
1373
 
                fprintf(stderr,
1374
 
                        "InnoDB: Error: you must set the log group"
1375
 
                        " home dir in my.cnf the\n"
1376
 
                        "InnoDB: same as log arch dir.\n");
 
1326
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1327
                                  "InnoDB: Error: you must set the log group home dir in my.cnf the same as log arch dir.");
1377
1328
 
1378
1329
                return(DB_ERROR);
1379
1330
        }
1380
1331
#endif /* UNIV_LOG_ARCHIVE */
1381
1332
 
1382
1333
        if (srv_n_log_files * srv_log_file_size >= 262144) {
1383
 
                fprintf(stderr,
1384
 
                        "InnoDB: Error: combined size of log files"
1385
 
                        " must be < 4 GB\n");
 
1334
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1335
                                  "InnoDB: Error: combined size of log files must be < 4 GB");
1386
1336
 
1387
1337
                return(DB_ERROR);
1388
1338
        }
1392
1342
        for (i = 0; i < srv_n_data_files; i++) {
1393
1343
#ifndef __WIN__
1394
1344
                if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
1395
 
                        fprintf(stderr,
1396
 
                                "InnoDB: Error: file size must be < 4 GB"
1397
 
                                " with this MySQL binary\n"
1398
 
                                "InnoDB: and operating system combination,"
1399
 
                                " in some OS's < 2 GB\n");
 
1345
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1346
                                          "InnoDB: Error: file size must be < 4 GB with this MySQL binary and operating system combination,"
 
1347
                                          " in some OS's < 2 GB\n");
1400
1348
 
1401
1349
                        return(DB_ERROR);
1402
1350
                }
1405
1353
        }
1406
1354
 
1407
1355
        if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
1408
 
                fprintf(stderr,
1409
 
                        "InnoDB: Error: tablespace size must be"
1410
 
                        " at least 10 MB\n");
 
1356
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Error: tablespace size must be at least 10 MB");
1411
1357
 
1412
1358
                return(DB_ERROR);
1413
1359
        }
1419
1365
                                        &min_flushed_lsn, &max_flushed_lsn,
1420
1366
                                        &sum_of_new_sizes);
1421
1367
        if (err != DB_SUCCESS) {
1422
 
                fprintf(stderr,
1423
 
                        "InnoDB: Could not open or create data files.\n"
1424
 
                        "InnoDB: If you tried to add new data files,"
1425
 
                        " and it failed here,\n"
1426
 
                        "InnoDB: you should now edit innodb_data_file_path"
1427
 
                        " in my.cnf back\n"
1428
 
                        "InnoDB: to what it was, and remove the"
1429
 
                        " new ibdata files InnoDB created\n"
1430
 
                        "InnoDB: in this failed attempt. InnoDB only wrote"
1431
 
                        " those files full of\n"
1432
 
                        "InnoDB: zeros, but did not yet use them in any way."
1433
 
                        " But be careful: do not\n"
1434
 
                        "InnoDB: remove old data files"
1435
 
                        " which contain your precious data!\n");
 
1368
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1369
                                  "InnoDB: Could not open or create data files.\n"
 
1370
                                  "InnoDB: If you tried to add new data files, and it failed here,\n"
 
1371
                                  "InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
 
1372
                                  "InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
 
1373
                                  "InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
 
1374
                                  "InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
 
1375
                                  "InnoDB: remove old data files which contain your precious data!\n");
1436
1376
 
1437
1377
                return((int) err);
1438
1378
        }
1457
1397
                }
1458
1398
                if ((log_opened && create_new_db)
1459
1399
                    || (log_opened && log_created)) {
1460
 
                        fprintf(stderr,
1461
 
                                "InnoDB: Error: all log files must be"
1462
 
                                " created at the same time.\n"
1463
 
                                "InnoDB: All log files must be"
1464
 
                                " created also in database creation.\n"
1465
 
                                "InnoDB: If you want bigger or smaller"
1466
 
                                " log files, shut down the\n"
1467
 
                                "InnoDB: database and make sure there"
1468
 
                                " were no errors in shutdown.\n"
1469
 
                                "InnoDB: Then delete the existing log files."
1470
 
                                " Edit the .cnf file\n"
 
1400
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1401
                                "InnoDB: Error: all log files must be created at the same time.\n"
 
1402
                                "InnoDB: All log files must be created also in database creation.\n"
 
1403
                                "InnoDB: If you want bigger or smaller log files, shut down the\n"
 
1404
                                "InnoDB: database and make sure there were no errors in shutdown.\n"
 
1405
                                "InnoDB: Then delete the existing log files. Edit the .cnf file\n"
1471
1406
                                "InnoDB: and start the database again.\n");
1472
1407
 
1473
1408
                        return(DB_ERROR);
1489
1424
                    || max_arch_log_no != min_arch_log_no
1490
1425
#endif /* UNIV_LOG_ARCHIVE */
1491
1426
                    ) {
1492
 
                        fprintf(stderr,
1493
 
                                "InnoDB: Cannot initialize created"
1494
 
                                " log files because\n"
1495
 
                                "InnoDB: data files were not in sync"
1496
 
                                " with each other\n"
 
1427
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1428
                                "InnoDB: Cannot initialize created log files because\n"
 
1429
                                "InnoDB: data files were not in sync with each other\n"
1497
1430
                                "InnoDB: or the data files are corrupt.\n");
1498
1431
 
1499
1432
                        return(DB_ERROR);
1500
1433
                }
1501
1434
 
1502
1435
                if (max_flushed_lsn < (ib_uint64_t) 1000) {
1503
 
                        fprintf(stderr,
1504
 
                                "InnoDB: Cannot initialize created"
1505
 
                                " log files because\n"
1506
 
                                "InnoDB: data files are corrupt,"
1507
 
                                " or new data files were\n"
1508
 
                                "InnoDB: created when the database"
1509
 
                                " was started previous\n"
1510
 
                                "InnoDB: time but the database"
1511
 
                                " was not shut down\n"
1512
 
                                "InnoDB: normally after that.\n");
 
1436
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1437
                                "InnoDB: Cannot initialize created log files because\n"
 
1438
                                "InnoDB: data files are corrupt, or new data files were\n"
 
1439
                                "InnoDB: created when the database was started previous\n"
 
1440
                                "InnoDB: time but the database was not shut down\n"
 
1441
                                "InnoDB: normally after that.\n");
1513
1442
 
1514
1443
                        return(DB_ERROR);
1515
1444
                }
1548
1477
 
1549
1478
#ifdef UNIV_LOG_ARCHIVE
1550
1479
        } else if (srv_archive_recovery) {
1551
 
                fprintf(stderr,
1552
 
                        "InnoDB: Starting archive"
1553
 
                        " recovery from a backup...\n");
 
1480
          drizzled::errmsg_printf(drizzled::error::INFO,
 
1481
                                  "InnoDB: Starting archive recovery from a backup...");
1554
1482
                err = recv_recovery_from_archive_start(
1555
1483
                        min_flushed_lsn, srv_archive_recovery_limit_lsn,
1556
1484
                        min_arch_log_no);
1771
1699
        if (!srv_auto_extend_last_data_file
1772
1700
            && sum_of_data_file_sizes != tablespace_size_in_header) {
1773
1701
 
1774
 
                fprintf(stderr,
1775
 
                        "InnoDB: Error: tablespace size"
1776
 
                        " stored in header is %lu pages, but\n"
1777
 
                        "InnoDB: the sum of data file sizes is %lu pages\n",
1778
 
                        (ulong) tablespace_size_in_header,
1779
 
                        (ulong) sum_of_data_file_sizes);
 
1702
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1703
                                  "InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes is %lu pages.",
 
1704
                                  (ulong) tablespace_size_in_header,
 
1705
                                  (ulong) sum_of_data_file_sizes);
1780
1706
 
1781
1707
                if (srv_force_recovery == 0
1782
1708
                    && sum_of_data_file_sizes < tablespace_size_in_header) {
1783
1709
                        /* This is a fatal error, the tail of a tablespace is
1784
1710
                        missing */
1785
1711
 
1786
 
                        fprintf(stderr,
1787
 
                                "InnoDB: Cannot start InnoDB."
1788
 
                                " The tail of the system tablespace is\n"
1789
 
                                "InnoDB: missing. Have you edited"
1790
 
                                " innodb_data_file_path in my.cnf in an\n"
1791
 
                                "InnoDB: inappropriate way, removing"
1792
 
                                " ibdata files from there?\n"
1793
 
                                "InnoDB: You can set innodb_force_recovery=1"
1794
 
                                " in my.cnf to force\n"
1795
 
                                "InnoDB: a startup if you are trying"
1796
 
                                " to recover a badly corrupt database.\n");
 
1712
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1713
                                          "InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
 
1714
                                          "missing. Have you edited innodb_data_file_path in my.cnf in an "
 
1715
                                          "inappropriate way, removing ibdata files from there? "
 
1716
                                          "You can set innodb_force_recovery=1 in my.cnf to force "
 
1717
                                          "a startup if you are trying to recover a badly corrupt database.");
1797
1718
 
1798
1719
                        return(DB_ERROR);
1799
1720
                }
1802
1723
        if (srv_auto_extend_last_data_file
1803
1724
            && sum_of_data_file_sizes < tablespace_size_in_header) {
1804
1725
 
1805
 
                fprintf(stderr,
1806
 
                        "InnoDB: Error: tablespace size stored in header"
1807
 
                        " is %lu pages, but\n"
1808
 
                        "InnoDB: the sum of data file sizes"
1809
 
                        " is only %lu pages\n",
1810
 
                        (ulong) tablespace_size_in_header,
1811
 
                        (ulong) sum_of_data_file_sizes);
 
1726
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1727
                                  "InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes"
 
1728
                                  " is only %lu pages\n",
 
1729
                                  (ulong) tablespace_size_in_header,
 
1730
                                  (ulong) sum_of_data_file_sizes);
1812
1731
 
1813
1732
                if (srv_force_recovery == 0) {
1814
1733
 
1815
 
                        fprintf(stderr,
1816
 
                                "InnoDB: Cannot start InnoDB. The tail of"
1817
 
                                " the system tablespace is\n"
1818
 
                                "InnoDB: missing. Have you edited"
1819
 
                                " innodb_data_file_path in my.cnf in an\n"
1820
 
                                "InnoDB: inappropriate way, removing"
1821
 
                                " ibdata files from there?\n"
1822
 
                                "InnoDB: You can set innodb_force_recovery=1"
1823
 
                                " in my.cnf to force\n"
1824
 
                                "InnoDB: a startup if you are trying to"
1825
 
                                " recover a badly corrupt database.\n");
 
1734
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1735
                                "InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
 
1736
                                "missing. Have you edited innodb_data_file_path in my.cnf in an "
 
1737
                                "inappropriate way, removing ibdata files from there? "
 
1738
                                "You can set innodb_force_recovery=1 in my.cnf to force "
 
1739
                                "a startup if you are trying to recover a badly corrupt database.\n");
1826
1740
 
1827
1741
                        return(DB_ERROR);
1828
1742
                }
1832
1746
        os_fast_mutex_init(&srv_os_test_mutex);
1833
1747
 
1834
1748
        if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
1835
 
                fprintf(stderr,
1836
 
                        "InnoDB: Error: pthread_mutex_trylock returns"
1837
 
                        " an unexpected value on\n"
1838
 
                        "InnoDB: success! Cannot continue.\n");
 
1749
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1750
                        "InnoDB: Error: pthread_mutex_trylock returns an unexpected value on success! Cannot continue.\n");
1839
1751
                exit(1);
1840
1752
        }
1841
1753
 
1848
1760
        os_fast_mutex_free(&srv_os_test_mutex);
1849
1761
 
1850
1762
        if (srv_print_verbose_log) {
1851
 
                ut_print_timestamp(stderr);
1852
 
                fprintf(stderr,
1853
 
                        "  InnoDB %s started; "
1854
 
                        "log sequence number %"PRIu64"\n",
1855
 
                        INNODB_VERSION_STR, srv_start_lsn);
 
1763
                drizzled::errmsg_printf(drizzled::error::ERROR,
 
1764
                                        "InnoDB %s started; log sequence number %"PRIu64"\n",
 
1765
                                        INNODB_VERSION_STR, srv_start_lsn);
1856
1766
        }
1857
1767
 
1858
1768
        if (srv_force_recovery > 0) {
1859
 
                fprintf(stderr,
1860
 
                        "InnoDB: !!! innodb_force_recovery"
1861
 
                        " is set to %lu !!!\n",
1862
 
                        (ulong) srv_force_recovery);
 
1769
          drizzled::errmsg_printf(drizzled::error::ERROR,
 
1770
                                  "InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
 
1771
                                  (ulong) srv_force_recovery);
1863
1772
        }
1864
1773
 
1865
 
        fflush(stderr);
1866
 
 
1867
1774
        if (trx_doublewrite_must_reset_space_ids) {
1868
1775
                /* Actually, we did not change the undo log format between
1869
1776
                4.0 and 4.1.1, and we would not need to run purge to
1878
1785
                4.1.1. It is essential that the insert buffer is emptied
1879
1786
                here! */
1880
1787
 
1881
 
                fprintf(stderr,
1882
 
                        "InnoDB: You are upgrading to an"
1883
 
                        " InnoDB version which allows multiple\n"
1884
 
                        "InnoDB: tablespaces. Wait that purge"
1885
 
                        " and insert buffer merge run to\n"
1886
 
                        "InnoDB: completion...\n");
 
1788
          drizzled::errmsg_printf(drizzled::error::INFO,
 
1789
                                  "InnoDB: You are upgrading to an InnoDB version which allows multiple. "
 
1790
                                  "tablespaces. Wait that purge and insert buffer merge run to completion...");
1887
1791
                for (;;) {
1888
1792
                        os_thread_sleep(1000000);
1889
1793
 
1895
1799
                                break;
1896
1800
                        }
1897
1801
                }
1898
 
                fprintf(stderr,
1899
 
                        "InnoDB: Full purge and insert buffer merge"
1900
 
                        " completed.\n");
 
1802
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1803
                                        "InnoDB: Full purge and insert buffer merge completed.");
1901
1804
 
1902
1805
                trx_sys_mark_upgraded_to_multiple_tablespaces();
1903
1806
 
1904
 
                fprintf(stderr,
1905
 
                        "InnoDB: You have now successfully upgraded"
1906
 
                        " to the multiple tablespaces\n"
1907
 
                        "InnoDB: format. You should NOT DOWNGRADE"
1908
 
                        " to an earlier version of\n"
1909
 
                        "InnoDB: InnoDB! But if you absolutely need to"
1910
 
                        " downgrade, see\n"
1911
 
                        "InnoDB: " REFMAN "multiple-tablespaces.html\n"
1912
 
                        "InnoDB: for instructions.\n");
 
1807
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1808
                                        "InnoDB: You have now successfully upgraded"
 
1809
                                        " to the multiple tablespaces\n"
 
1810
                                        "InnoDB: format. You should NOT DOWNGRADE"
 
1811
                                        " to an earlier version of\n"
 
1812
                                        "InnoDB: InnoDB! But if you absolutely need to"
 
1813
                                        " downgrade, see\n"
 
1814
                                        "InnoDB: " REFMAN "multiple-tablespaces.html\n"
 
1815
                                        "InnoDB: for instructions.\n");
1913
1816
        }
1914
1817
 
1915
1818
        if (srv_force_recovery == 0) {
1939
1842
        ulint   i;
1940
1843
        if (!srv_was_started) {
1941
1844
                if (srv_is_being_started) {
1942
 
                        ut_print_timestamp(stderr);
1943
 
                        fprintf(stderr,
1944
 
                                "  InnoDB: Warning: shutting down"
1945
 
                                " a not properly started\n"
1946
 
                                "InnoDB: or created database!\n");
 
1845
                  drizzled::errmsg_printf(drizzled::error::ERROR,
 
1846
                                "InnoDB: Warning: shutting down a not properly started or created database!");
1947
1847
                }
1948
1848
 
1949
1849
                return(DB_SUCCESS);
1956
1856
 
1957
1857
 
1958
1858
        if (srv_fast_shutdown == 2) {
1959
 
                ut_print_timestamp(stderr);
1960
 
                fprintf(stderr,
1961
 
                        "  InnoDB: MySQL has requested a very fast shutdown"
1962
 
                        " without flushing "
1963
 
                        "the InnoDB buffer pool to data files."
1964
 
                        " At the next mysqld startup "
1965
 
                        "InnoDB will do a crash recovery!\n");
 
1859
                drizzled::errmsg_printf(drizzled::error::INFO,
 
1860
                                        "InnoDB: MySQL has requested a very fast shutdown without flushing "
 
1861
                                        "the InnoDB buffer pool to data files. At the next mysqld startup "
 
1862
                                        "InnoDB will do a crash recovery!");
1966
1863
        }
1967
1864
 
1968
1865
        logs_empty_and_mark_files_at_shutdown();
1969
1866
 
1970
1867
        if (srv_conc_n_threads != 0) {
1971
 
                fprintf(stderr,
1972
 
                        "InnoDB: Warning: query counter shows %ld queries"
1973
 
                        " still\n"
1974
 
                        "InnoDB: inside InnoDB at shutdown\n",
1975
 
                        srv_conc_n_threads);
 
1868
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1869
                                  "InnoDB: Warning: query counter shows %ld queries still InnoDB: inside InnoDB at shutdown.",
 
1870
                                  srv_conc_n_threads);
1976
1871
        }
1977
1872
 
1978
1873
        /* 2. Make all threads created by InnoDB to exit */
2035
1930
        }
2036
1931
 
2037
1932
        if (i == 1000) {
2038
 
                fprintf(stderr,
2039
 
                        "InnoDB: Warning: %lu threads created by InnoDB"
2040
 
                        " had not exited at shutdown!\n",
 
1933
          drizzled::errmsg_printf(drizzled::error::WARN,
 
1934
                        "InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!",
2041
1935
                        (ulong) os_thread_count);
2042
1936
        }
2043
1937
 
2103
1997
            || os_event_count != 0
2104
1998
            || os_mutex_count != 0
2105
1999
            || os_fast_mutex_count != 0) {
2106
 
                fprintf(stderr,
2107
 
                        "InnoDB: Warning: some resources were not"
2108
 
                        " cleaned up in shutdown:\n"
2109
 
                        "InnoDB: threads %lu, events %lu,"
2110
 
                        " os_mutexes %lu, os_fast_mutexes %lu\n",
2111
 
                        (ulong) os_thread_count, (ulong) os_event_count,
2112
 
                        (ulong) os_mutex_count, (ulong) os_fast_mutex_count);
 
2000
          drizzled::errmsg_printf(drizzled::error::WARN,
 
2001
                                  "InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
 
2002
                                  "InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
 
2003
                                  (ulong) os_thread_count, (ulong) os_event_count,
 
2004
                                  (ulong) os_mutex_count, (ulong) os_fast_mutex_count);
2113
2005
        }
2114
2006
 
2115
2007
        if (dict_foreign_err_file) {
2120
2012
        }
2121
2013
 
2122
2014
        if (srv_print_verbose_log) {
2123
 
                ut_print_timestamp(stderr);
2124
 
                fprintf(stderr,
2125
 
                        "  InnoDB: Shutdown completed;"
2126
 
                        " log sequence number %"PRIu64"\n",
2127
 
                        srv_shutdown_lsn);
 
2015
                drizzled::errmsg_printf(drizzled::error::INFO,
 
2016
                                        "InnoDB: Shutdown completed log sequence number %"PRIu64,
 
2017
                                        srv_shutdown_lsn);
2128
2018
        }
2129
2019
 
2130
2020
        srv_was_started = FALSE;