@@ -3565,7 +3565,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(
35653565#if defined (UNIV_PMEMOBJ_PART_PL)
35663566 // wake up the sleeping threads to close them
35673567
3568- os_event_set (gb_pmw->ppl ->catcher ->is_log_req_not_empty );
35693568 os_event_set (gb_pmw->ppl ->flusher ->is_log_req_not_empty );
35703569#endif
35713570 my_thread_end ();
@@ -3986,11 +3985,6 @@ pm_log_flusher_init(
39863985 flusher->n_requested = 0 ;
39873986 flusher->is_running = false ;
39883987
3989- // partition array
3990- flusher->part_list_arr = static_cast <PMEM_MINI_BUF**> ( calloc (size, sizeof (PMEM_MINI_BUF*)));
3991- for (i = 0 ; i < size; i++) {
3992- flusher->part_list_arr [i] = NULL ;
3993- }
39943988
39953989 // flush array
39963990 flusher->flush_list_arr = static_cast <PMEM_PAGE_LOG_BUF**> ( calloc (size, sizeof (PMEM_PAGE_LOG_BUF*)));
@@ -4013,16 +4007,6 @@ pm_log_flusher_close(
40134007
40144008 switch (flusher->type ){
40154009 case CATCHER_LOG_BUF:
4016- // free partition list
4017- for (i = 0 ; i < flusher->size ; i++) {
4018- if (flusher->part_list_arr [i]){
4019- flusher->part_list_arr [i] = NULL ;
4020- }
4021- }
4022- if (flusher->flush_list_arr ){
4023- free (flusher->flush_list_arr );
4024- flusher->flush_list_arr = NULL ;
4025- }
40264010 break ;
40274011 case FLUSHER_LOG_BUF:
40284012 default :
@@ -4126,83 +4110,6 @@ DECLARE_THREAD(pm_log_flusher_coordinator)(
41264110 OS_THREAD_DUMMY_RETURN;
41274111}
41284112
4129- /* Worker thread of log catcher.
4130- * number of threads are equal to the number of cleaner threds from config
4131- @return a dummy parameter */
4132- extern " C"
4133- os_thread_ret_t
4134- DECLARE_THREAD (pm_log_catcher_worker)(
4135- /* ==========================================*/
4136- void * arg MY_ATTRIBUTE ((unused)))
4137- /* !< in: a dummy parameter required by
4138- os_thread_create */
4139- {
4140- ulint i;
4141-
4142- PMEM_LOG_FLUSHER* catcher = gb_pmw->ppl ->catcher ;
4143-
4144- PMEM_MINI_BUF* pmbuf = NULL ;
4145-
4146- my_thread_init ();
4147-
4148- mutex_enter (&catcher->mutex );
4149- catcher->n_workers ++;
4150- os_event_reset (catcher->is_log_all_closed );
4151- mutex_exit (&catcher->mutex );
4152-
4153- while (true ) {
4154- // worker thread wait until there is is_requested signal
4155- retry:
4156- os_event_wait (catcher->is_log_req_not_empty );
4157- // looking for a full list in wait-list and flush it
4158- mutex_enter (&catcher->mutex );
4159- if (catcher->n_requested > 0 ) {
4160- for (i = 0 ; i < catcher->size ; i++) {
4161- pmbuf = catcher->part_list_arr [i];
4162- if (pmbuf != NULL )
4163- {
4164- /* call back function*/
4165- // printf("\t [CATCHER] thread #%zu BEGIN partition catcher->size %zu catcher->n_reqs %zu pmbuf id %zu\n", i, catcher->size, catcher->n_requested, pmbuf->id);
4166- pm_log_partition_mini_buf (gb_pmw->pop , gb_pmw->ppl , pmbuf);
4167-
4168- catcher->n_requested --;
4169- os_event_set (catcher->is_log_req_full );
4170- // we can set the pointer to null after the pm_buf_flush_list finished
4171- // printf("\t [CATCHER] thread #%zu END partition catcher->size %zu catcher->n_reqs %zu pmbuf id %zu\n", i, catcher->size, catcher->n_requested, pmbuf->id);
4172- catcher->part_list_arr [i] = NULL ;
4173- break ;
4174- }
4175- }
4176-
4177- } // end if flusher->n_requested > 0
4178-
4179- if (catcher->n_requested == 0 ) {
4180- if (buf_page_cleaner_is_active) {
4181- // buf_page_cleaner is running, start waiting
4182- os_event_reset (catcher->is_log_req_not_empty );
4183- }
4184- else {
4185- mutex_exit (&catcher->mutex );
4186- break ;
4187- }
4188- }
4189- mutex_exit (&catcher->mutex );
4190- } // end while thread
4191-
4192- mutex_enter (&catcher->mutex );
4193- catcher->n_workers --;
4194- if (catcher->n_workers == 0 ) {
4195- printf (" The last catcher worker is closing\n " );
4196- // os_event_set(flusher->is_all_closed);
4197- }
4198- mutex_exit (&catcher->mutex );
4199-
4200- my_thread_end ();
4201-
4202- os_thread_exit ();
4203-
4204- OS_THREAD_DUMMY_RETURN;
4205- }
42064113
42074114/* Worker thread of log flusher.
42084115 * Managed by the coordinator thread
0 commit comments