Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix bug related with queries to dead backends#10

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ildus merged 2 commits intopostgrespro:masterfromCherkashinSergey:fix_segfault
Nov 1, 2018

Conversation

CherkashinSergey
Copy link
Collaborator

Исправлен баг: во время слоных запросов pg_query_state иногда пытался опрашивать процессы, которые уже завершили свою работу.

@codecov-io
Copy link

codecov-io commentedOct 31, 2018
edited
Loading

Codecov Report

Merging#10 intomaster willdecrease coverage by1.09%.
The diff coverage is9.09%.

Impacted file tree graph

@@            Coverage Diff            @@##           master      #10     +/-   ##=========================================- Coverage   76.78%   75.69%   -1.1%=========================================  Files           5        5               Lines         461      469      +8     =========================================+ Hits          354      355      +1- Misses        107      114      +7
Impacted FilesCoverage Δ
pg_query_state.c71.94% <9.09%> (-1.27%)⬇️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updateb7d5f98...91e3196. Read thecomment docs.

@ildusildus changed the titleFix bugFix bug related with queries to dead backendsOct 31, 2018
@@ -971,7 +982,7 @@ GetRemoteBackendQueryStates(PGPROC *leader,
foreach(iter, pworkers)
{
PGPROC *proc = (PGPROC *) lfirst(iter);

Assert (proc && proc->pid);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

вот здесь тоже надо через continue, бекенд может помереть и в этом месте

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Нет, Assert тут правильнее - мы предполагаем, что proc никогда не будет нулевым. А вот условие!proc->pid лишнее.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

А с чего ты взял что он не может быть нулевым?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

У вас тут условие есть в GetRemoteBackendWorkers()

if (!proc || !proc->pid)   continue;

Поэтому видимо не может быть нулевым.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Тут в смысле proc нулевым не будет в любом случае, но процесс мог умереть (или завершиться) и проверка на pid все равно нужна. По хорошему вообще SHARED лок надо ставить на procArray

@ildusildus merged commit1cb4967 intopostgrespro:masterNov 1, 2018
@maksm90
Copy link
Collaborator

@ildus зачем смёржил свой вариант!?

@ildus
Copy link
Collaborator

@maksm90 ответь на вопрос, всегда успеем отменить если нужно.

@maksm90
Copy link
Collaborator

На какой? Выше вроде на всё ответил. Список pworkers как входной аргументGetRemoteBackendQueryStates должен состоять из ненулевых proc - это предусловие. Обеспечиваем это условие на уровне выше вGetRemoteBackendWorkers - это будет постусловием для этой функции. Это обеспечивается вставкойcontinue в цикл:

for (i = 0; i < msg->number; i++){pid_t  pid = msg->pids[i];PGPROC*proc = BackendPidGetProc(pid);result = lcons(proc, result);}

@ildus
Copy link
Collaborator

Это указатели на структуры в shared memory, откуда предположение что pid у них будет валидным всегда?

@maksm90
Copy link
Collaborator

Тут соглашусь, гонки с аллокатором ProcArray могут быть. Тогда имеет смысл работать с pid'ами, а не со структурами PGPROC. Валидность pid'а мы сможем определить, отправляя сигнал (вызовSendProcSignal) или выполняя резолв на PGPROC. Пока мы остановимся на предположении, что гонки допустимы, но маловероятны. Для их полного разрешения надо переписывать всю логику взаимодействия, уменьшая кол-во RPC между процессами. Но это уже будет задача для следующей стадии.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ildusildusildus left review comments

@maksm90maksm90maksm90 left review comments

@za-arthurza-arthurza-arthur left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@CherkashinSergey@codecov-io@maksm90@ildus@za-arthur

[8]ページ先頭

©2009-2025 Movatter.jp