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

Commit9294264

Browse files
committed
Use pgstat_progress_update_multi_param() where possible
This commit changes one code path in REINDEX INDEX and one code pathin CREATE INDEX CONCURRENTLY to report the progress of each operationusing pgstat_progress_update_multi_param() rather thanmultiple calls to pgstat_progress_update_param(). This has theadvantage to make the progress report more consistent to the end-userwithout impacting the amount of information provided.Author: Bharath RupireddyDiscussion:https://postgr.es/m/CALj2ACV5zW7GxD8D_tyO==bcj6ZktQchEKWKPBOAGKiLhAQo=w@mail.gmail.com
1 parentdb8374d commit9294264

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

‎src/backend/catalog/index.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,12 +3686,18 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
36863686

36873687
if (progress)
36883688
{
3689+
constintprogress_cols[]= {
3690+
PROGRESS_CREATEIDX_COMMAND,
3691+
PROGRESS_CREATEIDX_INDEX_OID
3692+
};
3693+
constint64progress_vals[]= {
3694+
PROGRESS_CREATEIDX_COMMAND_REINDEX,
3695+
indexId
3696+
};
3697+
36893698
pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
36903699
heapId);
3691-
pgstat_progress_update_param(PROGRESS_CREATEIDX_COMMAND,
3692-
PROGRESS_CREATEIDX_COMMAND_REINDEX);
3693-
pgstat_progress_update_param(PROGRESS_CREATEIDX_INDEX_OID,
3694-
indexId);
3700+
pgstat_progress_update_multi_param(2,progress_cols,progress_vals);
36953701
}
36963702

36973703
/*

‎src/backend/commands/indexcmds.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,10 +1457,21 @@ DefineIndex(Oid relationId,
14571457
set_indexsafe_procflags();
14581458

14591459
/*
1460-
* The index is now visible, so we can report the OID.
1460+
* The index is now visible, so we can report the OID. While on it,
1461+
* include the report for the beginning of phase 2.
14611462
*/
1462-
pgstat_progress_update_param(PROGRESS_CREATEIDX_INDEX_OID,
1463-
indexRelationId);
1463+
{
1464+
constintprogress_cols[]= {
1465+
PROGRESS_CREATEIDX_INDEX_OID,
1466+
PROGRESS_CREATEIDX_PHASE
1467+
};
1468+
constint64progress_vals[]= {
1469+
indexRelationId,
1470+
PROGRESS_CREATEIDX_PHASE_WAIT_1
1471+
};
1472+
1473+
pgstat_progress_update_multi_param(2,progress_cols,progress_vals);
1474+
}
14641475

14651476
/*
14661477
* Phase 2 of concurrent index build (see comments for validate_index()
@@ -1478,8 +1489,6 @@ DefineIndex(Oid relationId,
14781489
* exclusive lock on our table. The lock code will detect deadlock and
14791490
* error out properly.
14801491
*/
1481-
pgstat_progress_update_param(PROGRESS_CREATEIDX_PHASE,
1482-
PROGRESS_CREATEIDX_PHASE_WAIT_1);
14831492
WaitForLockers(heaplocktag,ShareLock, true);
14841493

14851494
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp