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

Commit22c1055

Browse files
committed
Use int64 instead of long in incremental sort code
Windows 64bit has 4-byte long values which is not suitable for trackingdisk space usage in the incremental sort code. Let's just make all thesefields int64s.Author: James ColemanDiscussion:https://postgr.es/m/CAApHDvpky%2BUhof8mryPf5i%3D6e6fib2dxHqBrhp0Qhu0NeBhLJw%40mail.gmail.comBackpatch-through: 13, where the incremental sort code was added
1 parent725b43b commit22c1055

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

‎src/backend/commands/explain.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ show_sort_info(SortState *sortstate, ExplainState *es)
26762676
TuplesortInstrumentationstats;
26772677
constchar*sortMethod;
26782678
constchar*spaceType;
2679-
longspaceUsed;
2679+
int64spaceUsed;
26802680

26812681
tuplesort_get_stats(state,&stats);
26822682
sortMethod=tuplesort_method_name(stats.sortMethod);
@@ -2686,7 +2686,7 @@ show_sort_info(SortState *sortstate, ExplainState *es)
26862686
if (es->format==EXPLAIN_FORMAT_TEXT)
26872687
{
26882688
ExplainIndentText(es);
2689-
appendStringInfo(es->str,"Sort Method: %s %s:%ldkB\n",
2689+
appendStringInfo(es->str,"Sort Method: %s %s:"INT64_FORMAT"kB\n",
26902690
sortMethod,spaceType,spaceUsed);
26912691
}
26922692
else
@@ -2715,7 +2715,7 @@ show_sort_info(SortState *sortstate, ExplainState *es)
27152715
TuplesortInstrumentation*sinstrument;
27162716
constchar*sortMethod;
27172717
constchar*spaceType;
2718-
longspaceUsed;
2718+
int64spaceUsed;
27192719

27202720
sinstrument=&sortstate->shared_info->sinstrument[n];
27212721
if (sinstrument->sortMethod==SORT_TYPE_STILL_IN_PROGRESS)
@@ -2731,7 +2731,7 @@ show_sort_info(SortState *sortstate, ExplainState *es)
27312731
{
27322732
ExplainIndentText(es);
27332733
appendStringInfo(es->str,
2734-
"Sort Method: %s %s:%ldkB\n",
2734+
"Sort Method: %s %s:"INT64_FORMAT"kB\n",
27352735
sortMethod,spaceType,spaceUsed);
27362736
}
27372737
else
@@ -2795,23 +2795,23 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
27952795

27962796
if (groupInfo->maxMemorySpaceUsed>0)
27972797
{
2798-
longavgSpace=groupInfo->totalMemorySpaceUsed /groupInfo->groupCount;
2798+
int64avgSpace=groupInfo->totalMemorySpaceUsed /groupInfo->groupCount;
27992799
constchar*spaceTypeName;
28002800

28012801
spaceTypeName=tuplesort_space_type_name(SORT_SPACE_TYPE_MEMORY);
2802-
appendStringInfo(es->str," Average %s:%ldkBPeak %s:%ldkB",
2802+
appendStringInfo(es->str," Average %s:"INT64_FORMAT"kBPeak %s:"INT64_FORMAT"kB",
28032803
spaceTypeName,avgSpace,
28042804
spaceTypeName,groupInfo->maxMemorySpaceUsed);
28052805
}
28062806

28072807
if (groupInfo->maxDiskSpaceUsed>0)
28082808
{
2809-
longavgSpace=groupInfo->totalDiskSpaceUsed /groupInfo->groupCount;
2809+
int64avgSpace=groupInfo->totalDiskSpaceUsed /groupInfo->groupCount;
28102810

28112811
constchar*spaceTypeName;
28122812

28132813
spaceTypeName=tuplesort_space_type_name(SORT_SPACE_TYPE_DISK);
2814-
appendStringInfo(es->str," Average %s:%ldkBPeak %s:%ldkB",
2814+
appendStringInfo(es->str," Average %s:"INT64_FORMAT"kBPeak %s:"INT64_FORMAT"kB",
28152815
spaceTypeName,avgSpace,
28162816
spaceTypeName,groupInfo->maxDiskSpaceUsed);
28172817
}
@@ -2829,7 +2829,7 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
28292829

28302830
if (groupInfo->maxMemorySpaceUsed>0)
28312831
{
2832-
longavgSpace=groupInfo->totalMemorySpaceUsed /groupInfo->groupCount;
2832+
int64avgSpace=groupInfo->totalMemorySpaceUsed /groupInfo->groupCount;
28332833
constchar*spaceTypeName;
28342834
StringInfoDatamemoryName;
28352835

@@ -2846,7 +2846,7 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
28462846
}
28472847
if (groupInfo->maxDiskSpaceUsed>0)
28482848
{
2849-
longavgSpace=groupInfo->totalDiskSpaceUsed /groupInfo->groupCount;
2849+
int64avgSpace=groupInfo->totalDiskSpaceUsed /groupInfo->groupCount;
28502850
constchar*spaceTypeName;
28512851
StringInfoDatadiskName;
28522852

‎src/include/nodes/execnodes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,10 +2032,10 @@ typedef struct SortState
20322032
typedefstructIncrementalSortGroupInfo
20332033
{
20342034
int64groupCount;
2035-
longmaxDiskSpaceUsed;
2036-
longtotalDiskSpaceUsed;
2037-
longmaxMemorySpaceUsed;
2038-
longtotalMemorySpaceUsed;
2035+
int64maxDiskSpaceUsed;
2036+
int64totalDiskSpaceUsed;
2037+
int64maxMemorySpaceUsed;
2038+
int64totalMemorySpaceUsed;
20392039
bits32sortMethods;/* bitmask of TuplesortMethod */
20402040
}IncrementalSortGroupInfo;
20412041

‎src/include/utils/tuplesort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ typedef struct TuplesortInstrumentation
9090
{
9191
TuplesortMethodsortMethod;/* sort algorithm used */
9292
TuplesortSpaceTypespaceType;/* type of space spaceUsed represents */
93-
longspaceUsed;/* space consumption, in kB */
93+
int64spaceUsed;/* space consumption, in kB */
9494
}TuplesortInstrumentation;
9595

9696

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp