open my $wait_event_names, '<', $ARGV[0] or die;
+my @abi_compatibility_lines;
my @lines;
+my $abi_compatibility = 0;
my $section_name;
my $note;
my $note_name;
{
$section_name = $_;
$section_name =~ s/^.*- //;
+ $abi_compatibility = 0;
next;
}
- push(@lines, $section_name . "\t" . $_);
+ # ABI_compatibility region, preserving ABI compatibility of the code
+ # generated. Any wait events listed in this part of the file will
+ # not be sorted during the code generation.
+ if (/^ABI_compatibility:$/)
+ {
+ $abi_compatibility = 1;
+ next;
+ }
+
+ if ($gen_code && $abi_compatibility)
+ {
+ push(@abi_compatibility_lines, $section_name . "\t" . $_);
+ }
+ else
+ {
+ push(@lines, $section_name . "\t" . $_);
+ }
}
# Sort the lines based on the second column.
my @lines_sorted =
sort { uc((split(/\t/, $a))[1]) cmp uc((split(/\t/, $b))[1]) } @lines;
+# If we are generating code, concat @lines_sorted and then
+# @abi_compatibility_lines.
+if ($gen_code)
+{
+ push(@lines_sorted, @abi_compatibility_lines);
+}
+
# Read the sorted lines and populate the hash table
foreach my $line (@lines_sorted)
{
# When adding a new wait event, make sure it is placed in the appropriate
# ClassName section.
#
+# Wait events added in stable branches should be appended to the lists in
+# the "ABI_compatibility:" region of their related ClassName section to
+# preserve ABI compatibility of the C code generated from this file's data,
+# respecting the order of any wait event already listed there. The
+# "ABI_compatibility:" regions should remain empty on the master branch and
+# on unreleased branches.
+#
# WaitEventLWLock and WaitEventLock have their own C code for their wait event
# enums and function names. Hence, for these, only the SGML documentation is
# generated.
WAL_SUMMARIZER_WAL "Waiting in WAL summarizer for more WAL to be generated."
WAL_WRITER_MAIN "Waiting in main loop of WAL writer process."
+ABI_compatibility:
#
# Wait Events - Client
WAL_SENDER_WAIT_FOR_WAL "Waiting for WAL to be flushed in WAL sender process."
WAL_SENDER_WRITE_DATA "Waiting for any activity when processing replies from WAL receiver in WAL sender process."
+ABI_compatibility:
#
# Wait Events - IPC
WAL_SUMMARY_READY "Waiting for a new WAL summary to be generated."
XACT_GROUP_UPDATE "Waiting for the group leader to update transaction status at end of a parallel operation."
+ABI_compatibility:
#
# Wait Events - Timeout
VACUUM_TRUNCATE "Waiting to acquire an exclusive lock to truncate off any empty pages at the end of a table vacuumed."
WAL_SUMMARIZER_ERROR "Waiting after a WAL summarizer error."
+ABI_compatibility:
#
# Wait Events - IO
WAL_SYNC_METHOD_ASSIGN "Waiting for data to reach durable storage while assigning a new WAL sync method."
WAL_WRITE "Waiting for a write to a WAL file."
+ABI_compatibility:
#
# Wait Events - Buffer Pin
BUFFER_PIN "Waiting to acquire an exclusive pin on a buffer."
+ABI_compatibility:
#
# Wait Events - Extension
Extension "Waiting in an extension."
+ABI_compatibility:
+
#
# Wait Events - LWLock
#
XactSLRU "Waiting to access the transaction status SLRU cache."
ParallelVacuumDSA "Waiting for parallel vacuum dynamic shared memory allocation."
+# No "ABI_compatibility" region here as WaitEventLWLock has its own C code.
#
# Wait Events - Lock
userlock "Waiting to acquire a user lock."
advisory "Waiting to acquire an advisory user lock."
applytransaction "Waiting to acquire a lock on a remote transaction being applied by a logical replication subscriber."
+
+# No "ABI_compatibility" region here as WaitEventLock has its own C code.