@@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB
4
4
Originally Created 3/3/2009 Yasufumi Kinoshita
5
5
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
6
6
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
7
- (c) 2017, MariaDB Corporation.
7
+ (c) 2017, 2018, MariaDB Corporation.
8
8
Portions written by Marko Mäkelä.
9
9
10
10
This program is free software; you can redistribute it and/or modify
@@ -223,7 +223,6 @@ long innobase_buffer_pool_awe_mem_mb = 0;
223
223
long innobase_file_io_threads = 4 ;
224
224
long innobase_read_io_threads = 4 ;
225
225
long innobase_write_io_threads = 4 ;
226
- long innobase_log_buffer_size = 1024 *1024L ;
227
226
228
227
longlong innobase_page_size = (1LL << 14 ); /* 16KB */
229
228
char * innobase_buffer_pool_filename = NULL ;
@@ -236,9 +235,6 @@ are determined in innobase_init below: */
236
235
static char * innobase_ignored_opt;
237
236
char * innobase_data_home_dir;
238
237
char * 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;
242
238
243
239
my_bool innobase_use_doublewrite;
244
240
my_bool innobase_use_large_pages;
@@ -621,13 +617,9 @@ enum options_xtrabackup
621
617
OPT_INNODB_ADAPTIVE_HASH_INDEX,
622
618
OPT_INNODB_DOUBLEWRITE,
623
619
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,
627
620
OPT_INNODB_LOG_GROUP_HOME_DIR,
628
621
OPT_INNODB_MAX_DIRTY_PAGES_PCT,
629
622
OPT_INNODB_MAX_PURGE_LAG,
630
- OPT_INNODB_ROLLBACK_ON_TIMEOUT,
631
623
OPT_INNODB_STATUS_FILE,
632
624
OPT_INNODB_AUTOEXTEND_INCREMENT,
633
625
OPT_INNODB_BUFFER_POOL_SIZE,
@@ -1127,15 +1119,10 @@ struct my_option xb_server_options[] =
1127
1119
(G_PTR*) &innobase_file_per_table, 0 , GET_BOOL, NO_ARG,
1128
1120
FALSE , 0 , 0 , 0 , 0 , 0 },
1129
1121
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
-
1135
1122
{" innodb_log_buffer_size" , OPT_INNODB_LOG_BUFFER_SIZE,
1136
1123
" 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 },
1139
1126
{" innodb_log_file_size" , OPT_INNODB_LOG_FILE_SIZE,
1140
1127
" Ignored for mysqld option compatibility" ,
1141
1128
(G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0 ,
@@ -1479,11 +1466,6 @@ xb_get_one_option(int optid,
1479
1466
case OPT_INNODB_LOG_FILE_SIZE:
1480
1467
break ;
1481
1468
1482
- case OPT_INNODB_FLUSH_METHOD:
1483
-
1484
- ADD_PRINT_PARAM_OPT (innobase_unix_file_flush_method);
1485
- break ;
1486
-
1487
1469
case OPT_INNODB_PAGE_SIZE:
1488
1470
1489
1471
ADD_PRINT_PARAM_OPT (innobase_page_size);
@@ -1587,15 +1569,14 @@ xb_get_one_option(int optid,
1587
1569
return 0 ;
1588
1570
}
1589
1571
1590
- static my_bool
1591
- innodb_init_param (void )
1572
+ static bool innodb_init_param ()
1592
1573
{
1593
1574
srv_is_being_started = TRUE ;
1594
1575
/* === some variables from mysqld === */
1595
1576
memset ((G_PTR) &mysql_tmpdir_list, 0 , sizeof (mysql_tmpdir_list));
1596
1577
1597
1578
if (init_tmpdir (&mysql_tmpdir_list, opt_mysql_tmpdir))
1598
- exit (EXIT_FAILURE) ;
1579
+ return true ;
1599
1580
xtrabackup_tmpdir = my_tmpdir (&mysql_tmpdir_list);
1600
1581
/* dummy for initialize all_charsets[] */
1601
1582
get_charset_name (0 );
@@ -1617,7 +1598,7 @@ innodb_init_param(void)
1617
1598
} else {
1618
1599
msg (" InnoDB: Error: invalid value of "
1619
1600
" innobase_page_size: %lld" , innobase_page_size);
1620
- exit (EXIT_FAILURE) ;
1601
+ goto error ;
1621
1602
}
1622
1603
} else {
1623
1604
srv_page_size_shift = 14 ;
@@ -1684,6 +1665,9 @@ innodb_init_param(void)
1684
1665
goto error;
1685
1666
}
1686
1667
1668
+ srv_sys_space.normalize_size ();
1669
+ srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift);
1670
+
1687
1671
/* -------------- Log files ---------------------------*/
1688
1672
1689
1673
/* The default dir for log files is the datadir of MySQL */
@@ -1707,16 +1691,13 @@ innodb_init_param(void)
1707
1691
1708
1692
srv_adaptive_flushing = FALSE ;
1709
1693
1710
- srv_file_flush_method_str = innobase_unix_file_flush_method;
1711
-
1712
- srv_log_buffer_size = (ulint) innobase_log_buffer_size;
1713
-
1714
1694
/* We set srv_pool_size here in units of 1 kB. InnoDB internally
1715
1695
changes the value so that it becomes the number of database pages. */
1716
1696
1717
1697
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
1718
1698
srv_buf_pool_chunk_unit = (ulong)srv_buf_pool_size;
1719
1699
srv_buf_pool_instances = 1 ;
1700
+ srv_n_page_cleaners = 1 ;
1720
1701
1721
1702
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
1722
1703
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
@@ -1732,7 +1713,7 @@ innodb_init_param(void)
1732
1713
1733
1714
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
1734
1715
1735
- srv_max_n_open_files = ULINT_UNDEFINED;
1716
+ srv_max_n_open_files = ULINT_UNDEFINED - 5 ;
1736
1717
srv_innodb_status = (ibool) innobase_create_status_file;
1737
1718
1738
1719
srv_print_verbose_log = 1 ;
@@ -1743,20 +1724,7 @@ innodb_init_param(void)
1743
1724
/* We cannot treat characterset here for now!! */
1744
1725
data_mysql_default_charset_coll = (ulint)default_charset_info->number ;
1745
1726
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 );
1760
1728
1761
1729
#ifdef _WIN32
1762
1730
srv_use_native_aio = TRUE ;
@@ -1789,16 +1757,27 @@ innodb_init_param(void)
1789
1757
? log_block_calc_checksum_crc32
1790
1758
: log_block_calc_checksum_none;
1791
1759
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 ;
1793
1765
1794
1766
error:
1795
1767
msg (" mariabackup: innodb_init_param(): Error occured.\n " );
1796
- return ( TRUE ) ;
1768
+ return true ;
1797
1769
}
1798
1770
1799
1771
static bool innodb_init ()
1800
1772
{
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
+
1802
1781
if (err != DB_SUCCESS) {
1803
1782
msg (" mariabackup: innodb_init() returned %d (%s).\n " ,
1804
1783
err, ut_strerr (err));
@@ -3583,19 +3562,6 @@ open_or_create_log_file(
3583
3562
return (DB_SUCCESS);
3584
3563
}
3585
3564
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
-
3599
3565
/* **********************************************************************
3600
3566
Set the open files limit. Based on set_max_open_files().
3601
3567
@@ -3805,42 +3771,6 @@ xtrabackup_backup_func()
3805
3771
return (false );
3806
3772
}
3807
3773
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
-
3844
3774
if (srv_buf_pool_size >= 1000 * 1024 * 1024 ) {
3845
3775
/* Here we still have srv_pool_size counted
3846
3776
in kilobytes (in 4.0 this was in bytes)
@@ -5002,7 +4932,6 @@ xtrabackup_prepare_func(char** argv)
5002
4932
goto error_cleanup;
5003
4933
}
5004
4934
5005
- xb_normalize_init_values ();
5006
4935
sync_check_init ();
5007
4936
ut_d (sync_check_enable ());
5008
4937
ut_crc32_init ();
0 commit comments