Commit 84f3f3fa authored by Jan Lindström's avatar Jan Lindström

MDEV-7083: sys_vars.innodb_sched_priority* tests fail in buildbot

on work-amd64-valgrind.

Fixed issue by finding out first the current used priority
for both treads and using that seeing did we really change
the priority or not.
parent da521104
...@@ -16434,19 +16434,24 @@ innodb_sched_priority_cleaner_update( ...@@ -16434,19 +16434,24 @@ innodb_sched_priority_cleaner_update(
{ {
ulint priority = *static_cast<const ulint *>(save); ulint priority = *static_cast<const ulint *>(save);
ulint actual_priority; ulint actual_priority;
ulint nice = 0;
/* Set the priority for the LRU manager thread */ /* Set the priority for the LRU manager thread */
ut_ad(buf_lru_manager_is_active); ut_ad(buf_lru_manager_is_active);
nice = os_thread_get_priority(srv_lru_manager_tid);
actual_priority = os_thread_set_priority(srv_lru_manager_tid, actual_priority = os_thread_set_priority(srv_lru_manager_tid,
priority); priority);
if (UNIV_UNLIKELY(actual_priority != priority)) { if (UNIV_UNLIKELY(actual_priority != priority)) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, if (actual_priority+nice != priority) {
ER_WRONG_ARGUMENTS, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
"Failed to set the LRU manager thread " ER_WRONG_ARGUMENTS,
"priority to %lu, " "Failed to set the LRU manager thread "
"the current priority is %lu", priority, "priority to %lu, "
actual_priority); "the nice is %lu and used priority is %lu", priority,
nice, actual_priority);
}
} else { } else {
srv_sched_priority_cleaner = priority; srv_sched_priority_cleaner = priority;
...@@ -16459,15 +16464,17 @@ innodb_sched_priority_cleaner_update( ...@@ -16459,15 +16464,17 @@ innodb_sched_priority_cleaner_update(
} }
ut_ad(buf_page_cleaner_is_active); ut_ad(buf_page_cleaner_is_active);
nice = os_thread_get_priority(srv_cleaner_tid);
actual_priority = os_thread_set_priority(srv_cleaner_tid, priority); actual_priority = os_thread_set_priority(srv_cleaner_tid, priority);
if (UNIV_UNLIKELY(actual_priority != priority)) { if (UNIV_UNLIKELY(actual_priority != priority)) {
if (actual_priority+nice != priority) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS, ER_WRONG_ARGUMENTS,
"Failed to set the page cleaner thread " "Failed to set the page cleaner thread "
"priority to %lu, " "priority to %lu, "
"the current priority is %lu", priority, "the nice is %lu and used priority is %lu", priority,
actual_priority); nice, actual_priority);
}
} }
} }
......
...@@ -182,6 +182,17 @@ os_thread_set_priority( ...@@ -182,6 +182,17 @@ os_thread_set_priority(
ulint relative_priority); /*!< in: system-specific ulint relative_priority); /*!< in: system-specific
priority value */ priority value */
/*****************************************************************//**
Get priority for a given thread on Linux. Currently a
no-op on other systems.
@return An actual thread priority */
UNIV_INTERN
ulint
os_thread_get_priority(
/*===================*/
os_tid_t thread_id); /*!< in: thread id */
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "os0thread.ic" #include "os0thread.ic"
#endif #endif
......
...@@ -312,3 +312,21 @@ os_thread_set_priority( ...@@ -312,3 +312,21 @@ os_thread_set_priority(
return(relative_priority); return(relative_priority);
#endif #endif
} }
/*****************************************************************//**
Get priority for a given thread on Linux. Currently a
no-op on other systems.
@return An actual thread priority */
UNIV_INTERN
ulint
os_thread_get_priority(
/*===================*/
os_tid_t thread_id) /*!< in: thread id */
{
#ifdef UNIV_LINUX
return (getpriority(PRIO_PROCESS, thread_id));
#else
return (0);
#endif
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment