Commit b620e736 authored by Jan Lindström's avatar Jan Lindström

Small fixes to work_item handling.

parent 24235e99
...@@ -56,13 +56,14 @@ Modified 06/02/2014 Jan Lindström jan.lindstrom@skysql.com ...@@ -56,13 +56,14 @@ Modified 06/02/2014 Jan Lindström jan.lindstrom@skysql.com
/* Work item status */ /* Work item status */
typedef enum wrk_status { typedef enum wrk_status {
WRK_ITEM_SET=0, /*!< Work item is set */ WRK_ITEM_UNSET=0, /*!< Work item is not set */
WRK_ITEM_START=1, /*!< Processing of work item has started */ WRK_ITEM_START=1, /*!< Processing of work item has started */
WRK_ITEM_DONE=2, /*!< Processing is done usually set to WRK_ITEM_DONE=2, /*!< Processing is done usually set to
SUCCESS/FAILED */ SUCCESS/FAILED */
WRK_ITEM_SUCCESS=2, /*!< Work item successfully processed */ WRK_ITEM_SUCCESS=2, /*!< Work item successfully processed */
WRK_ITEM_FAILED=3, /*!< Work item process failed */ WRK_ITEM_FAILED=3, /*!< Work item process failed */
WRK_ITEM_EXIT=4, /*!< Exiting */ WRK_ITEM_EXIT=4, /*!< Exiting */
WRK_ITEM_SET=5, /*!< Work item is set */
WRK_ITEM_STATUS_UNDEFINED WRK_ITEM_STATUS_UNDEFINED
} wrk_status_t; } wrk_status_t;
...@@ -179,9 +180,7 @@ buf_mtflu_flush_pool_instance( ...@@ -179,9 +180,7 @@ buf_mtflu_flush_pool_instance(
pools based on the assumption that it will pools based on the assumption that it will
help in the retry which will follow the help in the retry which will follow the
failure. */ failure. */
#ifdef UNIV_DEBUG fprintf(stderr, "InnoDB: Note: buf flush start failed there is already active flush for this buffer pool.\n");
fprintf(stderr, "flush start failed.\n");
#endif
return 0; return 0;
} }
...@@ -257,12 +256,10 @@ mtflush_service_io( ...@@ -257,12 +256,10 @@ mtflush_service_io(
return; return;
case MT_WRK_WRITE: case MT_WRK_WRITE:
ut_a(work_item->wi_status == WRK_ITEM_SET);
work_item->wi_status = WRK_ITEM_START; work_item->wi_status = WRK_ITEM_START;
/* Process work item */ /* Process work item */
if (0 == (n_flushed = buf_mtflu_flush_pool_instance(work_item))) { if (0 == (n_flushed = buf_mtflu_flush_pool_instance(work_item))) {
#ifdef UNIV_DEBUG
fprintf(stderr, "No pages flushed\n");
#endif
work_item->wi_status = WRK_ITEM_FAILED; work_item->wi_status = WRK_ITEM_FAILED;
} }
work_item->wi_status = WRK_ITEM_SUCCESS; work_item->wi_status = WRK_ITEM_SUCCESS;
...@@ -320,7 +317,7 @@ buf_mtflu_io_thread_exit(void) ...@@ -320,7 +317,7 @@ buf_mtflu_io_thread_exit(void)
{ {
long i; long i;
thread_sync_t* mtflush_io = mtflush_ctx; thread_sync_t* mtflush_io = mtflush_ctx;
wrk_t* work_item; wrk_t* work_item = NULL;
ut_a(mtflush_io != NULL); ut_a(mtflush_io != NULL);
...@@ -358,7 +355,7 @@ buf_mtflu_io_thread_exit(void) ...@@ -358,7 +355,7 @@ buf_mtflu_io_thread_exit(void)
/* Collect all work done items */ /* Collect all work done items */
for (i=0; i < srv_mtflush_threads;) { for (i=0; i < srv_mtflush_threads;) {
wrk_t* work_item; wrk_t* work_item = NULL;
work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, MT_WAIT_IN_USECS); work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, MT_WAIT_IN_USECS);
...@@ -461,9 +458,8 @@ buf_mtflu_flush_work_items( ...@@ -461,9 +458,8 @@ buf_mtflu_flush_work_items(
number does not exceed min_n) */ number does not exceed min_n) */
{ {
ulint n_flushed=0, i; ulint n_flushed=0, i;
wrk_t *done_wi;
mem_heap_t* work_heap; mem_heap_t* work_heap;
wrk_t* work_item; wrk_t* work_item=NULL;
/* Allocate heap where all work items used and queue /* Allocate heap where all work items used and queue
node items areallocated */ node items areallocated */
...@@ -488,6 +484,7 @@ buf_mtflu_flush_work_items( ...@@ -488,6 +484,7 @@ buf_mtflu_flush_work_items(
/* wait on the completion to arrive */ /* wait on the completion to arrive */
for(i=0; i< buf_pool_inst;) { for(i=0; i< buf_pool_inst;) {
wrk_t *done_wi = NULL;
done_wi = (wrk_t *)ib_wqueue_wait(mtflush_ctx->wr_cq); done_wi = (wrk_t *)ib_wqueue_wait(mtflush_ctx->wr_cq);
if (done_wi != NULL) { if (done_wi != NULL) {
......
...@@ -56,13 +56,14 @@ Modified 06/02/2014 Jan Lindström jan.lindstrom@skysql.com ...@@ -56,13 +56,14 @@ Modified 06/02/2014 Jan Lindström jan.lindstrom@skysql.com
/* Work item status */ /* Work item status */
typedef enum wrk_status { typedef enum wrk_status {
WRK_ITEM_SET=0, /*!< Work item is set */ WRK_ITEM_UNSET=0, /*!< Work item is not set */
WRK_ITEM_START=1, /*!< Processing of work item has started */ WRK_ITEM_START=1, /*!< Processing of work item has started */
WRK_ITEM_DONE=2, /*!< Processing is done usually set to WRK_ITEM_DONE=2, /*!< Processing is done usually set to
SUCCESS/FAILED */ SUCCESS/FAILED */
WRK_ITEM_SUCCESS=2, /*!< Work item successfully processed */ WRK_ITEM_SUCCESS=2, /*!< Work item successfully processed */
WRK_ITEM_FAILED=3, /*!< Work item process failed */ WRK_ITEM_FAILED=3, /*!< Work item process failed */
WRK_ITEM_EXIT=4, /*!< Exiting */ WRK_ITEM_EXIT=4, /*!< Exiting */
WRK_ITEM_SET=5, /*!< Work item is set */
WRK_ITEM_STATUS_UNDEFINED WRK_ITEM_STATUS_UNDEFINED
} wrk_status_t; } wrk_status_t;
...@@ -181,9 +182,7 @@ buf_mtflu_flush_pool_instance( ...@@ -181,9 +182,7 @@ buf_mtflu_flush_pool_instance(
pools based on the assumption that it will pools based on the assumption that it will
help in the retry which will follow the help in the retry which will follow the
failure. */ failure. */
#ifdef UNIV_DEBUG fprintf(stderr, "InnoDB: Note: buf flush start failed there is already active flush for this buffer pool.\n");
fprintf(stderr, "flush start failed.\n");
#endif
return 0; return 0;
} }
...@@ -262,12 +261,10 @@ mtflush_service_io( ...@@ -262,12 +261,10 @@ mtflush_service_io(
return; return;
case MT_WRK_WRITE: case MT_WRK_WRITE:
ut_a(work_item->wi_status == WRK_ITEM_SET);
work_item->wi_status = WRK_ITEM_START; work_item->wi_status = WRK_ITEM_START;
/* Process work item */ /* Process work item */
if (0 == (n_flushed = buf_mtflu_flush_pool_instance(work_item))) { if (0 == (n_flushed = buf_mtflu_flush_pool_instance(work_item))) {
#ifdef UNIV_DEBUG
fprintf(stderr, "No pages flushed\n");
#endif
work_item->wi_status = WRK_ITEM_FAILED; work_item->wi_status = WRK_ITEM_FAILED;
} }
work_item->wi_status = WRK_ITEM_SUCCESS; work_item->wi_status = WRK_ITEM_SUCCESS;
...@@ -346,7 +343,7 @@ buf_mtflu_io_thread_exit(void) ...@@ -346,7 +343,7 @@ buf_mtflu_io_thread_exit(void)
{ {
long i; long i;
thread_sync_t* mtflush_io = mtflush_ctx; thread_sync_t* mtflush_io = mtflush_ctx;
wrk_t* work_item; wrk_t* work_item = NULL;
ut_a(mtflush_io != NULL); ut_a(mtflush_io != NULL);
...@@ -384,7 +381,7 @@ buf_mtflu_io_thread_exit(void) ...@@ -384,7 +381,7 @@ buf_mtflu_io_thread_exit(void)
/* Collect all work done items */ /* Collect all work done items */
for (i=0; i < srv_mtflush_threads;) { for (i=0; i < srv_mtflush_threads;) {
wrk_t* work_item; wrk_t* work_item = NULL;
work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, MT_WAIT_IN_USECS); work_item = (wrk_t *)ib_wqueue_timedwait(mtflush_io->wr_cq, MT_WAIT_IN_USECS);
...@@ -487,9 +484,8 @@ buf_mtflu_flush_work_items( ...@@ -487,9 +484,8 @@ buf_mtflu_flush_work_items(
number does not exceed min_n) */ number does not exceed min_n) */
{ {
ulint n_flushed=0, i; ulint n_flushed=0, i;
wrk_t *done_wi;
mem_heap_t* work_heap; mem_heap_t* work_heap;
wrk_t* work_item; wrk_t* work_item=NULL;
/* Allocate heap where all work items used and queue /* Allocate heap where all work items used and queue
node items areallocated */ node items areallocated */
...@@ -514,6 +510,7 @@ buf_mtflu_flush_work_items( ...@@ -514,6 +510,7 @@ buf_mtflu_flush_work_items(
/* wait on the completion to arrive */ /* wait on the completion to arrive */
for(i=0; i< buf_pool_inst;) { for(i=0; i< buf_pool_inst;) {
wrk_t *done_wi = NULL;
done_wi = (wrk_t *)ib_wqueue_wait(mtflush_ctx->wr_cq); done_wi = (wrk_t *)ib_wqueue_wait(mtflush_ctx->wr_cq);
if (done_wi != NULL) { if (done_wi != NULL) {
......
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