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 support of package removal rollback#11

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

Можно откатывать как удаление одного пакета переменных, так и pgv_free(). Теперь обычные и транзакционные переменные хранятся в разных хэш-таблицах, сами пакеты имеют такую же историю состояний, как и переменные.

funbringer reacted with thumbs up emoji
@za-arthur
Copy link
Contributor

@CherkashinSergey , похоже pg_variables на тестах падает.

@codecov-io
Copy link

codecov-io commentedMay 25, 2018
edited
Loading

Codecov Report

Merging#11 intomaster willincrease coverage by0.38%.
The diff coverage is97.5%.

Impacted file tree graph

@@            Coverage Diff             @@##           master      #11      +/-   ##==========================================+ Coverage   93.91%   94.29%   +0.38%==========================================  Files           4        4                Lines         772      876     +104     ==========================================+ Hits          725      826     +101- Misses         47       50       +3
Impacted FilesCoverage Δ
pg_variables_record.c93.27% <100%> (-0.85%)⬇️
pg_variables.c94.33% <97.39%> (+0.63%)⬆️

Continue to review full report at Codecov.

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

if (!scalar->is_null)
{
oldcxt=MemoryContextSwitchTo(package->hctx);
oldcxt=MemoryContextSwitchTo(is_transactional ?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Предлагаю выделить выбор контекстаis_transactional ? ... : ... в отдельный макрос, принимающий в качестве аргументаpackage.

hash_seq_init(&vstat,package->variablesHash);
while ((variable=
(HashVariableEntry*)hash_seq_search(&vstat))!=NULL)
for(inti=0;i<2;i++)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Объявление переменной в цикле не соответствует ansi c89.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Я мог проглядеть похожие ошибки, советую компилировать сCFLAGS=... -std=c89. Если найдем что-то еще, нужно будет поправить. Мне самому больше нравится не выносить переменные из шапки цикла, но это не соответствует стилю PostgreSQL, а значит, нежелательно.

package->hctxRegular=AllocSetContextCreate(ModuleContext,
PGV_MCXT_VARS,
ALLOCSET_DEFAULT_SIZES);
sprintf(hash_name,"%s variables hash for package \"%s\"",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Для буферов всегда надо использоватьsnprintf.

caseXACT_EVENT_PRE_COMMIT:
applyActionOnChangedVars(RELEASE_SAVEPOINT);
popChangedVarsStack();
proceedChanges(RELEASE_SAVEPOINT);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я думаю, имелся в виду все-таки process, а не proceed.

hash_seq_init(&vstat,package->variablesHash);
while ((variable=
(HashVariableEntry*)hash_seq_search(&vstat))!=NULL)
for(inti=0;i<2;i++)
Copy link
Collaborator

@funbringerfunbringerMay 28, 2018
edited
Loading

Choose a reason for hiding this comment

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

Я посмотрел код в целом, и мне кажется, что как-то много дублирующихся фрагментов.

Например,addToChanged{Packs,Vars}(),is{Var,Pack}ChangedInUpperTrans() итд абсолютно эквивалентны с точностью до пары строчек, вremoveFromChangedVars() два почти одинаковых цикла. Мне не нравится, что практически не производится никаких попыток сжать код.

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

dlist_head*changedPacksList;
MemoryContextctx;
}ChangedVarsStackNode;
}ChangesStackNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Мне кажется тут название непоследовательное. Может ChangedStackNode?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Подразумевается "стэк изменеий". Потому что в самом стеке лежит история изменений как переменных, так и пакетов. "ChangedStack" больше выглядит как "изменённый стэк".

MemoryContextpackageContext);

/* Internal macros to manage with dlist structure */
#defineget_actual_value_scalar(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.

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

dlist_nodenode;
boolis_valid;
intlevel;
}PackHistoryEntry;
Copy link
Contributor

Choose a reason for hiding this comment

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

Пока еще не все смотрел, но кажется тут можно реализовать наследование. VarHistoryEntry наследуется от PackHistoryEntry.

Copy link
Contributor

@za-arthurza-arthurJun 6, 2018
edited
Loading

Choose a reason for hiding this comment

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

typedefstructHistoryEntry{dlist_nodenode;boolis_valid;intlevel;}HistoryEntry;typedefstructVarHistoryEntry{HistoryEntryentry;union    {ScalarVarscalar;RecordVarrecord;    }value;}VarHistoryEntry;/* ... */staticboolfunc(HistoryEntry*entry){/* Do something */returnentry->is_valid;}/* ... */{HistoryEntry*entry=/* ... */;if (is_var)    {VarHistoryEntry*var_entry= (VarHistoryEntry*)entry;/* ... */    }returnfunc(entry);}

@za-arthurza-arthur merged commit26c5328 intopostgrespro:masterJun 21, 2018
@za-arthur
Copy link
Contributor

Смержил!

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

Reviewers

@funbringerfunbringerfunbringer requested changes

+1 more reviewer

@za-arthurza-arthurza-arthur requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@CherkashinSergey@za-arthur@codecov-io@funbringer

[8]ページ先頭

©2009-2025 Movatter.jp