You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"commit":{"oid":"0e5c823806a3519a3f6966637cb62755dee659d4","url":"/postgres/postgres/commit/0e5c823806a3519a3f6966637cb62755dee659d4","authoredDate":"2024-08-30T16:47:39.000-04:00","committedDate":"2024-08-30T16:47:39.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eMake postgres_fdw's query_cancel test less flaky.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"This test occasionally shows\n\n+WARNING: could not get result of cancel request due to timeout\n\nwhich appears to be because the cancel request is sometimes unluckily\nsent to the remote session between queries, and then it's ignored.\n\nThis patch tries to make that less probable in three ways:\n\n1. Use a test query that does not involve remote estimates, so that\nno EXPLAINs are sent.\n2. Make sure that the remote session is ready-to-go (transaction\nstarted, SET commands sent) before we start the timer.\n3. Increase the statement_timeout to 100ms, to give the local\nsession enough time to plan and issue the query.\n\nWe might have to go higher than 100ms to make this adequately\nstable in the buildfarm, but let's see how it goes.\n\nBack-patch to v17 where this test was introduced.\n\nJelte Fennema-Nio and Tom Lane\n\nDiscussion: \u003ca href=\"https://postgr.es/m/578934.1725045685@sss.pgh.pa.us\" rel=\"nofollow\"\u003ehttps://postgr.es/m/578934.1725045685@sss.pgh.pa.us\u003c/a\u003e","authors":[{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false}],"committerAttribution":false,"committer":{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false},"parents":["cb8e50a4a09fe541e32cd54ea90a97f2924121a1"],"globalRelayId":"C_kwDOAA4m0toAKDBlNWM4MjM4MDZhMzUxOWEzZjY5NjY2MzdjYjYyNzU1ZGVlNjU5ZDQ","sha1":"cb8e50a4a09fe541e32cd54ea90a97f2924121a1","sha2":"0e5c823806a3519a3f6966637cb62755dee659d4"},"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":1,"text":"@@ -2,19 +2,31 @@ SELECT version() ~ 'cygwin' AS skip_test \\gset","html":"@@ -2,19 +2,31 @@ SELECT version() ~ \u0026#39;cygwin\u0026#39; AS skip_test \\gset","displayNoNewLineWarning":false,"position":0,"left":1,"right":1},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2,"text":" \\if :skip_test","html":" \\if :skip_test","displayNoNewLineWarning":false,"position":1,"left":2,"right":2},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3,"text":" \\quit","html":" \\quit","displayNoNewLineWarning":false,"position":2,"left":3,"right":3},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4,"text":" \\endif","html":" \\endif","displayNoNewLineWarning":false,"position":3,"left":4,"right":4},{"stylingDirective":null,"type":"DELETION","blobLineNumber":5,"text":"--- Make sure this big CROSS JOIN query is pushed down","html":"--- Make sure this big CROSS JOIN query is pushed down","displayNoNewLineWarning":false,"position":4,"left":5,"right":4},{"stylingDirective":null,"type":"DELETION","blobLineNumber":6,"text":"-EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5;","html":"-EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5;","displayNoNewLineWarning":false,"position":5,"left":6,"right":4},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":5,"text":"+-- Let's test canceling a remote query. Use a table that does not have","html":"+-- Let\u0026#39;s test canceling a remote query. Use a table that does not have","displayNoNewLineWarning":false,"position":6,"left":6,"right":5},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":6,"text":"+-- remote_estimate enabled, else there will be multiple queries to the","html":"+-- remote_estimate enabled, else there will be multiple queries to the","displayNoNewLineWarning":false,"position":7,"left":6,"right":6},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":7,"text":"+-- remote and we might unluckily send the cancel in between two of them.","html":"+-- remote and we might unluckily send the cancel in between two of them.","displayNoNewLineWarning":false,"position":8,"left":6,"right":7},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":8,"text":"+-- First let's confirm that the query is actually pushed down.","html":"+-- First let\u0026#39;s confirm that the query is actually pushed down.","displayNoNewLineWarning":false,"position":9,"left":6,"right":8},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":9,"text":"+EXPLAIN (VERBOSE, COSTS OFF)","html":"+EXPLAIN (VERBOSE, COSTS OFF)","displayNoNewLineWarning":false,"position":10,"left":6,"right":9},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":10,"text":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","html":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","displayNoNewLineWarning":false,"position":11,"left":6,"right":10},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":11,"text":" QUERY PLAN ","html":" QUERY PLAN ","displayNoNewLineWarning":false,"position":12,"left":7,"right":11},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":12,"text":" ---------------------------------------------------------------------------------------------------------------------------------------------------------------------","html":" ---------------------------------------------------------------------------------------------------------------------------------------------------------------------","displayNoNewLineWarning":false,"position":13,"left":8,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" Foreign Scan","html":" Foreign Scan","displayNoNewLineWarning":false,"position":14,"left":9,"right":13},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":14,"text":" Output: (count(*))","html":" Output: (count(*))","displayNoNewLineWarning":false,"position":15,"left":10,"right":14},{"stylingDirective":null,"type":"DELETION","blobLineNumber":11,"text":"- Relations: Aggregate on ((((public.ft1) INNER JOIN (public.ft2)) INNER JOIN (public.ft4)) INNER JOIN (public.ft5))","html":"- Relations: Aggregate on ((((public.ft1) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft2\u003c/span\u003e)) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft4\u003c/span\u003e)) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft5\u003c/span\u003e))","displayNoNewLineWarning":false,"position":16,"left":11,"right":14},{"stylingDirective":null,"type":"DELETION","blobLineNumber":12,"text":"- Remote SQL: SELECT count(*) FROM (((\"S 1\".\"T 1\" r1 INNER JOIN \"S 1\".\"T 1\" r2 ON (TRUE)) INNER JOIN \"S 1\".\"T 3\" r4 ON (TRUE)) INNER JOIN \"S 1\".\"T 4\" r6 ON (TRUE))","html":"- Remote SQL: SELECT count(*) FROM (((\u0026quot;S 1\u0026quot;.\u0026quot;T 1\u0026quot; r1 INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T 1\u0026quot; r2 ON (TRUE)) INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T \u003cspan class=\"x x-first x-last\"\u003e3\u003c/span\u003e\u0026quot; r4 ON (TRUE)) INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T \u003cspan class=\"x x-first x-last\"\u003e4\u003c/span\u003e\u0026quot; r6 ON (TRUE))","displayNoNewLineWarning":false,"position":17,"left":12,"right":14},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":15,"text":"+ Relations: Aggregate on ((((public.ft1 a) INNER JOIN (public.ft1 b)) INNER JOIN (public.ft1 c)) INNER JOIN (public.ft1 d))","html":"+ Relations: Aggregate on ((((public.ft1\u003cspan class=\"x x-first x-last\"\u003e a\u003c/span\u003e) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft1 b\u003c/span\u003e)) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft1 c\u003c/span\u003e)) INNER JOIN (public.\u003cspan class=\"x x-first x-last\"\u003eft1 d\u003c/span\u003e))","displayNoNewLineWarning":false,"position":18,"left":12,"right":15},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":16,"text":"+ Remote SQL: SELECT count(*) FROM (((\"S 1\".\"T 1\" r1 INNER JOIN \"S 1\".\"T 1\" r2 ON (TRUE)) INNER JOIN \"S 1\".\"T 1\" r4 ON (TRUE)) INNER JOIN \"S 1\".\"T 1\" r6 ON (TRUE))","html":"+ Remote SQL: SELECT count(*) FROM (((\u0026quot;S 1\u0026quot;.\u0026quot;T 1\u0026quot; r1 INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T 1\u0026quot; r2 ON (TRUE)) INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T \u003cspan class=\"x x-first x-last\"\u003e1\u003c/span\u003e\u0026quot; r4 ON (TRUE)) INNER JOIN \u0026quot;S 1\u0026quot;.\u0026quot;T \u003cspan class=\"x x-first x-last\"\u003e1\u003c/span\u003e\u0026quot; r6 ON (TRUE))","displayNoNewLineWarning":false,"position":19,"left":12,"right":16},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":17,"text":" (4 rows)","html":" (4 rows)","displayNoNewLineWarning":false,"position":20,"left":13,"right":17},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":18,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":21,"left":14,"right":18},{"stylingDirective":null,"type":"DELETION","blobLineNumber":15,"text":"--- Make sure query cancellation works","html":"--- Make sure query cancellation works","displayNoNewLineWarning":false,"position":22,"left":15,"right":18},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":19,"text":" BEGIN;","html":" BEGIN;","displayNoNewLineWarning":false,"position":23,"left":16,"right":19},{"stylingDirective":null,"type":"DELETION","blobLineNumber":17,"text":"-SET LOCAL statement_timeout = '10ms';","html":"-SET LOCAL statement_timeout = \u0026#39;10ms\u0026#39;;","displayNoNewLineWarning":false,"position":24,"left":17,"right":19},{"stylingDirective":null,"type":"DELETION","blobLineNumber":18,"text":"-select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long","html":"-select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long","displayNoNewLineWarning":false,"position":25,"left":18,"right":19},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":20,"text":"+-- Make sure that connection is open and set up.","html":"+-- Make sure that connection is open and set up.","displayNoNewLineWarning":false,"position":26,"left":18,"right":20},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":21,"text":"+SELECT count(*) FROM ft1 a;","html":"+SELECT count(*) FROM ft1 a;","displayNoNewLineWarning":false,"position":27,"left":18,"right":21},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":22,"text":"+ count ","html":"+ count ","displayNoNewLineWarning":false,"position":28,"left":18,"right":22},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":23,"text":"+-------","html":"+-------","displayNoNewLineWarning":false,"position":29,"left":18,"right":23},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":24,"text":"+ 822","html":"+ 822","displayNoNewLineWarning":false,"position":30,"left":18,"right":24},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":25,"text":"+(1 row)","html":"+(1 row)","displayNoNewLineWarning":false,"position":31,"left":18,"right":25},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":26,"text":"+","html":"+","displayNoNewLineWarning":false,"position":32,"left":18,"right":26},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":27,"text":"+-- Timeout needs to be long enough to be sure that we've sent the slow query.","html":"+-- Timeout needs to be long enough to be sure that we\u0026#39;ve sent the slow query.","displayNoNewLineWarning":false,"position":33,"left":18,"right":27},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":28,"text":"+SET LOCAL statement_timeout = '100ms';","html":"+SET LOCAL statement_timeout = \u0026#39;100ms\u0026#39;;","displayNoNewLineWarning":false,"position":34,"left":18,"right":28},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":29,"text":"+-- This would take very long if not canceled:","html":"+-- This would take very long if not canceled:","displayNoNewLineWarning":false,"position":35,"left":18,"right":29},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":30,"text":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","html":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","displayNoNewLineWarning":false,"position":36,"left":18,"right":30},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":31,"text":" ERROR: canceling statement due to statement timeout","html":" ERROR: canceling statement due to statement timeout","displayNoNewLineWarning":false,"position":37,"left":19,"right":31},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":32,"text":" COMMIT;","html":" COMMIT;","displayNoNewLineWarning":false,"position":38,"left":20,"right":32}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":32,"linesChanged":26,"newTreeEntry":{"lineCount":32,"path":"contrib/postgres_fdw/expected/query_cancel.out","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/postgres_fdw/expected/query_cancel.out","mode":100644},"linesAdded":19,"linesDeleted":7,"path":"contrib/postgres_fdw/expected/query_cancel.out","pathDigest":"e974be62cbd59377cecaf3e47f12ede4215d6aa6873333e06bca403ea15463e6","status":"MODIFIED","truncatedReason":null,"oldOid":"cb8e50a4a09fe541e32cd54ea90a97f2924121a1","newOid":"0e5c823806a3519a3f6966637cb62755dee659d4","copilotChatReference":null,"deletedSha":"cb8e50a4a09fe541e32cd54ea90a97f2924121a1","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":2,"text":"@@ -3,10 +3,18 @@ SELECT version() ~ 'cygwin' AS skip_test \\gset","html":"@@ -3,10 +3,18 @@ SELECT version() ~ \u0026#39;cygwin\u0026#39; AS skip_test \\gset","displayNoNewLineWarning":false,"position":0,"left":2,"right":2},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3,"text":" \\quit","html":" \\quit","displayNoNewLineWarning":false,"position":1,"left":3,"right":3},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4,"text":" \\endif","html":" \\endif","displayNoNewLineWarning":false,"position":2,"left":4,"right":4},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":5,"right":5},{"stylingDirective":null,"type":"DELETION","blobLineNumber":6,"text":"--- Make sure this big CROSS JOIN query is pushed down","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Make sure this big CROSS JOIN query is pushed down\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":6,"right":5},{"stylingDirective":null,"type":"DELETION","blobLineNumber":7,"text":"-EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5;","html":"-EXPLAIN (VERBOSE, COSTS OFF) \u003cspan class=\"pl-k\"\u003eSELECT\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e ft1 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft2 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft4 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft5;","displayNoNewLineWarning":false,"position":5,"left":7,"right":5},{"stylingDirective":null,"type":"DELETION","blobLineNumber":8,"text":"--- Make sure query cancellation works","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Make sure query cancellation works\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":8,"right":5},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":6,"text":"+-- Let's test canceling a remote query. Use a table that does not have","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Let\u0026#39;s test canceling a remote query. Use a table that does not have\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":8,"right":6},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":7,"text":"+-- remote_estimate enabled, else there will be multiple queries to the","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e remote_estimate enabled, else there will be multiple queries to the\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":8,"right":7},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":8,"text":"+-- remote and we might unluckily send the cancel in between two of them.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e remote and we might unluckily send the cancel in between two of them.\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":8,"right":8},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":9,"text":"+-- First let's confirm that the query is actually pushed down.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e First let\u0026#39;s confirm that the query is actually pushed down.\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":8,"right":9},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":10,"text":"+EXPLAIN (VERBOSE, COSTS OFF)","html":"+EXPLAIN (VERBOSE, COSTS OFF)","displayNoNewLineWarning":false,"position":11,"left":8,"right":10},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":11,"text":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","html":"+\u003cspan class=\"pl-k\"\u003eSELECT\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e ft1 a \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 b \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 c \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 d;","displayNoNewLineWarning":false,"position":12,"left":8,"right":11},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":12,"text":"+","html":"+","displayNoNewLineWarning":false,"position":13,"left":8,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" BEGIN;","html":" \u003cspan class=\"pl-k\"\u003eBEGIN\u003c/span\u003e;","displayNoNewLineWarning":false,"position":14,"left":9,"right":13},{"stylingDirective":null,"type":"DELETION","blobLineNumber":10,"text":"-SET LOCAL statement_timeout = '10ms';","html":"-\u003cspan class=\"pl-k\"\u003eSET\u003c/span\u003e LOCAL statement_timeout \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e10ms\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":15,"left":10,"right":13},{"stylingDirective":null,"type":"DELETION","blobLineNumber":11,"text":"-select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long","html":"-\u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e ft1 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft2 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft4 \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft5; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e this takes very long\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":11,"right":13},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":14,"text":"+-- Make sure that connection is open and set up.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Make sure that connection is open and set up.\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":11,"right":14},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":15,"text":"+SELECT count(*) FROM ft1 a;","html":"+\u003cspan class=\"pl-k\"\u003eSELECT\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e ft1 a;","displayNoNewLineWarning":false,"position":18,"left":11,"right":15},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":16,"text":"+-- Timeout needs to be long enough to be sure that we've sent the slow query.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Timeout needs to be long enough to be sure that we\u0026#39;ve sent the slow query.\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":11,"right":16},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":17,"text":"+SET LOCAL statement_timeout = '100ms';","html":"+\u003cspan class=\"pl-k\"\u003eSET\u003c/span\u003e LOCAL statement_timeout \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e100ms\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":20,"left":11,"right":17},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":18,"text":"+-- This would take very long if not canceled:","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e This would take very long if not canceled:\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":11,"right":18},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":19,"text":"+SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;","html":"+\u003cspan class=\"pl-k\"\u003eSELECT\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e ft1 a \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 b \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 c \u003cspan class=\"pl-k\"\u003eCROSS JOIN\u003c/span\u003e ft1 d;","displayNoNewLineWarning":false,"position":22,"left":11,"right":19},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":20,"text":" COMMIT;","html":" \u003cspan class=\"pl-k\"\u003eCOMMIT\u003c/span\u003e;","displayNoNewLineWarning":false,"position":23,"left":12,"right":20}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":20,"linesChanged":18,"newTreeEntry":{"lineCount":20,"path":"contrib/postgres_fdw/sql/query_cancel.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/postgres_fdw/sql/query_cancel.sql","mode":100644},"linesAdded":13,"linesDeleted":5,"path":"contrib/postgres_fdw/sql/query_cancel.sql","pathDigest":"902eab291a1646802d6b77a9da1e13318aa8cc0e47cf1f8efdb04a9a2389a74d","status":"MODIFIED","truncatedReason":null,"oldOid":"cb8e50a4a09fe541e32cd54ea90a97f2924121a1","newOid":"0e5c823806a3519a3f6966637cb62755dee659d4","copilotChatReference":null,"deletedSha":"cb8e50a4a09fe541e32cd54ea90a97f2924121a1","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/0e5c823806a3519a3f6966637cb62755dee659d4","fileTreeExpanded":true,"headerInfo":{"additions":32,"deletions":12,"filesChanged":2,"filesChangedString":"2"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":2,"truncated":false,"byteCount":3361,"lineShownCount":63},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"EveABxMG8eX1Ao1zdEE35Z1r1RdWiTjm660fqmegFrfWEY7tmz_Tvy2gzu-SIQSmvYcURhYy-rWig_dINNuG3w"},"/users/diffview?diff=unified":{"post":"qZYI6FOaWzmgRogUYA8WxByyKxOky8c3vvCac2fB4o9tcAYC26N5Y3jky4iGbyWHPF7qQuRwBWT33nKRNLpy5w"},"/notifications/thread":{"post":"mUV21WXyuveBCHdIFFejIJF1FVYzunPDHQRZNlDlMfurDYDFJMDPMRx2B56KHEYbF96HpYawRXgyKgVnZu75hw"}}},"title":"Make postgres_fdw's query_cancel test less flaky. · postgres/postgres@0e5c823","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}}}
This test occasionally shows
+WARNING: could not get result of cancel request due to timeout
which appears to be because the cancel request is sometimes unluckily
sent to the remote session between queries, and then it's ignored.
This patch tries to make that less probable in three ways:
1. Use a test query that does not involve remote estimates, so that
no EXPLAINs are sent.
2. Make sure that the remote session is ready-to-go (transaction
started, SET commands sent) before we start the timer.
3. Increase the statement_timeout to 100ms, to give the local
session enough time to plan and issue the query.
We might have to go higher than 100ms to make this adequately
stable in the buildfarm, but let's see how it goes.
Back-patch to v17 where this test was introduced.
Jelte Fennema-Nio and Tom Lane
Discussion: https://postgr.es/m/578934.1725045685@sss.pgh.pa.us
0 commit comments