Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d67ea815
Commit
d67ea815
authored
Oct 28, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename LOG_HEADER_FORMAT_ to log_t::FORMAT_
parent
8f46e383
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
44 deletions
+44
-44
storage/innobase/include/log0log.h
storage/innobase/include/log0log.h
+24
-23
storage/innobase/log/log0crypt.cc
storage/innobase/log/log0crypt.cc
+2
-2
storage/innobase/log/log0log.cc
storage/innobase/log/log0log.cc
+3
-4
storage/innobase/log/log0recv.cc
storage/innobase/log/log0recv.cc
+11
-11
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+4
-4
No files found.
storage/innobase/include/log0log.h
View file @
d67ea815
...
...
@@ -405,7 +405,7 @@ extern my_bool innodb_log_checksums;
#define LOG_BLOCK_KEY 4
/* encryption key version
before LOG_BLOCK_CHECKSUM;
in
LOG_HEADER_
FORMAT_ENC_10_4 only */
in
log_t::
FORMAT_ENC_10_4 only */
#define LOG_BLOCK_CHECKSUM 4
/* 4 byte checksum of the log block
contents; in InnoDB versions
< 3.23.52 this did not contain the
...
...
@@ -461,23 +461,6 @@ or the MySQL version that created the redo log file. */
IB_TO_STR(MYSQL_VERSION_MINOR) "." \
IB_TO_STR(MYSQL_VERSION_PATCH)
/** The original (not version-tagged) InnoDB redo log format */
#define LOG_HEADER_FORMAT_3_23 0
/** The MySQL 5.7.9/MariaDB 10.2.2 log format */
#define LOG_HEADER_FORMAT_10_2 1
/** The MariaDB 10.3.2 log format.
To prevent crash-downgrade to earlier 10.2 due to the inability to
roll back a retroactively introduced TRX_UNDO_RENAME_TABLE undo log record,
MariaDB 10.2.18 and later will use the 10.3 format, but LOG_HEADER_SUBFORMAT
1 instead of 0. MariaDB 10.3 will use subformat 0 (5.7-style TRUNCATE) or 2
(MDEV-13564 backup-friendly TRUNCATE). */
#define LOG_HEADER_FORMAT_10_3 103
#define LOG_HEADER_FORMAT_10_4 104
/** The MariaDB 10.4.0 log format (only with innodb_encrypt_log=ON) */
#define LOG_HEADER_FORMAT_ENC_10_4 (104U | 1U << 31)
/** Encrypted MariaDB redo log */
#define LOG_HEADER_FORMAT_ENCRYPTED (1U<<31)
/* @} */
#define LOG_CHECKPOINT_1 OS_FILE_LOG_BLOCK_SIZE
...
...
@@ -502,6 +485,24 @@ typedef ib_mutex_t FlushOrderMutex;
/** Redo log buffer */
struct
log_t
{
/** The original (not version-tagged) InnoDB redo log format */
static
constexpr
uint32_t
FORMAT_3_23
=
0
;
/** The MySQL 5.7.9/MariaDB 10.2.2 log format */
static
constexpr
uint32_t
FORMAT_10_2
=
1
;
/** The MariaDB 10.3.2 log format.
To prevent crash-downgrade to earlier 10.2 due to the inability to
roll back a retroactively introduced TRX_UNDO_RENAME_TABLE undo log record,
MariaDB 10.2.18 and later will use the 10.3 format, but LOG_HEADER_SUBFORMAT
1 instead of 0. MariaDB 10.3 will use subformat 0 (5.7-style TRUNCATE) or 2
(MDEV-13564 backup-friendly TRUNCATE). */
static
constexpr
uint32_t
FORMAT_10_3
=
103
;
/** The MariaDB 10.4.0 log format. */
static
constexpr
uint32_t
FORMAT_10_4
=
104
;
/** Encrypted MariaDB redo log */
static
constexpr
uint32_t
FORMAT_ENCRYPTED
=
1U
<<
31
;
/** The MariaDB 10.4.0 log format (only with innodb_encrypt_log=ON) */
static
constexpr
uint32_t
FORMAT_ENC_10_4
=
FORMAT_10_4
|
FORMAT_ENCRYPTED
;
MY_ALIGNED
(
CACHE_LINE_SIZE
)
lsn_t
lsn
;
/*!< log sequence number */
ulong
buf_free
;
/*!< first free offset within the log
...
...
@@ -550,7 +551,7 @@ struct log_t{
struct
files
{
/** number of files */
ulint
n_files
;
/** format of the redo log: e.g.,
LOG_HEADER_
FORMAT_10_4 */
/** format of the redo log: e.g., FORMAT_10_4 */
uint32_t
format
;
/** redo log subformat: 0 with separately logged TRUNCATE,
2 with fully redo-logged TRUNCATE (1 in MariaDB 10.2) */
...
...
@@ -568,7 +569,7 @@ struct log_t{
lsn_t
scanned_lsn
;
/** @return whether the redo log is encrypted */
bool
is_encrypted
()
const
{
return
format
&
LOG_HEADER_
FORMAT_ENCRYPTED
;
}
bool
is_encrypted
()
const
{
return
format
&
FORMAT_ENCRYPTED
;
}
/** @return capacity in bytes */
lsn_t
capacity
()
const
{
return
(
file_size
-
LOG_FILE_HDR_SIZE
)
*
n_files
;
}
/** Calculate the offset of a log sequence number.
...
...
@@ -711,14 +712,14 @@ struct log_t{
/** @return the log block header + trailer size */
unsigned
framing_size
()
const
{
return
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
return
log
.
format
==
FORMAT_ENC_10_4
?
LOG_BLOCK_HDR_SIZE
+
LOG_BLOCK_KEY
+
LOG_BLOCK_CHECKSUM
:
LOG_BLOCK_HDR_SIZE
+
LOG_BLOCK_CHECKSUM
;
}
/** @return the log block payload size */
unsigned
payload_size
()
const
{
return
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
return
log
.
format
==
FORMAT_ENC_10_4
?
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_HDR_SIZE
-
LOG_BLOCK_CHECKSUM
-
LOG_BLOCK_KEY
:
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_HDR_SIZE
-
LOG_BLOCK_CHECKSUM
;
...
...
@@ -726,7 +727,7 @@ struct log_t{
/** @return the log block trailer offset */
unsigned
trailer_offset
()
const
{
return
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
return
log
.
format
==
FORMAT_ENC_10_4
?
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_CHECKSUM
-
LOG_BLOCK_KEY
:
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_CHECKSUM
;
}
...
...
storage/innobase/log/log0crypt.cc
View file @
d67ea815
...
...
@@ -173,10 +173,10 @@ bool log_crypt(byte* buf, lsn_t lsn, ulint size, log_crypt_t op)
byte
*
key_ver
=
&
buf
[
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_KEY
-
LOG_BLOCK_CHECKSUM
];
const
uint
dst_size
=
log_sys
.
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
=
log_sys
.
log
.
format
==
log_t
::
FORMAT_ENC_10_4
?
sizeof
dst
-
LOG_BLOCK_KEY
:
sizeof
dst
;
if
(
log_sys
.
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
)
{
if
(
log_sys
.
log
.
format
==
log_t
::
FORMAT_ENC_10_4
)
{
const
uint
key_version
=
info
.
key_version
;
switch
(
op
)
{
case
LOG_ENCRYPT_ROTATE_KEY
:
...
...
storage/innobase/log/log0log.cc
View file @
d67ea815
...
...
@@ -601,8 +601,7 @@ void log_t::files::create(ulint n_files)
ut_ad
(
log_sys
.
is_initialised
());
this
->
n_files
=
n_files
;
format
=
srv_encrypt_log
?
LOG_HEADER_FORMAT_ENC_10_4
:
LOG_HEADER_FORMAT_10_4
;
format
=
srv_encrypt_log
?
log_t
::
FORMAT_ENC_10_4
:
log_t
::
FORMAT_10_4
;
subformat
=
2
;
file_size
=
srv_log_file_size
;
lsn
=
LOG_START_LSN
;
...
...
@@ -624,8 +623,8 @@ log_file_header_flush(
ut_ad
(
log_write_mutex_own
());
ut_ad
(
!
recv_no_log_write
);
ut_a
(
nth_file
<
log_sys
.
log
.
n_files
);
ut_ad
(
log_sys
.
log
.
format
==
LOG_HEADER_
FORMAT_10_4
||
log_sys
.
log
.
format
==
LOG_HEADER_
FORMAT_ENC_10_4
);
ut_ad
(
log_sys
.
log
.
format
==
log_t
::
FORMAT_10_4
||
log_sys
.
log
.
format
==
log_t
::
FORMAT_ENC_10_4
);
// man 2 open suggests this buffer to be aligned by 512 for O_DIRECT
MY_ALIGNED
(
OS_FILE_LOG_BLOCK_SIZE
)
...
...
storage/innobase/log/log0recv.cc
View file @
d67ea815
...
...
@@ -1221,10 +1221,10 @@ recv_find_max_checkpoint(ulint* max_field)
/* Check the header page checksum. There was no
checksum in the first redo log format (version 0). */
log_sys
.
log
.
format
=
mach_read_from_4
(
buf
+
LOG_HEADER_FORMAT
);
log_sys
.
log
.
subformat
=
log_sys
.
log
.
format
!=
LOG_HEADER_
FORMAT_3_23
log_sys
.
log
.
subformat
=
log_sys
.
log
.
format
!=
log_t
::
FORMAT_3_23
?
mach_read_from_4
(
buf
+
LOG_HEADER_SUBFORMAT
)
:
0
;
if
(
log_sys
.
log
.
format
!=
LOG_HEADER_
FORMAT_3_23
if
(
log_sys
.
log
.
format
!=
log_t
::
FORMAT_3_23
&&
!
recv_check_log_header_checksum
(
buf
))
{
ib
::
error
()
<<
"Invalid redo log header checksum."
;
return
(
DB_CORRUPTION
);
...
...
@@ -1237,14 +1237,14 @@ recv_find_max_checkpoint(ulint* max_field)
creator
[
LOG_HEADER_CREATOR_END
-
LOG_HEADER_CREATOR
]
=
0
;
switch
(
log_sys
.
log
.
format
)
{
case
LOG_HEADER_
FORMAT_3_23
:
case
log_t
:
:
FORMAT_3_23
:
return
(
recv_find_max_checkpoint_0
(
max_field
));
case
LOG_HEADER_
FORMAT_10_2
:
case
LOG_HEADER_FORMAT_10_2
|
LOG_HEADER_
FORMAT_ENCRYPTED
:
case
LOG_HEADER_
FORMAT_10_3
:
case
LOG_HEADER_FORMAT_10_3
|
LOG_HEADER_
FORMAT_ENCRYPTED
:
case
LOG_HEADER_
FORMAT_10_4
:
case
LOG_HEADER_FORMAT_10_4
|
LOG_HEADER_
FORMAT_ENCRYPTED
:
case
log_t
:
:
FORMAT_10_2
:
case
log_t
:
:
FORMAT_10_2
|
log_t
::
FORMAT_ENCRYPTED
:
case
log_t
:
:
FORMAT_10_3
:
case
log_t
:
:
FORMAT_10_3
|
log_t
::
FORMAT_ENCRYPTED
:
case
log_t
:
:
FORMAT_10_4
:
case
log_t
:
:
FORMAT_10_4
|
log_t
::
FORMAT_ENCRYPTED
:
break
;
default:
ib
::
error
()
<<
"Unsupported redo log format."
...
...
@@ -2350,8 +2350,8 @@ void recv_apply_hashed_log_recs(bool last_batch)
tables whose names start with FTS_ to
skip the optimization. */
if
((
log_sys
.
log
.
format
&
~
LOG_HEADER_
FORMAT_ENCRYPTED
)
!=
LOG_HEADER_
FORMAT_10_4
&
~
log_t
::
FORMAT_ENCRYPTED
)
!=
log_t
::
FORMAT_10_4
&&
strstr
(
space
->
name
,
"/FTS_"
))
{
goto
do_read
;
}
...
...
storage/innobase/srv/srv0start.cc
View file @
d67ea815
...
...
@@ -1223,8 +1223,8 @@ srv_prepare_to_delete_redo_log_files(
{
ib
::
info
info
;
if
(
srv_log_file_size
==
0
||
(
log_sys
.
log
.
format
&
~
LOG_HEADER_
FORMAT_ENCRYPTED
)
!=
LOG_HEADER_
FORMAT_10_4
)
{
||
(
log_sys
.
log
.
format
&
~
log_t
::
FORMAT_ENCRYPTED
)
!=
log_t
::
FORMAT_10_4
)
{
info
<<
"Upgrading redo log: "
;
}
else
if
(
n_files
!=
srv_n_log_files
||
srv_log_file_size
...
...
@@ -2044,8 +2044,8 @@ dberr_t srv_start(bool create_new_db)
&&
srv_n_log_files_found
==
srv_n_log_files
&&
log_sys
.
log
.
format
==
(
srv_encrypt_log
?
LOG_HEADER_
FORMAT_ENC_10_4
:
LOG_HEADER_
FORMAT_10_4
)
?
log_t
::
FORMAT_ENC_10_4
:
log_t
::
FORMAT_10_4
)
&&
log_sys
.
log
.
subformat
==
2
)
{
/* No need to add or remove encryption,
upgrade, downgrade, or resize. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment