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
edde1f6e
Commit
edde1f6e
authored
Oct 25, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17441 - InnoDB transition to C++11 atomics
trx_sys_t::rseg_history_len transition to Atomic_counter.
parent
de32e663
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
47 deletions
+29
-47
storage/innobase/btr/btr0cur.cc
storage/innobase/btr/btr0cur.cc
+3
-3
storage/innobase/include/fut0lst.h
storage/innobase/include/fut0lst.h
+1
-1
storage/innobase/include/fut0lst.ic
storage/innobase/include/fut0lst.ic
+1
-1
storage/innobase/include/trx0sys.h
storage/innobase/include/trx0sys.h
+4
-20
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+2
-2
storage/innobase/srv/srv0mon.cc
storage/innobase/srv/srv0mon.cc
+1
-1
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+11
-13
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+3
-3
storage/innobase/trx/trx0rseg.cc
storage/innobase/trx/trx0rseg.cc
+2
-2
storage/innobase/trx/trx0sys.cc
storage/innobase/trx/trx0sys.cc
+1
-1
No files found.
storage/innobase/btr/btr0cur.cc
View file @
edde1f6e
...
...
@@ -1392,7 +1392,7 @@ btr_cur_search_to_nth_level_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if
(
lock_intention
==
BTR_INTENTION_DELETE
&&
trx_sys
.
history_size
()
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
trx_sys
.
rseg_history_len
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
buf_get_n_pending_read_ios
())
{
mtr_x_lock
(
dict_index_get_lock
(
index
),
mtr
);
}
else
if
(
dict_index_is_spatial
(
index
)
...
...
@@ -2528,7 +2528,7 @@ btr_cur_open_at_index_side_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if
(
lock_intention
==
BTR_INTENTION_DELETE
&&
trx_sys
.
history_size
()
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
trx_sys
.
rseg_history_len
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
buf_get_n_pending_read_ios
())
{
mtr_x_lock
(
dict_index_get_lock
(
index
),
mtr
);
}
else
{
...
...
@@ -2873,7 +2873,7 @@ btr_cur_open_at_rnd_pos_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if
(
lock_intention
==
BTR_INTENTION_DELETE
&&
trx_sys
.
history_size
()
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
trx_sys
.
rseg_history_len
>
BTR_CUR_FINE_HISTORY_LENGTH
&&
buf_get_n_pending_read_ios
())
{
mtr_x_lock
(
dict_index_get_lock
(
index
),
mtr
);
}
else
{
...
...
storage/innobase/include/fut0lst.h
View file @
edde1f6e
...
...
@@ -125,7 +125,7 @@ flst_remove(
@param[in] base base node
@return length */
UNIV_INLINE
u
lin
t
u
int32_
t
flst_get_len
(
const
flst_base_node_t
*
base
);
/********************************************************************//**
...
...
storage/innobase/include/fut0lst.ic
View file @
edde1f6e
...
...
@@ -91,7 +91,7 @@ flst_init(
@param[in] base base node
@return length */
UNIV_INLINE
u
lin
t
u
int32_
t
flst_get_len(
const flst_base_node_t* base)
{
...
...
storage/innobase/include/trx0sys.h
View file @
edde1f6e
...
...
@@ -804,14 +804,14 @@ class trx_sys_t
MY_ALIGNED
(
CACHE_LINE_SIZE
)
std
::
atomic
<
trx_id_t
>
m_rw_trx_hash_version
;
bool
m_initialised
;
public:
/**
TRX_RSEG_HISTORY list length (number of committed transactions to purge)
*/
MY_ALIGNED
(
CACHE_LINE_SIZE
)
int32
rseg_history_len
;
MY_ALIGNED
(
CACHE_LINE_SIZE
)
Atomic_counter
<
uint32_t
>
rseg_history_len
;
bool
m_initialised
;
public:
/** Mutex protecting trx_list. */
MY_ALIGNED
(
CACHE_LINE_SIZE
)
mutable
TrxSysMutex
mutex
;
...
...
@@ -1103,22 +1103,6 @@ class trx_sys_t
return
count
;
}
/** @return number of committed transactions waiting for purge */
ulint
history_size
()
const
{
return
uint32
(
my_atomic_load32
(
&
const_cast
<
trx_sys_t
*>
(
this
)
->
rseg_history_len
));
}
/** Add to the TRX_RSEG_HISTORY length (on database startup). */
void
history_add
(
int32
len
)
{
my_atomic_add32
(
&
rseg_history_len
,
len
);
}
/** Register a committed transaction. */
void
history_insert
()
{
history_add
(
1
);
}
/** Note that a committed transaction was purged. */
void
history_remove
()
{
history_add
(
-
1
);
}
private:
static
my_bool
get_min_trx_id_callback
(
rw_trx_hash_element_t
*
element
,
trx_id_t
*
id
)
...
...
storage/innobase/lock/lock0lock.cc
View file @
edde1f6e
...
...
@@ -4607,14 +4607,14 @@ lock_print_info_summary(
fprintf
(
file
,
"Purge done for trx's n:o < "
TRX_ID_FMT
" undo n:o < "
TRX_ID_FMT
" state: %s
\n
"
"History list length
"
ULINTPF
"
\n
"
,
"History list length
%u
\n
"
,
purge_sys
.
tail
.
trx_no
(),
purge_sys
.
tail
.
undo_no
,
purge_sys
.
enabled
()
?
(
purge_sys
.
running
()
?
"running"
:
purge_sys
.
paused
()
?
"stopped"
:
"running but idle"
)
:
"disabled"
,
trx_sys
.
history_size
()
);
uint32_t
{
trx_sys
.
rseg_history_len
}
);
#ifdef PRINT_NUM_OF_LOCK_STRUCTS
fprintf
(
file
,
...
...
storage/innobase/srv/srv0mon.cc
View file @
edde1f6e
...
...
@@ -1936,7 +1936,7 @@ srv_mon_process_existing_counter(
break
;
case
MONITOR_RSEG_HISTORY_LEN
:
value
=
trx_sys
.
history_size
()
;
value
=
trx_sys
.
rseg_history_len
;
break
;
case
MONITOR_RSEG_CUR_SIZE
:
...
...
storage/innobase/srv/srv0srv.cc
View file @
edde1f6e
...
...
@@ -1939,7 +1939,7 @@ srv_wake_purge_thread_if_not_active()
if
(
purge_sys
.
enabled
()
&&
!
purge_sys
.
paused
()
&&
!
my_atomic_loadlint
(
&
srv_sys
.
n_threads_active
[
SRV_PURGE
])
&&
trx_sys
.
history_size
()
)
{
&&
trx_sys
.
rseg_history_len
)
{
srv_release_threads
(
SRV_PURGE
,
1
);
}
...
...
@@ -2412,9 +2412,7 @@ static bool srv_purge_should_exit()
return
(
true
);
}
/* Slow shutdown was requested. */
ulint
history_size
=
trx_sys
.
history_size
();
if
(
history_size
)
{
if
(
uint32_t
history_size
=
trx_sys
.
rseg_history_len
)
{
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
static
ib_time_t
progress_time
;
ib_time_t
time
=
ut_time
();
...
...
@@ -2422,7 +2420,7 @@ static bool srv_purge_should_exit()
progress_time
=
time
;
service_manager_extend_timeout
(
INNODB_EXTEND_TIMEOUT_INTERVAL
,
"InnoDB: to purge
"
ULINTPF
"
transactions"
,
"InnoDB: to purge
%u
transactions"
,
history_size
);
}
#endif
...
...
@@ -2525,14 +2523,14 @@ DECLARE_THREAD(srv_worker_thread)(
@param[in,out] n_total_purged total number of purged pages
@return length of history list before the last purge batch. */
static
u
lin
t
u
int32_
t
srv_do_purge
(
ulint
*
n_total_purged
)
{
ulint
n_pages_purged
;
static
ulint
count
=
0
;
static
ulint
n_use_threads
=
0
;
static
u
lin
t
rseg_history_len
=
0
;
static
u
int32_
t
rseg_history_len
=
0
;
ulint
old_activity_count
=
srv_get_activity_count
();
const
ulint
n_threads
=
srv_n_purge_threads
;
...
...
@@ -2550,7 +2548,7 @@ srv_do_purge(ulint* n_total_purged)
}
do
{
if
(
trx_sys
.
history_size
()
>
rseg_history_len
if
(
trx_sys
.
rseg_history_len
>
rseg_history_len
||
(
srv_max_purge_lag
>
0
&&
rseg_history_len
>
srv_max_purge_lag
))
{
...
...
@@ -2579,7 +2577,7 @@ srv_do_purge(ulint* n_total_purged)
ut_a
(
n_use_threads
<=
n_threads
);
/* Take a snapshot of the history list before purge. */
if
(
!
(
rseg_history_len
=
trx_sys
.
history_size
()
))
{
if
(
!
(
rseg_history_len
=
trx_sys
.
rseg_history_len
))
{
break
;
}
...
...
@@ -2603,7 +2601,7 @@ srv_purge_coordinator_suspend(
/*==========================*/
srv_slot_t
*
slot
,
/*!< in/out: Purge coordinator
thread slot */
u
lint
rseg_history_len
)
/*!< in: history list length
u
int32_t
rseg_history_len
)
/*!< in: history list length
before last purge */
{
ut_ad
(
!
srv_read_only_mode
);
...
...
@@ -2620,7 +2618,7 @@ srv_purge_coordinator_suspend(
/* We don't wait right away on the the non-timed wait because
we want to signal the thread that wants to suspend purge. */
const
bool
wait
=
stop
||
rseg_history_len
<=
trx_sys
.
history_size
()
;
||
rseg_history_len
<=
trx_sys
.
rseg_history_len
;
const
bool
timeout
=
srv_resume_thread
(
slot
,
sig_count
,
wait
,
stop
?
0
:
SRV_PURGE_MAX_TIMEOUT
);
...
...
@@ -2635,7 +2633,7 @@ srv_purge_coordinator_suspend(
if
(
!
stop
)
{
if
(
timeout
&&
rseg_history_len
<
5000
&&
rseg_history_len
==
trx_sys
.
history_size
()
)
{
&&
rseg_history_len
==
trx_sys
.
rseg_history_len
)
{
/* No new records were added since the
wait started. Simply wait for new
records. The magic number 5000 is an
...
...
@@ -2688,7 +2686,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
slot
=
srv_reserve_slot
(
SRV_PURGE
);
u
lint
rseg_history_len
=
trx_sys
.
history_size
()
;
u
int32_t
rseg_history_len
=
trx_sys
.
rseg_history_len
;
do
{
/* If there are no records to purge or the last
...
...
storage/innobase/trx/trx0purge.cc
View file @
edde1f6e
...
...
@@ -315,7 +315,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
rseg
->
needs_purge
=
true
;
}
trx_sys
.
history_insert
()
;
trx_sys
.
rseg_history_len
++
;
if
(
undo
->
state
==
TRX_UNDO_CACHED
)
{
UT_LIST_ADD_FIRST
(
rseg
->
undo_cached
,
undo
);
...
...
@@ -341,7 +341,7 @@ trx_purge_remove_log_hdr(
{
flst_remove
(
rseg_hdr
+
TRX_RSEG_HISTORY
,
log_hdr
+
TRX_UNDO_HISTORY_NODE
,
mtr
);
trx_sys
.
history_remove
()
;
trx_sys
.
rseg_history_len
--
;
}
/** Free an undo log segment, and remove the header from the history list.
...
...
@@ -1240,7 +1240,7 @@ trx_purge_dml_delay(void)
if
(
srv_max_purge_lag
>
0
)
{
float
ratio
;
ratio
=
float
(
trx_sys
.
history_size
()
)
/
srv_max_purge_lag
;
ratio
=
float
(
trx_sys
.
rseg_history_len
)
/
srv_max_purge_lag
;
if
(
ratio
>
1.0
)
{
/* If the history list length exceeds the
...
...
storage/innobase/trx/trx0rseg.cc
View file @
edde1f6e
...
...
@@ -468,8 +468,8 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr)
rseg
->
curr_size
=
mach_read_from_4
(
rseg_header
+
TRX_RSEG_HISTORY_SIZE
)
+
1
+
trx_undo_lists_init
(
rseg
,
max_trx_id
,
rseg_header
);
if
(
ulint
len
=
flst_get_len
(
rseg_header
+
TRX_RSEG_HISTORY
))
{
trx_sys
.
history_add
(
int32
(
len
))
;
if
(
auto
len
=
flst_get_len
(
rseg_header
+
TRX_RSEG_HISTORY
))
{
trx_sys
.
rseg_history_len
+=
len
;
fil_addr_t
node_addr
=
trx_purge_get_log_from_hist
(
flst_get_last
(
rseg_header
+
TRX_RSEG_HISTORY
,
mtr
));
...
...
storage/innobase/trx/trx0sys.cc
View file @
edde1f6e
...
...
@@ -212,7 +212,7 @@ trx_sys_t::create()
m_initialised
=
true
;
mutex_create
(
LATCH_ID_TRX_SYS
,
&
mutex
);
UT_LIST_INIT
(
trx_list
,
&
trx_t
::
trx_list
);
my_atomic_store32
(
&
rseg_history_len
,
0
)
;
rseg_history_len
=
0
;
rw_trx_hash
.
init
();
}
...
...
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