~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2011-01-12 02:31:03 UTC
  • mfrom: (2068.7.5 session-fix)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: kalebral@gmail.com-20110112023103-nmz26cv1j32jc6n3
Merge Brian - fix bug 527084 - DROP TABLE: getTableDefiniton returns EEXIST but doDropTable returns ENOENT leads to SIGSEGV

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>
97
96
 
98
97
/** Log sequence number immediately after startup */
99
98
UNIV_INTERN ib_uint64_t srv_start_lsn;
604
603
                    && os_file_get_last_error(FALSE) != 100
605
604
#endif
606
605
                    ) {
607
 
                  drizzled::errmsg_printf(drizzled::error::ERROR,
608
 
                                          "InnoDB: Error in creating or opening %s", name);
 
606
                        fprintf(stderr,
 
607
                                "InnoDB: Error in creating"
 
608
                                " or opening %s\n", 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
 
                  drizzled::errmsg_printf(drizzled::error::ERROR,
618
 
                                          "InnoDB: Error in opening %s.", name);
 
617
                        fprintf(stderr,
 
618
                                "InnoDB: Error in opening %s\n", 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
 
                  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));
 
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));
635
637
 
636
638
                        return(DB_ERROR);
637
639
                }
638
640
        } else {
639
641
                *log_file_created = TRUE;
640
642
 
641
 
                drizzled::errmsg_printf(drizzled::error::INFO,
642
 
                                        "InnoDB: Log file %s did not exist: new to be created",
643
 
                                        name);
 
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);
644
649
                if (log_file_has_been_opened) {
645
650
 
646
651
                        return(DB_ERROR);
647
652
                }
648
653
 
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));
 
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));
653
657
 
654
 
                drizzled::errmsg_printf(drizzled::error::INFO,
655
 
                                        "InnoDB: Database physically writes the file full: wait...\n");
 
658
                fprintf(stderr,
 
659
                        "InnoDB: Database physically writes the file"
 
660
                        " full: wait...\n");
656
661
 
657
662
                ret = os_file_set_size(name, files[i],
658
663
                                       srv_calc_low32(srv_log_file_size),
659
664
                                       srv_calc_high32(srv_log_file_size));
660
665
                if (!ret) {
661
 
                  drizzled::errmsg_printf(drizzled::error::ERROR,
662
 
                                          "InnoDB: Error in creating %s: probably out of disk space",
663
 
                                          name);
 
666
                        fprintf(stderr,
 
667
                                "InnoDB: Error in creating %s:"
 
668
                                " probably out of disk space\n",
 
669
                                name);
664
670
 
665
671
                        return(DB_ERROR);
666
672
                }
737
743
        char    name[10000];
738
744
 
739
745
        if (srv_n_data_files >= 1000) {
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);
 
746
                fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
 
747
                        "InnoDB: you have defined %lu\n",
 
748
                        (ulong) srv_n_data_files);
743
749
                return(DB_ERROR);
744
750
        }
745
751
 
784
790
                            && os_file_get_last_error(FALSE) != 100
785
791
#endif
786
792
                            ) {
787
 
                          drizzled::errmsg_printf(drizzled::error::ERROR,
788
 
                                                  "InnoDB: Error in creating or opening %s",
789
 
                                                  name);
 
793
                                fprintf(stderr,
 
794
                                        "InnoDB: Error in creating"
 
795
                                        " or opening %s\n",
 
796
                                        name);
790
797
 
791
798
                                return(DB_ERROR);
792
799
                        }
802
809
                                                  OS_FILE_NORMAL,
803
810
                                                  OS_DATA_FILE, &ret);
804
811
                        if (!ret) {
805
 
                          drizzled::errmsg_printf(drizzled::error::ERROR,
806
 
                                                  "InnoDB: Error in opening %s", name);
 
812
                                fprintf(stderr,
 
813
                                        "InnoDB: Error in opening %s\n", name);
807
814
 
808
815
                                return(DB_ERROR);
809
816
                        }
819
826
                        /* We open the data file */
820
827
 
821
828
                        if (one_created) {
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);
 
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);
826
836
                                return(DB_ERROR);
827
837
                        }
828
838
 
844
854
                        }
845
855
 
846
856
                        if (!ret) {
847
 
                          drizzled::errmsg_printf(drizzled::error::ERROR,
848
 
                                                  "InnoDB: Error in opening %s", name);
 
857
                                fprintf(stderr,
 
858
                                        "InnoDB: Error in opening %s\n", name);
849
859
                                os_file_get_last_error(TRUE);
850
860
 
851
861
                                return(DB_ERROR);
872
882
                                        && srv_last_file_size_max
873
883
                                        < rounded_size_pages)) {
874
884
 
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);
 
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);
884
900
 
885
901
                                        return(DB_ERROR);
886
902
                                }
890
906
 
891
907
                        if (rounded_size_pages != srv_data_file_sizes[i]) {
892
908
 
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!",
 
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",
897
916
                                        name,
898
917
                                        (ulong) rounded_size_pages,
899
918
                                        (ulong) srv_data_file_sizes[i]);
915
934
                        one_created = TRUE;
916
935
 
917
936
                        if (i > 0) {
918
 
                                drizzled::errmsg_printf(drizzled::error::INFO,
919
 
                                        "  InnoDB: Data file %s did not exist: new to be created",
 
937
                                ut_print_timestamp(stderr);
 
938
                                fprintf(stderr,
 
939
                                        "  InnoDB: Data file %s did not"
 
940
                                        " exist: new to be created\n",
920
941
                                        name);
921
942
                        } else {
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);
 
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);
924
948
                                *create_new_db = TRUE;
925
949
                        }
926
950
 
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)));
 
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)));
931
957
 
932
 
                        drizzled::errmsg_printf(drizzled::error::INFO,
933
 
                                "InnoDB: Database physically writes the file full: wait...");
 
958
                        fprintf(stderr,
 
959
                                "InnoDB: Database physically writes the"
 
960
                                " file full: wait...\n");
934
961
 
935
962
                        ret = os_file_set_size(
936
963
                                name, files[i],
938
965
                                srv_calc_high32(srv_data_file_sizes[i]));
939
966
 
940
967
                        if (!ret) {
941
 
                          drizzled::errmsg_printf(drizzled::error::ERROR,
942
 
                                                  "InnoDB: Error in creating %s: probably out of disk space", name);
 
968
                                fprintf(stderr,
 
969
                                        "InnoDB: Error in creating %s:"
 
970
                                        " probably out of disk space\n", name);
943
971
 
944
972
                                return(DB_ERROR);
945
973
                        }
1016
1044
#endif /* HAVE_DARWIN_THREADS */
1017
1045
 
1018
1046
        if (sizeof(ulint) != sizeof(void*)) {
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."),
 
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."),
1022
1053
                        (ulong)sizeof(ulint), (ulong)sizeof(void*));
1023
1054
        }
1024
1055
 
1028
1059
        innodb_file_per_table) until this function has returned. */
1029
1060
        srv_file_per_table = FALSE;
1030
1061
#ifdef UNIV_DEBUG
1031
 
        drizzled::errmsg_printf(drizzled::error::INFO,
1032
 
                                _("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
 
1062
        fprintf(stderr,
 
1063
                _("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
1033
1064
#endif
1034
1065
 
1035
1066
#ifdef UNIV_IBUF_DEBUG
1036
 
        drizzled::errmsg_printf(drizzled::error::INFO,
 
1067
        fprintf(stderr,
1037
1068
                _("InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1038
1069
# ifdef UNIV_IBUF_COUNT_DEBUG
1039
1070
                  "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1043
1074
#endif
1044
1075
 
1045
1076
#ifdef UNIV_SYNC_DEBUG
1046
 
        drizzled::errmsg_printf(drizzled::error::INFO,
1047
 
                                _("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
 
1077
        fprintf(stderr,
 
1078
                _("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
1048
1079
#endif
1049
1080
 
1050
1081
#ifdef UNIV_SEARCH_DEBUG
1051
 
        drizzled::errmsg_printf(drizzled::error::INFO,
1052
 
                                _("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
 
1082
        fprintf(stderr,
 
1083
                _("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
1053
1084
#endif
1054
1085
 
1055
1086
#ifdef UNIV_LOG_LSN_DEBUG
1056
 
        drizzled::errmsg_printf(drizzled::error::INFO,
1057
 
                                _("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
 
1087
        fprintf(stderr,
 
1088
                _("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
1058
1089
#endif /* UNIV_LOG_LSN_DEBUG */
1059
1090
#ifdef UNIV_MEM_DEBUG
1060
 
        drizzled::errmsg_printf(drizzled::error::INFO,
1061
 
                                _("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
 
1091
        fprintf(stderr,
 
1092
                _("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
1062
1093
#endif
1063
1094
 
1064
 
        if (UNIV_LIKELY(srv_use_sys_malloc))
1065
 
        {
1066
 
          drizzled::errmsg_printf(drizzled::error::ERROR, _("InnoDB: The InnoDB memory heap is disabled\n"));
 
1095
        if (UNIV_LIKELY(srv_use_sys_malloc)) {
 
1096
                fprintf(stderr,
 
1097
                        _("InnoDB: The InnoDB memory heap is disabled\n"));
1067
1098
        }
1068
1099
 
1069
1100
        fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1083
1114
        second time during the process lifetime. */
1084
1115
 
1085
1116
        if (srv_start_has_been_called) {
1086
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
1087
 
                        "InnoDB: Error: startup called second time during the process lifetime.\n");
 
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");
1088
1124
        }
1089
1125
 
1090
1126
        srv_start_has_been_called = TRUE;
1126
1162
#elif defined(LINUX_NATIVE_AIO)
1127
1163
 
1128
1164
        if (srv_use_native_aio) {
1129
 
                drizzled::errmsg_printf(drizzled::error::INFO,
1130
 
                                        _("InnoDB: Using Linux native AIO"));
 
1165
                ut_print_timestamp(stderr);
 
1166
                fprintf(stderr,
 
1167
                        _("  InnoDB: Using Linux native AIO\n"));
1131
1168
        }
1132
1169
#else
1133
1170
        /* Currently native AIO is supported only on windows and linux
1172
1209
                srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
1173
1210
#endif
1174
1211
        } else {
1175
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
1176
 
                                  "InnoDB: Unrecognized value %s for innodb_flush_method",
1177
 
                                  srv_file_flush_method_str);
 
1212
                fprintf(stderr,
 
1213
                        "InnoDB: Unrecognized value %s for"
 
1214
                        " innodb_flush_method\n",
 
1215
                        srv_file_flush_method_str);
1178
1216
                return(DB_ERROR);
1179
1217
        }
1180
1218
 
1221
1259
                        fil_path_to_mysql_datadir, os_proc_get_number());
1222
1260
                srv_monitor_file = fopen(srv_monitor_file_name, "w+");
1223
1261
                if (!srv_monitor_file) {
1224
 
                  drizzled::errmsg_printf(drizzled::error::ERROR,
1225
 
                                          "InnoDB: unable to create %s: %s\n", srv_monitor_file_name, strerror(errno));
 
1262
                        fprintf(stderr, "InnoDB: unable to create %s: %s\n",
 
1263
                                srv_monitor_file_name, strerror(errno));
1226
1264
                        return(DB_ERROR);
1227
1265
                }
1228
1266
        } else {
1276
1314
                 srv_max_n_open_files);
1277
1315
 
1278
1316
        /* Print time to initialize the buffer pool */
 
1317
        ut_print_timestamp(stderr);
 
1318
        fprintf(stderr,
 
1319
                "  InnoDB: Initializing buffer pool, size =");
1279
1320
 
1280
1321
        if (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));
 
1322
                fprintf(stderr,
 
1323
                        " %.1fG\n",
 
1324
                        ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1283
1325
        } else {
1284
 
          drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fM",
1285
 
                                  ((double) srv_buf_pool_size) / (1024 * 1024));
 
1326
                fprintf(stderr,
 
1327
                        " %.1fM\n",
 
1328
                        ((double) srv_buf_pool_size) / (1024 * 1024));
1286
1329
        }
1287
1330
 
1288
1331
        err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1289
1332
 
1290
 
        drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Completed initialization of buffer pool");
 
1333
        ut_print_timestamp(stderr);
 
1334
        fprintf(stderr,
 
1335
                "  InnoDB: Completed initialization of buffer pool\n");
1291
1336
 
1292
1337
        if (err != DB_SUCCESS) {
1293
 
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Fatal error: cannot allocate the memory for the buffer pool");
 
1338
                fprintf(stderr,
 
1339
                        "InnoDB: Fatal error: cannot allocate the memory"
 
1340
                        " for the buffer pool\n");
1294
1341
 
1295
 
          return(DB_ERROR);
 
1342
                return(DB_ERROR);
1296
1343
        }
1297
1344
 
1298
1345
#ifdef UNIV_DEBUG
1301
1348
 
1302
1349
        if (srv_buf_pool_size <= 5 * 1024 * 1024) {
1303
1350
 
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);
 
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);
1308
1355
        }
1309
1356
#endif
1310
1357
 
1323
1370
 
1324
1371
#ifdef UNIV_LOG_ARCHIVE
1325
1372
        if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
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.");
 
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");
1328
1377
 
1329
1378
                return(DB_ERROR);
1330
1379
        }
1331
1380
#endif /* UNIV_LOG_ARCHIVE */
1332
1381
 
1333
1382
        if (srv_n_log_files * srv_log_file_size >= 262144) {
1334
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
1335
 
                                  "InnoDB: Error: combined size of log files must be < 4 GB");
 
1383
                fprintf(stderr,
 
1384
                        "InnoDB: Error: combined size of log files"
 
1385
                        " must be < 4 GB\n");
1336
1386
 
1337
1387
                return(DB_ERROR);
1338
1388
        }
1342
1392
        for (i = 0; i < srv_n_data_files; i++) {
1343
1393
#ifndef __WIN__
1344
1394
                if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
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");
 
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");
1348
1400
 
1349
1401
                        return(DB_ERROR);
1350
1402
                }
1353
1405
        }
1354
1406
 
1355
1407
        if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
1356
 
          drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Error: tablespace size must be at least 10 MB");
 
1408
                fprintf(stderr,
 
1409
                        "InnoDB: Error: tablespace size must be"
 
1410
                        " at least 10 MB\n");
1357
1411
 
1358
1412
                return(DB_ERROR);
1359
1413
        }
1365
1419
                                        &min_flushed_lsn, &max_flushed_lsn,
1366
1420
                                        &sum_of_new_sizes);
1367
1421
        if (err != DB_SUCCESS) {
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");
 
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");
1376
1436
 
1377
1437
                return((int) err);
1378
1438
        }
1397
1457
                }
1398
1458
                if ((log_opened && create_new_db)
1399
1459
                    || (log_opened && log_created)) {
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"
 
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"
1406
1471
                                "InnoDB: and start the database again.\n");
1407
1472
 
1408
1473
                        return(DB_ERROR);
1424
1489
                    || max_arch_log_no != min_arch_log_no
1425
1490
#endif /* UNIV_LOG_ARCHIVE */
1426
1491
                    ) {
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"
 
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"
1430
1497
                                "InnoDB: or the data files are corrupt.\n");
1431
1498
 
1432
1499
                        return(DB_ERROR);
1433
1500
                }
1434
1501
 
1435
1502
                if (max_flushed_lsn < (ib_uint64_t) 1000) {
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");
 
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");
1442
1513
 
1443
1514
                        return(DB_ERROR);
1444
1515
                }
1477
1548
 
1478
1549
#ifdef UNIV_LOG_ARCHIVE
1479
1550
        } else if (srv_archive_recovery) {
1480
 
          drizzled::errmsg_printf(drizzled::error::INFO,
1481
 
                                  "InnoDB: Starting archive recovery from a backup...");
 
1551
                fprintf(stderr,
 
1552
                        "InnoDB: Starting archive"
 
1553
                        " recovery from a backup...\n");
1482
1554
                err = recv_recovery_from_archive_start(
1483
1555
                        min_flushed_lsn, srv_archive_recovery_limit_lsn,
1484
1556
                        min_arch_log_no);
1699
1771
        if (!srv_auto_extend_last_data_file
1700
1772
            && sum_of_data_file_sizes != tablespace_size_in_header) {
1701
1773
 
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);
 
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);
1706
1780
 
1707
1781
                if (srv_force_recovery == 0
1708
1782
                    && sum_of_data_file_sizes < tablespace_size_in_header) {
1709
1783
                        /* This is a fatal error, the tail of a tablespace is
1710
1784
                        missing */
1711
1785
 
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.");
 
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");
1718
1797
 
1719
1798
                        return(DB_ERROR);
1720
1799
                }
1723
1802
        if (srv_auto_extend_last_data_file
1724
1803
            && sum_of_data_file_sizes < tablespace_size_in_header) {
1725
1804
 
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);
 
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);
1731
1812
 
1732
1813
                if (srv_force_recovery == 0) {
1733
1814
 
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");
 
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");
1740
1826
 
1741
1827
                        return(DB_ERROR);
1742
1828
                }
1746
1832
        os_fast_mutex_init(&srv_os_test_mutex);
1747
1833
 
1748
1834
        if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
1749
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
1750
 
                        "InnoDB: Error: pthread_mutex_trylock returns an unexpected value on success! Cannot continue.\n");
 
1835
                fprintf(stderr,
 
1836
                        "InnoDB: Error: pthread_mutex_trylock returns"
 
1837
                        " an unexpected value on\n"
 
1838
                        "InnoDB: success! Cannot continue.\n");
1751
1839
                exit(1);
1752
1840
        }
1753
1841
 
1760
1848
        os_fast_mutex_free(&srv_os_test_mutex);
1761
1849
 
1762
1850
        if (srv_print_verbose_log) {
1763
 
                drizzled::errmsg_printf(drizzled::error::ERROR,
1764
 
                                        "InnoDB %s started; log sequence number %"PRIu64"\n",
1765
 
                                        INNODB_VERSION_STR, srv_start_lsn);
 
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);
1766
1856
        }
1767
1857
 
1768
1858
        if (srv_force_recovery > 0) {
1769
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
1770
 
                                  "InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
1771
 
                                  (ulong) srv_force_recovery);
 
1859
                fprintf(stderr,
 
1860
                        "InnoDB: !!! innodb_force_recovery"
 
1861
                        " is set to %lu !!!\n",
 
1862
                        (ulong) srv_force_recovery);
1772
1863
        }
1773
1864
 
 
1865
        fflush(stderr);
 
1866
 
1774
1867
        if (trx_doublewrite_must_reset_space_ids) {
1775
1868
                /* Actually, we did not change the undo log format between
1776
1869
                4.0 and 4.1.1, and we would not need to run purge to
1785
1878
                4.1.1. It is essential that the insert buffer is emptied
1786
1879
                here! */
1787
1880
 
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...");
 
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");
1791
1887
                for (;;) {
1792
1888
                        os_thread_sleep(1000000);
1793
1889
 
1799
1895
                                break;
1800
1896
                        }
1801
1897
                }
1802
 
                drizzled::errmsg_printf(drizzled::error::INFO,
1803
 
                                        "InnoDB: Full purge and insert buffer merge completed.");
 
1898
                fprintf(stderr,
 
1899
                        "InnoDB: Full purge and insert buffer merge"
 
1900
                        " completed.\n");
1804
1901
 
1805
1902
                trx_sys_mark_upgraded_to_multiple_tablespaces();
1806
1903
 
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");
 
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");
1816
1913
        }
1817
1914
 
1818
1915
        if (srv_force_recovery == 0) {
1842
1939
        ulint   i;
1843
1940
        if (!srv_was_started) {
1844
1941
                if (srv_is_being_started) {
1845
 
                  drizzled::errmsg_printf(drizzled::error::ERROR,
1846
 
                                "InnoDB: Warning: shutting down a not properly started or created database!");
 
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");
1847
1947
                }
1848
1948
 
1849
1949
                return(DB_SUCCESS);
1856
1956
 
1857
1957
 
1858
1958
        if (srv_fast_shutdown == 2) {
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!");
 
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");
1863
1966
        }
1864
1967
 
1865
1968
        logs_empty_and_mark_files_at_shutdown();
1866
1969
 
1867
1970
        if (srv_conc_n_threads != 0) {
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);
 
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);
1871
1976
        }
1872
1977
 
1873
1978
        /* 2. Make all threads created by InnoDB to exit */
1930
2035
        }
1931
2036
 
1932
2037
        if (i == 1000) {
1933
 
          drizzled::errmsg_printf(drizzled::error::WARN,
1934
 
                        "InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!",
 
2038
                fprintf(stderr,
 
2039
                        "InnoDB: Warning: %lu threads created by InnoDB"
 
2040
                        " had not exited at shutdown!\n",
1935
2041
                        (ulong) os_thread_count);
1936
2042
        }
1937
2043
 
1997
2103
            || os_event_count != 0
1998
2104
            || os_mutex_count != 0
1999
2105
            || os_fast_mutex_count != 0) {
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);
 
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);
2005
2113
        }
2006
2114
 
2007
2115
        if (dict_foreign_err_file) {
2012
2120
        }
2013
2121
 
2014
2122
        if (srv_print_verbose_log) {
2015
 
                drizzled::errmsg_printf(drizzled::error::INFO,
2016
 
                                        "InnoDB: Shutdown completed log sequence number %"PRIu64,
2017
 
                                        srv_shutdown_lsn);
 
2123
                ut_print_timestamp(stderr);
 
2124
                fprintf(stderr,
 
2125
                        "  InnoDB: Shutdown completed;"
 
2126
                        " log sequence number %"PRIu64"\n",
 
2127
                        srv_shutdown_lsn);
2018
2128
        }
2019
2129
 
2020
2130
        srv_was_started = FALSE;