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

Add xact support optimization#9

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

Conversation

@CherkashinSergey
Copy link
Collaborator

Optimization of isVarChangedInTrans()

@codecov-io
Copy link

codecov-io commentedMay 2, 2018
edited
Loading

Codecov Report

Merging#9 intomaster willincrease coverage by0.05%.
The diff coverage is100%.

Impacted file tree graph

@@            Coverage Diff             @@##           master       #9      +/-   ##==========================================+ Coverage   95.02%   95.07%   +0.05%==========================================  Files           4        4                Lines         945      955      +10     ==========================================+ Hits          898      908      +10  Misses         47       47
Impacted FilesCoverage Δ
pg_variables.c95.16% <100%> (+0.06%)⬆️

Continue to review full report at Codecov.

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

@funbringerfunbringer self-requested a reviewMay 3, 2018 10:32
* Check if variable was changed in parent transaction level
*/
staticbool
isVarChangedInUpperTrans(HashVariableEntry*variable)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Функции не хватает декларации в начале файла (долго искал).

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

А теперь вопрос к оформлению: так ли нужны декларации в начале файла? Потому что таковых нет у большинства функций.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Как раз у большинства есть (если учитывать функции с PG_FUNCTION_ARGS). Я за декларации, потому что они позволяют выполнять рефакторинг и выделять новые методы без опасений, что сборка развалится из-за "неправильного" порядка определений функций.

Допустим, в изначальном коде уже есть такая особенность. Зачем усугублять?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

В таком случае, там надо все функции добавить в декларации и вообще порядок в файле навести.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Порядок во всем файле -- это хорошо, но пока лучше не распыляться и привести в порядок свои правки.

Существующий код, который не был затронут в этом пулл реквесте, будем упорядочивать в будущих пулл реквестах.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Ну, не вопрос, конечно. Можно и так. Но мне почему-то кажется уместным сделать это сразу.

* it was created in another context
*/
cvsn=dlist_head_element(ChangedVarsStackNode,node,changedVarsStack);
cvn_new=MemoryContextAllocZero(cvsn->ctx,sizeof(ChangedVarsNode));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Было бы недурно выделить

cvn_new = MemoryContextAllocZero ...cnv_new-> ... = ...

в отдельную inline-функцию, принимающую на вход значения полей и контекст.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Выделил. Но не скажу, что код стал выглядеть менее монстрозно.

cvn_new->package=cvn_old->package;
cvn_new->variable=cvn_old->variable;
dlist_push_head(cvsn->changedVarsList,&cvn_new->node);
(get_actual_value(cvn_new->variable)->level)--;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Надо бы каждое такое место с инкрементом и декрементом уровня выделить в отдельный абзац и сопроводить кратким комментарием-напоминалкой, зачем это нужно.

return (var_prev_state->level== (GetCurrentTransactionNestLevel()-1));
}
return false;
else
Copy link
Collaborator

Choose a reason for hiding this comment

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

Лишняя правка (которая не особо красиво выглядит).

ERROR: unrecognized variable"var_int"
COMMIT;
```
Also you cannot undo removing variable by`ROLLBACK`:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Подобные вещи нужно уточнять у автора задачи. Предложил возможное решение проблемы в личной переписке.

@funbringerfunbringer merged commit6753a2c intopostgrespro:masterMay 4, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@funbringerfunbringerfunbringer 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.

3 participants

@CherkashinSergey@codecov-io@funbringer

[8]ページ先頭

©2009-2025 Movatter.jp