88
88
# include "thr0loc.h"
89
89
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
90
90
# include "zlib.h" /* for ZLIB_VERSION */
91
#include "xtrabackup_api.h"
93
94
#include <unistd.h>
96
#include <drizzled/gettext.h>
97
#include <drizzled/errmsg_print.h>
95
99
/** Log sequence number immediately after startup */
96
100
UNIV_INTERN ib_uint64_t srv_start_lsn;
97
101
/** Log sequence number at shutdown */
123
127
/** Files comprising the system tablespace */
124
128
static os_file_t files[1000];
126
/** Mutex protecting the ios count */
127
static mutex_t ios_mutex;
128
/** Count of I/O operations in io_handler_thread() */
131
130
/** io_handler_thread parameters for thread identification */
132
static ulint n[SRV_MAX_N_IO_THREADS + 6];
131
static ulint n[SRV_MAX_N_IO_THREADS + 7];
133
132
/** io_handler_thread identifiers */
134
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6];
133
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7];
136
135
/** We use this mutex to test the return value of pthread_mutex_trylock
137
136
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
154
153
UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
155
154
#endif /* UNIV_PFS_THREAD */
157
#ifdef UNIV_PFS_MUTEX
158
/* Key to register ios_mutex_key with performance schema */
159
UNIV_INTERN mysql_pfs_key_t ios_mutex_key;
160
#endif /* UNIV_PFS_MUTEX */
162
156
/*********************************************************************//**
163
157
Convert a numeric string that optionally ends in G or M, to a number
164
158
containing megabytes.
292
srv_data_file_names = malloc(i * sizeof *srv_data_file_names);
293
srv_data_file_sizes = malloc(i * sizeof *srv_data_file_sizes);
294
srv_data_file_is_raw_partition = malloc(
295
i * sizeof *srv_data_file_is_raw_partition);
286
srv_data_file_names = static_cast<char **>(malloc(i * sizeof *srv_data_file_names));
287
srv_data_file_sizes = static_cast<ulint *>(malloc(i * sizeof *srv_data_file_sizes));
288
srv_data_file_is_raw_partition = static_cast<ulint *>(malloc(
289
i * sizeof *srv_data_file_is_raw_partition));
297
291
srv_n_data_files = i;
613
604
&& os_file_get_last_error(FALSE) != 100
617
"InnoDB: Error in creating"
618
" or opening %s\n", name);
607
drizzled::errmsg_printf(drizzled::error::ERROR,
608
"InnoDB: Error in creating or opening %s", name);
623
613
files[i] = os_file_create(innodb_file_log_key, name,
624
614
OS_FILE_OPEN, OS_FILE_AIO,
625
615
OS_LOG_FILE, &ret);
628
"InnoDB: Error in opening %s\n", name);
617
drizzled::errmsg_printf(drizzled::error::ERROR,
618
"InnoDB: Error in opening %s.", name);
630
620
return(DB_ERROR);
636
626
if (size != srv_calc_low32(srv_log_file_size)
637
627
|| size_high != srv_calc_high32(srv_log_file_size)) {
640
"InnoDB: Error: log file %s is"
641
" of different size %lu %lu bytes\n"
642
"InnoDB: than specified in the .cnf"
643
" file %lu %lu bytes!\n",
644
name, (ulong) size_high, (ulong) size,
645
(ulong) srv_calc_high32(srv_log_file_size),
646
(ulong) srv_calc_low32(srv_log_file_size));
629
drizzled::errmsg_printf(drizzled::error::ERROR,
630
"InnoDB: Error: log file %s is of different size %lu %lu bytes than specified in the .cnf"
631
" file %lu %lu bytes!",
632
name, (ulong) size_high, (ulong) size,
633
(ulong) srv_calc_high32(srv_log_file_size),
634
(ulong) srv_calc_low32(srv_log_file_size));
648
636
return(DB_ERROR);
651
639
*log_file_created = TRUE;
653
ut_print_timestamp(stderr);
656
" InnoDB: Log file %s did not exist:"
657
" new to be created\n",
641
drizzled::errmsg_printf(drizzled::error::INFO,
642
"InnoDB: Log file %s did not exist: new to be created",
659
644
if (log_file_has_been_opened) {
661
646
return(DB_ERROR);
664
fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n",
665
name, (ulong) srv_log_file_size
666
>> (20 - UNIV_PAGE_SIZE_SHIFT));
649
drizzled::errmsg_printf(drizzled::error::INFO,
650
"InnoDB: Setting log file %s size to %lu MB",
651
name, (ulong) srv_log_file_size
652
>> (20 - UNIV_PAGE_SIZE_SHIFT));
669
"InnoDB: Database physically writes the file"
654
drizzled::errmsg_printf(drizzled::error::INFO,
655
"InnoDB: Database physically writes the file full: wait...\n");
672
657
ret = os_file_set_size(name, files[i],
673
658
srv_calc_low32(srv_log_file_size),
674
659
srv_calc_high32(srv_log_file_size));
677
"InnoDB: Error in creating %s:"
678
" probably out of disk space\n",
661
drizzled::errmsg_printf(drizzled::error::ERROR,
662
"InnoDB: Error in creating %s: probably out of disk space",
681
665
return(DB_ERROR);
753
736
char name[10000];
755
738
if (srv_n_data_files >= 1000) {
756
fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
757
"InnoDB: you have defined %lu\n",
758
(ulong) srv_n_data_files);
739
drizzled::errmsg_printf(drizzled::error::ERROR,
740
"InnoDB: can only have < 1000 data files you have defined %lu",
741
(ulong) srv_n_data_files);
759
742
return(DB_ERROR);
836
818
/* We open the data file */
838
820
if (one_created) {
840
"InnoDB: Error: data files can only"
841
" be added at the end\n");
843
"InnoDB: of a tablespace, but"
844
" data file %s existed beforehand.\n",
821
drizzled::errmsg_printf(drizzled::error::ERROR,
822
"InnoDB: Error: data files can only be added at the end of a tablespace, but"
823
" data file %s existed beforehand.",
846
825
return(DB_ERROR);
892
871
&& srv_last_file_size_max
893
872
< rounded_size_pages)) {
896
"InnoDB: Error: auto-extending"
898
" of a different size\n"
899
"InnoDB: %lu pages (rounded"
900
" down to MB) than specified"
901
" in the .cnf file:\n"
902
"InnoDB: initial %lu pages,"
903
" max %lu (relevant if"
904
" non-zero) pages!\n",
906
(ulong) rounded_size_pages,
907
(ulong) srv_data_file_sizes[i],
909
srv_last_file_size_max);
874
drizzled::errmsg_printf(drizzled::error::ERROR,
875
"InnoDB: Error: auto-extending data file %s is of a different size. "
876
"%lu pages (rounded down to MB) than specified in the .cnf file: "
877
"initial %lu pages, max %lu (relevant if non-zero) pages!",
879
(ulong) rounded_size_pages,
880
(ulong) srv_data_file_sizes[i],
882
srv_last_file_size_max);
911
884
return(DB_ERROR);
917
890
if (rounded_size_pages != srv_data_file_sizes[i]) {
920
"InnoDB: Error: data file %s"
921
" is of a different size\n"
923
" (rounded down to MB)\n"
924
"InnoDB: than specified"
925
" in the .cnf file %lu pages!\n",
892
drizzled::errmsg_printf(drizzled::error::ERROR,
893
"InnoDB: Error: data file %s is of a different size. "
894
"%lu pages (rounded down to MB). "
895
"Than specified in the .cnf file %lu pages!",
927
897
(ulong) rounded_size_pages,
928
898
(ulong) srv_data_file_sizes[i]);
944
914
one_created = TRUE;
947
ut_print_timestamp(stderr);
949
" InnoDB: Data file %s did not"
950
" exist: new to be created\n",
917
drizzled::errmsg_printf(drizzled::error::INFO,
918
" InnoDB: Data file %s did not exist: new to be created",
954
"InnoDB: The first specified"
955
" data file %s did not exist:\n"
956
"InnoDB: a new database"
957
" to be created!\n", name);
921
drizzled::errmsg_printf(drizzled::error::INFO,
922
"InnoDB: The first specified data file %s did not exist. A new database to be created!", name);
958
923
*create_new_db = TRUE;
961
ut_print_timestamp(stderr);
963
" InnoDB: Setting file %s size to %lu MB\n",
965
(ulong) (srv_data_file_sizes[i]
966
>> (20 - UNIV_PAGE_SIZE_SHIFT)));
926
drizzled::errmsg_printf(drizzled::error::INFO,
927
" InnoDB: Setting file %s size to %lu MB",
928
name, (ulong) (srv_data_file_sizes[i]
929
>> (20 - UNIV_PAGE_SIZE_SHIFT)));
969
"InnoDB: Database physically writes the"
970
" file full: wait...\n");
931
drizzled::errmsg_printf(drizzled::error::INFO,
932
"InnoDB: Database physically writes the file full: wait...");
972
934
ret = os_file_set_size(
975
937
srv_calc_high32(srv_data_file_sizes[i]));
979
"InnoDB: Error in creating %s:"
980
" probably out of disk space\n", name);
940
drizzled::errmsg_printf(drizzled::error::ERROR,
941
"InnoDB: Error in creating %s: probably out of disk space", name);
982
943
return(DB_ERROR);
1045
1002
on Mac OS X 10.3 or later. */
1046
1003
struct utsname utsname;
1047
1004
if (uname(&utsname)) {
1048
fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
1005
fputs(_("InnoDB: cannot determine Mac OS X version!\n"), stderr);
1050
1007
srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
1052
1009
if (!srv_have_fullfsync) {
1053
fputs("InnoDB: On Mac OS X, fsync() may be"
1054
" broken on internal drives,\n"
1055
"InnoDB: making transactions unsafe!\n", stderr);
1010
fputs(_("InnoDB: On Mac OS X, fsync() may be"
1011
" broken on internal drives,\n"
1012
"InnoDB: making transactions unsafe!\n"), stderr);
1057
1014
# endif /* F_FULLFSYNC */
1058
1015
#endif /* HAVE_DARWIN_THREADS */
1060
1017
if (sizeof(ulint) != sizeof(void*)) {
1062
"InnoDB: Error: size of InnoDB's ulint is %lu,"
1063
" but size of void* is %lu.\n"
1064
"InnoDB: The sizes should be the same"
1065
" so that on a 64-bit platform you can\n"
1066
"InnoDB: allocate more than 4 GB of memory.",
1018
drizzled::errmsg_printf(drizzled::error::WARN,
1019
_("InnoDB: Error: size of InnoDB's ulint is %lu, but size of void* is %lu. "
1020
"The sizes should be the same so that on a 64-bit platform you can. Allocate more than 4 GB of memory."),
1067
1021
(ulong)sizeof(ulint), (ulong)sizeof(void*));
1073
1027
innodb_file_per_table) until this function has returned. */
1074
1028
srv_file_per_table = FALSE;
1075
1029
#ifdef UNIV_DEBUG
1077
"InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
1030
drizzled::errmsg_printf(drizzled::error::INFO,
1031
_("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
1080
1034
#ifdef UNIV_IBUF_DEBUG
1082
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1035
drizzled::errmsg_printf(drizzled::error::INFO,
1036
_("InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1083
1037
# ifdef UNIV_IBUF_COUNT_DEBUG
1084
"InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1085
"InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1038
"InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1039
"InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1090
1044
#ifdef UNIV_SYNC_DEBUG
1092
"InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
1045
drizzled::errmsg_printf(drizzled::error::INFO,
1046
_("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
1095
1049
#ifdef UNIV_SEARCH_DEBUG
1097
"InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
1050
drizzled::errmsg_printf(drizzled::error::INFO,
1051
_("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
1100
1054
#ifdef UNIV_LOG_LSN_DEBUG
1102
"InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
1055
drizzled::errmsg_printf(drizzled::error::INFO,
1056
_("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
1103
1057
#endif /* UNIV_LOG_LSN_DEBUG */
1104
1058
#ifdef UNIV_MEM_DEBUG
1106
"InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
1059
drizzled::errmsg_printf(drizzled::error::INFO,
1060
_("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
1109
if (UNIV_LIKELY(srv_use_sys_malloc)) {
1111
"InnoDB: The InnoDB memory heap is disabled\n");
1063
if (UNIV_LIKELY(srv_use_sys_malloc))
1065
drizzled::errmsg_printf(drizzled::error::INFO, _("InnoDB: The InnoDB memory heap is disabled\n"));
1114
fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1115
"\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1068
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: " IB_ATOMICS_STARTUP_MSG
1069
"\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1116
1070
#ifdef UNIV_ZIP_DEBUG
1117
1071
" with validation"
1118
1072
#endif /* UNIV_ZIP_DEBUG */
1119
1073
#ifdef UNIV_ZIP_COPY
1120
1074
" and extra copying"
1121
1075
#endif /* UNIV_ZIP_COPY */
1125
1079
/* Since InnoDB does not currently clean up all its internal data
1128
1082
second time during the process lifetime. */
1130
1084
if (srv_start_has_been_called) {
1132
"InnoDB: Error: startup called second time"
1133
" during the process lifetime.\n"
1134
"InnoDB: In the MySQL Embedded Server Library"
1135
" you cannot call server_init()\n"
1136
"InnoDB: more than once during"
1137
" the process lifetime.\n");
1085
drizzled::errmsg_printf(drizzled::error::ERROR,
1086
"InnoDB: Error: startup called second time during the process lifetime.\n");
1140
1089
srv_start_has_been_called = TRUE;
1176
1125
#elif defined(LINUX_NATIVE_AIO)
1178
1127
if (srv_use_native_aio) {
1179
ut_print_timestamp(stderr);
1181
" InnoDB: Using Linux native AIO\n");
1128
drizzled::errmsg_printf(drizzled::error::INFO,
1129
_("InnoDB: Using Linux native AIO"));
1184
1132
/* Currently native AIO is supported only on windows and linux
1204
1152
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
1205
1153
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
1155
} else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) {
1156
srv_unix_file_flush_method = SRV_UNIX_ALL_O_DIRECT;
1207
1158
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
1208
1159
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
1223
1174
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
1227
"InnoDB: Unrecognized value %s for"
1228
" innodb_flush_method\n",
1229
srv_file_flush_method_str);
1177
drizzled::errmsg_printf(drizzled::error::ERROR,
1178
"InnoDB: Unrecognized value %s for innodb_flush_method",
1179
srv_file_flush_method_str);
1230
1180
return(DB_ERROR);
1266
1216
&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
1268
1218
if (srv_innodb_status) {
1269
srv_monitor_file_name = mem_alloc(
1219
srv_monitor_file_name = static_cast<char *>(mem_alloc(
1270
1220
strlen(fil_path_to_mysql_datadir)
1271
+ 20 + sizeof "/innodb_status.");
1221
+ 20 + sizeof "/innodb_status."));
1272
1222
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
1273
1223
fil_path_to_mysql_datadir, os_proc_get_number());
1274
1224
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
1275
1225
if (!srv_monitor_file) {
1276
fprintf(stderr, "InnoDB: unable to create %s: %s\n",
1277
srv_monitor_file_name, strerror(errno));
1226
drizzled::errmsg_printf(drizzled::error::ERROR,
1227
"InnoDB: unable to create %s: %s\n", srv_monitor_file_name, strerror(errno));
1278
1228
return(DB_ERROR);
1328
1278
srv_max_n_open_files);
1330
1280
/* Print time to initialize the buffer pool */
1331
ut_print_timestamp(stderr);
1333
" InnoDB: Initializing buffer pool, size =");
1335
1282
if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
1338
((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1283
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fG",
1284
((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1342
((double) srv_buf_pool_size) / (1024 * 1024));
1286
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fM",
1287
((double) srv_buf_pool_size) / (1024 * 1024));
1345
1290
err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1347
ut_print_timestamp(stderr);
1349
" InnoDB: Completed initialization of buffer pool\n");
1292
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Completed initialization of buffer pool");
1351
1294
if (err != DB_SUCCESS) {
1353
"InnoDB: Fatal error: cannot allocate the memory"
1354
" for the buffer pool\n");
1295
drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Fatal error: cannot allocate the memory for the buffer pool");
1359
1300
#ifdef UNIV_DEBUG
1363
1304
if (srv_buf_pool_size <= 5 * 1024 * 1024) {
1365
fprintf(stderr, "InnoDB: Warning: Small buffer pool size "
1366
"(%luM), the flst_validate() debug function "
1367
"can cause a deadlock if the buffer pool fills up.\n",
1368
srv_buf_pool_size / 1024 / 1024);
1306
drizzled::errmsg_printf(drizzled::error::WARN, "InnoDB: Warning: Small buffer pool size "
1307
"(%luM), the flst_validate() debug function "
1308
"can cause a deadlock if the buffer pool fills up.\n",
1309
srv_buf_pool_size / 1024 / 1024);
1385
1326
#ifdef UNIV_LOG_ARCHIVE
1386
1327
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
1388
"InnoDB: Error: you must set the log group"
1389
" home dir in my.cnf the\n"
1390
"InnoDB: same as log arch dir.\n");
1328
drizzled::errmsg_printf(drizzled::error::ERROR,
1329
"InnoDB: Error: you must set the log group home dir in my.cnf the same as log arch dir.");
1392
1331
return(DB_ERROR);
1394
1333
#endif /* UNIV_LOG_ARCHIVE */
1396
1335
if (srv_n_log_files * srv_log_file_size >= 262144) {
1398
"InnoDB: Error: combined size of log files"
1399
" must be < 4 GB\n");
1336
drizzled::errmsg_printf(drizzled::error::ERROR,
1337
"InnoDB: Error: combined size of log files must be < 4 GB");
1401
1339
return(DB_ERROR);
1406
1344
for (i = 0; i < srv_n_data_files; i++) {
1407
1345
#ifndef __WIN__
1408
1346
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
1410
"InnoDB: Error: file size must be < 4 GB"
1411
" with this MySQL binary\n"
1412
"InnoDB: and operating system combination,"
1413
" in some OS's < 2 GB\n");
1347
drizzled::errmsg_printf(drizzled::error::ERROR,
1348
"InnoDB: Error: file size must be < 4 GB with this MySQL binary and operating system combination,"
1349
" in some OS's < 2 GB\n");
1415
1351
return(DB_ERROR);
1433
1367
&min_flushed_lsn, &max_flushed_lsn,
1434
1368
&sum_of_new_sizes);
1435
1369
if (err != DB_SUCCESS) {
1437
"InnoDB: Could not open or create data files.\n"
1438
"InnoDB: If you tried to add new data files,"
1439
" and it failed here,\n"
1440
"InnoDB: you should now edit innodb_data_file_path"
1442
"InnoDB: to what it was, and remove the"
1443
" new ibdata files InnoDB created\n"
1444
"InnoDB: in this failed attempt. InnoDB only wrote"
1445
" those files full of\n"
1446
"InnoDB: zeros, but did not yet use them in any way."
1447
" But be careful: do not\n"
1448
"InnoDB: remove old data files"
1449
" which contain your precious data!\n");
1370
drizzled::errmsg_printf(drizzled::error::ERROR,
1371
"InnoDB: Could not open or create data files.\n"
1372
"InnoDB: If you tried to add new data files, and it failed here,\n"
1373
"InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
1374
"InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
1375
"InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
1376
"InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
1377
"InnoDB: remove old data files which contain your precious data!\n");
1451
1379
return((int) err);
1472
1400
if ((log_opened && create_new_db)
1473
1401
|| (log_opened && log_created)) {
1475
"InnoDB: Error: all log files must be"
1476
" created at the same time.\n"
1477
"InnoDB: All log files must be"
1478
" created also in database creation.\n"
1479
"InnoDB: If you want bigger or smaller"
1480
" log files, shut down the\n"
1481
"InnoDB: database and make sure there"
1482
" were no errors in shutdown.\n"
1483
"InnoDB: Then delete the existing log files."
1484
" Edit the .cnf file\n"
1402
drizzled::errmsg_printf(drizzled::error::ERROR,
1403
"InnoDB: Error: all log files must be created at the same time.\n"
1404
"InnoDB: All log files must be created also in database creation.\n"
1405
"InnoDB: If you want bigger or smaller log files, shut down the\n"
1406
"InnoDB: database and make sure there were no errors in shutdown.\n"
1407
"InnoDB: Then delete the existing log files. Edit the .cnf file\n"
1485
1408
"InnoDB: and start the database again.\n");
1487
1410
return(DB_ERROR);
1503
1426
|| max_arch_log_no != min_arch_log_no
1504
1427
#endif /* UNIV_LOG_ARCHIVE */
1507
"InnoDB: Cannot initialize created"
1508
" log files because\n"
1509
"InnoDB: data files were not in sync"
1510
" with each other\n"
1429
drizzled::errmsg_printf(drizzled::error::ERROR,
1430
"InnoDB: Cannot initialize created log files because\n"
1431
"InnoDB: data files were not in sync with each other\n"
1511
1432
"InnoDB: or the data files are corrupt.\n");
1513
1434
return(DB_ERROR);
1516
1437
if (max_flushed_lsn < (ib_uint64_t) 1000) {
1518
"InnoDB: Cannot initialize created"
1519
" log files because\n"
1520
"InnoDB: data files are corrupt,"
1521
" or new data files were\n"
1522
"InnoDB: created when the database"
1523
" was started previous\n"
1524
"InnoDB: time but the database"
1525
" was not shut down\n"
1526
"InnoDB: normally after that.\n");
1438
drizzled::errmsg_printf(drizzled::error::ERROR,
1439
"InnoDB: Cannot initialize created log files because\n"
1440
"InnoDB: data files are corrupt, or new data files were\n"
1441
"InnoDB: created when the database was started previous\n"
1442
"InnoDB: time but the database was not shut down\n"
1443
"InnoDB: normally after that.\n");
1528
1445
return(DB_ERROR);
1563
1480
#ifdef UNIV_LOG_ARCHIVE
1564
1481
} else if (srv_archive_recovery) {
1566
"InnoDB: Starting archive"
1567
" recovery from a backup...\n");
1482
drizzled::errmsg_printf(drizzled::error::INFO,
1483
"InnoDB: Starting archive recovery from a backup...");
1568
1484
err = recv_recovery_from_archive_start(
1569
1485
min_flushed_lsn, srv_archive_recovery_limit_lsn,
1570
1486
min_arch_log_no);
1748
1668
os_thread_create(&srv_monitor_thread, NULL,
1749
1669
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
1671
/* Create the thread which automaticaly dumps/restore buffer pool */
1672
os_thread_create(&srv_LRU_dump_restore_thread, NULL,
1673
thread_ids + 5 + SRV_MAX_N_IO_THREADS);
1751
1675
srv_is_being_started = FALSE;
1753
1677
err = dict_create_or_check_foreign_constraint_tables();
1785
1709
if (!srv_auto_extend_last_data_file
1786
1710
&& sum_of_data_file_sizes != tablespace_size_in_header) {
1789
"InnoDB: Error: tablespace size"
1790
" stored in header is %lu pages, but\n"
1791
"InnoDB: the sum of data file sizes is %lu pages\n",
1792
(ulong) tablespace_size_in_header,
1793
(ulong) sum_of_data_file_sizes);
1712
drizzled::errmsg_printf(drizzled::error::ERROR,
1713
"InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes is %lu pages.",
1714
(ulong) tablespace_size_in_header,
1715
(ulong) sum_of_data_file_sizes);
1795
1717
if (srv_force_recovery == 0
1796
1718
&& sum_of_data_file_sizes < tablespace_size_in_header) {
1797
1719
/* This is a fatal error, the tail of a tablespace is
1801
"InnoDB: Cannot start InnoDB."
1802
" The tail of the system tablespace is\n"
1803
"InnoDB: missing. Have you edited"
1804
" innodb_data_file_path in my.cnf in an\n"
1805
"InnoDB: inappropriate way, removing"
1806
" ibdata files from there?\n"
1807
"InnoDB: You can set innodb_force_recovery=1"
1808
" in my.cnf to force\n"
1809
"InnoDB: a startup if you are trying"
1810
" to recover a badly corrupt database.\n");
1722
drizzled::errmsg_printf(drizzled::error::ERROR,
1723
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
1724
"missing. Have you edited innodb_data_file_path in my.cnf in an "
1725
"inappropriate way, removing ibdata files from there? "
1726
"You can set innodb_force_recovery=1 in my.cnf to force "
1727
"a startup if you are trying to recover a badly corrupt database.");
1812
1729
return(DB_ERROR);
1816
1733
if (srv_auto_extend_last_data_file
1817
1734
&& sum_of_data_file_sizes < tablespace_size_in_header) {
1820
"InnoDB: Error: tablespace size stored in header"
1821
" is %lu pages, but\n"
1822
"InnoDB: the sum of data file sizes"
1823
" is only %lu pages\n",
1824
(ulong) tablespace_size_in_header,
1825
(ulong) sum_of_data_file_sizes);
1736
drizzled::errmsg_printf(drizzled::error::ERROR,
1737
"InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes"
1738
" is only %lu pages\n",
1739
(ulong) tablespace_size_in_header,
1740
(ulong) sum_of_data_file_sizes);
1827
1742
if (srv_force_recovery == 0) {
1830
"InnoDB: Cannot start InnoDB. The tail of"
1831
" the system tablespace is\n"
1832
"InnoDB: missing. Have you edited"
1833
" innodb_data_file_path in my.cnf in an\n"
1834
"InnoDB: inappropriate way, removing"
1835
" ibdata files from there?\n"
1836
"InnoDB: You can set innodb_force_recovery=1"
1837
" in my.cnf to force\n"
1838
"InnoDB: a startup if you are trying to"
1839
" recover a badly corrupt database.\n");
1744
drizzled::errmsg_printf(drizzled::error::ERROR,
1745
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
1746
"missing. Have you edited innodb_data_file_path in my.cnf in an "
1747
"inappropriate way, removing ibdata files from there? "
1748
"You can set innodb_force_recovery=1 in my.cnf to force "
1749
"a startup if you are trying to recover a badly corrupt database.\n");
1841
1751
return(DB_ERROR);
1846
1756
os_fast_mutex_init(&srv_os_test_mutex);
1848
1758
if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
1850
"InnoDB: Error: pthread_mutex_trylock returns"
1851
" an unexpected value on\n"
1852
"InnoDB: success! Cannot continue.\n");
1759
drizzled::errmsg_printf(drizzled::error::ERROR,
1760
"InnoDB: Error: pthread_mutex_trylock returns an unexpected value on success! Cannot continue.\n");
1862
1770
os_fast_mutex_free(&srv_os_test_mutex);
1864
1772
if (srv_print_verbose_log) {
1865
ut_print_timestamp(stderr);
1867
" InnoDB %s started; "
1868
"log sequence number %"PRIu64"\n",
1869
INNODB_VERSION_STR, srv_start_lsn);
1773
drizzled::errmsg_printf(drizzled::error::INFO,
1774
"InnoDB %s started; log sequence number %"PRIu64"\n",
1775
INNODB_VERSION_STR, srv_start_lsn);
1872
1778
if (srv_force_recovery > 0) {
1874
"InnoDB: !!! innodb_force_recovery"
1875
" is set to %lu !!!\n",
1876
(ulong) srv_force_recovery);
1779
drizzled::errmsg_printf(drizzled::error::ERROR,
1780
"InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
1781
(ulong) srv_force_recovery);
1881
1784
if (trx_doublewrite_must_reset_space_ids) {
1882
1785
/* Actually, we did not change the undo log format between
1883
1786
4.0 and 4.1.1, and we would not need to run purge to
1892
1795
4.1.1. It is essential that the insert buffer is emptied
1896
"InnoDB: You are upgrading to an"
1897
" InnoDB version which allows multiple\n"
1898
"InnoDB: tablespaces. Wait that purge"
1899
" and insert buffer merge run to\n"
1900
"InnoDB: completion...\n");
1798
drizzled::errmsg_printf(drizzled::error::INFO,
1799
"InnoDB: You are upgrading to an InnoDB version which allows multiple. "
1800
"tablespaces. Wait that purge and insert buffer merge run to completion...");
1902
1802
os_thread_sleep(1000000);
1913
"InnoDB: Full purge and insert buffer merge"
1812
drizzled::errmsg_printf(drizzled::error::INFO,
1813
"InnoDB: Full purge and insert buffer merge completed.");
1916
1815
trx_sys_mark_upgraded_to_multiple_tablespaces();
1919
"InnoDB: You have now successfully upgraded"
1920
" to the multiple tablespaces\n"
1921
"InnoDB: format. You should NOT DOWNGRADE"
1922
" to an earlier version of\n"
1923
"InnoDB: InnoDB! But if you absolutely need to"
1925
"InnoDB: " REFMAN "multiple-tablespaces.html\n"
1926
"InnoDB: for instructions.\n");
1817
drizzled::errmsg_printf(drizzled::error::INFO,
1818
"InnoDB: You have now successfully upgraded"
1819
" to the multiple tablespaces\n"
1820
"InnoDB: format. You should NOT DOWNGRADE"
1821
" to an earlier version of\n"
1822
"InnoDB: InnoDB! But if you absolutely need to"
1824
"InnoDB: " REFMAN "multiple-tablespaces.html\n"
1825
"InnoDB: for instructions.\n");
1929
1828
if (srv_force_recovery == 0) {
1954
1854
if (!srv_was_started) {
1955
1855
if (srv_is_being_started) {
1956
ut_print_timestamp(stderr);
1958
" InnoDB: Warning: shutting down"
1959
" a not properly started\n"
1960
"InnoDB: or created database!\n");
1856
drizzled::errmsg_printf(drizzled::error::ERROR,
1857
"InnoDB: Warning: shutting down a not properly started or created database!");
1963
1860
return(DB_SUCCESS);
1972
1869
if (srv_fast_shutdown == 2) {
1973
ut_print_timestamp(stderr);
1975
" InnoDB: MySQL has requested a very fast shutdown"
1976
" without flushing "
1977
"the InnoDB buffer pool to data files."
1978
" At the next mysqld startup "
1979
"InnoDB will do a crash recovery!\n");
1870
drizzled::errmsg_printf(drizzled::error::INFO,
1871
"InnoDB: MySQL has requested a very fast shutdown without flushing "
1872
"the InnoDB buffer pool to data files. At the next mysqld startup "
1873
"InnoDB will do a crash recovery!");
1982
1876
logs_empty_and_mark_files_at_shutdown();
1984
1878
if (srv_conc_n_threads != 0) {
1986
"InnoDB: Warning: query counter shows %ld queries"
1988
"InnoDB: inside InnoDB at shutdown\n",
1989
srv_conc_n_threads);
1879
drizzled::errmsg_printf(drizzled::error::WARN,
1880
"InnoDB: Warning: query counter shows %ld queries still InnoDB: inside InnoDB at shutdown.",
1881
srv_conc_n_threads);
1992
1884
/* 2. Make all threads created by InnoDB to exit */
2051
1943
if (i == 1000) {
2053
"InnoDB: Warning: %lu threads created by InnoDB"
2054
" had not exited at shutdown!\n",
1944
drizzled::errmsg_printf(drizzled::error::WARN,
1945
"InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!",
2055
1946
(ulong) os_thread_count);
2117
2008
|| os_event_count != 0
2118
2009
|| os_mutex_count != 0
2119
2010
|| os_fast_mutex_count != 0) {
2121
"InnoDB: Warning: some resources were not"
2122
" cleaned up in shutdown:\n"
2123
"InnoDB: threads %lu, events %lu,"
2124
" os_mutexes %lu, os_fast_mutexes %lu\n",
2125
(ulong) os_thread_count, (ulong) os_event_count,
2126
(ulong) os_mutex_count, (ulong) os_fast_mutex_count);
2011
drizzled::errmsg_printf(drizzled::error::WARN,
2012
"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
2013
"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
2014
(ulong) os_thread_count, (ulong) os_event_count,
2015
(ulong) os_mutex_count, (ulong) os_fast_mutex_count);
2129
2018
if (dict_foreign_err_file) {
2136
2025
if (srv_print_verbose_log) {
2137
ut_print_timestamp(stderr);
2139
" InnoDB: Shutdown completed;"
2140
" log sequence number %"PRIu64"\n",
2026
drizzled::errmsg_printf(drizzled::error::INFO,
2027
"InnoDB: Shutdown completed log sequence number %"PRIu64,
2144
2031
srv_was_started = FALSE;