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
e0e80575
Commit
e0e80575
authored
May 15, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.2 into 10.3
parents
fde29f3a
56976e60
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
87 deletions
+25
-87
storage/innobase/include/log0log.h
storage/innobase/include/log0log.h
+1
-3
storage/innobase/log/log0log.cc
storage/innobase/log/log0log.cc
+24
-84
No files found.
storage/innobase/include/log0log.h
View file @
e0e80575
...
...
@@ -527,7 +527,7 @@ struct log_t{
to the first half before freeing/resizing
must be undertaken. */
bool
first_in_use
;
/*!< true if buf points to the first
half of the
aligned(buf_ptr)
, false
half of the
buffer
, false
if the second half */
ulong
max_buf_free
;
/*!< recommended maximum value of
buf_free for the buffer in use, after
...
...
@@ -611,8 +611,6 @@ struct log_t{
later; this is advanced when a flush
operation is completed to all the log
groups */
volatile
bool
is_extending
;
/*!< this is set to true during extend
the log buffer size */
lsn_t
write_lsn
;
/*!< last written lsn */
lsn_t
current_flush_lsn
;
/*!< end lsn for the current running
write + flush operation */
...
...
storage/innobase/log/log0log.cc
View file @
e0e80575
...
...
@@ -161,87 +161,42 @@ log_buf_pool_get_oldest_modification(void)
@param[in] len requested minimum size in bytes */
void
log_buffer_extend
(
ulong
len
)
{
byte
tmp_buf
[
OS_FILE_LOG_BLOCK_SIZE
];
const
ulong
new_buf_size
=
ut_calc_align
(
len
,
srv_page_size
);
byte
*
new_buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
new_buf_size
*
2
));
TRASH_ALLOC
(
new_buf
,
new_buf_size
*
2
);
log_mutex_enter_all
();
while
(
log_sys
.
is_extending
)
{
/* Another thread is trying to extend already.
Needs to wait for. */
log_mutex_exit_all
();
log_buffer_flush_to_disk
();
log_mutex_enter_all
();
log_mutex_enter
();
if
(
srv_log_buffer_size
>
len
)
{
if
(
len
<=
srv_log_buffer_size
)
{
/* Already extended enough by the others */
log_mutex_exit_all
();
log_mutex_exit
();
ut_free_dodump
(
new_buf
,
new_buf_size
*
2
);
return
;
}
}
if
(
len
>=
srv_log_buffer_size
/
2
)
{
DBUG_EXECUTE_IF
(
"ib_log_buffer_is_short_crash"
,
DBUG_SUICIDE
(););
/* log_buffer is too small. try to extend instead of crash. */
ib
::
warn
()
<<
"The redo log transaction size "
<<
len
<<
" exceeds innodb_log_buffer_size="
<<
srv_log_buffer_size
<<
" / 2). Trying to extend it."
;
}
log_sys
.
is_extending
=
true
;
while
((
log_sys
.
buf_free
^
log_sys
.
buf_next_to_write
)
&
(
OS_FILE_LOG_BLOCK_SIZE
-
1
))
{
/* Buffer might have >1 blocks to write still. */
log_mutex_exit_all
();
log_buffer_flush_to_disk
();
log_mutex_enter_all
();
}
ulong
move_start
=
ut_2pow_round
(
log_sys
.
buf_free
,
ulong
(
OS_FILE_LOG_BLOCK_SIZE
));
ulong
move_end
=
log_sys
.
buf_free
;
/* store the last log block in buffer */
ut_memcpy
(
tmp_buf
,
log_sys
.
buf
+
move_start
,
move_end
-
move_start
);
log_sys
.
buf_free
-=
move_start
;
log_sys
.
buf_next_to_write
-=
move_start
;
/* free previous after getting the right address */
if
(
!
log_sys
.
first_in_use
)
{
log_sys
.
buf
-=
srv_log_buffer_size
;
}
ut_free_dodump
(
log_sys
.
buf
,
srv_log_buffer_size
*
2
);
/* reallocate log buffer */
srv_log_buffer_size
=
len
;
log_sys
.
buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
srv_log_buffer_size
*
2
));
TRASH_ALLOC
(
log_sys
.
buf
,
srv_log_buffer_size
*
2
);
const
byte
*
old_buf_begin
=
log_sys
.
buf
;
const
ulong
old_buf_size
=
srv_log_buffer_size
;
byte
*
old_buf
=
log_sys
.
first_in_use
?
log_sys
.
buf
:
log_sys
.
buf
-
old_buf_size
;
srv_log_buffer_size
=
new_buf_size
;
log_sys
.
buf
=
new_buf
;
log_sys
.
first_in_use
=
true
;
memcpy
(
log_sys
.
buf
,
old_buf_begin
,
log_sys
.
buf_free
);
log_sys
.
max_buf_free
=
srv_log_buffer
_size
/
LOG_BUF_FLUSH_RATIO
log_sys
.
max_buf_free
=
new_buf
_size
/
LOG_BUF_FLUSH_RATIO
-
LOG_BUF_FLUSH_MARGIN
;
/* restore the last log block */
ut_memcpy
(
log_sys
.
buf
,
tmp_buf
,
move_end
-
move_start
);
log_mutex_exit
();
ut_ad
(
log_sys
.
is_extending
);
log_sys
.
is_extending
=
false
;
log_mutex_exit_all
();
ut_free_dodump
(
old_buf
,
old_buf_size
);
ib
::
info
()
<<
"innodb_log_buffer_size was extended to "
<<
srv_log_buffer
_size
<<
"."
;
<<
new_buf
_size
<<
"."
;
}
/** Calculate actual length in redo buffer and file including
...
...
@@ -350,20 +305,6 @@ log_reserve_and_open(
loop:
ut_ad
(
log_mutex_own
());
if
(
log_sys
.
is_extending
)
{
log_mutex_exit
();
/* Log buffer size is extending. Writing up to the next block
should wait for the extending finished. */
os_thread_sleep
(
100000
);
ut_ad
(
++
count
<
50
);
log_mutex_enter
();
goto
loop
;
}
/* Calculate an upper limit for the space the string may take in the
log buffer */
...
...
@@ -619,7 +560,6 @@ void log_t::create()
last_printout_time
=
time
(
NULL
);
buf_next_to_write
=
0
;
is_extending
=
false
;
write_lsn
=
lsn
;
flushed_to_disk_lsn
=
0
;
n_pending_flushes
=
0
;
...
...
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