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

Commitfa88928

Browse files
committed
Generate automatically code and documentation related to wait events
The documentation and the code is generated automatically from a newfile called wait_event_names.txt, formatted in sections dedicated toeach wait event class (Timeout, Lock, IO, etc.) with three tab-separatedfields:- C symbol in enums- Format in the system views- Description in the docsUsing this approach has several advantages, as we have proved to berather bad in maintaining this area of the tree across the years:- The order of each item in the documentation and the code, which shouldbe alphabetical, has become incorrect multiple times, and the scriptgenerating the code and documentation has a few rules to enforce that,making the maintenance a no-brainer.- Some wait events were added to the code, but not documented, so thiscannot be missed now.- The order of the tables for each wait event class is enforced in thedocumentation (the input .txt file does so as well for clarity, thoughthis is not mandatory).- Less code, shaving 1.2k lines from the tree, with 1/3 of the savingscoming from the code, the rest from the documentation.The wait event types "Lock" and "LWLock" still have their own code pathfor their code, hence only the documentation is created for them. Theseclasses are listed with a special marker called WAIT_EVENT_DOCONLY inthe input file.Adding a new wait event now requires only an update ofwait_event_names.txt, with "Lock" and "LWLock" treated as exceptions.This commit has been tested with configure/Makefile, the CI and VPATHbuild. clean, distclean and maintainer-clean were working fine.Author: Bertrand Drouvot, Michael PaquierDiscussion:https://postgr.es/m/77a86b3a-c4a8-5f5d-69b9-d70bbf2e9b98@gmail.com
1 parent48efb23 commitfa88928

File tree

22 files changed

+757
-2111
lines changed

22 files changed

+757
-2111
lines changed

‎doc/src/sgml/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/errcodes-table.sgml
1818
/keywords-table.sgml
1919
/version.sgml
20+
/wait_event_types.sgml
2021
# Assorted byproducts from building the above
2122
/postgres-full.xml
2223
/INSTALL.html

‎doc/src/sgml/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
5858

5959
GENERATED_SGML = version.sgml\
6060
features-supported.sgml features-unsupported.sgml errcodes-table.sgml\
61-
keywords-table.sgml
61+
keywords-table.sgml wait_event_types.sgml
6262

6363
ALLSGML :=$(wildcard$(srcdir)/*.sgml$(srcdir)/ref/*.sgml)$(GENERATED_SGML)
6464

@@ -111,6 +111,8 @@ errcodes-table.sgml: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errco
111111
keywords-table.sgml:$(top_srcdir)/src/include/parser/kwlist.h$(wildcard$(srcdir)/keywords/sql*.txt) generate-keywords-table.pl
112112
$(PERL)$(srcdir)/generate-keywords-table.pl$(srcdir)>$@
113113

114+
wait_event_types.sgml:$(top_srcdir)/src/backend/utils/activity/wait_event_names.txt$(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
115+
$(PERL)$(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --docs$<
114116

115117
##
116118
## Generation of some text files.

‎doc/src/sgml/filelist.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<!ENTITY maintenance SYSTEM "maintenance.sgml">
4343
<!ENTITY manage-ag SYSTEM "manage-ag.sgml">
4444
<!ENTITY monitoring SYSTEM "monitoring.sgml">
45+
<!ENTITY wait_event_types SYSTEM "wait_event_types.sgml">
4546
<!ENTITY regress SYSTEM "regress.sgml">
4647
<!ENTITY runtime SYSTEM "runtime.sgml">
4748
<!ENTITY config SYSTEM "config.sgml">

‎doc/src/sgml/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ doc_generated += custom_target('errcodes-table.sgml',
4646
capture:true,
4747
)
4848

49+
doc_generated+=custom_target('wait_event_types.sgml',
50+
input:files(
51+
'../../../src/backend/utils/activity/wait_event_names.txt'),
52+
output:'wait_event_types.sgml',
53+
command: [perl,
54+
files('../../../src/backend/utils/activity/generate-wait_event_types.pl'),
55+
'--outdir','@OUTDIR@','--docs','@INPUT@'],
56+
build_by_default:false,
57+
install:false,
58+
capture:false,
59+
)
60+
4961
# FIXME: this actually has further inputs, adding depfile support to
5062
# generate-keywords-table.pl is probably the best way to address that
5163
# robustly.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp