-
Notifications
You must be signed in to change notification settings - Fork 55
[PGPRO-7038] bgworker for aqo_cleanup #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dc79224
to
4688cf6
Compare
bf3a32d
to
a8d85d5
Compare
status = GetBackgroundWorkerPid(aqo_state->bgw_handle, &pid); | ||
} | ||
} | ||
LWLockRelease(&aqo_state->bgw_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь необязательно вводить новый лок. Операция достаточно редкая и короткая, можно воспользоваться aqo_state->lock
} | ||
} | ||
LWLockRelease(&aqo_state->bgw_lock); | ||
elog(LOG, "status %d", status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот код точно не нужен в релизе
|
||
LWLockAcquire(&aqo_state->bgw_lock, LW_EXCLUSIVE); | ||
if (aqo_state->bgw_handle != NULL) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Такой вариант опасен: если ждать окончания очистки, можно подвесить всех бэкендов на данном хуке. Стоит посмотреть в сторону следующей логики:
'Если удаляется объект проверить bgw_handle и получить pid процесса. Если он еще живой, то ничего не делать. Если не запущен, то запустить и выйти из функции. Если pid уже недействующий, поставить bgw_handle = NULL.
No description provided.