| 1 |
# |
| 2 |
# Test the Redo-Log Archiving feature. File and directory permissions. |
| 3 |
# |
| 4 |
--source include/not_windows.inc |
| 5 |
|
| 6 |
--disable_query_log |
| 7 |
# When log-bin, skip-log-bin and binlog-format options are specified, mask the warning |
| 8 |
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* You need to use --log-bin to make --binlog-format work."); |
| 9 |
--enable_query_log |
| 10 |
|
| 11 |
--let $saved_dirs = `SELECT @@global.innodb_redo_log_archive_dirs` |
| 12 |
--let $SERVER_UUID = `SELECT @@global.server_uuid` |
| 13 |
--let $IRLA_FILENAME = archive.$SERVER_UUID.000001.log |
| 14 |
--let $IRLA_DIRECTORY_1 = $MYSQLTEST_VARDIR/log/redo_log_archive_1 |
| 15 |
--let $IRLA_PATHNAME_1 = $IRLA_DIRECTORY_1/$IRLA_FILENAME |
| 16 |
|
| 17 |
--echo # |
| 18 |
--echo # Show the original variable value (from -master.opt). |
| 19 |
--echo # |
| 20 |
SELECT @@global.innodb_redo_log_archive_dirs; |
| 21 |
--echo |
| 22 |
|
| 23 |
--echo # |
| 24 |
--echo # Try to start redo log archiving with that value. |
| 25 |
--echo # |
| 26 |
--error ER_INNODB_REDO_LOG_ARCHIVE_DIR_CLASH, ER_INNODB_REDO_LOG_ARCHIVE_DIR_PERMISSIONS |
| 27 |
DO innodb_redo_log_archive_start('command_line_label'); |
| 28 |
--echo |
| 29 |
|
| 30 |
--echo # |
| 31 |
--echo # Set innodb_redo_log_archive_dirs for the following tests. |
| 32 |
--echo # |
| 33 |
--replace_result $IRLA_DIRECTORY_1 IRLA_DIRECTORY_1 |
| 34 |
eval SET @@global.innodb_redo_log_archive_dirs = 'label1:$IRLA_DIRECTORY_1'; |
| 35 |
--mkdir $IRLA_DIRECTORY_1 |
| 36 |
--echo |
| 37 |
|
| 38 |
--echo # |
| 39 |
--echo # Directory with world permissions |
| 40 |
--echo # |
| 41 |
--exec chmod o+rx $IRLA_DIRECTORY_1 |
| 42 |
--replace_result $IRLA_DIRECTORY_1 IRLA_DIRECTORY_1 |
| 43 |
--error ER_INNODB_REDO_LOG_ARCHIVE_DIR_PERMISSIONS |
| 44 |
DO innodb_redo_log_archive_start('label1'); |
| 45 |
--exec chmod o= $IRLA_DIRECTORY_1 |
| 46 |
--echo |
| 47 |
|
| 48 |
--echo # |
| 49 |
--echo # Redo log archive file is read-only. No world permissions |
| 50 |
--echo # |
| 51 |
DO innodb_redo_log_archive_start('label1'); |
| 52 |
--echo # |
| 53 |
--echo # Check the redo log archive file for existence and permissions. |
| 54 |
--echo # |
| 55 |
--file_exists $IRLA_PATHNAME_1 |
| 56 |
|
| 57 |
--let _INPUT_FILE_ = $IRLA_PATHNAME_1 |
| 58 |
--source include/get_file_permissions.inc |
| 59 |
--source $MYSQL_TMP_DIR/permissions.inc |
| 60 |
--remove_file $MYSQL_TMP_DIR/permissions.inc |
| 61 |
--let $assert_cond= $FILE_PERMISSIONS= 440 |
| 62 |
--let $assert_text= File permissions should be equal to 440 |
| 63 |
--source include/assert.inc |
| 64 |
--let _INPUT_FILE_ = |
| 65 |
|
| 66 |
--echo # |
| 67 |
--echo # Stop redo log archiving. |
| 68 |
--echo # |
| 69 |
DO innodb_redo_log_archive_stop(); |
| 70 |
--echo # |
| 71 |
--echo # Check the redo log archive file again. |
| 72 |
--echo # |
| 73 |
--file_exists $IRLA_PATHNAME_1 |
| 74 |
|
| 75 |
--let _INPUT_FILE_ = $IRLA_PATHNAME_1 |
| 76 |
--source include/get_file_permissions.inc |
| 77 |
--source $MYSQL_TMP_DIR/permissions.inc |
| 78 |
--remove_file $MYSQL_TMP_DIR/permissions.inc |
| 79 |
--let $assert_cond= $FILE_PERMISSIONS= 440 |
| 80 |
--let $assert_text= File permissions should be equal to 440 |
| 81 |
--source include/assert.inc |
| 82 |
--let _INPUT_FILE_ = |
| 83 |
|
| 84 |
--echo # |
| 85 |
--echo # Remove the redo log archive file. |
| 86 |
--echo # |
| 87 |
--remove_file $IRLA_PATHNAME_1 |
| 88 |
--echo |
| 89 |
|
| 90 |
--echo # |
| 91 |
--echo # Cleanup |
| 92 |
--echo # |
| 93 |
--rmdir $IRLA_DIRECTORY_1 |
| 94 |
eval SET @@global.innodb_redo_log_archive_dirs = '$saved_dirs'; |