8000 pg_visibility: Add pg_truncate_visibility_map function. · postgres/postgres@71d05a2 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"71d05a2c7b82379bb1013a0e338906349c54ed85","url":"/postgres/postgres/commit/71d05a2c7b82379bb1013a0e338906349c54ed85","authoredDate":"2016-06-17T17:37:30.000-04:00","committedDate":"2016-06-17T17:37:30.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003epg_visibility: Add pg_truncate_visibility_map function.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"This requires some core changes as well so that we can properly\nWAL-log the truncation. Specifically, it changes the format of the\nXLOG_SMGR_TRUNCATE WAL record, so bump XLOG_PAGE_MAGIC.\n\nPatch by me, reviewed but not fully endorsed by Andres Freund.","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":["54f5c5150fa05d7ad15f8406debd5a2b394885b5"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjcxZDA1YTJjN2I4MjM3OWJiMTAxM2EwZTMzODkwNjM0OWM1NGVkODU=","sha1":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","sha2":"71d05a2c7b82379bb1013a0e338906349c54ed85"},"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":12,"text":"@@ -13,5 +13,12 @@ RETURNS SETOF tid","html":"@@ -13,5 +13,12 @@ RETURNS SETOF tid","displayNoNewLineWarning":false,"position":0,"left":12,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" AS 'MODULE_PATHNAME', 'pg_check_visible'","html":" \u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_check_visible\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":13,"right":13},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":14,"text":" LANGUAGE C STRICT;","html":" LANGUAGE C STRICT;","displayNoNewLineWarning":false,"position":2,"left":14,"right":14},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":15,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":15,"right":15},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":16,"text":"+CREATE FUNCTION pg_truncate_visibility_map(regclass)","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e \u003cspan class=\"pl-en\"\u003epg_truncate_visibility_map\u003c/span\u003e(regclass)","displayNoNewLineWarning":false,"position":4,"left":15,"right":16},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":17,"text":"+RETURNS void","html":"+RETURNS void","displayNoNewLineWarning":false,"position":5,"left":15,"right":17},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":18,"text":"+AS 'MODULE_PATHNAME', 'pg_truncate_visibility_map'","html":"+\u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_truncate_visibility_map\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":15,"right":18},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":19,"text":"+LANGUAGE C STRICT","html":"+LANGUAGE C STRICT","displayNoNewLineWarning":false,"position":7,"left":15,"right":19},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":20,"text":"+PARALLEL UNSAFE; -- let's not make this any more dangerous","html":"+PARALLEL UNSAFE; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e let\u0026#39;s not make this any more dangerous\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":15,"right":20},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":21,"text":"+","html":"+","displayNoNewLineWarning":false,"position":9,"left":15,"right":21},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":22,"text":" REVOKE ALL ON FUNCTION pg_check_frozen(regclass) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_check_frozen(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":10,"left":16,"right":22},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":23,"text":" REVOKE ALL ON FUNCTION pg_check_visible(regclass) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_check_visible(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":11,"left":17,"right":23},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":24,"text":"+REVOKE ALL ON FUNCTION pg_truncate_visibility_map(regclass) FROM PUBLIC;","html":"+\u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_truncate_visibility_map(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":12,"left":17,"right":24}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":24,"linesChanged":7,"newTreeEntry":{"lineCount":24,"path":"contrib/pg_visibility/pg_visibility--1.0--1.1.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pg_visibility/pg_visibility--1.0--1.1.sql","mode":100644},"linesAdded":7,"linesDeleted":0,"path":"contrib/pg_visibility/pg_visibility--1.0--1.1.sql","pathDigest":"f74dcd6a4fe322e9287feb2ca78b2eee7e39e26e5a8b456ef477f92ff69e6944","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":56,"text":"@@ -57,6 +57,13 @@ RETURNS SETOF tid","html":"@@ -57,6 +57,13 @@ RETURNS SETOF tid","displayNoNewLineWarning":false,"position":0,"left":56,"right":56},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":57,"text":" AS 'MODULE_PATHNAME', 'pg_check_visible'","html":" \u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_check_visible\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":57,"right":57},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":58,"text":" LANGUAGE C STRICT;","html":" LANGUAGE C STRICT;","displayNoNewLineWarning":false,"position":2,"left":58,"right":58},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":59,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":59,"right":59},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":60,"text":"+-- Truncate the visibility map fork.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Truncate the visibility map fork.\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":59,"right":60},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":61,"text":"+CREATE FUNCTION pg_truncate_visibility_map(regclass)","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e \u003cspan class=\"pl-en\"\u003epg_truncate_visibility_map\u003c/span\u003e(regclass)","displayNoNewLineWarning":false,"position":5,"left":59,"right":61},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":62,"text":"+RETURNS void","html":"+RETURNS void","displayNoNewLineWarning":false,"position":6,"left":59,"right":62},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":63,"text":"+AS 'MODULE_PATHNAME', 'pg_truncate_visibility_map'","html":"+\u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_truncate_visibility_map\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":59,"right":63},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":64,"text":"+LANGUAGE C STRICT","html":"+LANGUAGE C STRICT","displayNoNewLineWarning":false,"position":8,"left":59,"right":64},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":65,"text":"+PARALLEL UNSAFE; -- let's not make this any more dangerous","html":"+PARALLEL UNSAFE; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e let\u0026#39;s not make this any more dangerous\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":59,"right":65},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":66,"text":"+","html":"+","displayNoNewLineWarning":false,"position":10,"left":59,"right":66},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":67,"text":" -- Don't want these to be available to public.","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Don\u0026#39;t want these to be available to public.\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":60,"right":67},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":68,"text":" REVOKE ALL ON FUNCTION pg_visibility_map(regclass, bigint) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_visibility_map(regclass, \u003cspan class=\"pl-k\"\u003ebigint\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":12,"left":61,"right":68},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":69,"text":" REVOKE ALL ON FUNCTION pg_visibility(regclass, bigint) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_visibility(regclass, \u003cspan class=\"pl-k\"\u003ebigint\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":13,"left":62,"right":69},{"stylingDirective":null,"type":"HUNK","blobLineNumber":71,"text":"@@ -65,3 +72,4 @@ REVOKE ALL ON FUNCTION pg_visibility(regclass) FROM PUBLIC;","html":"@@ -65,3 +72,4 @@ REVOKE ALL ON FUNCTION pg_visibility(regclass) FROM PUBLIC;","displayNoNewLineWarning":false,"position":14,"left":64,"right":71},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":72,"text":" REVOKE ALL ON FUNCTION pg_visibility_map_summary(regclass) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_visibility_map_summary(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":15,"left":65,"right":72},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":73,"text":" REVOKE ALL ON FUNCTION pg_check_frozen(regclass) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_check_frozen(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":16,"left":66,"right":73},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":74,"text":" REVOKE ALL ON FUNCTION pg_check_visible(regclass) FROM PUBLIC;","html":" \u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_check_visible(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":17,"left":67,"right":74},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":75,"text":"+REVOKE ALL ON FUNCTION pg_truncate_visibility_map(regclass) FROM PUBLIC;","html":"+\u003cspan class=\"pl-k\"\u003eREVOKE\u003c/span\u003e ALL \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e FUNCTION pg_truncate_visibility_map(regclass) \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e PUBLIC;","displayNoNewLineWarning":false,"position":18,"left":67,"right":75}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":75,"linesChanged":8,"newTreeEntry":{"lineCount":75,"path":"contrib/pg_visibility/pg_visibility--1.1.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pg_visibility/pg_visibility--1.1.sql","mode":100644},"linesAdded":8,"linesDeleted":0,"path":"contrib/pg_visibility/pg_visibility--1.1.sql","pathDigest":"0c2a8979899af995529b9d8e7039df47352f8acd2751ef0d02554da2dd4abb2c","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":10,"text":"@@ -11,10 +11,12 @@","html":"@@ -11,10 +11,12 @@","displayNoNewLineWarning":false,"position":0,"left":10,"right":10},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":11,"text":" #include \"access/htup_details.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;access/htup_details.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":11,"right":11},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":12,"text":" #include \"access/visibilitymap.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;access/visibilitymap.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":12,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" #include \"catalog/pg_type.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;catalog/pg_type.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":13,"right":13},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":14,"text":"+#include \"catalog/storage_xlog.h\"","html":"+\u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;catalog/storage_xlog.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":13,"right":14},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":15,"text":" #include \"funcapi.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;funcapi.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":14,"right":15},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":16,"text":" #include \"miscadmin.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;miscadmin.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":15,"right":16},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":17,"text":" #include \"storage/bufmgr.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;storage/bufmgr.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":16,"right":17},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":18,"text":" #include \"storage/procarray.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;storage/procarray.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":17,"right":18},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":19,"text":"+#include \"storage/smgr.h\"","html":"+\u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;storage/smgr.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":17,"right":19},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":20,"text":" #include \"utils/rel.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;utils/rel.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":18,"right":20},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":21,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":11,"left":19,"right":21},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":22,"text":" PG_MODULE_MAGIC;","html":" \u003cspan class=pl-c1\u003ePG_MODULE_MAGIC\u003c/span\u003e;","displayNoNewLineWarning":false,"position":12,"left":20,"right":22},{"stylingDirective":null,"type":"HUNK","blobLineNumber":41,"text":"@@ -40,6 +42,7 @@ PG_FUNCTION_INFO_V1(pg_visibility_rel);","html":"@@ -40,6 +42,7 @@ PG_FUNCTION_INFO_V1(pg_visibility_rel);","displayNoNewLineWarning":false,"position":13,"left":39,"right":41},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":42,"text":" PG_FUNCTION_INFO_V1(pg_visibility_map_summary);","html":" \u003cspan class=pl-en\u003ePG_FUNCTION_INFO_V1\u003c/span\u003e(\u003cspan class=pl-s1\u003epg_visibility_map_summary\u003c/span\u003e);","displayNoNewLineWarning":false,"position":14,"left":40,"right":42},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":43,"text":" PG_FUNCTION_INFO_V1(pg_check_frozen);","html":" \u003cspan class=pl-en\u003ePG_FUNCTION_INFO_V1\u003c/span\u003e(\u003cspan class=pl-s1\u003epg_check_frozen\u003c/span\u003e);","displayNoNewLineWarning":false,"position":15,"left":41,"right":43},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":44,"text":" PG_FUNCTION_INFO_V1(pg_check_visible);","html":" \u003cspan class=pl-en\u003ePG_FUNCTION_INFO_V1\u003c/span\u003e(\u003cspan class=pl-s1\u003epg_check_visible\u003c/span\u003e);","displayNoNewLineWarning":false,"position":16,"left":42,"right":44},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":45,"text":"+PG_FUNCTION_INFO_V1(pg_truncate_visibility_map);","html":"+\u003cspan class=pl-en\u003ePG_FUNCTION_INFO_V1\u003c/span\u003e(\u003cspan class=pl-s1\u003epg_truncate_visibility_map\u003c/span\u003e);","displayNoNewLineWarning":false,"position":17,"left":42,"right":45},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":46,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":18,"left":43,"right":46},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":47,"text":" static TupleDesc pg_visibility_tupdesc(bool include_blkno, bool include_pd);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eTupleDesc\u003c/span\u003e \u003cspan class=pl-en\u003epg_visibility_tupdesc\u003c/span\u003e(\u003cspan class=pl-smi\u003ebool\u003c/span\u003e \u003cspan class=pl-s1\u003einclude_blkno\u003c/span\u003e, \u003cspan class=pl-smi\u003ebool\u003c/span\u003e \u003cspan class=pl-s1\u003einclude_pd\u003c/span\u003e);","displayNoNewLineWarning":false,"position":19,"left":44,"right":47},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":48,"text":" static vbits *collect_visibility_data(Oid relid, bool include_pd);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evbits\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-en\u003ecollect_visibility_data\u003c/span\u003e(\u003cspan class=pl-smi\u003eOid\u003c/span\u003e \u003cspan class=pl-s1\u003erelid\u003c/span\u003e, \u003cspan class=pl-smi\u003ebool\u003c/span\u003e \u003cspan class=pl-s1\u003einclude_pd\u003c/span\u003e);","displayNoNewLineWarning":false,"position":20,"left":45,"right":48},{"stylingDirective":null,"type":"HUNK","blobLineNumber":337,"text":"@@ -335,6 +338,75 @@ pg_check_visible(PG_FUNCTION_ARGS)","html":"@@ -335,6 +338,75 @@ pg_check_visible(PG_FUNCTION_ARGS)","displayNoNewLineWarning":false,"position":21,"left":334,"right":337},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":338,"text":" \tSRF_RETURN_DONE(funcctx);","html":" \t\u003cspan class=pl-en\u003eSRF_RETURN_DONE\u003c/span\u003e(\u003cspan class=pl-s1\u003efuncctx\u003c/span\u003e);","displayNoNewLineWarning":false,"position":22,"left":335,"right":338},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":339,"text":" }","html":" }","displayNoNewLineWarning":false,"position":23,"left":336,"right":339},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":340,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":24,"left":337,"right":340},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":341,"text":"+/*","html":"+\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":337,"right":341},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":342,"text":"+ * Remove the visibility map fork for a relation. If there turn out to be","html":"+\u003cspan class=pl-c\u003e * Remove the visibility map fork for a relation. If there turn out to be\u003c/span\u003e","displayNoNewLineWarning":false,"position":26,"left":337,"right":342},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":343,"text":"+ * any bugs in the visibility map code that require rebuilding the VM, this","html":"+\u003cspan class=pl-c\u003e * any bugs in the visibility map code that require rebuilding the VM, this\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":337,"right":343},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":344,"text":"+ * provides users with a way to do it that is cleaner than shutting down the","html":"+\u003cspan class=pl-c\u003e * provides users with a way to do it that is cleaner than shutting down the\u003c/span\u003e","displayNoNewLineWarning":false,"position":28,"left":337,"right":344},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":345,"text":"+ * server and removing files by hand.","html":"+\u003cspan class=pl-c\u003e * server and removing files by hand.\u003c/span\u003e","displayNoNewLineWarning":false,"position":29,"left":337,"right":345},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":346,"text":"+ *","html":"+\u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":337,"right":346},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":347,"text":"+ * This is a cut-down version of RelationTruncate.","html":"+\u003cspan class=pl-c\u003e * This is a cut-down version of RelationTruncate.\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":337,"right":347},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":348,"text":"+ */","html":"+\u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":337,"right":348},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":349,"text":"+Datum","html":"+\u003cspan class=pl-smi\u003eDatum\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":337,"right":349},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":350,"text":"+pg_truncate_visibility_map(PG_FUNCTION_ARGS)","html":"+\u003cspan class=pl-en\u003epg_truncate_visibility_map\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_FUNCTION_ARGS\u003c/span\u003e)","displayNoNewLineWarning":false,"position":34,"left":337,"right":350},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":351,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":35,"left":337,"right":351},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":352,"text":"+\tOid\t\t\trelid = PG_GETARG_OID(0);","html":"+\t\u003cspan class=pl-smi\u003eOid\u003c/span\u003e\t\t\t\u003cspan class=pl-s1\u003erelid\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003ePG_GETARG_OID\u003c/span\u003e(\u003cspan class=pl-c1\u003e0\u003c/span\u003e);","displayNoNewLineWarning":false,"position":36,"left":337,"right":352},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":353,"text":"+\tRelation\trel;","html":"+\t\u003cspan class=pl-smi\u003eRelation\u003c/span\u003e\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e;","displayNoNewLineWarning":false,"position":37,"left":337,"right":353},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":354,"text":"+","html":"+","displayNoNewLineWarning":false,"position":38,"left":337,"right":354},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":355,"text":"+\trel = relation_open(relid, AccessExclusiveLock);","html":"+\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003erelation_open\u003c/span\u003e(\u003cspan class=pl-s1\u003erelid\u003c/span\u003e, \u003cspan class=pl-s1\u003eAccessExclusiveLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":39,"left":337,"right":355},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":356,"text":"+","html":"+","displayNoNewLineWarning":false,"position":40,"left":337,"right":356},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":357,"text":"+\tif (rel-\u003erd_rel-\u003erelkind != RELKIND_RELATION \u0026\u0026","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_rel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelkind\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eRELKIND_RELATION\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":41,"left":337,"right":357},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":358,"text":"+\t\trel-\u003erd_rel-\u003erelkind != RELKIND_MATVIEW \u0026\u0026","html":"+\t\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_rel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelkind\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eRELKIND_MATVIEW\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":42,"left":337,"right":358},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":359,"text":"+\t\trel-\u003erd_rel-\u003erelkind != RELKIND_TOASTVALUE)","html":"+\t\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_rel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelkind\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eRELKIND_TOASTVALUE\u003c/span\u003e)","displayNoNewLineWarning":false,"position":43,"left":337,"right":359},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":360,"text":"+\t\tereport(ERROR,","html":"+\t\t\u003cspan class=pl-en\u003eereport\u003c/span\u003e(\u003cspan class=pl-c1\u003eERROR\u003c/span\u003e,","displayNoNewLineWarning":false,"position":44,"left":337,"right":360},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":361,"text":"+\t\t\t\t(errcode(ERRCODE_WRONG_OBJECT_TYPE),","html":"+\t\t\t\t(\u003cspan class=pl-en\u003eerrcode\u003c/span\u003e(\u003cspan class=pl-c1\u003eERRCODE_WRONG_OBJECT_TYPE\u003c/span\u003e),","displayNoNewLineWarning":false,"position":45,"left":337,"right":361},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":362,"text":"+\t\t errmsg(\"\\\"%s\\\" is not a table, materialized view, or TOAST table\",","html":"+\t\t \u003cspan class=pl-en\u003eerrmsg\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;\\\u0026quot;%s\\\u0026quot; is not a table, materialized view, or TOAST table\u0026quot;\u003c/span\u003e,","displayNoNewLineWarning":false,"position":46,"left":337,"right":362},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":363,"text":"+\t\t\t\t RelationGetRelationName(rel))));","html":"+\t\t\t\t \u003cspan class=pl-en\u003eRelationGetRelationName\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e))));","displayNoNewLineWarning":false,"position":47,"left":337,"right":363},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":364,"text":"+","html":"+","displayNoNewLineWarning":false,"position":48,"left":337,"right":364},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":365,"text":"+\tRelationOpenSmgr(rel);","html":"+\t\u003cspan class=pl-en\u003eRelationOpenSmgr\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e);","displayNoNewLineWarning":false,"position":49,"left":337,"right":365},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":366,"text":"+\trel-\u003erd_smgr-\u003esmgr_vm_nblocks = InvalidBlockNumber;","html":"+\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_smgr\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esmgr_vm_nblocks\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eInvalidBlockNumber\u003c/span\u003e;","displayNoNewLineWarning":false,"position":50,"left":337,"right":366},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":367,"text":"+","html":"+","displayNoNewLineWarning":false,"position":51,"left":337,"right":367},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":368,"text":"+\tvisibilitymap_truncate(rel, 0);","html":"+\t\u003cspan class=pl-en\u003evisibilitymap_truncate\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e, \u003cspan class=pl-c1\u003e0\u003c/span\u003e);","displayNoNewLineWarning":false,"position":52,"left":337,"right":368},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":369,"text":"+","html":"+","displayNoNewLineWarning":false,"position":53,"left":337,"right":369},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":370,"text":"+\tif (RelationNeedsWAL(rel))","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eRelationNeedsWAL\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e))","displayNoNewLineWarning":false,"position":54,"left":337,"right":370},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":371,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":55,"left":337,"right":371},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":372,"text":"+\t\txl_smgr_truncate xlrec;","html":"+\t\t\u003cspan class=pl-smi\u003exl_smgr_truncate\u003c/span\u003e \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e;","displayNoNewLineWarning":false,"position":56,"left":337,"right":372},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":373,"text":"+","html":"+","displayNoNewLineWarning":false,"po 8000 sition":57,"left":337,"right":373},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":374,"text":"+\t\txlrec.blkno = 0;","html":"+\t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e;","displayNoNewLineWarning":false,"position":58,"left":337,"right":374},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":375,"text":"+\t\txlrec.rnode = rel-\u003erd_node;","html":"+\t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan class=pl-c1\u003ernode\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_node\u003c/span\u003e;","displayNoNewLineWarning":false,"position":59,"left":337,"right":375},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":376,"text":"+\t\txlrec.flags = SMGR_TRUNCATE_VM;","html":"+\t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan class=pl-c1\u003eflags\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_VM\u003c/span\u003e;","displayNoNewLineWarning":false,"position":60,"left":337,"right":376},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":377,"text":"+","html":"+","displayNoNewLineWarning":false,"position":61,"left":337,"right":377},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":378,"text":"+\t\tXLogBeginInsert();","html":"+\t\t\u003cspan class=pl-en\u003eXLogBeginInsert\u003c/span\u003e();","displayNoNewLineWarning":false,"position":62,"left":337,"right":378},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":379,"text":"+\t\tXLogRegisterData((char *) \u0026xlrec, sizeof(xlrec));","html":"+\t\t\u003cspan class=pl-en\u003eXLogRegisterData\u003c/span\u003e((\u003cspan class=pl-smi\u003echar\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e, \u003cspan class=pl-k\u003esizeof\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e));","displayNoNewLineWarning":false,"position":63,"left":337,"right":379},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":380,"text":"+","html":"+","displayNoNewLineWarning":false,"position":64,"left":337,"right":380},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":381,"text":"+\t\tXLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE | XLR_SPECIAL_REL_UPDATE);","html":"+\t\t\u003cspan class=pl-en\u003eXLogInsert\u003c/span\u003e(\u003cspan class=pl-c1\u003eRM_SMGR_ID\u003c/span\u003e, \u003cspan class=pl-c1\u003eXLOG_SMGR_TRUNCATE\u003c/span\u003e | \u003cspan class=pl-c1\u003eXLR_SPECIAL_REL_UPDATE\u003c/span\u003e);","displayNoNewLineWarning":false,"position":65,"left":337,"right":381},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":382,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":66,"left":337,"right":382},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":383,"text":"+","html":"+","displayNoNewLineWarning":false,"position":67,"left":337,"right":383},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":384,"text":"+\t/*","html":"+\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":68,"left":337,"right":384},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":385,"text":"+\t * Release the lock right away, not at commit time.","html":"+\u003cspan class=pl-c\u003e\t * Release the lock right away, not at commit time.\u003c/span\u003e","displayNoNewLineWarning":false,"position":69,"left":337,"right":385},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":386,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":70,"left":337,"right":386},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":387,"text":"+\t * It would be a problem to release the lock prior to commit if this","html":"+\u003cspan class=pl-c\u003e\t * It would be a problem to release the lock prior to commit if this\u003c/span\u003e","displayNoNewLineWarning":false,"position":71,"left":337,"right":387},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":388,"text":"+\t * truncate operation sends any transactional invalidation messages. Other","html":"+\u003cspan class=pl-c\u003e\t * truncate operation sends any transactional invalidation messages. Other\u003c/span\u003e","displayNoNewLineWarning":false,"position":72,"left":337,"right":388},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":389,"text":"+\t * backends would potentially be able to lock the relation without","html":"+\u003cspan class=pl-c\u003e\t * backends would potentially be able to lock the relation without\u003c/span\u003e","displayNoNewLineWarning":false,"position":73,"left":337,"right":389},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":390,"text":"+\t * processing them in the window of time between when we release the lock","html":"+\u003cspan class=pl-c\u003e\t * processing them in the window of time between when we release the lock\u003c/span\u003e","displayNoNewLineWarning":false,"position":74,"left":337,"right":390},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":391,"text":"+\t * here and when we sent the messages at our eventual commit. However,","html":"+\u003cspan class=pl-c\u003e\t * here and when we sent the messages at our eventual commit. However,\u003c/span\u003e","displayNoNewLineWarning":false,"position":75,"left":337,"right":391},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":392,"text":"+\t * we're currently only sending a non-transactional smgr invalidation,","html":"+\u003cspan class=pl-c\u003e\t * we\u0026#39;re currently only sending a non-transactional smgr invalidation,\u003c/span\u003e","displayNoNewLineWarning":false,"position":76,"left":337,"right":392},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":393,"text":"+\t * which will have been posted to shared memory immediately from within","html":"+\u003cspan class=pl-c\u003e\t * which will have been posted to shared memory immediately from within\u003c/span\u003e","displayNoNewLineWarning":false,"position":77,"left":337,"right":393},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":394,"text":"+\t * visibilitymap_truncate. Therefore, there should be no race here.","html":"+\u003cspan class=pl-c\u003e\t * visibilitymap_truncate. Therefore, there should be no race here.\u003c/span\u003e","displayNoNewLineWarning":false,"position":78,"left":337,"right":394},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":395,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":79,"left":337,"right":395},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":396,"text":"+\t * The reason why it's desirable to release the lock early here is because","html":"+\u003cspan class=pl-c\u003e\t * The reason why it\u0026#39;s desirable to release the lock early here is because\u003c/span\u003e","displayNoNewLineWarning":false,"position":80,"left":337,"right":396},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":397,"text":"+\t * of the possibility that someone will need to use this to blow away many","html":"+\u003cspan class=pl-c\u003e\t * of the possibility that someone will need to use this to blow away many\u003c/span\u003e","displayNoNewLineWarning":false,"position":81,"left":337,"right":397},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":398,"text":"+\t * visibility map forks at once. If we can't release the lock until","html":"+\u003cspan class=pl-c\u003e\t * visibility map forks at once. If we can\u0026#39;t release the lock until\u003c/span\u003e","displayNoNewLineWarning":false,"position":82,"left":337,"right":398},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":399,"text":"+\t * commit time, the transaction doing this will accumulate","html":"+\u003cspan class=pl-c\u003e\t * commit time, the transaction doing this will accumulate\u003c/span\u003e","displayNoNewLineWarning":false,"position":83,"left":337,"right":399},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":400,"text":"+\t * AccessExclusiveLocks on all of those relations at the same time, which","html":"+\u003cspan class=pl-c\u003e\t * AccessExclusiveLocks on all of those relations at the same time, which\u003c/span\u003e","displayNoNewLineWarning":false,"position":84,"left":337,"right":400},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":401,"text":"+\t * is undesirable. However, if this turns out to be unsafe we may have no","html":"+\u003cspan class=pl-c\u003e\t * is undesirable. However, if this turns out to be unsafe we may have no\u003c/span\u003e","displayNoNewLineWarning":false,"position":85,"left":337,"right":401},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":402,"text":"+\t * choice...","html":"+\u003cspan class=pl-c\u003e\t * choice...\u003c/span\u003e","displayNoNewLineWarning":false,"position":86,"left":337,"right":402},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":403,"text":"+\t */","html":"+\u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":87,"left":337,"right":403},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":404,"text":"+\trelation_close(rel, AccessExclusiveLock);","html":"+\t\u003cspan class=pl-en\u003erelation_close\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e, \u003cspan class=pl-s1\u003eAccessExclusiveLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":88,"left":337,"right":404},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":405,"text":"+","html":"+","displayNoNewLineWarning":false,"position":89,"left":337,"right":405},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":406,"text":"+\t/* Nothing to return. */","html":"+\t\u003cspan class=pl-c\u003e/* Nothing to return. */\u003c/span\u003e","displayNoNewLineWarning":false,"position":90,"left":337,"right":406},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":407,"text":"+\tPG_RETURN_VOID();","html":"+\t\u003cspan class=pl-en\u003ePG_RETURN_VOID\u003c/span\u003e();","displayNoNewLineWarning":false,"position":91,"left":337,"right":407},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":408,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":92,"left":337,"right":408},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":409,"text":"+","html":"+","displayNoNewLineWarning":false,"position":93,"left":337,"right":409},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":410,"text":" /*","html":" \u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":94,"left":338,"right":410},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":411,"text":" * Helper function to construct whichever TupleDesc we need for a particular","html":" \u003cspan class=pl-c\u003e * Helper function to construct whichever TupleDesc we need for a particular\u003c/span\u003e","displayNoNewLineWarning":false,"position":95,"left":339,"right":411},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":412,"text":" * call.","html":" \u003cspan class=pl-c\u003e * call.\u003c/span\u003e","displayNoNewLineWarning":false,"position":96,"left":340,"right":412}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":735,"linesChanged":72,"newTreeEntry":{"lineCount":735,"path":"contrib/pg_visibility/pg_visibility.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pg_visibility/pg_visibility.c","mode":100644},"linesAdded":72,"linesDeleted":0,"path":"contrib/pg_visibility/pg_visibility.c","pathDigest":"99e85e270dce6248c0ee37b6b1964c2de3bac4eeb67c39aaa6dc8fa5d6197e50","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":8,"text":"@@ -9,14 +9,16 @@","html":"@@ -9,14 +9,16 @@","displayNoNewLineWarning":false,"position":0,"left":8,"right":8},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":9,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":9,"right":9},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":10,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":2,"left":10,"right":10},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":11,"text":" The \u003cfilename\u003epg_visibility\u003c/\u003e module provides a means for examining the","html":" The \u0026lt;filename\u0026gt;pg_visibility\u0026lt;/\u0026gt; module provides a means for examining the","displayNoNewLineWarning":false,"position":3,"left":11,"right":11},{"stylingDirective":null,"type":"DELETION","blobLineNumber":12,"text":"- visibility map (VM) and page-level visibility information.","html":"- visibility map (VM) and page-level visibility information.","displayNoNewLineWarning":false,"position":4,"left":12,"right":11},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":12,"text":"+ visibility map (VM) and page-level visibility information. It also","html":"+ visibility map (VM) and page-level visibility information. It also","displayNoNewLineWarning":false,"position":5,"left":12,"right":12},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":13,"text":"+ provides functions to check the integrity of the visibility map and to","html":"+ provides functions to check the integrity of the visibility map and to","displayNoNewLineWarning":false,"position":6,"left":12,"right":13},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":14,"text":"+ force it to be rebuilt.","html":"+ force it to be rebuilt.","displayNoNewLineWarning":false,"position":7,"left":12,"right":14},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":15,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":8,"left":13,"right":15},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":16,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":9,"left":14,"right":16},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":17,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":10,"left":15,"right":17},{"stylingDirective":null,"type":"DELETION","blobLineNumber":16,"text":"- These routines return information about three different bits. The","html":"- \u003cspan class=\"x x-first x-last\"\u003eThese routines return information about three different bits. The\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":16,"right":17},{"stylingDirective":null,"type":"DELETION","blobLineNumber":17,"text":"- all-visible bit in the visibility map indicates that every tuple on","html":"- all-visible bit in the visibility map indicates that every\u003cspan class=\"x x-first x-last\"\u003e tuple on\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":17,"right":17},{"stylingDirective":null,"type":"DELETION","blobLineNumber":18,"text":"- a given page of a relation is visible to every current transaction. The","html":"- a given page of a relation is visible to every current transaction.\u003cspan class=\"x x-first x-last\"\u003e The\u003c/span\u003e","displayNoNewLineWarning":false,"position":13,"left":18,"right":17},{"stylingDirective":null,"type":"DELETION","blobLineNumber":19,"text":"- all-frozen bit in the visibility map indicates that every tuple on the","html":"- all-frozen bit in the visibility map indicates that every tuple on the","displayNoNewLineWarning":false,"position":14,"left":19,"right":17},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":18,"text":"+ Three different bits are used to store information about page-level","html":"+ \u003cspan class=\"x x-first x-last\"\u003eThree different bits are used to store information about page-level\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":19,"right":18},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":19,"text":"+ visibility. The all-visible bit in the visibility map indicates that every","html":"+ \u003cspan class=\"x x-first x-last\"\u003evisibility. The \u003c/span\u003eall-visible bit in the visibility map indicates that every","displayNoNewLineWarning":false,"position":16,"left":19,"right":19},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":20,"text":"+ tuple on a given page of a relation is visible to every current transaction.","html":"+ \u003cspan class=\"x x-first x-last\"\u003etuple on \u003c/span\u003ea given page of a relation is visible to every current transaction.","displayNoNewLineWarning":false,"position":17,"left":19,"right":20},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":21,"text":"+ The all-frozen bit in the visibility map indicates that every tuple on the","html":"+ \u003cspan class=\"x x-first x-last\"\u003eThe \u003c/span\u003eall-frozen bit in the visibility map indicates that every tuple on the","displayNoNewLineWarning":false,"position":18,"left":19,"right":21},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":22,"text":" page is frozen; that is, no future vacuum will need to modify the page","html":" page is frozen; that is, no future vacuum will need to modify the page","displayNoNewLineWarning":false,"position":19,"left":20,"right":22},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":23,"text":" until such time as a tuple is inserted, updated, deleted, or locked on","html":" until such time as a tuple is inserted, updated, deleted, or locked on","displayNoNewLineWarning":false,"position":20,"left":21,"right":23},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":24,"text":" that page. The page-level \u003cliteral\u003ePD_ALL_VISIBLE\u003c/literal\u003e bit has the","html":" that page. The page-level \u0026lt;literal\u0026gt;PD_ALL_VISIBLE\u0026lt;/literal\u0026gt; bit has the","displayNoNewLineWarning":false,"position":21,"left":22,"right":24},{"stylingDirective":null,"type":"HUNK","blobLineNumber":26,"text":"@@ -25,7 +27,8 @@","html":"@@ -25,7 +27,8 @@","displayNoNewLineWarning":false,"position":22,"left":24,"right":26},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":27,"text":" will normally agree, but the page-level bit can sometimes be set while the","html":" will normally agree, but the page-level bit can sometimes be set while the","displayNoNewLineWarning":false,"position":23,"left":25,"right":27},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":28,"text":" visibility map bit is clear after a crash recovery; or they can disagree","html":" visibility map bit is clear after a crash recovery; or they can disagree","displayNoNewLineWarning":false,"position":24,"left":26,"right":28},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":29,"text":" because of a change which occurs after \u003cliteral\u003epg_visibility\u003c/\u003e examines","html":" because of a change which occurs after \u0026lt;literal\u0026gt;pg_visibility\u0026lt;/\u0026gt; examines","displayNoNewLineWarning":false,"position":25,"left":27,"right":29},{"stylingDirective":null,"type":"DELETION","blobLineNumber":28,"text":"- the visibility map and before it examines the data page.","html":"- the visibility map and before it examines the data page.","displayNoNewLineWarning":false,"position":26,"left":28,"right":29},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":30,"text":"+ the visibility map and before it examines the data page. Any event which","html":"+ the visibility map and before it examines the data page. Any event which","displayNoNewLineWarning":false,"position":27,"left":28,"right":30},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":31,"text":"+ causes data corruption can also cause these bits to disagree.","html":"+ causes data corruption can also cause these bits to disagree.","displayNoNewLineWarning":false,"position":28,"left":28,"right":31},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":32,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":29,"left":29,"right":32},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":33,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":30,"left":30,"right":33},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":34,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":31,"left":31,"right":34},{"stylingDirective":null,"type":"HUNK","blobLineNumber":120,"text":"@@ -118,6 +121,21 @@","html":"@@ -118,6 +121,21 @@","displayNoNewLineWarning":false,"position":32,"left":117,"right":120},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":121,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":33,"left":118,"right":121},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":122,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":34,"left":119,"right":122},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":123,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":35,"left":120,"right":123},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":124,"text":"+","html":"+","displayNoNewLineWarning":false,"position":36,"left":120,"right":124},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":125,"text":"+ \u003cvarlistentry\u003e","html":"+ \u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":37,"left":120,"right":125},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":126,"text":"+ \u003cterm\u003e\u003cfunction\u003epg_truncate_visibility_map(regclass) returns void\u003c/function\u003e\u003c/term\u003e","html":"+ \u0026lt;term\u0026gt;\u0026lt;function\u0026gt;pg_truncate_visibility_map(regclass) returns void\u0026lt;/function\u0026gt;\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":38,"left":120,"right":126},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":127,"text":"+","html":"+","displayNoNewLineWarning":false,"position":39,"left":120,"right":127},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":128,"text":"+ \u003clistitem\u003e","html":"+ \u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":40,"left":120,"right":128},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":129,"text":"+ \u003cpara\u003e","html":"+ \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":41,"left":120,"right":129},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":130,"text":"+ Truncates the visibility map for the given relation. This function","html":"+ Truncates the visibility map for the given relation. This function","displayNoNewLineWarning":false,"position":42,"left":120,"right":130},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":131,"text":"+ is only expected to be useful if you suspect that the visibility map","html":"+ is only expected to be useful if you suspect that the visibility map","displayNoNewLineWarning":false,"position":43,"left":120,"right":131},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":132,"text":"+ for the indicated relation is corrupt and wish to rebuild it. The first","html":"+ for the indicated relation is corrupt and wish to rebuild it. The first","displayNoNewLineWarning":false,"position":44,"left":120,"right":132},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":133,"text":"+ \u003ccommand\u003eVACUUM\u003c/\u003e executed on the given relation after this function","html":"+ \u0026lt;command\u0026gt;VACUUM\u0026lt;/\u0026gt; executed on the given relation after this function","displayNoNewLineWarning":false,"position":45,"left":120,"right":133},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":134,"text":"+ is executed will scan every page in the relation and rebuild the","html":"+ is executed will scan every page in the relation and rebuild the","displayNoNewLineWarning":false,"position":46,"left":120,"right":134},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":135,"text":"+ visibility map.","html":"+ visibility map.","displayNoNewLineWarning":false,"position":47,"left":120,"right":135},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":136,"text":"+ \u003c/para\u003e","html":"+ \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":48,"left":120,"right":136},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":137,"text":"+ \u003c/listitem\u003e","html":"+ \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":49,"left":120,"right":137},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":138,"text":"+ \u003c/varlistentry\u003e","html":"+ \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":50,"left":120,"right":138},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":139,"text":" \u003c/variablelist\u003e","html":" \u0026lt;/variablelist\u0026gt;","displayNoNewLineWarning":false,"position":51,"left":121,"right":139},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":140,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":52,"left":122,"right":140},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":141,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":53,"left":123,"right":141}],"diffNumber":3,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":154,"linesChanged":30,"newTreeEntry":{"lineCount":154,"path":"doc/src/sgml/pgvisibility.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/pgvisibility.sgml","mode":100644},"linesAdded":24,"linesDeleted":6,"path":"doc/src/sgml/pgvisibility.sgml","pathDigest":"4a7cc6d0f0711f3c8637bbc34a48dc895c89ffd3f9ee1c380a84b63feae6db07","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":36,"text":"@@ -37,7 +37,8 @@ smgr_desc(StringInfo buf, XLogReaderState *record)","html":"@@ -37,7 +37,8 @@ smgr_desc(StringInfo buf, XLogReaderState *record)","displayNoNewLineWarning":false,"position":0,"left":36,"right":36},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":37,"text":" \t\txl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;","html":" \t\t\u003cspan class=pl-smi\u003exl_smgr_truncate\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003exl_smgr_truncate\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003erec\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":37,"right":37},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":38,"text":" \t\tchar\t *path = relpathperm(xlrec-\u003ernode, MAIN_FORKNUM);","html":" \t\t\u003cspan class=pl-smi\u003echar\u003c/span\u003e\t \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003epath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003erelpathperm\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ernode\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAIN_FORKNUM\u003c/span\u003e);","displayNoNewLineWarning":false,"position":2,"left":38,"right":38},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":39,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":39,"right":39},{"stylingDirective":null,"type":"DELETION","blobLineNumber":40,"text":"-\t\tappendStringInfo(buf, \"%s to %u blocks\", path, xlrec-\u003eblkno);","html":"-\t\t\u003cspan class=pl-en\u003eappendStringInfo\u003c/span\u003e(\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;%s to %u blocks\u0026quot;\u003c/span\u003e, \u003cspan class=pl-s1\u003epath\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":4,"left":40,"right":39},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":40,"text":"+\t\tappendStringInfo(buf, \"%s to %u blocks flags %d\", path,","html":"+\t\t\u003cspan class=pl-en\u003eappendStringInfo\u003c/span\u003e(\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;%s to %u blocks flags %d\u0026quot;\u003c/span\u003e, \u003cspan class=pl-s1\u003epath\u003c/span\u003e,","displayNoNewLineWarning":false,"position":5,"left":40,"right":40},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":41,"text":"+\t\t\t\t\t\t xlrec-\u003eblkno, xlrec-\u003eflags);","html":"+\t\t\t\t\t\t \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eflags\u003c/span\u003e);","displayNoNewLineWarning":false,"position":6,"left":40,"right":41},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":42,"text":" \t\tpfree(path);","html":" \t\t\u003cspan class=pl-en\u003epfree\u003c/span\u003e(\u003cspan class=pl-s1\u003epath\u003c/span\u003e);","displayNoNewLineWarning":false,"position":7,"left":41,"right":42},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":43,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":8,"left":42,"right":43},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":44,"text":" }","html":" }","displayNoNewLineWarning":false,"position":9,"left":43,"right":44}],"diffNumber":4,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":62,"linesChanged":3,"newTreeEntry":{"lineCount":62,"path":"src/backend/access/rmgrdesc/smgrdesc.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/access/rmgrdesc/smgrdesc.c","mode":100644},"linesAdded":2,"linesDeleted":1,"path":"src/backend/access/rmgrdesc/smgrdesc.c","pathDigest":"ff20a717d16e80983f747f272fe4fe45724221571a892014f97d7bb1a9a7d00d","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":267,"text":"@@ -268,6 +268,7 @@ RelationTruncate(Relation rel, BlockNumber nblocks)","html":"@@ -268,6 +268,7 @@ RelationTruncate(Relation rel, BlockNumber nblocks)","displayNoNewLineWarning":false,"position":0,"left":267,"right":267},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":268,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":268,"right":268},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":269,"text":" \t\txlrec.blkno = nblocks;","html":" \t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan cla 8000 ss=pl-c1\u003eblkno\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003enblocks\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":269,"right":269},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":270,"text":" \t\txlrec.rnode = rel-\u003erd_node;","html":" \t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan class=pl-c1\u003ernode\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003erel\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erd_node\u003c/span\u003e;","displayNoNewLineWarning":false,"position":3,"left":270,"right":270},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":271,"text":"+\t\txlrec.flags = SMGR_TRUNCATE_ALL;","html":"+\t\t\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e.\u003cspan class=pl-c1\u003eflags\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_ALL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":4,"left":270,"right":271},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":272,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":5,"left":271,"right":272},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":273,"text":" \t\tXLogBeginInsert();","html":" \t\t\u003cspan class=pl-en\u003eXLogBeginInsert\u003c/span\u003e();","displayNoNewLineWarning":false,"position":6,"left":272,"right":273},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":274,"text":" \t\tXLogRegisterData((char *) \u0026xlrec, sizeof(xlrec));","html":" \t\t\u003cspan class=pl-en\u003eXLogRegisterData\u003c/span\u003e((\u003cspan class=pl-smi\u003echar\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e, \u003cspan class=pl-k\u003esizeof\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e));","displayNoNewLineWarning":false,"position":7,"left":273,"right":274},{"stylingDirective":null,"type":"HUNK","blobLineNumber":522,"text":"@@ -522,17 +523,22 @@ smgr_redo(XLogReaderState *record)","html":"@@ -522,17 +523,22 @@ smgr_redo(XLogReaderState *record)","displayNoNewLineWarning":false,"position":8,"left":521,"right":522},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":523,"text":" \t\t */","html":" \u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":522,"right":523},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":524,"text":" \t\tXLogFlush(lsn);","html":" \t\t\u003cspan class=pl-en\u003eXLogFlush\u003c/span\u003e(\u003cspan class=pl-s1\u003elsn\u003c/span\u003e);","displayNoNewLineWarning":false,"position":10,"left":523,"right":524},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":525,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":11,"left":524,"right":525},{"stylingDirective":null,"type":"DELETION","blobLineNumber":525,"text":"-\t\tsmgrtruncate(reln, MAIN_FORKNUM, xlrec-\u003eblkno);","html":"-\t\t\u003cspan class=pl-en\u003esmgrtruncate\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAIN_FORKNUM\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":12,"left":525,"right":525},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":526,"text":"+\t\tif ((xlrec-\u003eflags \u0026 SMGR_TRUNCATE_HEAP) != 0)","html":"+\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e ((\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eflags\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_HEAP\u003c/span\u003e) \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e)","displayNoNewLineWarning":false,"position":13,"left":525,"right":526},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":527,"text":"+\t\t{","html":"+\t\t{","displayNoNewLineWarning":false,"position":14,"left":525,"right":527},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":528,"text":"+\t\t\tsmgrtruncate(reln, MAIN_FORKNUM, xlrec-\u003eblkno);","html":"+\t\t\t\u003cspan class=pl-en\u003esmgrtruncate\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAIN_FORKNUM\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":15,"left":525,"right":528},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":529,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":16,"left":526,"right":529},{"stylingDirective":null,"type":"DELETION","blobLineNumber":527,"text":"-\t\t/* Also tell xlogutils.c about it */","html":"-\t\t\u003cspan class=pl-c\u003e/* Also tell xlogutils.c about it */\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":527,"right":529},{"stylingDirective":null,"type":"DELETION","blobLineNumber":528,"text":"-\t\tXLogTruncateRelation(xlrec-\u003ernode, MAIN_FORKNUM, xlrec-\u003eblkno);","html":"-\t\t\u003cspan class=pl-en\u003eXLogTruncateRelation\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ernode\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAIN_FORKNUM\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":18,"left":528,"right":529},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":530,"text":"+\t\t\t/* Also tell xlogutils.c about it */","html":"+\t\t\t\u003cspan class=pl-c\u003e/* Also tell xlogutils.c about it */\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":528,"right":530},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":531,"text":"+\t\t\tXLogTruncateRelation(xlrec-\u003ernode, MAIN_FORKNUM, xlrec-\u003eblkno);","html":"+\t\t\t\u003cspan class=pl-en\u003eXLogTruncateRelation\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ernode\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAIN_FORKNUM\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":20,"left":528,"right":531},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":532,"text":"+\t\t}","html":"+\t\t}","displayNoNewLineWarning":false,"position":21,"left":528,"right":532},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":533,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":22,"left":529,"right":533},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":534,"text":" \t\t/* Truncate FSM and VM too */","html":" \t\t\u003cspan class=pl-c\u003e/* Truncate FSM and VM too */\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":530,"right":534},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":535,"text":" \t\trel = CreateFakeRelcacheEntry(xlrec-\u003ernode);","html":" \t\t\u003cspan class=pl-s1\u003erel\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003eCreateFakeRelcacheEntry\u003c/span\u003e(\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ernode\u003c/span\u003e);","displayNoNewLineWarning":false,"position":24,"left":531,"right":535},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":536,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":25,"left":532,"right":536},{"stylingDirective":null,"type":"DELETION","blobLineNumber":533,"text":"-\t\tif (smgrexists(reln, FSM_FORKNUM))","html":"-\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003esmgrexists\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eFSM_FORKNUM\u003c/span\u003e))","displayNoNewLineWarning":false,"position":26,"left":533,"right":536},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":537,"text":"+\t\tif ((xlrec-\u003eflags \u0026 SMGR_TRUNCATE_FSM) != 0 \u0026\u0026","html":"+\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e ((\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eflags\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_FSM\u003c/span\u003e) \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":533,"right":537},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":538,"text":"+\t\t\tsmgrexists(reln, FSM_FORKNUM))","html":"+\t\t\t\u003cspan class=pl-en\u003esmgrexists\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eFSM_FORKNUM\u003c/span\u003e))","displayNoNewLineWarning":false,"position":28,"left":533,"right":538},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":539,"text":" \t\t\tFreeSpaceMapTruncateRel(rel, xlrec-\u003eblkno);","html":" \t\t\t\u003cspan class=pl-en\u003eFreeSpaceMapTruncateRel\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":29,"left":534,"right":539},{"stylingDirective":null,"type":"DELETION","blobLineNumber":535,"text":"-\t\tif (smgrexists(reln, VISIBILITYMAP_FORKNUM))","html":"-\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003esmgrexists\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eVISIBILITYMAP_FORKNUM\u003c/span\u003e))","displayNoNewLineWarning":false,"position":30,"left":535,"right":539},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":540,"text":"+\t\tif ((xlrec-\u003eflags \u0026 SMGR_TRUNCATE_VM) != 0 \u0026\u0026","html":"+\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e ((\u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eflags\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_VM\u003c/span\u003e) \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":535,"right":540},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":541,"text":"+\t\t\tsmgrexists(reln, VISIBILITYMAP_FORKNUM))","html":"+\t\t\t\u003cspan class=pl-en\u003esmgrexists\u003c/span\u003e(\u003cspan class=pl-s1\u003ereln\u003c/span\u003e, \u003cspan class=pl-c1\u003eVISIBILITYMAP_FORKNUM\u003c/span\u003e))","displayNoNewLineWarning":false,"position":32,"left":535,"right":541},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":542,"text":" \t\t\tvisibilitymap_truncate(rel, xlrec-\u003eblkno);","html":" \t\t\t\u003cspan class=pl-en\u003evisibilitymap_truncate\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e, \u003cspan class=pl-s1\u003exlrec\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eblkno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":33,"left":536,"right":542},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":543,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":34,"left":537,"right":543},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":544,"text":" \t\tFreeFakeRelcacheEntry(rel);","html":" \t\t\u003cspan class=pl-en\u003eFreeFakeRelcacheEntry\u003c/span\u003e(\u003cspan class=pl-s1\u003erel\u003c/span\u003e);","displayNoNewLineWarning":false,"position":35,"left":538,"right":544}],"diffNumber":5,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":548,"linesChanged":16,"newTreeEntry":{"lineCount":548,"path":"src/backend/catalog/storage.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/catalog/storage.c","mode":100644},"linesAdded":11,"linesDeleted":5,"path":"src/backend/catalog/storage.c","pathDigest":"01db32374f662b40c4d3c29dcfe59849fb4da520a6559b1a7e4427d5c804f99c","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":30,"text":"@@ -31,7 +31,7 @@","html":"@@ -31,7 +31,7 @@","displayNoNewLineWarning":false,"position":0,"left":30,"right":30},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":31,"text":" /*","html":" \u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":31,"right":31},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":32,"text":" * Each page of XLOG file has a header like this:","html":" \u003cspan class=pl-c\u003e * Each page of XLOG file has a header like this:\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":32,"right":32},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":33,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":33,"right":33},{"stylingDirective":null,"type":"DELETION","blobLineNumber":34,"text":"-#define XLOG_PAGE_MAGIC 0xD091\t/* can be used as WAL version indicator */","html":"-\u003cspan class=\"pl-k\"\u003e#define\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eXLOG_PAGE_MAGIC\u003c/span\u003e \u003cspan class=\"x x-first x-last\"\u003e0xD091\u003c/span\u003e\t\u003cspan class=\"pl-c\"\u003e/* can be used as WAL version indicator */\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":34,"right":33},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":34,"text":"+#define XLOG_PAGE_MAGIC 0xD092\t/* can be used as WAL version indicator */","html":"+\u003cspan class=\"pl-k\"\u003e#define\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eXLOG_PAGE_MAGIC\u003c/span\u003e \u003cspan class=\"x x-first x-last\"\u003e0xD092\u003c/span\u003e\t\u003cspan class=\"pl-c\"\u003e/* can be used as WAL version indicator */\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":34,"right":34},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":35,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":6,"left":35,"right":35},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":36,"text":" typedef struct XLogPageHeaderData","html":" \u003cspan class=pl-k\u003etypedef\u003c/span\u003e \u003cspan class=pl-k\u003estruct\u003c/span\u003e \u003cspan class=pl-smi\u003eXLogPageHeaderData\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":36,"right":36},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":37,"text":" {","html":" {","displayNoNewLineWarning":false,"position":8,"left":37,"right":37}],"diffNumber":6,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":318,"linesChanged":2,"newTreeEntry":{"lineCount":318,"path":"src/include/access/xlog_internal.h","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/include/access/xlog_internal.h","mode":100644},"linesAdded":1,"linesDeleted":1,"path":"src/include/access/xlog_internal.h","pathDigest":"765a7934aff85443cad6a3cbd65fdf38a8af70108e337a8d47a55b61dd1f4bb4","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":35,"text":"@@ -36,10 +36,18 @@ typedef struct xl_smgr_create","html":"@@ -36,10 +36,18 @@ typedef struct xl_smgr_create","displayNoNewLineWarning":false,"position":0,"left":35,"right":35},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":36,"text":" \tForkNumber\tforkNum;","html":" \t\u003cspan class=pl-smi\u003eForkNumber\u003c/span\u003e\t\u003cspan class=pl-c1\u003eforkNum\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":36,"right":36},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":37,"text":" } xl_smgr_create;","html":" } \u003cspan class=pl-smi\u003exl_smgr_create\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":37,"right":37},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":38,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":38,"right":38},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":39,"text":"+/* flags for xl_smgr_truncate */","html":"+\u003cspan class=pl-c\u003e/* flags for xl_smgr_truncate */\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":38,"right":39},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":40,"text":"+#define SMGR_TRUNCATE_HEAP\t\t0x0001","html":"+\u003cspan class=pl-k\u003e#define\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_HEAP\u003c/span\u003e\t\t0x0001","displayNoNewLineWarning":false,"position":5,"left":38,"right":40},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":41,"text":"+#define SMGR_TRUNCATE_VM\t\t0x0002","html":"+\u003cspan class=pl-k\u003e#define\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_VM\u003c/span\u003e\t\t0x0002","displayNoNewLineWarning":false,"position":6,"left":38,"right":41},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":42,"text":"+#define SMGR_TRUNCATE_FSM\t\t0x0004","html":"+\u003cspan class=pl-k\u003e#define\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_FSM\u003c/span\u003e\t\t0x0004","displayNoNewLineWarning":false,"position":7,"left":38,"right":42},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":43,"text":"+#define SMGR_TRUNCATE_ALL\t\t\\","html":"+\u003cspan class=pl-k\u003e#define\u003c/span\u003e \u003cspan class=pl-c1\u003eSMGR_TRUNCATE_ALL\u003c/span\u003e\t\t\\","displayNoNewLineWarning":false,"position":8,"left":38,"right":43},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":44,"text":"+\t(SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM)","html":"+\t(SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM)","displayNoNewLineWarning":false,"position":9,"left":38,"right":44},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":45,"text":"+","html":"+","displayNoNewLineWarning":false,"position":10,"left":38,"right":45},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":46,"text":" typedef struct xl_smgr_truncate","html":" \u003cspan class=pl-k\u003etypedef\u003c/span\u003e \u003cspan class=pl-k\u003estruct\u003c/span\u003e \u003cspan class=pl-smi\u003exl_smgr_truncate\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":39,"right":46},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":47,"text":" {","html":" {","displayNoNewLineWarning":false,"position":12,"left":40,"right":47},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":48,"text":" \tBlockNumber blkno;","html":" \t\u003cspan class=pl-smi\u003eBlockNumber\u003c/span\u003e \u003cspan class=pl-c1\u003eblkno\u003c/span\u003e;","displayNoNewLineWarning":false,"position":13,"left":41,"right":48},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":49,"text":" \tRelFileNode rnode;","html":" \t\u003cspan class=pl-smi\u003eRelFileNode\u003c/span\u003e \u003cspan class=pl-c1\u003ernode\u003c/span\u003e;","displayNoNewLineWarning":false,"position":14,"left":42,"right":49},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":50,"text":"+\tint\t\t\tflags;","html":"+\t\u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\t\t\u003cspan class=pl-c1\u003eflags\u003c/span\u003e;","displayNoNewLineWarning":false,"position":15,"left":42,"right":50},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":51,"text":" } xl_smgr_truncate;","html":" } \u003cspan class=pl-smi\u003exl_smgr_truncate\u003c/span\u003e;","displayNoNewLineWarning":false,"position":16,"left":43,"right":51},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":52,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":17,"left":44,"right":52},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":53,"text":" extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum);","html":" \u003cspan class=pl-k\u003eextern\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-en\u003elog_smgrcreate\u003c/span\u003e(\u003cspan class=pl-smi\u003eRelFileNode\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003ernode\u003c/span\u003e, \u003cspan class=pl-smi\u003eForkNumber\u003c/span\u003e \u003cspan class=pl-s1\u003eforkNum\u003c/span\u003e);","displayNoNewLineWarning":false,"position":18,"left":45,"right":53}],"diffNumber":7,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":59,"linesChanged":8,"newTreeEntry":{"lineCount":59,"path":"src/include/catalog/storage_xlog.h","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/include/catalog/storage_xlog.h","mode":100644},"linesAdded":8,"linesDeleted":0,"path":"src/include/catalog/storage_xlog.h","pathDigest":"d0b58e6afc46c31813b5e2cb979397b70505828c24bd350bf269a020ca7f40e8","status":"MODIFIED","truncatedReason":null,"oldOid":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","newOid":"71d05a2c7b82379bb1013a0e338906349c54ed85","copilotChatReference":null,"deletedSha":"54f5c5150fa05d7ad15f8406debd5a2b394885b5","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/71d05a2c7b82379bb1013a0e338906349c54ed85","fileTreeExpanded":true,"headerInfo":{"additions":133,"deletions":13,"filesChanged":8,"filesChangedString":"8"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":8,"truncated":false,"byteCount":9408,"lineShownCount":257},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"imiG6mMB3O5ozoDOeAAHbxuDuL4AReMsMGQ_ipHPhvh7k4PFAKQlBCbMW826Zv3e2E4phm0oCNZ31WArNt21yA"},"/users/diffview?diff=unified":{"post":"SYKV5abqkDv1dq5wuxf7axR6YlJ1lJOy-_MFWBhaajm4eZDKxU9p0bt0dXN5cQHa17fzahj5eEi8Qlr5v0hZCQ"},"/notifications/thread":{"post":"E7CTd1tRb_-QTE4iR3KoXPeZH2HXNk1hjwP9ogxPhSVixHMd7DA7XGjDqDT1yteBhvrl-8eLztodVV5xGVAz0w"}}},"title":"pg_visibility: Add pg_truncate_visibility_map function. · postgres/postgres@71d05a2","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 71d05a2

Browse files
committed
pg_visibility: Add pg_truncate_visibility_map function.
This requires some core changes as well so that we can properly WAL-log the truncation. Specifically, it changes the format of the XLOG_SMGR_TRUNCATE WAL record, so bump XLOG_PAGE_MAGIC. Patch by me, reviewed but not fully endorsed by Andres Freund.
1 parent 54f5c51 commit 71d05a2

File tree

8 files changed

+133
-13
lines changed

8 files changed

+133
-13
lines changed

contrib/pg_visibility/pg_visibility--1.0--1.1.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,12 @@ RETURNS SETOF tid
1313
AS 'MODULE_PATHNAME', 'pg_check_visible'
1414
LANGUAGE C STRICT;
1515

16+
CREATE FUNCTION pg_truncate_visibility_map(regclass)
17+
RETURNS void
18+
AS 'MODULE_PATHNAME', 'pg_truncate_visibility_map'
19+
LANGUAGE C STRICT
20+
PARALLEL UNSAFE; -- let's not make this any more dangerous
21+
1622
REVOKE ALL ON FUNCTION pg_check_frozen(regclass) FROM PUBLIC;
1723
REVOKE ALL ON FUNCTION pg_check_visible(regclass) FROM PUBLIC;
24+
REVOKE ALL ON FUNCTION pg_truncate_visibility_map(regclass) FROM PUBLIC;

contrib/pg_visibility/pg_visibility--1.1.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ RETURNS SETOF tid
5757
AS 'MODULE_PATHNAME', 'pg_check_visible'
5858
LANGUAGE C STRICT;
5959

60+
-- Truncate the visibility map fork.
61+
CREATE FUNCTION pg_truncate_visibility_map(regclass)
62+
RETURNS void
63+
AS 'MODULE_PATHNAME', 'pg_truncate_visibility_map'
64+
LANGUAGE C STRICT
65+
PARALLEL UNSAFE; -- let's not make this any more dangerous
66+
6067
-- Don't want these to be available to public.
6168
REVOKE ALL ON FUNCTION pg_visibility_map(regclass, bigint) FROM PUBLIC;
6269
REVOKE ALL ON FUNCTION pg_visibility(regclass, bigint) FROM PUBLIC;
@@ -65,3 +72,4 @@ REVOKE ALL ON FUNCTION pg_visibility(regclass) FROM PUBLIC;
6572
REVOKE ALL ON FUNCTION pg_visibility_map_summary(regclass) FROM PUBLIC;
6673
REVOKE ALL ON FUNCTION pg_check_frozen(regclass) FROM PUBLIC;
6774
REVOKE ALL ON FUNCTION pg_check_visible(regclass) FROM PUBLIC;
75+
REVOKE ALL ON FUNCTION pg_truncate_visibility_map(regclass) FROM PUBLIC;

contrib/pg_visibility/pg_visibility.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
#include "access/htup_details.h"
1212
#include "access/visibilitymap.h"
1313
#include "catalog/pg_type.h"
14+
#include "catalog/storage_xlog.h"
1415
#include "funcapi.h"
1516
#include "miscadmin.h"
1617
#include "storage/bufmgr.h"
1718
#include "storage/procarray.h"
19+
#include "storage/smgr.h"
1820
#include "utils/rel.h"
1921

2022
PG_MODULE_MAGIC;
@@ -40,6 +42,7 @@ PG_FUNCTION_INFO_V1(pg_visibility_rel);
4042
PG_FUNCTION_INFO_V1(pg_visibility_map_summary);
4143
PG_FUNCTION_INFO_V1(pg_check_frozen);
4244
PG_FUNCTION_INFO_V1(pg_check_visible);
45+
PG_FUNCTION_INFO_V1(pg_truncate_visibility_map);
4346

4447
static TupleDesc pg_visibility_tupdesc(bool include_blkno, bool include_pd);
4548
static vbits *collect_visibility_data(Oid relid, bool include_pd);
@@ -335,6 +338,75 @@ pg_check_visible(PG_FUNCTION_ARGS)
335338
SRF_RETURN_DONE(funcctx);
336339
}
337340

341+
/*
342+
* Remove the visibility map fork for a relation. If there turn out to be
343+
* any bugs in the visibility map code that require rebuilding the VM, this
344+
* provides users with a way to do it that is cleaner than shutting down the
345+
* server and removing files by hand.
346+
*
347+
* This is a cut-down version of RelationTruncate.
348+
*/
349+
Datum
350+
pg_truncate_visibility_map(PG_FUNCTION_ARGS)
351+
{
352+
Oid relid = PG_GETARG_OID(0);
353+
Relation rel;
354+
355+
rel = relation_open(relid, AccessExclusiveLock);
356+
357+
if (rel->rd_rel->relkind != RELKIND_RELATION &&
358+
rel->rd_rel->relkind != RELKIND_MATVIEW &&
359+
rel->rd_rel->relkind != RELKIND_TOASTVALUE)
360+
ereport(ERROR,
361+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
362+
errmsg("\"%s\" is not a table, materialized view, or TOAST table",
363+
RelationGetRelationName(rel))));
364+
365+
RelationOpenSmgr(rel);
366+
rel->rd_smgr->smgr_vm_nblocks = InvalidBlockNumber;
367+
368+
visibilitymap_truncate(rel, 0);
369+
370+
if (RelationNeedsWAL(rel))
371+
{
372+
xl_smgr_truncate xlrec;
373+
374+
xlrec.blkno = 0;
375+
xlrec.rnode = rel->rd_node;
376+
xlrec.flags = SMGR_TRUNCATE_VM;
377+
378+
XLogBeginInsert();
379+
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
380+
381+
XLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE | XLR_SPECIAL_REL_UPDATE);
382+
}
383+
384+
/*
385+
* Release the lock right away, not at commit time.
386+
*
387+
* It would be a problem to release the lock prior to commit if this
388+
* truncate operation sends any transactional invalidation messages. Other
389+
* backends would potentially be able to lock the relation without
390+
* processing them in the window of time between when we release the lock
391+
* here and when we sent the messages at our eventual commit. However,
392+
* we're currently only sending a non-transactional smgr invalidation,
393+
* which will have been posted to shared memory immediately from within
394+
* visibilitymap_truncate. Therefore, there should be no race here.
395+
*
396+
* The reason why it's desirable to release the lock early here is because
397+
* of the possibility that someone will need to use this to blow away many
398+
* visibility map forks at once. If we can't release the lock until
399+
* commit time, the transaction doing this will accumulate
400+
* AccessExclusiveLocks on all of those relations at the same time, which
401+
* is undesirable. However, if this turns out to be unsafe we may have no
402+
* choice...
403+
*/
404+
relation_close(rel, AccessExclusiveLock);
405+
406+
/* Nothing to return. */
407+
PG_RETURN_VOID();
408+
}
409+
338410
/*
339411
* Helper function to construct whichever TupleDesc we need for a particular
340412
* call.

doc/src/sgml/pgvisibility.sgml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99

1010
<para>
1111
The <filename>pg_visibility</> module provides a means for examining the
12-
visibility map (VM) and page-level visibility information.
12+
visibility map (VM) and page-level visibility information. It also
13+
provides functions to check the integrity of the visibility map and to
14+
force it to be rebuilt.
1315
</para>
1416

1517
<para>
16-
These routines return information about three different bits. The
17-
all-visible bit in the visibility map indicates that every tuple on
18-
a given page of a relation is visible to every current transaction. The
19-
all-frozen bit in the visibility map indicates that every tuple on the
18+
Three different bits are used to store information about page-level
19+
visibility. The all-visible bit in the visibility map indicates that every
20+
tuple on a given page of a relation is visible to every current transaction.
21+
The all-frozen bit in the visibility map indicates that every tuple on the
2022
page is frozen; that is, no future vacuum will need to modify the page
2123
until such time as a tuple is inserted, updated, deleted, or locked on
2224
that page. The page-level <literal>PD_ALL_VISIBLE</literal> bit has the
@@ -25,7 +27,8 @@
2527
will normally agree, but the page-level bit can sometimes be set while the
2628
visibility map bit is clear after a crash recovery; or they can disagree
2729
because of a change which occurs after <literal>pg_visibility</> examines
28-
the visibility map and before it examines the data page.
30+
the visibility map and before it examines the data page. Any event which
31+
causes data corruption can also cause these bits to disagree.
2932
</para>
3033

3134
<para>
@@ -118,6 +121,21 @@
118121
</para>
119122
</listitem>
120123
</varlistentry>
124+
125+
<varlistentry>
126+
<term><function>pg_truncate_visibility_map(regclass) returns void</function></term>
127+
128+
<listitem>
129+
<para>
130+
Truncates the visibility map for the given relation. This function
131+
is only expected to be useful if you suspect that the visibility map
132+
for the indicated relation is corrupt and wish to rebuild it. The first
133+
<command>VACUUM</> executed on the given relation after this function
134+
is executed will scan every page in the relation and rebuild the
135+
visibility map.
136+
</para>
137+
</listitem>
138+
</varlistentry>
121139
</variablelist>
122140

123141
<para>

src/backend/access/rmgrdesc/smgrdesc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ smgr_desc(StringInfo buf, XLogReaderState *record)
3737
xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
3838
char *path = relpathperm(xlrec->rnode, MAIN_FORKNUM);
3939

40-
appendStringInfo(buf, "%s to %u blocks", path, xlrec->blkno);
40+
appendStringInfo(buf, "%s to %u blocks flags %d", path,
41+
xlrec->blkno, xlrec->flags);
4142
pfree(path);
4243
}
4344
}

src/backend/catalog/storage.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ RelationTruncate(Relation rel, BlockNumber nblocks)
268268

269269
xlrec.blkno = nblocks;
270270
xlrec.rnode = rel->rd_node;
271+
xlrec.flags = SMGR_TRUNCATE_ALL;
271272

272273
XLogBeginInsert();
273274
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
@@ -522,17 +523,22 @@ smgr_redo(XLogReaderState *record)
522523
*/
523524
XLogFlush(lsn);
524525

525-
smgrtruncate(reln, MAIN_FORKNUM, xlrec->blkno);
526+
if ((xlrec->flags & SMGR_TRUNCATE_HEAP) != 0)
527+
{
528+
smgrtruncate(reln, MAIN_FORKNUM, xlrec->blkno);
526529

527-
/* Also tell xlogutils.c about it */
528-
XLogTruncateRelation(xlrec->rnode, MAIN_FORKNUM, xlrec->blkno);
530+
/* Also tell xlogutils.c about it */
531+
XLogTruncateRelation(xlrec->rnode, MAIN_FORKNUM, xlrec->blkno);
532+
}
529533

530534
/* Truncate FSM and VM too */
531535
rel = CreateFakeRelcacheEntry(xlrec->rnode);
532536

533-
if (smgrexists(reln, FSM_FORKNUM))
537+
if ((xlrec->flags & SMGR_TRUNCATE_FSM) != 0 &&
538+
smgrexists(reln, FSM_FORKNUM))
534539
FreeSpaceMapTruncateRel(rel, xlrec->blkno);
535-
if (smgrexists(reln, VISIBILITYMAP_FORKNUM))
540+
if ((xlrec->flags & SMGR_TRUNCATE_VM) != 0 &&
541+
smgrexists(reln, VISIBILITYMAP_FORKNUM))
536542
visibilitymap_truncate(rel, xlrec->blkno);
537543

538544
FreeFakeRelcacheEntry(rel);

src/include/access/xlog_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/*
3232
* Each page of XLOG file has a header like this:
3333
*/
34-
#define XLOG_PAGE_MAGIC 0xD091 /* can be used as WAL version indicator */
34+
#define XLOG_PAGE_MAGIC 0xD092 /* can be used as WAL version indicator */
3535

3636
typedef struct XLogPageHeaderData
3737
{

src/include/catalog/storage_xlog.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@ typedef struct xl_smgr_create
3636
ForkNumber forkNum;
3737
} xl_smgr_create;
3838

39+
/* flags for xl_smgr_truncate */
40+
#define SMGR_TRUNCATE_HEAP 0x0001
41+
#define SMGR_TRUNCATE_VM 0x0002
42+
#define SMGR_TRUNCATE_FSM 0x0004
43+
#define SMGR_TRUNCATE_ALL \
44+
(SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM)
45+
3946
typedef struct xl_smgr_truncate
4047
{
4148
BlockNumber blkno;
4249
RelFileNode rnode;
50+
int flags;
4351
} xl_smgr_truncate;
4452

4553
extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum);

0 commit comments

Comments
 (0)
0