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

Commit59cbf60

Browse files
committed
Remove column for wait event names in wait_event_names.txt
This file is now made of two columns, removing the column listing theuser-visible strings used in the system views and the documentation:- Enum definitions for each class without the prefix "WAIT_EVENT_", soas this information can be grepped in the code and wait_event_names.txtat the same time.- Description in the documentation.The wait event names are now generated from the enum objects inCamelCase, with the underscores removed. The data generated for waitevents is consistent with what was produced by414f6c0.This has the advantage to remove WAIT_EVENT_DOCONLY, which was aplaceholder for the wait event types Lock and LWLock as these two onlyrequire the generation of the documentation.Reviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/ZOxVHQwEC/9X/p/z@paquier.xyz
1 parent414f6c0 commit59cbf60

File tree

2 files changed

+279
-263
lines changed

2 files changed

+279
-263
lines changed

‎src/backend/utils/activity/generate-wait_event_types.pl

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,45 @@
6565
push(@lines,$section_name ."\t" .$_);
6666
}
6767

68-
# Sort the lines based on thethird column.
68+
# Sort the lines based on thesecond column.
6969
# uc() is being used to force the comparison to be case-insensitive.
7070
my@lines_sorted =
71-
sort {uc((split(/\t/,$a))[2])cmpuc((split(/\t/,$b))[2]) }@lines;
71+
sort {uc((split(/\t/,$a))[1])cmpuc((split(/\t/,$b))[1]) }@lines;
7272

7373
# Read the sorted lines and populate the hash table
7474
foreachmy$line (@lines_sorted)
7575
{
7676
die"unable to parse wait_event_names.txt for line$line\n"
77-
unless$line =~/^(\w+)\t+(\w+)\t+(\w+)\t+("\w.*\.")$/;
77+
unless$line =~/^(\w+)\t+(\w+)\t+("\w.*\.")$/;
7878

79-
(my$waitclassname,
80-
my$waiteventenumname,
81-
my$waiteventdescription,
82-
my$waitevendocsentence) =split(/\t/,$line);
79+
(my$waitclassname,my$waiteventname,my$waitevendocsentence) =
80+
split(/\t/,$line);
8381

82+
# Generate the element name for the enums based on the
83+
# description. The C symbols are prefixed with "WAIT_EVENT_".
84+
my$waiteventenumname ="WAIT_EVENT_$waiteventname";
85+
86+
# Build the descriptions. These are in camel-case.
87+
# LWLock and Lock classes do not need any modifications.
88+
my$waiteventdescription ='';
89+
if ($waitclassnameeq'WaitEventLWLock'
90+
||$waitclassnameeq'WaitEventLock')
91+
{
92+
$waiteventdescription =$waiteventname;
93+
}
94+
else
95+
{
96+
my@waiteventparts =split("_",$waiteventname);
97+
foreachmy$waiteventpart (@waiteventparts)
98+
{
99+
$waiteventdescription .=substr($waiteventpart, 0, 1)
100+
.lc(substr($waiteventpart, 1,length($waiteventpart)));
101+
}
102+
}
103+
104+
# Store the event into the list for each class.
84105
my@waiteventlist =
85106
[$waiteventenumname,$waiteventdescription,$waitevendocsentence ];
86-
my$trimmedwaiteventname =$waiteventenumname;
87-
$trimmedwaiteventname =~s/^WAIT_EVENT_//;
88-
89-
die"wait event names must start with 'WAIT_EVENT_'"
90-
if ($trimmedwaiteventnameeq$waiteventenumname);
91107
push(@{$hashwe{$waitclassname} },@waiteventlist);
92108
}
93109

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp