8000 Move Cluster.pm initialization code to a more obvious place · postgres/postgres@70fea39 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"70fea390cfa71c438998993bebfb584effd3e7df","url":"/postgres/postgres/commit/70fea390cfa71c438998993bebfb584effd3e7df","authoredDate":"2024-10-06T10:34:45.000-04:00","committedDate":"2024-10-06T10:34:45.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eMove Cluster.pm initialization code to a more obvious place\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"Commit \u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/postgres/postgres/commit/460c0076e8de6233eee53f4d6c175b04d8d41de9/hovercard\" href=\"https://github.com/postgres/postgres/commit/460c0076e8de6233eee53f4d6c175b04d8d41de9\"\u003e\u003ctt\u003e460c007\u003c/tt\u003e\u003c/a\u003e added some module intialization code to set signal\nhandlers. However, that code has now become somewhat buried, as later\ncommits added new subroutines. Therefore, move the initialization code\nto the module's INIT block where it won't become obscured.","authors":[{"login":"adunstan","displayName":"Andrew Dunstan","avatarUrl":"https://avatars.githubusercontent.com/u/241593?v=4","path":"/adunstan","isGitHub":false}],"committerAttribution":false,"committer":{"login":"adunstan","displayName":"Andrew Dunstan","avatarUrl":"https://avatars.githubusercontent.com/u/241593?v=4","path":"/adunstan","isGitHub":false},"parents":["430ce189fc4521a1c197eee36b8ca6b37b29e86e"],"globalRelayId":"C_kwDOAA4m0toAKDcwZmVhMzkwY2ZhNzFjNDM4OTk4OTkzYmViZmI1ODRlZmZkM2U3ZGY","sha1":"430ce189fc4521a1c197eee36b8ca6b37b29e86e","sha2":"70fea390cfa71c438998993bebfb584effd3e7df"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":174,"text":"@@ -175,6 +175,11 @@ INIT","html":"@@ -175,6 +175,11 @@ INIT","displayNoNewLineWarning":false,"position":0,"left":174,"right":174},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":175,"text":" \t$portdir =~ s!\\\\!/!g;","html":" \t\u003cspan class=\"pl-smi\"\u003e$portdir\u003c/span\u003e =~ \u003cspan class=\"pl-sr\"\u003e\u003cspan class=\"pl-pds\"\u003e\u003cspan class=\"pl-c1\"\u003es\u003c/span\u003e!\u003c/span\u003e\u003cspan class=\"pl-cce\"\u003e\\\\\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"pl-sr\"\u003e\u003cspan class=\"pl-pds\"\u003e!\u003c/span\u003e/\u003cspan class=\"pl-pds\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"pl-sr\"\u003e\u003cspan class=\"pl-pds\"\u003e\u003cspan class=\"pl-k\"\u003eg\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":175,"right":175},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":176,"text":" \t# Make sure the directory exists","html":" \t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Make sure the directory exists\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":176,"right":176},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":177,"text":" \tmkpath($portdir) unless -d $portdir;","html":" \tmkpath(\u003cspan class=\"pl-smi\"\u003e$portdir\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eunless\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e-d\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$portdir\u003c/span\u003e;","displayNoNewLineWarning":false,"position":3,"left":177,"right":177},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":178,"text":"+","html":"+","displayNoNewLineWarning":false,"position":4,"left":177,"right":178},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":179,"text":"+\t#","html":"+\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":177,"right":179},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":180,"text":"+\t# Signal handlers","html":"+\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Signal handlers\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":177,"right":180},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":181,"text":"+\t#","html":"+\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":177,"right":181},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":182,"text":"+\t$SIG{TERM} = $SIG{INT} = sub { die \"death by signal\"; };","html":"+\t\u003cspan class=\"pl-smi\"\u003e$SIG\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003eTERM\u003c/span\u003e} = \u003cspan class=\"pl-smi\"\u003e$SIG\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003eINT\u003c/span\u003e} = \u003cspan class=\"pl-k\"\u003esub\u003c/span\u003e { \u003cspan class=\"pl-k\"\u003edie\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003edeath by signal\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e; };","displayNoNewLineWarning":false,"position":8,"left":177,"right":182},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":183,"text":" }","html":" }","displayNoNewLineWarning":false,"position":9,"left":178,"right":183},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":184,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":10,"left":179,"right":184},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":185,"text":" =pod","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-k\"\u003e=pod\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":180,"right":185},{"stylingDirective":null,"type":"HUNK","blobLineNumber":3354,"text":"@@ -3350,13 +3355,6 @@ sub corrupt_page_checksum","html":"@@ -3350,13 +3355,6 @@ sub corrupt_page_checksum","displayNoNewLineWarning":false,"position":12,"left":3349,"right":3354},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3355,"text":" \treturn;","html":" \t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e;","displayNoNewLineWarning":false,"position":13,"left":3350,"right":3355},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3356,"text":" }","html":" }","displayNoNewLineWarning":false,"position":14,"left":3351,"right":3356},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3357,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":15,"left":3352,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3353,"text":"-#","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":3353,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3354,"text":"-# Signal handlers","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Signal handlers\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":3354,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3355,"text":"-#","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":3355,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3356,"text":"-$SIG{TERM} = $SIG{INT} = sub {","html":"-\u003cspan class=\"pl-smi\"\u003e$SIG\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003eTERM\u003c/span\u003e} = \u003cspan class=\"pl-smi\"\u003e$SIG\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003eINT\u003c/span\u003e} = \u003cspan class=\"pl-k\"\u003esub\u003c/span\u003e {","displayNoNewLineWarning":false,"position":19,"left":3356,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3357,"text":"-\tdie \"death by signal\";","html":"-\t\u003cspan class=\"pl-k\"\u003edie\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003edeath by signal\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":20,"left":3357,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3358,"text":"-};","html":"-};","displayNoNewLineWarning":false,"position":21,"left":3358,"right":3357},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3359,"text":"-","html":"-","displayNoNewLineWarning":false,"position":22,"left":3359,"right":3357},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3358,"text":" =pod","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-k\"\u003e=pod\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":3360,"right":3358},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3359,"text":" ","html":" \u003cspan class=\"pl-c\"\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":3361,"right":3359},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3360,"text":" =item $node-\u003elog_standby_snapshot(self, standby, slot_name)","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-k\"\u003e=item\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$node-\u0026gt;log_standby_snapshot(self, standby, slot_name)\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":3362,"right":3360}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3529,"linesChanged":12,"newTreeEntry":{"lineCount":3529,"path":"src/test/perl/PostgreSQL/Test/Cluster.pm","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/perl/PostgreSQL/Test/Cluster.pm","mode":100644},"linesAdded":5,"linesDeleted":7,"path":"src/test/perl/PostgreSQL/Test/Cluster.pm","pathDigest":"91d950c80585d5592e050e361316dc9c03520a4064ce0077e335a187a88191e8","status":"MODIFIED","truncatedReason":null,"oldOid":"430ce189fc4521a1c197eee36b8ca6b37b29e86e","newOid":"70fea390cfa71c438998993bebfb584effd3e7df","copilotChatReference":null,"deletedSha":"430ce189fc4521a1c197eee36b8ca6b37b29e86e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/70fea390cfa71c438998993bebfb584effd3e7df","fileTreeExpanded":true,"headerInfo":{"additions":5,"deletions":7,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":444,"lineShownCount":26},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"lw5DoCm9S4MPV_fVCfeYPAUqTpw2ESSNGrCrKUvSSx-j-hLHH1u177goIZ8gU4xl51K0KiTb43fq4F3vFYvr8g"},"/users/diffview?diff=unified":{"post":"D-DWPZX-o7hIvrjZ7xPVwcni7PGxi95PJk_MFsmcQLo7FIdaoxhd1P_BbpPGt8GYK5oWR6NBGbXWHzrQl8XgVw"},"/notifications/thread":{"post":"uf8CcxZjRAv2fTD8btGQlbTqMI9fNINenHTNN02SQLkIqhVEPJorIAo33RLBygCKHPEpx-OvPF3Ov1MzOmnK7A"}}},"title":"Move Cluster.pm initialization code to a more obvious place · postgres/postgres@70fea39","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}

Commit 70fea39

Browse files
committed
Move Cluster.pm initialization code to a more obvious place
Commit 460c007 added some module intialization code to set signal handlers. However, that code has now become somewhat buried, as later commits added new subroutines. Therefore, move the initialization code to the module's INIT block where it won't become obscured.
1 parent 430ce18 commit 70fea39

File tree

1 file changed

+5
-7
lines changed

src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ INIT
175175
$portdir =~ s!\\!/!g;
176176
# Make sure the directory exists
177177
mkpath($portdir) unless -d $portdir;
178+
179+
#
180+
# Signal handlers
181+
#
182+
$SIG{TERM} = $SIG{INT} = sub { die "death by signal"; };
178183
}
179184

180185
=pod
@@ -3350,13 +3355,6 @@ sub corrupt_page_checksum
33503355
return;
33513356
}
33523357

3353-
#
3354-
# Signal handlers
3355-
#
3356-
$SIG{TERM} = $SIG{INT} = sub {
3357-
die "death by signal";
3358-
};
3359-
33603358
=pod
33613359
33623360
=item $node->log_standby_snapshot(self, standby, slot_name)

0 commit comments

Comments
 (0)
0