@@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB
44Originally Created 3/3/2009 Yasufumi Kinoshita
55Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
66Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
7- (c) 2017, MariaDB Corporation.
7+ (c) 2017, 2018, MariaDB Corporation.
88Portions written by Marko Mäkelä.
99
1010This program is free software; you can redistribute it and/or modify
@@ -223,7 +223,6 @@ long innobase_buffer_pool_awe_mem_mb = 0;
223223long innobase_file_io_threads = 4 ;
224224long innobase_read_io_threads = 4 ;
225225long innobase_write_io_threads = 4 ;
226- long innobase_log_buffer_size = 1024 *1024L ;
227226
228227longlong innobase_page_size = (1LL << 14 ); /* 16KB */
229228char * innobase_buffer_pool_filename = NULL ;
@@ -236,9 +235,6 @@ are determined in innobase_init below: */
236235static char * innobase_ignored_opt;
237236char * innobase_data_home_dir;
238237char * innobase_data_file_path;
239- /* The following has a misleading name: starting from 4.0.5, this also
240- affects Windows: */
241- char * innobase_unix_file_flush_method;
242238
243239my_bool innobase_use_doublewrite;
244240my_bool innobase_use_large_pages;
@@ -621,13 +617,9 @@ enum options_xtrabackup
621617 OPT_INNODB_ADAPTIVE_HASH_INDEX,
622618 OPT_INNODB_DOUBLEWRITE,
623619 OPT_INNODB_FILE_PER_TABLE,
624- OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
625- OPT_INNODB_FLUSH_METHOD,
626- OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
627620 OPT_INNODB_LOG_GROUP_HOME_DIR,
628621 OPT_INNODB_MAX_DIRTY_PAGES_PCT,
629622 OPT_INNODB_MAX_PURGE_LAG,
630- OPT_INNODB_ROLLBACK_ON_TIMEOUT,
631623 OPT_INNODB_STATUS_FILE,
632624 OPT_INNODB_AUTOEXTEND_INCREMENT,
633625 OPT_INNODB_BUFFER_POOL_SIZE,
@@ -1127,15 +1119,10 @@ struct my_option xb_server_options[] =
11271119 (G_PTR*) &innobase_file_per_table, 0 , GET_BOOL, NO_ARG,
11281120 FALSE , 0 , 0 , 0 , 0 , 0 },
11291121
1130- {" innodb_flush_method" , OPT_INNODB_FLUSH_METHOD,
1131- " With which method to flush data." , (G_PTR*) &innobase_unix_file_flush_method,
1132- (G_PTR*) &innobase_unix_file_flush_method, 0 , GET_STR, REQUIRED_ARG, 0 , 0 , 0 ,
1133- 0 , 0 , 0 },
1134-
11351122 {" innodb_log_buffer_size" , OPT_INNODB_LOG_BUFFER_SIZE,
11361123 " The size of the buffer which InnoDB uses to write log to the log files on disk." ,
1137- (G_PTR*) &innobase_log_buffer_size , (G_PTR*) &innobase_log_buffer_size , 0 ,
1138- GET_LONG , REQUIRED_ARG, 1024 *1024L , 256 *1024L , LONG_MAX, 0 , 1024 , 0 },
1124+ (G_PTR*) &srv_log_buffer_size , (G_PTR*) &srv_log_buffer_size , 0 ,
1125+ GET_ULONG , REQUIRED_ARG, 1024 *1024L , 256 *1024L , LONG_MAX, 0 , 1024 , 0 },
11391126 {" innodb_log_file_size" , OPT_INNODB_LOG_FILE_SIZE,
11401127 " Ignored for mysqld option compatibility" ,
11411128 (G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0 ,
@@ -1479,11 +1466,6 @@ xb_get_one_option(int optid,
14791466 case OPT_INNODB_LOG_FILE_SIZE:
14801467 break ;
14811468
1482- case OPT_INNODB_FLUSH_METHOD:
1483-
1484- ADD_PRINT_PARAM_OPT (innobase_unix_file_flush_method);
1485- break ;
1486-
14871469 case OPT_INNODB_PAGE_SIZE:
14881470
14891471 ADD_PRINT_PARAM_OPT (innobase_page_size);
@@ -1587,15 +1569,14 @@ xb_get_one_option(int optid,
15871569 return 0 ;
15881570}
15891571
1590- static my_bool
1591- innodb_init_param (void )
1572+ static bool innodb_init_param ()
15921573{
15931574srv_is_being_started = TRUE ;
15941575/* === some variables from mysqld === */
15951576memset ((G_PTR) &mysql_tmpdir_list, 0 , sizeof (mysql_tmpdir_list));
15961577
15971578if (init_tmpdir (&mysql_tmpdir_list, opt_mysql_tmpdir))
1598- exit (EXIT_FAILURE) ;
1579+ return true ;
15991580xtrabackup_tmpdir = my_tmpdir (&mysql_tmpdir_list);
16001581/* dummy for initialize all_charsets[] */
16011582get_charset_name (0 );
@@ -1617,7 +1598,7 @@ innodb_init_param(void)
16171598} else {
16181599msg (" InnoDB: Error: invalid value of "
16191600 " innobase_page_size: %lld" , innobase_page_size);
1620- exit (EXIT_FAILURE) ;
1601+ goto error ;
16211602}
16221603} else {
16231604srv_page_size_shift = 14 ;
@@ -1684,6 +1665,9 @@ innodb_init_param(void)
16841665goto error;
16851666}
16861667
1668+ srv_sys_space.normalize_size ();
1669+ srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift);
1670+
16871671/* -------------- Log files ---------------------------*/
16881672
16891673/* The default dir for log files is the datadir of MySQL */
@@ -1707,16 +1691,13 @@ innodb_init_param(void)
17071691
17081692srv_adaptive_flushing = FALSE ;
17091693
1710- srv_file_flush_method_str = innobase_unix_file_flush_method;
1711-
1712- srv_log_buffer_size = (ulint) innobase_log_buffer_size;
1713-
17141694 /* We set srv_pool_size here in units of 1 kB. InnoDB internally
17151695 changes the value so that it becomes the number of database pages. */
17161696
17171697srv_buf_pool_size = (ulint) xtrabackup_use_memory;
17181698srv_buf_pool_chunk_unit = (ulong)srv_buf_pool_size;
17191699srv_buf_pool_instances = 1 ;
1700+ srv_n_page_cleaners = 1 ;
17201701
17211702srv_n_file_io_threads = (ulint) innobase_file_io_threads;
17221703srv_n_read_io_threads = (ulint) innobase_read_io_threads;
@@ -1732,7 +1713,7 @@ innodb_init_param(void)
17321713
17331714 srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
17341715
1735- srv_max_n_open_files = ULINT_UNDEFINED;
1716+ srv_max_n_open_files = ULINT_UNDEFINED - 5 ;
17361717srv_innodb_status = (ibool) innobase_create_status_file;
17371718
17381719srv_print_verbose_log = 1 ;
@@ -1743,20 +1724,7 @@ innodb_init_param(void)
17431724/* We cannot treat characterset here for now!! */
17441725data_mysql_default_charset_coll = (ulint)default_charset_info->number ;
17451726
1746- ut_a (DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number );
1747-
1748- // innobase_commit_concurrency_init_default();
1749-
1750- /* Since we in this module access directly the fields of a trx
1751- struct, and due to different headers and flags it might happen that
1752- mutex_t has a different size in this module and in InnoDB
1753- modules, we check at run time that the size is the same in
1754- these compilation modules. */
1755-
1756- /* On 5.5+ srv_use_native_aio is TRUE by default. It is later reset
1757- if it is not supported by the platform in
1758- innobase_start_or_create_for_mysql(). As we don't call it in xtrabackup,
1759- we have to duplicate checks from that function here. */
1727+ ut_ad (DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number );
17601728
17611729#ifdef _WIN32
17621730srv_use_native_aio = TRUE ;
@@ -1789,16 +1757,27 @@ innodb_init_param(void)
17891757? log_block_calc_checksum_crc32
17901758: log_block_calc_checksum_none;
17911759
1792- return (FALSE );
1760+ #ifdef _WIN32
1761+ srv_use_native_aio = TRUE ;
1762+ #endif
1763+ srv_file_flush_method = IF_WIN (SRV_ALL_O_DIRECT_FSYNC, SRV_FSYNC);
1764+ return false ;
17931765
17941766error:
17951767msg (" mariabackup: innodb_init_param(): Error occured.\n " );
1796- return ( TRUE ) ;
1768+ return true ;
17971769}
17981770
17991771static bool innodb_init ()
18001772{
1801- dberr_t err = innobase_start_or_create_for_mysql ();
1773+ bool create_new_db = false ;
1774+ /* Check if the data files exist or not. */
1775+ dberr_t err = srv_sys_space.check_file_spec (&create_new_db, 5U << 20 );
1776+
1777+ if (err == DB_SUCCESS) {
1778+ err = srv_start (create_new_db);
1779+ }
1780+
18021781if (err != DB_SUCCESS) {
18031782msg (" mariabackup: innodb_init() returned %d (%s).\n " ,
18041783 err, ut_strerr (err));
@@ -3583,19 +3562,6 @@ open_or_create_log_file(
35833562return (DB_SUCCESS);
35843563}
35853564
3586- /* ********************************************************************/ /* *
3587- Normalizes init parameter values to use units we use inside InnoDB.
3588- @return DB_SUCCESS or error code */
3589- static
3590- void
3591- xb_normalize_init_values (void )
3592- /* ==========================*/
3593- {
3594- srv_sys_space.normalize ();
3595- srv_log_buffer_size >>= srv_page_size_shift;
3596- srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift);
3597- }
3598-
35993565/* **********************************************************************
36003566Set the open files limit. Based on set_max_open_files().
36013567
@@ -3805,42 +3771,6 @@ xtrabackup_backup_func()
38053771return (false );
38063772}
38073773
3808- xb_normalize_init_values ();
3809-
3810-
3811- if (srv_file_flush_method_str == NULL ) {
3812- /* These are the default options */
3813- srv_file_flush_method = SRV_FSYNC;
3814- } else if (0 == ut_strcmp (srv_file_flush_method_str, " fsync" )) {
3815- srv_file_flush_method = SRV_FSYNC;
3816- } else if (0 == ut_strcmp (srv_file_flush_method_str, " O_DSYNC" )) {
3817- srv_file_flush_method = SRV_O_DSYNC;
3818-
3819- } else if (0 == ut_strcmp (srv_file_flush_method_str, " O_DIRECT" )) {
3820- srv_file_flush_method = SRV_O_DIRECT;
3821- msg (" mariabackup: using O_DIRECT\n " );
3822- } else if (0 == ut_strcmp (srv_file_flush_method_str, " littlesync" )) {
3823- srv_file_flush_method = SRV_LITTLESYNC;
3824- } else if (0 == ut_strcmp (srv_file_flush_method_str, " nosync" )) {
3825- srv_file_flush_method = SRV_NOSYNC;
3826- } else if (0 == ut_strcmp (srv_file_flush_method_str, " ALL_O_DIRECT" )) {
3827- srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC;
3828- msg (" mariabackup: using ALL_O_DIRECT\n " );
3829- } else if (0 == ut_strcmp (srv_file_flush_method_str,
3830- " O_DIRECT_NO_FSYNC" )) {
3831- srv_file_flush_method = SRV_O_DIRECT_NO_FSYNC;
3832- msg (" mariabackup: using O_DIRECT_NO_FSYNC\n " );
3833- } else {
3834- msg (" mariabackup: Unrecognized value %s for "
3835- " innodb_flush_method\n " , srv_file_flush_method_str);
3836- goto fail;
3837- }
3838-
3839- #ifdef _WIN32
3840- srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC;
3841- srv_use_native_aio = TRUE ;
3842- #endif
3843-
38443774if (srv_buf_pool_size >= 1000 * 1024 * 1024 ) {
38453775 /* Here we still have srv_pool_size counted
38463776 in kilobytes (in 4.0 this was in bytes)
@@ -5002,7 +4932,6 @@ xtrabackup_prepare_func(char** argv)
50024932goto error_cleanup;
50034933}
50044934
5005- xb_normalize_init_values ();
50064935sync_check_init ();
50074936ut_d (sync_check_enable ());
50084937ut_crc32_init ();
0 commit comments