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
06d555a4
Commit
06d555a4
authored
May 19, 2023
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge bb-10.5-release into 10.5
parents
caeff135
e0084b9d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
30 deletions
+49
-30
storage/innobase/include/trx0sys.h
storage/innobase/include/trx0sys.h
+1
-1
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+25
-16
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+3
-7
storage/innobase/trx/trx0sys.cc
storage/innobase/trx/trx0sys.cc
+20
-6
No files found.
storage/innobase/include/trx0sys.h
View file @
06d555a4
...
...
@@ -1055,7 +1055,7 @@ class trx_sys_t
void
close
();
/** @return total number of active (non-prepared) transactions */
ulint
any_active_transactions
(
);
size_t
any_active_transactions
(
size_t
*
prepared
=
nullptr
);
/**
...
...
storage/innobase/srv/srv0srv.cc
View file @
06d555a4
...
...
@@ -1697,7 +1697,7 @@ void srv_master_callback(void*)
}
/** @return whether purge should exit due to shutdown */
static
bool
srv_purge_should_exit
()
static
bool
srv_purge_should_exit
(
size_t
old_history_size
)
{
ut_ad
(
srv_shutdown_state
<=
SRV_SHUTDOWN_CLEANUP
);
...
...
@@ -1708,7 +1708,12 @@ static bool srv_purge_should_exit()
return
true
;
/* Slow shutdown was requested. */
if
(
const
size_t
history_size
=
trx_sys
.
rseg_history_len
)
size_t
prepared
,
active
=
trx_sys
.
any_active_transactions
(
&
prepared
);
const
size_t
history_size
=
trx_sys
.
rseg_history_len
;
if
(
!
history_size
);
else
if
(
!
active
&&
history_size
==
old_history_size
&&
prepared
);
else
{
static
time_t
progress_time
;
time_t
now
=
time
(
NULL
);
...
...
@@ -1725,7 +1730,7 @@ static bool srv_purge_should_exit()
return
false
;
}
return
!
trx_sys
.
any_active_transactions
()
;
return
!
active
;
}
/*********************************************************************//**
...
...
@@ -1845,7 +1850,7 @@ static size_t srv_do_purge(ulint* n_total_purged)
*
n_total_purged
+=
n_pages_purged
;
}
while
(
n_pages_purged
>
0
&&
!
purge_sys
.
paused
()
&&
!
srv_purge_should_exit
());
&&
!
srv_purge_should_exit
(
rseg_history_len
));
return
(
rseg_history_len
);
}
...
...
@@ -1960,7 +1965,7 @@ static void purge_coordinator_callback_low()
}
}
while
((
purge_sys
.
enabled
()
&&
!
purge_sys
.
paused
())
||
!
srv_purge_should_exit
());
!
srv_purge_should_exit
(
trx_sys
.
rseg_history_len
));
}
static
void
purge_coordinator_callback
(
void
*
)
...
...
@@ -2031,15 +2036,19 @@ ulint srv_get_task_queue_length()
/** Shut down the purge threads. */
void
srv_purge_shutdown
()
{
if
(
purge_sys
.
enabled
())
{
if
(
!
srv_fast_shutdown
&&
!
opt_bootstrap
)
srv_update_purge_thread_count
(
innodb_purge_threads_MAX
);
while
(
!
srv_purge_should_exit
())
{
ut_a
(
!
purge_sys
.
paused
());
srv_wake_purge_thread_if_not_active
();
purge_coordinator_task
.
wait
();
}
purge_sys
.
coordinator_shutdown
();
srv_shutdown_purge_tasks
();
}
if
(
purge_sys
.
enabled
())
{
if
(
!
srv_fast_shutdown
&&
!
opt_bootstrap
)
srv_update_purge_thread_count
(
innodb_purge_threads_MAX
);
size_t
history_size
=
trx_sys
.
rseg_history_len
;
while
(
!
srv_purge_should_exit
(
history_size
))
{
history_size
=
trx_sys
.
rseg_history_len
;
ut_a
(
!
purge_sys
.
paused
());
srv_wake_purge_thread_if_not_active
();
purge_coordinator_task
.
wait
();
}
purge_sys
.
coordinator_shutdown
();
srv_shutdown_purge_tasks
();
}
}
storage/innobase/trx/trx0purge.cc
View file @
06d555a4
...
...
@@ -448,12 +448,7 @@ trx_purge_truncate_rseg_history(
prev_hdr_addr
.
boffset
=
static_cast
<
uint16_t
>
(
prev_hdr_addr
.
boffset
-
TRX_UNDO_HISTORY_NODE
);
if
(
!
rseg
.
trx_ref_count
&&
rseg
.
needs_purge
<=
(
purge_sys
.
head
.
trx_no
?
purge_sys
.
head
.
trx_no
:
purge_sys
.
tail
.
trx_no
)
&&
mach_read_from_2
(
TRX_UNDO_SEG_HDR
+
TRX_UNDO_STATE
+
block
->
frame
)
if
(
mach_read_from_2
(
TRX_UNDO_SEG_HDR
+
TRX_UNDO_STATE
+
block
->
frame
)
==
TRX_UNDO_TO_PURGE
&&
!
mach_read_from_2
(
block
->
frame
+
hdr_addr
.
boffset
+
TRX_UNDO_NEXT_LOG
))
{
...
...
@@ -544,7 +539,8 @@ static void trx_purge_truncate_history()
ut_ad
(
rseg
->
id
==
i
);
ut_ad
(
rseg
->
is_persistent
());
mutex_enter
(
&
rseg
->
mutex
);
trx_purge_truncate_rseg_history
(
*
rseg
,
head
);
if
(
!
rseg
->
trx_ref_count
&&
rseg
->
needs_purge
<=
head
.
trx_no
)
trx_purge_truncate_rseg_history
(
*
rseg
,
head
);
mutex_exit
(
&
rseg
->
mutex
);
}
}
...
...
storage/innobase/trx/trx0sys.cc
View file @
06d555a4
...
...
@@ -325,15 +325,29 @@ trx_sys_t::close()
}
/** @return total number of active (non-prepared) transactions */
ulint
trx_sys_t
::
any_active_transactions
(
)
size_t
trx_sys_t
::
any_active_transactions
(
size_t
*
prepared
)
{
uint32_t
total_trx
=
0
;
trx_sys
.
trx_list
.
for_each
([
&
total_trx
](
const
trx_t
&
trx
)
{
if
(
trx
.
state
==
TRX_STATE_COMMITTED_IN_MEMORY
||
(
trx
.
state
==
TRX_STATE_ACTIVE
&&
trx
.
id
))
size_t
total_trx
=
0
,
prepared_trx
=
0
;
trx_sys
.
trx_list
.
for_each
([
&
](
const
trx_t
&
trx
)
{
switch
(
trx
.
state
)
{
case
TRX_STATE_NOT_STARTED
:
break
;
case
TRX_STATE_ACTIVE
:
if
(
!
trx
.
id
)
break
;
/* fall through */
case
TRX_STATE_COMMITTED_IN_MEMORY
:
total_trx
++
;
break
;
case
TRX_STATE_PREPARED
:
case
TRX_STATE_PREPARED_RECOVERED
:
prepared_trx
++
;
}
});
if
(
prepared
)
*
prepared
=
prepared_trx
;
return
total_trx
;
}
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