Commit 80409986 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16264: Fix some white space

parent 37f1ab23
......@@ -326,17 +326,11 @@ void dict_stats_deinit()
mutex_free(&recalc_pool_mutex);
}
/*****************************************************************//**
/**
Get the first table that has been added for auto recalc and eventually
update its stats.
@return : true if pool was non-empty and first entry does
not needs delay, false otherwise.
*/
static
bool
dict_stats_process_entry_from_recalc_pool()
/*=======================================*/
@return whether the first entry can be processed immediately */
static bool dict_stats_process_entry_from_recalc_pool()
{
table_id_t table_id;
......
......@@ -49,9 +49,6 @@ static tpool::task task(fts_optimize_callback,0, &task_group);
/** The FTS vector to store fts_slot_t */
static ib_vector_t* fts_slots;
/** Time to wait for a message. */
static const ulint FTS_QUEUE_WAIT_IN_USECS = 5000000;
/** Default optimize interval in secs. */
static const ulint FTS_OPTIMIZE_INTERVAL_IN_SECS = 300;
......
......@@ -663,8 +663,7 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in] file own: handle to a file
@return true if success */
bool
os_file_close_func(os_file_t file);
bool os_file_close_func(os_file_t file);
#ifdef UNIV_PFS_IO
......
......@@ -78,7 +78,6 @@ Created 10/21/1995 Heikki Tuuri
#include <my_sys.h>
#endif
/* Per-IO operation environment*/
class io_slots
{
......@@ -281,61 +280,42 @@ os_win32_device_io_control(
/** Helper class for doing synchronous file IO. Currently, the objective
is to hide the OS specific code, so that the higher level functions aren't
peppered with #ifdef. Makes the code flow difficult to follow. */
class SyncFileIO {
class SyncFileIO
{
public:
/** Constructor
@param[in] fh File handle
@param[in,out] buf Buffer to read/write
@param[in] n Number of bytes to read/write
@param[in] offset Offset where to read or write */
SyncFileIO(os_file_t fh, void* buf, ulint n, os_offset_t offset)
:
m_fh(fh),
m_buf(buf),
m_n(static_cast<ssize_t>(n)),
m_offset(offset)
{
ut_ad(m_n > 0);
}
/** Destructor */
~SyncFileIO()
{
/* No op */
}
/** Do the read/write
@param[in] request The IO context and type
@return the number of bytes read/written or negative value on error */
ssize_t execute(const IORequest& request);
/** Move the read/write offset up to where the partial IO succeeded.
@param[in] n_bytes The number of bytes to advance */
void advance(ssize_t n_bytes)
{
m_offset += n_bytes;
ut_ad(m_n >= n_bytes);
m_n -= n_bytes;
m_buf = reinterpret_cast<uchar*>(m_buf) + n_bytes;
}
/** Constructor
@param[in] fh File handle
@param[in,out] buf Buffer to read/write
@param[in] n Number of bytes to read/write
@param[in] offset Offset where to read or write */
SyncFileIO(os_file_t fh, void *buf, ulint n, os_offset_t offset) :
m_fh(fh), m_buf(buf), m_n(static_cast<ssize_t>(n)), m_offset(offset)
{ ut_ad(m_n > 0); }
/** Do the read/write
@param[in] request The IO context and type
@return the number of bytes read/written or negative value on error */
ssize_t execute(const IORequest &request);
/** Move the read/write offset up to where the partial IO succeeded.
@param[in] n_bytes The number of bytes to advance */
void advance(ssize_t n_bytes)
{
m_offset+= n_bytes;
ut_ad(m_n >= n_bytes);
m_n-= n_bytes;
m_buf= reinterpret_cast<uchar*>(m_buf) + n_bytes;
}
private:
/** Open file handle */
os_file_t m_fh;
/** Buffer to read/write */
void* m_buf;
/** Number of bytes to read/write */
ssize_t m_n;
/** Offset from where to read/write */
os_offset_t m_offset;
/** Open file handle */
const os_file_t m_fh;
/** Buffer to read/write */
void *m_buf;
/** Number of bytes to read/write */
ssize_t m_n;
/** Offset from where to read/write */
os_offset_t m_offset;
};
#undef USE_FILE_LOCK
......@@ -1665,19 +1645,15 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in] file Handle to close
@return true if success */
bool
os_file_close_func(
os_file_t file)
bool os_file_close_func(os_file_t file)
{
int ret = close(file);
int ret= close(file);
if (ret == -1) {
os_file_handle_error(NULL, "close");
if (!ret)
return true;
return(false);
}
return(true);
os_file_handle_error(NULL, "close");
return false;
}
/** Gets a file size.
......@@ -2501,7 +2477,7 @@ os_file_create_func(
switch (srv_file_flush_method)
{
case SRV_O_DSYNC:
case SRV_O_DSYNC:
if (type == OS_LOG_FILE) {
/* Map O_SYNC to FILE_WRITE_THROUGH */
attributes |= FILE_FLAG_WRITE_THROUGH;
......@@ -2510,11 +2486,10 @@ os_file_create_func(
case SRV_O_DIRECT_NO_FSYNC:
case SRV_O_DIRECT:
if (type == OS_DATA_FILE) {
attributes |= FILE_FLAG_NO_BUFFERING;
if (type != OS_DATA_FILE) {
break;
}
break;
/* fall through */
case SRV_ALL_O_DIRECT_FSYNC:
/*Traditional Windows behavior, no buffering for any files.*/
attributes |= FILE_FLAG_NO_BUFFERING;
......@@ -2849,22 +2824,18 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in,own] file Handle to a file
@return true if success */
bool
os_file_close_func(
os_file_t file)
bool os_file_close_func(os_file_t file)
{
ut_a(file != 0);
if (!CloseHandle(file)) {
os_file_handle_error(NULL, "close");
return false;
}
ut_ad(file);
if (!CloseHandle(file))
{
os_file_handle_error(NULL, "close");
return false;
}
if(srv_thread_pool)
srv_thread_pool->unbind(file);
return(true);
if(srv_thread_pool)
srv_thread_pool->unbind(file);
return true;
}
/** Gets a file size.
......@@ -3338,7 +3309,7 @@ static MY_ATTRIBUTE((warn_unused_result))
dberr_t
os_file_read_page(
const IORequest& type,
os_file_t file,
os_file_t file,
void* buf,
os_offset_t offset,
ulint n,
......@@ -3761,7 +3732,7 @@ Requests a synchronous positioned read operation.
dberr_t
os_file_read_no_error_handling_func(
const IORequest& type,
os_file_t file,
os_file_t file,
void* buf,
os_offset_t offset,
ulint n,
......
......@@ -27,11 +27,11 @@ namespace tpool
/*
In order to be able to execute synchronous IO even on file opened
with FILE_FLAG_OVERLAPPED, and to bypass to completion port,
we use valid event handle for the hEvent member of the OVERLAPPED structure,
with FILE_FLAG_OVERLAPPED, and to bypass to completion port,
we use valid event handle for the hEvent member of the OVERLAPPED structure,
with its low-order bit set.
See MSDN docs for GetQueuedCompletionStatus() for description of this trick.
See MSDN docs for GetQueuedCompletionStatus() for description of this trick.
*/
static DWORD fls_sync_io= FLS_OUT_OF_INDEXES;
HANDLE win_get_syncio_event()
......@@ -177,4 +177,4 @@ aio *create_simulated_aio(thread_pool *tp)
return new simulated_aio(tp);
}
} // namespace tpool
\ No newline at end of file
} // namespace tpool
......@@ -53,7 +53,7 @@ namespace tpool
typedef void (*callback_func)(void *);
class task;
/* A class that can be used e.g for
/** A class that can be used e.g. for
restricting concurrency for specific class of tasks. */
class task_group
......
......@@ -54,7 +54,7 @@ namespace tpool
- The task queue. This queue is populated by submit()
- Worker that execute the work items.
- Timer thread that takes care of pool health
The task queue is populated by submit() method.
on submit(), a worker thread can be woken, or created
to execute tasks.
......@@ -162,26 +162,26 @@ class thread_pool_generic : public thread_pool
/** The task queue */
circular_queue<task*> m_task_queue;
/* List of standby (idle) workers.*/
/** List of standby (idle) workers */
doubly_linked_list<worker_data> m_standby_threads;
/** List of threads that are executing tasks. */
/** List of threads that are executing tasks */
doubly_linked_list<worker_data> m_active_threads;
/* Mutex that protects the whole struct, most importantly
the standby threads list, and task queue. */
the standby threads list, and task queue */
std::mutex m_mtx;
/** Timeout after which idle worker shuts down.*/
/** Timeout after which idle worker shuts down */
std::chrono::milliseconds m_thread_timeout;
/** How often should timer wakeup.*/
std::chrono::milliseconds m_timer_interval;
/** Another condition variable, used in pool shutdown-*/
/** Another condition variable, used in pool shutdown */
std::condition_variable m_cv_no_threads;
/** Condition variable for the timer thread. Signaled on shutdown.*/
/** Condition variable for the timer thread. Signaled on shutdown. */
std::condition_variable m_cv_timer;
/** Overall number of enqueues*/
......@@ -189,16 +189,17 @@ class thread_pool_generic : public thread_pool
/** Overall number of dequeued tasks. */
unsigned long long m_tasks_dequeued;
/**Statistic related, number of worker thread wakeups.*/
/** Statistic related, number of worker thread wakeups */
int m_wakeups;
/**
/**
Statistic related, number of spurious thread wakeups
(i.e thread woke up, and the task queue is empty)
*/
int m_spurious_wakeups;
/** The desired concurrency. This number of workers should be actively executing.*/
/** The desired concurrency. This number of workers should be
actively executing. */
unsigned int m_concurrency;
/** True, if threadpool is being shutdown, false otherwise */
......@@ -207,7 +208,7 @@ class thread_pool_generic : public thread_pool
/** time point when timer last ran, used as a coarse clock. */
std::chrono::system_clock::time_point m_timestamp;
/** Number of long running tasks. The long running tasks are excluded when
/** Number of long running tasks. The long running tasks are excluded when
adjusting concurrency */
int m_long_tasks_count;
......@@ -387,12 +388,11 @@ void thread_pool_generic::cancel_pending(task* t)
/**
Register worker in standby list, and wait to be woken.
@return
true - thread was woken
false - idle wait timeout exceeded (the current thread need to shutdown)
@retval true if thread was woken
@retval false idle wait timeout exceeded (the current thread must shutdown)
*/
bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk,
worker_data *thread_data)
worker_data *thread_data)
{
assert(m_task_queue.empty());
assert(!m_in_shutdown);
......@@ -441,7 +441,7 @@ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk,
bool thread_pool_generic::get_task(worker_data *thread_var, task **t)
{
std::unique_lock<std::mutex> lk(m_mtx);
if (thread_var->is_long_task() && m_long_tasks_count)
m_long_tasks_count--;
......@@ -577,7 +577,7 @@ void thread_pool_generic::maintainence()
/*
Heuristic used for thread creation throttling.
Returns interval in milliseconds between thread creation
(depending on number of threads already in the pool, and
(depending on number of threads already in the pool, and
desired concurrency level)
*/
static int throttling_interval_ms(size_t n_threads,size_t concurrency)
......
......@@ -199,44 +199,27 @@ template <typename T> class circular_queue
explicit iterator(size_t pos , circular_queue<T>* q) : m_pos(pos), m_queue(q) {}
iterator& operator++()
{
m_pos = (m_pos + 1) % m_queue->m_capacity;
m_pos= (m_pos + 1) % m_queue->m_capacity;
return *this;
}
iterator operator++(int)
{
iterator retval = *this;
++(*this);
iterator retval= *this;
++*this;
return retval;
}
bool operator==(iterator other) const
{
return m_pos == other.m_pos;
}
bool operator!=(iterator other) const
{
return !(*this == other);
}
T& operator*() const
{
return m_queue->m_buffer[m_pos];
}
bool operator==(iterator other) const { return m_pos == other.m_pos; }
bool operator!=(iterator other) const { return !(*this == other); }
T& operator*() const { return m_queue->m_buffer[m_pos]; }
};
iterator begin()
{
return iterator(m_tail, this);
}
iterator end()
{
return iterator(m_head, this);
}
iterator begin() { return iterator(m_tail, this); }
iterator end() { return iterator(m_head, this); }
private:
size_t m_capacity;
std::vector<T> m_buffer;
size_t m_head;
size_t m_tail;
};
/* Doubly linked list. Intrusive,
......
......@@ -133,7 +133,7 @@ class thread_pool_win : public thread_pool
class native_aio : public aio
{
thread_pool_win& m_pool;
public:
native_aio(thread_pool_win &pool, int max_io)
: m_pool(pool)
......
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