8000 Fix possible crash with Parallel Bitmap Heap Scan. · postgres/postgres@6393613 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"6393613b6a1e0feae3d22af608397b252cee5b58","url":"/postgres/postgres/commit/6393613b6a1e0feae3d22af608397b252cee5b58","authoredDate":"2017-10-13T14:53:28.000-04:00","committedDate":"2017-10-13T15:02:45.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eFix possible crash with Parallel Bitmap Heap Scan.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"If a Parallel Bitmap Heap scan's chain of leftmost descendents\nincludes a BitmapOr whose first child is a BitmapAnd, the prior coding\nwould mistakenly create a non-shared TIDBitmap and then try to perform\nshared iteration.\n\nReport by Tomas Vondra. Patch by Dilip Kumar.\n\nDiscussion: \u003ca href=\"http://postgr.es/m/50e89684-8ad9-dead-8767-c9545bafd3b6@2ndquadrant.com\" rel=\"nofollow\"\u003ehttp://postgr.es/m/50e89684-8ad9-dead-8767-c9545bafd3b6@2ndquadrant.com\u003c/a\u003e","authors":[{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false}],"committerAttribution":false,"committer":{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false},"parents":["73937119bfd07a140da4817f5ca949351942ffdc"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjYzOTM2MTNiNmExZTBmZWFlM2QyMmFmNjA4Mzk3YjI1MmNlZTViNTg=","sha1":"73937119bfd07a140da4817f5ca949351942ffdc","sha2":"6393613b6a1e0feae3d22af608397b252cee5b58"},"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":4932,"text":"@@ -4933,7 +4933,11 @@ bitmap_subplan_mark_shared(Plan *plan)","html":"@@ -4933,7 +4933,11 @@ bitmap_subplan_mark_shared(Plan *plan)","displayNoNewLineWarning":false,"position":0,"left":4932,"right":4932},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4933,"text":" \t\tbitmap_subplan_mark_shared(","html":" \t\t\u003cspan class=pl-en\u003ebitmap_subplan_mark_shared\u003c/span\u003e(","displayNoNewLineWarning":false,"position":1,"left":4933,"right":4933},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4934,"text":" \t\t\t\t\t\t\t\t linitial(((BitmapAnd *) plan)-\u003ebitmapplans));","html":" \t\t\t\t\t\t\t\t \u003cspan class=pl-en\u003elinitial\u003c/span\u003e(((\u003cspan class=pl-smi\u003eBitmapAnd\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003eplan\u003c/span\u003e)\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ebitmapplans\u003c/span\u003e));","displayNoNewLineWarning":false,"position":2,"left":4934,"right":4934},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4935,"text":" \telse if (IsA(plan, BitmapOr))","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eIsA\u003c/span\u003e(\u003cspan class=pl-s1\u003eplan\u003c/span\u003e, \u003cspan class=pl-s1\u003eBitmapOr\u003c/span\u003e))","displayNoNewLineWarning":false,"position":3,"left":4935,"right":4935},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4936,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":4,"left":4935,"right":4936},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4937,"text":" \t\t((BitmapOr *) plan)-\u003eisshared = true;","html":" \t\t((\u003cspan class=pl-smi\u003eBitmapOr\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003eplan\u003c/span\u003e)\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eisshared\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e true;","displayNoNewLineWarning":false,"position":5,"left":4936,"right":4937},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4938,"text":"+\t\tbitmap_subplan_mark_shared(","html":"+\t\t\u003cspan class=pl-en\u003ebitmap_subplan_mark_shared\u003c/span\u003e(","displayNoNewLineWarning":false,"position":6,"left":4936,"right":4938},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4939,"text":"+\t\t\t\t\t\t\t\t linitial(((BitmapOr *) plan)-\u003ebitmapplans));","html":"+\t\t\t\t\t\t\t\t \u003cspan class=pl-en\u003elinitial\u003c/span\u003e(((\u003cspan class=pl-smi\u003eBitmapOr\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003eplan\u003c/span\u003e)\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ebitmapplans\u003c/span\u003e));","displayNoNewLineWarning":false,"position":7,"left":4936,"right":4939},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4940,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":8,"left":4936,"right":4940},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4941,"text":" \telse if (IsA(plan, BitmapIndexScan))","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eIsA\u003c/span\u003e(\u003cspan class=pl-s1\u003eplan\u003c/span\u003e, \u003cspan class=pl-s1\u003eBitmapIndexScan\u003c/span\u003e))","displayNoNewLineWarning":false,"position":9,"left":4937,"right":4941},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4942,"text":" \t\t((BitmapIndexScan *) plan)-\u003eisshared = true;","html":" \t\t((\u003cspan class=pl-smi\u003eBitmapIndexScan\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003eplan\u003c/span\u003e)\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eisshared\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e true;","displayNoNewLineWarning":false,"position":10,"left":4938,"right":4942},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4943,"text":" \telse","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":4939,"right":4943}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":6634,"linesChanged":4,"newTreeEntry":{"lineCount":6634,"path":"src/backend/optimizer/plan/createplan.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/optimizer/plan/createplan.c","mode":100644},"linesAdded":4,"linesDeleted":0,"path":"src/backend/optimizer/plan/createplan.c","pathDigest":"4f0575423ee0e1a3434c5af37bdc873165983c0884489e5ae2c71250c66a0ec3","status":"MODIFIED","truncatedReason":null,"oldOid":"73937119bfd07a140da4817f5ca949351942ffdc","newOid":"6393613b6a1e0feae3d22af608397b252cee5b58","copilotChatReference":null,"deletedSha":"73937119bfd07a140da4817f5ca949351942ffdc","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/6393613b6a1e0feae3d22af608397b252cee5b58","fileTreeExpanded":true,"headerInfo":{"additions":4,"deletions":0,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":413,"lineShownCount":12},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"yA9XPO9Uou4lEDAAb2auJJn_bE3WfHRPiTjmj0RaGeyKgPiFPRj2VDGooq-5aw34UP0aQ2P0cqUYgM_PyBMY5A"},"/users/diffview?diff=unified":{"post":"WboOuldo71kov7y8Alz-r_Pn-l43A6Pb2y0mZGJm6eYbNaEDhSS74zwHLhPUUV1zOuWMUIKLpTFKlQ8k7i_o7g"},"/notifications/thread":{"post":"obzyFr7TCpcFzffwxTdQ0ooGqpTKRApJEEbu05VCQqDNrn-pG2HQkpS4T-LXTUtWWPggeumPsNGACIL8-wkA9Q"}}},"title":"Fix possible crash with Parallel Bitmap Heap Scan. · postgres/postgres@6393613","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 6393613

Browse files
committed
Fix possible crash with Parallel Bitmap Heap Scan.
If a Parallel Bitmap Heap scan's chain of leftmost descendents includes a BitmapOr whose first child is a BitmapAnd, the prior coding would mistakenly create a non-shared TIDBitmap and then try to perform shared iteration. Report by Tomas Vondra. Patch by Dilip Kumar. Discussion: http://postgr.es/m/50e89684-8ad9-dead-8767-c9545bafd3b6@2ndquadrant.com
1 parent 7393711 commit 6393613

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/optimizer/plan/createplan.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,7 +4933,11 @@ bitmap_subplan_mark_shared(Plan *plan)
49334933
bitmap_subplan_mark_shared(
49344934
linitial(((BitmapAnd *) plan)->bitmapplans));
49354935
else if (IsA(plan, BitmapOr))
4936+
{
49364937
((BitmapOr *) plan)->isshared = true;
4938+
bitmap_subplan_mark_shared(
4939+
linitial(((BitmapOr *) plan)->bitmapplans));
4940+
}
49374941
else if (IsA(plan, BitmapIndexScan))
49384942
((BitmapIndexScan *) plan)->isshared = true;
49394943
else

0 commit comments

Comments
 (0)
0