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"
94
93
#include <unistd.h>
96
#include <drizzled/gettext.h>
97
#include <drizzled/errmsg_print.h>
99
95
/** Log sequence number immediately after startup */
100
96
UNIV_INTERN ib_uint64_t srv_start_lsn;
101
97
/** Log sequence number at shutdown */
127
123
/** Files comprising the system tablespace */
128
124
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() */
130
131
/** io_handler_thread parameters for thread identification */
131
static ulint n[SRV_MAX_N_IO_THREADS + 7];
132
static ulint n[SRV_MAX_N_IO_THREADS + 6];
132
133
/** io_handler_thread identifiers */
133
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7];
134
static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6];
135
136
/** We use this mutex to test the return value of pthread_mutex_trylock
136
137
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
153
154
UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
154
155
#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 */
156
162
/*********************************************************************//**
157
163
Convert a numeric string that optionally ends in G or M, to a number
158
164
containing megabytes.
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));
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);
291
297
srv_n_data_files = i;
604
613
&& os_file_get_last_error(FALSE) != 100
607
drizzled::errmsg_printf(drizzled::error::ERROR,
608
"InnoDB: Error in creating or opening %s", name);
617
"InnoDB: Error in creating"
618
" or opening %s\n", name);
613
623
files[i] = os_file_create(innodb_file_log_key, name,
614
624
OS_FILE_OPEN, OS_FILE_AIO,
615
625
OS_LOG_FILE, &ret);
617
drizzled::errmsg_printf(drizzled::error::ERROR,
618
"InnoDB: Error in opening %s.", name);
628
"InnoDB: Error in opening %s\n", name);
620
630
return(DB_ERROR);
626
636
if (size != srv_calc_low32(srv_log_file_size)
627
637
|| size_high != srv_calc_high32(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));
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));
636
648
return(DB_ERROR);
639
651
*log_file_created = TRUE;
641
drizzled::errmsg_printf(drizzled::error::INFO,
642
"InnoDB: Log file %s did not exist: new to be created",
653
ut_print_timestamp(stderr);
656
" InnoDB: Log file %s did not exist:"
657
" new to be created\n",
644
659
if (log_file_has_been_opened) {
646
661
return(DB_ERROR);
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));
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));
654
drizzled::errmsg_printf(drizzled::error::INFO,
655
"InnoDB: Database physically writes the file full: wait...\n");
669
"InnoDB: Database physically writes the file"
657
672
ret = os_file_set_size(name, files[i],
658
673
srv_calc_low32(srv_log_file_size),
659
674
srv_calc_high32(srv_log_file_size));
661
drizzled::errmsg_printf(drizzled::error::ERROR,
662
"InnoDB: Error in creating %s: probably out of disk space",
677
"InnoDB: Error in creating %s:"
678
" probably out of disk space\n",
665
681
return(DB_ERROR);
736
753
char name[10000];
738
755
if (srv_n_data_files >= 1000) {
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);
756
fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
757
"InnoDB: you have defined %lu\n",
758
(ulong) srv_n_data_files);
742
759
return(DB_ERROR);
818
836
/* We open the data file */
820
838
if (one_created) {
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.",
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",
825
846
return(DB_ERROR);
871
892
&& srv_last_file_size_max
872
893
< rounded_size_pages)) {
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);
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);
884
911
return(DB_ERROR);
890
917
if (rounded_size_pages != srv_data_file_sizes[i]) {
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!",
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",
897
927
(ulong) rounded_size_pages,
898
928
(ulong) srv_data_file_sizes[i]);
914
944
one_created = TRUE;
917
drizzled::errmsg_printf(drizzled::error::INFO,
918
" InnoDB: Data file %s did not exist: new to be created",
947
ut_print_timestamp(stderr);
949
" InnoDB: Data file %s did not"
950
" exist: new to be created\n",
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);
954
"InnoDB: The first specified"
955
" data file %s did not exist:\n"
956
"InnoDB: a new database"
957
" to be created!\n", name);
923
958
*create_new_db = TRUE;
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)));
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)));
931
drizzled::errmsg_printf(drizzled::error::INFO,
932
"InnoDB: Database physically writes the file full: wait...");
969
"InnoDB: Database physically writes the"
970
" file full: wait...\n");
934
972
ret = os_file_set_size(
937
975
srv_calc_high32(srv_data_file_sizes[i]));
940
drizzled::errmsg_printf(drizzled::error::ERROR,
941
"InnoDB: Error in creating %s: probably out of disk space", name);
979
"InnoDB: Error in creating %s:"
980
" probably out of disk space\n", name);
943
982
return(DB_ERROR);
1002
1045
on Mac OS X 10.3 or later. */
1003
1046
struct utsname utsname;
1004
1047
if (uname(&utsname)) {
1005
fputs(_("InnoDB: cannot determine Mac OS X version!\n"), stderr);
1048
fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
1007
1050
srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
1009
1052
if (!srv_have_fullfsync) {
1010
fputs(_("InnoDB: On Mac OS X, fsync() may be"
1011
" broken on internal drives,\n"
1012
"InnoDB: making transactions unsafe!\n"), stderr);
1053
fputs("InnoDB: On Mac OS X, fsync() may be"
1054
" broken on internal drives,\n"
1055
"InnoDB: making transactions unsafe!\n", stderr);
1014
1057
# endif /* F_FULLFSYNC */
1015
1058
#endif /* HAVE_DARWIN_THREADS */
1017
1060
if (sizeof(ulint) != sizeof(void*)) {
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."),
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.",
1021
1067
(ulong)sizeof(ulint), (ulong)sizeof(void*));
1027
1073
innodb_file_per_table) until this function has returned. */
1028
1074
srv_file_per_table = FALSE;
1029
1075
#ifdef UNIV_DEBUG
1030
drizzled::errmsg_printf(drizzled::error::INFO,
1031
_("InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"));
1077
"InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
1034
1080
#ifdef UNIV_IBUF_DEBUG
1035
drizzled::errmsg_printf(drizzled::error::INFO,
1036
_("InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1082
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
1037
1083
# ifdef UNIV_IBUF_COUNT_DEBUG
1038
"InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1039
"InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1084
"InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
1085
"InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
1044
1090
#ifdef UNIV_SYNC_DEBUG
1045
drizzled::errmsg_printf(drizzled::error::INFO,
1046
_("InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"));
1092
"InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
1049
1095
#ifdef UNIV_SEARCH_DEBUG
1050
drizzled::errmsg_printf(drizzled::error::INFO,
1051
_("InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"));
1097
"InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
1054
1100
#ifdef UNIV_LOG_LSN_DEBUG
1055
drizzled::errmsg_printf(drizzled::error::INFO,
1056
_("InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"));
1102
"InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
1057
1103
#endif /* UNIV_LOG_LSN_DEBUG */
1058
1104
#ifdef UNIV_MEM_DEBUG
1059
drizzled::errmsg_printf(drizzled::error::INFO,
1060
_("InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"));
1106
"InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
1063
if (UNIV_LIKELY(srv_use_sys_malloc))
1065
drizzled::errmsg_printf(drizzled::error::INFO, _("InnoDB: The InnoDB memory heap is disabled\n"));
1109
if (UNIV_LIKELY(srv_use_sys_malloc)) {
1111
"InnoDB: The InnoDB memory heap is disabled\n");
1068
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: " IB_ATOMICS_STARTUP_MSG
1069
"\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1114
fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
1115
"\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
1070
1116
#ifdef UNIV_ZIP_DEBUG
1071
1117
" with validation"
1072
1118
#endif /* UNIV_ZIP_DEBUG */
1073
1119
#ifdef UNIV_ZIP_COPY
1074
1120
" and extra copying"
1075
1121
#endif /* UNIV_ZIP_COPY */
1079
1125
/* Since InnoDB does not currently clean up all its internal data
1082
1128
second time during the process lifetime. */
1084
1130
if (srv_start_has_been_called) {
1085
drizzled::errmsg_printf(drizzled::error::ERROR,
1086
"InnoDB: Error: startup called second time during the process lifetime.\n");
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");
1089
1140
srv_start_has_been_called = TRUE;
1125
1176
#elif defined(LINUX_NATIVE_AIO)
1127
1178
if (srv_use_native_aio) {
1128
drizzled::errmsg_printf(drizzled::error::INFO,
1129
_("InnoDB: Using Linux native AIO"));
1179
ut_print_timestamp(stderr);
1181
" InnoDB: Using Linux native AIO\n");
1132
1184
/* Currently native AIO is supported only on windows and linux
1152
1204
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
1153
1205
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;
1158
1207
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
1159
1208
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
1174
1223
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
1177
drizzled::errmsg_printf(drizzled::error::ERROR,
1178
"InnoDB: Unrecognized value %s for innodb_flush_method",
1179
srv_file_flush_method_str);
1227
"InnoDB: Unrecognized value %s for"
1228
" innodb_flush_method\n",
1229
srv_file_flush_method_str);
1180
1230
return(DB_ERROR);
1216
1266
&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
1218
1268
if (srv_innodb_status) {
1219
srv_monitor_file_name = static_cast<char *>(mem_alloc(
1269
srv_monitor_file_name = mem_alloc(
1220
1270
strlen(fil_path_to_mysql_datadir)
1221
+ 20 + sizeof "/innodb_status."));
1271
+ 20 + sizeof "/innodb_status.");
1222
1272
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
1223
1273
fil_path_to_mysql_datadir, os_proc_get_number());
1224
1274
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
1225
1275
if (!srv_monitor_file) {
1226
drizzled::errmsg_printf(drizzled::error::ERROR,
1227
"InnoDB: unable to create %s: %s\n", srv_monitor_file_name, strerror(errno));
1276
fprintf(stderr, "InnoDB: unable to create %s: %s\n",
1277
srv_monitor_file_name, strerror(errno));
1228
1278
return(DB_ERROR);
1278
1328
srv_max_n_open_files);
1280
1330
/* Print time to initialize the buffer pool */
1331
ut_print_timestamp(stderr);
1333
" InnoDB: Initializing buffer pool, size =");
1282
1335
if (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));
1338
((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
1286
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Initializing buffer pool, size = %.1fM",
1287
((double) srv_buf_pool_size) / (1024 * 1024));
1342
((double) srv_buf_pool_size) / (1024 * 1024));
1290
1345
err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
1292
drizzled::errmsg_printf(drizzled::error::INFO, "InnoDB: Completed initialization of buffer pool");
1347
ut_print_timestamp(stderr);
1349
" InnoDB: Completed initialization of buffer pool\n");
1294
1351
if (err != DB_SUCCESS) {
1295
drizzled::errmsg_printf(drizzled::error::ERROR, "InnoDB: Fatal error: cannot allocate the memory for the buffer pool");
1353
"InnoDB: Fatal error: cannot allocate the memory"
1354
" for the buffer pool\n");
1300
1359
#ifdef UNIV_DEBUG
1304
1363
if (srv_buf_pool_size <= 5 * 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);
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);
1326
1385
#ifdef UNIV_LOG_ARCHIVE
1327
1386
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
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.");
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");
1331
1392
return(DB_ERROR);
1333
1394
#endif /* UNIV_LOG_ARCHIVE */
1335
if (sizeof(ulint) == 4
1336
&& srv_n_log_files * srv_log_file_size
1337
>= (1UL << (32 - UNIV_PAGE_SIZE_SHIFT))) {
1338
drizzled::errmsg_printf(drizzled::error::ERROR,
1339
"InnoDB: Error: combined size of log files must be < 4 GB on 32-bit systems\n");
1396
if (srv_n_log_files * srv_log_file_size >= 262144) {
1398
"InnoDB: Error: combined size of log files"
1399
" must be < 4 GB\n");
1341
1401
return(DB_ERROR);
1346
1406
for (i = 0; i < srv_n_data_files; i++) {
1347
1407
#ifndef __WIN__
1348
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= (1UL << (32 - UNIV_PAGE_SIZE_SHIFT))) {
1349
drizzled::errmsg_printf(drizzled::error::ERROR,
1350
"InnoDB: Error: file size must be < 4 GB with this MySQL binary and operating system combination,"
1351
" in some OS's < 2 GB\n");
1408
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");
1353
1415
return(DB_ERROR);
1369
1433
&min_flushed_lsn, &max_flushed_lsn,
1370
1434
&sum_of_new_sizes);
1371
1435
if (err != DB_SUCCESS) {
1372
drizzled::errmsg_printf(drizzled::error::ERROR,
1373
"InnoDB: Could not open or create data files.\n"
1374
"InnoDB: If you tried to add new data files, and it failed here,\n"
1375
"InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
1376
"InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
1377
"InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
1378
"InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
1379
"InnoDB: remove old data files which contain your precious data!\n");
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");
1381
1451
return((int) err);
1402
1472
if ((log_opened && create_new_db)
1403
1473
|| (log_opened && log_created)) {
1404
drizzled::errmsg_printf(drizzled::error::ERROR,
1405
"InnoDB: Error: all log files must be created at the same time.\n"
1406
"InnoDB: All log files must be created also in database creation.\n"
1407
"InnoDB: If you want bigger or smaller log files, shut down the\n"
1408
"InnoDB: database and make sure there were no errors in shutdown.\n"
1409
"InnoDB: Then delete the existing log files. Edit the .cnf file\n"
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"
1410
1485
"InnoDB: and start the database again.\n");
1412
1487
return(DB_ERROR);
1428
1503
|| max_arch_log_no != min_arch_log_no
1429
1504
#endif /* UNIV_LOG_ARCHIVE */
1431
drizzled::errmsg_printf(drizzled::error::ERROR,
1432
"InnoDB: Cannot initialize created log files because\n"
1433
"InnoDB: data files were not in sync with each other\n"
1507
"InnoDB: Cannot initialize created"
1508
" log files because\n"
1509
"InnoDB: data files were not in sync"
1510
" with each other\n"
1434
1511
"InnoDB: or the data files are corrupt.\n");
1436
1513
return(DB_ERROR);
1439
1516
if (max_flushed_lsn < (ib_uint64_t) 1000) {
1440
drizzled::errmsg_printf(drizzled::error::ERROR,
1441
"InnoDB: Cannot initialize created log files because\n"
1442
"InnoDB: data files are corrupt, or new data files were\n"
1443
"InnoDB: created when the database was started previous\n"
1444
"InnoDB: time but the database was not shut down\n"
1445
"InnoDB: normally after that.\n");
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");
1447
1528
return(DB_ERROR);
1482
1563
#ifdef UNIV_LOG_ARCHIVE
1483
1564
} else if (srv_archive_recovery) {
1484
drizzled::errmsg_printf(drizzled::error::INFO,
1485
"InnoDB: Starting archive recovery from a backup...");
1566
"InnoDB: Starting archive"
1567
" recovery from a backup...\n");
1486
1568
err = recv_recovery_from_archive_start(
1487
1569
min_flushed_lsn, srv_archive_recovery_limit_lsn,
1488
1570
min_arch_log_no);
1670
1748
os_thread_create(&srv_monitor_thread, NULL,
1671
1749
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
1673
/* Create the thread which automaticaly dumps/restore buffer pool */
1674
os_thread_create(&srv_LRU_dump_restore_thread, NULL,
1675
thread_ids + 5 + SRV_MAX_N_IO_THREADS);
1677
1751
srv_is_being_started = FALSE;
1679
1753
err = dict_create_or_check_foreign_constraint_tables();
1711
1785
if (!srv_auto_extend_last_data_file
1712
1786
&& sum_of_data_file_sizes != tablespace_size_in_header) {
1714
drizzled::errmsg_printf(drizzled::error::ERROR,
1715
"InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes is %lu pages.",
1716
(ulong) tablespace_size_in_header,
1717
(ulong) sum_of_data_file_sizes);
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);
1719
1795
if (srv_force_recovery == 0
1720
1796
&& sum_of_data_file_sizes < tablespace_size_in_header) {
1721
1797
/* This is a fatal error, the tail of a tablespace is
1724
drizzled::errmsg_printf(drizzled::error::ERROR,
1725
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
1726
"missing. Have you edited innodb_data_file_path in my.cnf in an "
1727
"inappropriate way, removing ibdata files from there? "
1728
"You can set innodb_force_recovery=1 in my.cnf to force "
1729
"a startup if you are trying to recover a badly corrupt database.");
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");
1731
1812
return(DB_ERROR);
1735
1816
if (srv_auto_extend_last_data_file
1736
1817
&& sum_of_data_file_sizes < tablespace_size_in_header) {
1738
drizzled::errmsg_printf(drizzled::error::ERROR,
1739
"InnoDB: Error: tablespace size stored in header is %lu pages, but the sum of data file sizes"
1740
" is only %lu pages\n",
1741
(ulong) tablespace_size_in_header,
1742
(ulong) sum_of_data_file_sizes);
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);
1744
1827
if (srv_force_recovery == 0) {
1746
drizzled::errmsg_printf(drizzled::error::ERROR,
1747
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is "
1748
"missing. Have you edited innodb_data_file_path in my.cnf in an "
1749
"inappropriate way, removing ibdata files from there? "
1750
"You can set innodb_force_recovery=1 in my.cnf to force "
1751
"a startup if you are trying to recover a badly corrupt database.\n");
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");
1753
1841
return(DB_ERROR);
1758
1846
os_fast_mutex_init(&srv_os_test_mutex);
1760
1848
if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
1761
drizzled::errmsg_printf(drizzled::error::ERROR,
1762
"InnoDB: Error: pthread_mutex_trylock returns an unexpected value on success! Cannot continue.\n");
1850
"InnoDB: Error: pthread_mutex_trylock returns"
1851
" an unexpected value on\n"
1852
"InnoDB: success! Cannot continue.\n");
1772
1862
os_fast_mutex_free(&srv_os_test_mutex);
1774
1864
if (srv_print_verbose_log) {
1775
drizzled::errmsg_printf(drizzled::error::INFO,
1776
"InnoDB %s started; log sequence number %"PRIu64"\n",
1777
INNODB_VERSION_STR, srv_start_lsn);
1865
ut_print_timestamp(stderr);
1867
" InnoDB %s started; "
1868
"log sequence number %"PRIu64"\n",
1869
INNODB_VERSION_STR, srv_start_lsn);
1780
1872
if (srv_force_recovery > 0) {
1781
drizzled::errmsg_printf(drizzled::error::ERROR,
1782
"InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
1783
(ulong) srv_force_recovery);
1874
"InnoDB: !!! innodb_force_recovery"
1875
" is set to %lu !!!\n",
1876
(ulong) srv_force_recovery);
1786
1881
if (trx_doublewrite_must_reset_space_ids) {
1787
1882
/* Actually, we did not change the undo log format between
1788
1883
4.0 and 4.1.1, and we would not need to run purge to
1797
1892
4.1.1. It is essential that the insert buffer is emptied
1800
drizzled::errmsg_printf(drizzled::error::INFO,
1801
"InnoDB: You are upgrading to an InnoDB version which allows multiple. "
1802
"tablespaces. Wait that purge and insert buffer merge run to completion...");
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");
1804
1902
os_thread_sleep(1000000);
1814
drizzled::errmsg_printf(drizzled::error::INFO,
1815
"InnoDB: Full purge and insert buffer merge completed.");
1913
"InnoDB: Full purge and insert buffer merge"
1817
1916
trx_sys_mark_upgraded_to_multiple_tablespaces();
1819
drizzled::errmsg_printf(drizzled::error::INFO,
1820
"InnoDB: You have now successfully upgraded"
1821
" to the multiple tablespaces\n"
1822
"InnoDB: format. You should NOT DOWNGRADE"
1823
" to an earlier version of\n"
1824
"InnoDB: InnoDB! But if you absolutely need to"
1826
"InnoDB: " REFMAN "multiple-tablespaces.html\n"
1827
"InnoDB: for instructions.\n");
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");
1830
1929
if (srv_force_recovery == 0) {
1856
1954
if (!srv_was_started) {
1857
1955
if (srv_is_being_started) {
1858
drizzled::errmsg_printf(drizzled::error::ERROR,
1859
"InnoDB: Warning: shutting down a not properly started or created database!");
1956
ut_print_timestamp(stderr);
1958
" InnoDB: Warning: shutting down"
1959
" a not properly started\n"
1960
"InnoDB: or created database!\n");
1862
1963
return(DB_SUCCESS);
1871
1972
if (srv_fast_shutdown == 2) {
1872
drizzled::errmsg_printf(drizzled::error::INFO,
1873
"InnoDB: MySQL has requested a very fast shutdown without flushing "
1874
"the InnoDB buffer pool to data files. At the next mysqld startup "
1875
"InnoDB will do a crash recovery!");
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");
1878
1982
logs_empty_and_mark_files_at_shutdown();
1880
1984
if (srv_conc_n_threads != 0) {
1881
drizzled::errmsg_printf(drizzled::error::WARN,
1882
"InnoDB: Warning: query counter shows %ld queries still InnoDB: inside InnoDB at shutdown.",
1883
srv_conc_n_threads);
1986
"InnoDB: Warning: query counter shows %ld queries"
1988
"InnoDB: inside InnoDB at shutdown\n",
1989
srv_conc_n_threads);
1886
1992
/* 2. Make all threads created by InnoDB to exit */
1945
2051
if (i == 1000) {
1946
drizzled::errmsg_printf(drizzled::error::WARN,
1947
"InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!",
2053
"InnoDB: Warning: %lu threads created by InnoDB"
2054
" had not exited at shutdown!\n",
1948
2055
(ulong) os_thread_count);
2010
2117
|| os_event_count != 0
2011
2118
|| os_mutex_count != 0
2012
2119
|| os_fast_mutex_count != 0) {
2013
drizzled::errmsg_printf(drizzled::error::WARN,
2014
"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
2015
"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
2016
(ulong) os_thread_count, (ulong) os_event_count,
2017
(ulong) os_mutex_count, (ulong) os_fast_mutex_count);
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);
2020
2129
if (dict_foreign_err_file) {
2027
2136
if (srv_print_verbose_log) {
2028
drizzled::errmsg_printf(drizzled::error::INFO,
2029
"InnoDB: Shutdown completed log sequence number %"PRIu64,
2137
ut_print_timestamp(stderr);
2139
" InnoDB: Shutdown completed;"
2140
" log sequence number %"PRIu64"\n",
2033
2144
srv_was_started = FALSE;