| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 2019, 2026, Oracle and/or its affiliates. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify it under |
| 6 |
the terms of the GNU General Public License, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/**************************************************/ /** |
| 29 |
@file include/log0files_finder.h |
| 30 |
|
| 31 |
*******************************************************/ |
| 32 |
|
| 33 |
#ifndef log0files_finder_h |
| 34 |
#define log0files_finder_h |
| 35 |
|
| 36 |
#include <string> |
| 37 |
|
| 38 |
/* Log_files_dict */ |
| 39 |
#include "log0files_dict.h" |
| 40 |
|
| 41 |
/* Log_format, Log_flags */ |
| 42 |
#include "log0types.h" |
| 43 |
|
| 44 |
/** Result returned by the @see log_files_find_and_analyze(). */ |
| 45 |
enum class Log_files_find_result { |
| 46 |
/** We have found valid log files. */ |
| 47 |
FOUND_VALID_FILES, |
| 48 |
|
| 49 |
/** There were log files which have not been fully initialized. */ |
| 50 |
FOUND_UNINITIALIZED_FILES, |
| 51 |
|
| 52 |
/** There were no log files at all. */ |
| 53 |
FOUND_NO_FILES, |
| 54 |
|
| 55 |
/** Found valid log files, but discovered that some of the newest are missing. |
| 56 |
When this is reported, it means that the only reason why the FOUND_VALID_FILES |
| 57 |
was not returned, is that the newest found log file has been already marked as |
| 58 |
full. */ |
| 59 |
FOUND_VALID_FILES_BUT_MISSING_NEWEST, |
| 60 |
|
| 61 |
/** Found log files, but marked as "crash unsafe" (disabled redo) */ |
| 62 |
FOUND_DISABLED_FILES, |
| 63 |
|
| 64 |
/** Found log files, but structure is corrupted. */ |
| 65 |
FOUND_CORRUPTED_FILES, |
| 66 |
|
| 67 |
/** System error occurred when scanning files on disk. */ |
| 68 |
SYSTEM_ERROR |
| 69 |
}; |
| 70 |
|
| 71 |
/** Scans for existing log files on disk. Performs basic validation for the |
| 72 |
files that have been found. Clears and builds the Log_files_dict. Determines |
| 73 |
global properties of the redo log files: format, creator, flags and uuid. |
| 74 |
@param[in] read_only T: check file permissions only for reading, |
| 75 |
F: check for both reading and writing |
| 76 |
@param[in] encryption_metadata pointer to encryption metadata to be used by |
| 77 |
all redo log file IO operations except those |
| 78 |
related to the first LOG_FILE_HDR_SIZE bytes |
| 79 |
of each log file |
| 80 |
@see Log_file_handle::m_encryption_metadata |
| 81 |
@param[out] files dictionary of files that have been found |
| 82 |
when FOUND_VALID_FILES is returned; |
| 83 |
otherwise stays untouched |
| 84 |
@param[out] format discovered format of the redo log files |
| 85 |
@param[out] creator_name name of creator of the files |
| 86 |
@param[out] log_flags discovered flags of the redo log files |
| 87 |
@param[out] log_uuid discovered uuid of the redo log files |
| 88 |
@return result of the scan and validation - @see Log_files_find_result */ |
| 89 |
Log_files_find_result log_files_find_and_analyze( |
| 90 |
bool read_only, Encryption_metadata &encryption_metadata, |
| 91 |
Log_files_dict &files, Log_format &format, std::string &creator_name, |
| 92 |
Log_flags &log_flags, Log_uuid &log_uuid); |
| 93 |
|
| 94 |
#endif /* !log0files_finder_h */ |