Advertisement
garrettboast

log-bin option for xtrabackup

Sep 27th, 2017
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.97 KB | None | 0 0
  1. commit bc64aaba916590eae0479f9cfd55db7d1889fe2d
  2. Author: Garrett <garrett@dbm1.db.aws.awebsitesomewhere.com>
  3. Date:   Fri Feb 12 17:31:01 2016 -0500
  4.  
  5.     Implement log-bin option for xtrabackup, grumble grumble
  6.  
  7. diff --git a/storage/innobase/xtrabackup/src/backup_mysql.cc b/storage/innobase/xtrabackup/src/backup_mysql.cc
  8. index 39d7425..ee9eabb 100644
  9. --- a/storage/innobase/xtrabackup/src/backup_mysql.cc
  10. +++ b/storage/innobase/xtrabackup/src/backup_mysql.cc
  11. @@ -1178,6 +1178,11 @@ write_current_binlog_file(MYSQL *connection)
  12.         read_mysql_variables(connection, "SHOW MASTER STATUS",
  13.             status_after_flush, false);
  14.  
  15. +       if (opt_bin_logname != NULL)
  16. +       {
  17. +           log_bin_dir = strdup(opt_bin_logname);
  18. +       }
  19. +
  20.         if (log_bin_dir == NULL) {
  21.             /* log_bin_basename does not exist in MariaDB,
  22.             fallback to datadir */
  23. diff --git a/storage/innobase/xtrabackup/src/innobackupex.cc b/storage/innobase/xtrabackup/src/innobackupex.cc
  24. index bba6305..88edc2e 100644
  25. --- a/storage/innobase/xtrabackup/src/innobackupex.cc
  26. +++ b/storage/innobase/xtrabackup/src/innobackupex.cc
  27. @@ -131,6 +131,7 @@ ulonglong ibx_xtrabackup_compress_chunk_size;
  28.  ulong ibx_xtrabackup_encrypt_algo;
  29.  char *ibx_xtrabackup_encrypt_key;
  30.  char *ibx_xtrabackup_encrypt_key_file;
  31. +char *ibx_xtrabackup_log_bin;
  32.  uint ibx_xtrabackup_encrypt_threads;
  33.  ulonglong ibx_xtrabackup_encrypt_chunk_size;
  34.  my_bool ibx_xtrabackup_export;
  35. @@ -221,6 +222,7 @@ enum innobackupex_options
  36.     OPT_ENCRYPT,
  37.     OPT_ENCRYPT_KEY,
  38.     OPT_ENCRYPT_KEY_FILE,
  39. +   OPT_LOG_BIN,
  40.     OPT_ENCRYPT_THREADS,
  41.     OPT_ENCRYPT_CHUNK_SIZE,
  42.     OPT_EXPORT,
  43. @@ -591,6 +593,11 @@ static struct my_option ibx_long_options[] =
  44.      (uchar*) &ibx_xtrabackup_encrypt_key_file, 0,
  45.      GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  46.  
  47. +   {"log-bin", OPT_LOG_BIN, "This option tells xtrabackup where to find the binary log directory because Percona, MySQL, and MariaDB are shit.",
  48. +    (uchar*) &ibx_xtrabackup_log_bin,
  49. +    (uchar*) &ibx_xtrabackup_log_bin, 0,
  50. +    GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  51. +
  52.     {"encrypt-threads", OPT_ENCRYPT_THREADS,
  53.      "This option specifies the number of worker threads that will be used "
  54.      "for parallel encryption. It is passed directly to the xtrabackup "
  55. @@ -761,6 +768,7 @@ SYNOPOSIS\n\
  56.  innobackupex [--compress] [--compress-threads=NUMBER-OF-THREADS] [--compress-chunk-size=CHUNK-SIZE]\n\
  57.               [--encrypt=ENCRYPTION-ALGORITHM] [--encrypt-threads=NUMBER-OF-THREADS] [--encrypt-chunk-size=CHUNK-SIZE]\n\
  58.               [--encrypt-key=LITERAL-ENCRYPTION-KEY] | [--encryption-key-file=MY.KEY]\n\
  59. +             [--log-bin=/path/to/bin]\n\
  60.               [--include=REGEXP] [--user=NAME]\n\
  61.               [--password=WORD] [--port=PORT] [--socket=SOCKET]\n\
  62.               [--no-timestamp] [--ibbackup=IBBACKUP-BINARY]\n\
  63. @@ -1039,6 +1047,7 @@ ibx_init()
  64.     xtrabackup_encrypt_algo = ibx_xtrabackup_encrypt_algo;
  65.     xtrabackup_encrypt_key = ibx_xtrabackup_encrypt_key;
  66.     xtrabackup_encrypt_key_file = ibx_xtrabackup_encrypt_key_file;
  67. +   opt_bin_logname = ibx_xtrabackup_log_bin;
  68.     xtrabackup_encrypt_threads = ibx_xtrabackup_encrypt_threads;
  69.     xtrabackup_encrypt_chunk_size = ibx_xtrabackup_encrypt_chunk_size;
  70.     xtrabackup_export = ibx_xtrabackup_export;
  71. diff --git a/storage/innobase/xtrabackup/src/xtrabackup.cc b/storage/innobase/xtrabackup/src/xtrabackup.cc
  72. index 559a8d2..b44bedb 100644
  73. --- a/storage/innobase/xtrabackup/src/xtrabackup.cc
  74. +++ b/storage/innobase/xtrabackup/src/xtrabackup.cc
  75. @@ -358,6 +358,7 @@ char *opt_incremental_history_uuid = NULL;
  76.  
  77.  char *opt_user = NULL;
  78.  char *opt_password = NULL;
  79. +char *opt_logbin = NULL;
  80.  char *opt_host = NULL;
  81.  char *opt_defaults_group = NULL;
  82.  char *opt_socket = NULL;
  83. @@ -579,6 +580,7 @@ enum options_xtrabackup
  84.    OPT_HOST,
  85.    OPT_PORT,
  86.    OPT_PASSWORD,
  87. +  OPT_LOGBIN,
  88.    OPT_SOCKET,
  89.    OPT_INCREMENTAL_HISTORY_NAME,
  90.    OPT_INCREMENTAL_HISTORY_UUID,
  91. @@ -1077,6 +1079,10 @@ Disable with --skip-innodb-doublewrite.", (G_PTR*) &innobase_use_doublewrite,
  92.     (uchar*) &opt_password, (uchar*) &opt_password, 0, GET_STR,
  93.     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  94.  
  95. +  {"log-bin", OPT_LOGBIN, "This option specifies the path to binary logs, because suck it Percona and MariaDB and Oracle",
  96. +   (uchar*) &opt_logbin,    (uchar*) &opt_logbin,  0, GET_STR,
  97. +   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  98. +
  99.    {"socket", OPT_SOCKET, "This option specifies the socket to use when "
  100.     "connecting to the local database server with a UNIX domain socket.  "
  101.     "The option accepts a string argument. See mysql --help for details.",
  102. diff --git a/storage/innobase/xtrabackup/src/xtrabackup.h b/storage/innobase/xtrabackup/src/xtrabackup.h
  103. index 7a7f1cb..f2d633a 100644
  104. --- a/storage/innobase/xtrabackup/src/xtrabackup.h
  105. +++ b/storage/innobase/xtrabackup/src/xtrabackup.h
  106. @@ -142,6 +142,7 @@ extern char     *opt_incremental_history_uuid;
  107.  
  108.  extern char        *opt_user;
  109.  extern char        *opt_password;
  110. +extern char        *opt_logbin;
  111.  extern char        *opt_host;
  112.  extern char        *opt_defaults_group;
  113.  extern char        *opt_socket;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement