Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

Andrey2001
Copy link

No description provided.

@Andrey2001 Andrey2001 requested a review from danolivo September 15, 2022 19:12
@danolivo danolivo force-pushed the stable13 branch 2 times, most recently from dc79224 to 4688cf6 Compare September 23, 2022 11:02
@Alena0704 Alena0704 force-pushed the stable13 branch 3 times, most recently from bf3a32d to a8d85d5 Compare October 3, 2022 12:12
status = GetBackgroundWorkerPid(aqo_state->bgw_handle, &pid);
}
}
LWLockRelease(&aqo_state->bgw_lock);
Copy link
Collaborator

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);
Copy link
Collaborator

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)
{
Copy link
Collaborator

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.

@Andrey2001 Andrey2001 closed this Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants