You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"commit":{"oid":"e50cda78404d6400b1326a996a4fabb144871151","url":"/postgres/postgres/commit/e50cda78404d6400b1326a996a4fabb144871151","authoredDate":"2015-12-01T18:56:44.000+03:00","committedDate":"2015-12-01T18:56:44.000+03:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eUse pg_rewind when target timeline was switched\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"Allow pg_rewind to work when target timeline was switched. Now\nuser can return promoted standby to old master.\n\nTarget timeline history becomes a global variable. Index\nin target timeline history is used in function interfaces instead of\nspecifying TLI directly. Thus, SimpleXLogPageRead() can easily start\nreading XLOGs from next timeline when current timeline ends.\n\nAuthor: Alexander Korotkov\nReview: Michael Paquier","authors":[{"login":"feodor","displayName":"Teodor Sigaev","avatarUrl":"https://avatars.githubusercontent.com/u/851388?v=4","path":"/feodor","isGitHub":false}],"committerAttribution":false,"committer":{"login":"feodor","displayName":"Teodor Sigaev","avatarUrl":"https://avatars.githubusercontent.com/u/851388?v=4","path":"/feodor","isGitHub":false},"parents":["0e0776bc99553ff229e0d536ed8c78ab9db62464"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOmU1MGNkYTc4NDA0ZDY0MDBiMTMyNmE5OTZhNGZhYmIxNDQ4NzExNTE=","sha1":"0e0776bc99553ff229e0d536ed8c78ab9db62464","sha2":"e50cda78404d6400b1326a996a4fabb144871151"},"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":60,"text":"@@ -61,13 +61,17 @@ PostgreSQL documentation","html":"@@ -61,13 +61,17 @@ PostgreSQL documentation","displayNoNewLineWarning":false,"position":0,"left":60,"right":60},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":61,"text":" \u003capplication\u003epg_rewind\u003c/\u003e examines the timeline histories of the source","html":" \u0026lt;application\u0026gt;pg_rewind\u0026lt;/\u0026gt; examines the timeline histories of the source","displayNoNewLineWarning":false,"position":1,"left":61,"right":61},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":62,"text":" and target clusters to determine the point where they diverged, and","html":" and target clusters to determine the point where they diverged, and","displayNoNewLineWarning":false,"position":2,"left":62,"right":62},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":63,"text":" expects to find WAL in the target cluster's \u003cfilename\u003epg_xlog\u003c/\u003e directory","html":" expects to find WAL in the target cluster\u0026#39;s \u0026lt;filename\u0026gt;pg_xlog\u0026lt;/\u0026gt; directory","displayNoNewLineWarning":false,"position":3,"left":63,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":64,"text":"- reaching all the way back to the point of divergence. In the typical","html":"- reaching all the way back to the point of divergence. In the typical","displayNoNewLineWarning":false,"position":4,"left":64,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":65,"text":"- failover scenario where the target cluster was shut down soon after the","html":"- failover scenario where the target cluster was shut down soon after the","displayNoNewLineWarning":false,"position":5,"left":65,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":66,"text":"- divergence, that is not a problem, but if the target cluster had run for a","html":"- divergence, that is not a problem, but if the target cluster had run for a","displayNoNewLineWarning":false,"position":6,"left":66,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":67,"text":"- long time after the divergence, the old WAL files might not be present","html":"- long time after the divergence, the old WAL files might not be present","displayNoNewLineWarning":false,"position":7,"left":67,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":68,"text":"- anymore. In that case, they can be manually copied from the WAL archive to","html":"- anymore. In that case, they can be manually copied from the WAL archive to","displayNoNewLineWarning":false,"position":8,"left":68,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":69,"text":"- the \u003cfilename\u003epg_xlog\u003c/\u003e directory. Fetching missing files from a WAL","html":"- the \u0026lt;filename\u0026gt;pg_xlog\u0026lt;/\u0026gt; directory. Fetching missing files from a WAL","displayNoNewLineWarning":false,"position":9,"left":69,"right":63},{"stylingDirective":null,"type":"DELETION","blobLineNumber":70,"text":"- archive automatically is currently not supported.","html":"- archive automatically is currently not supported.","displayNoNewLineWarning":false,"position":10,"left":70,"right":63},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":64,"text":"+ reaching all the way back to the point of divergence. The point of divergence","html":"+ reaching all the way back to the point of divergence. The point of divergence","displayNoNewLineWarning":false,"position":11,"left":70,"right":64},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":65,"text":"+ could be found either on target timeline, source timeline or their common","html":"+ could be found either on target timeline, source timeline or their common","displayNoNewLineWarning":false,"position":12,"left":70,"right":65},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":66,"text":"+ ancestor. In the typical failover scenario where the target cluster was","html":"+ ancestor. In the typical failover scenario where the target cluster was","displayNoNewLineWarning":false,"position":13,"left":70,"right":66},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":67,"text":"+ shut down soon after the divergence, that is not a problem, but if the","html":"+ shut down soon after the divergence, that is not a problem, but if the","displayNoNewLineWarning":false,"position":14,"left":70,"right":67},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":68,"text":"+ target cluster had run for a long time after the divergence, the old WAL","html":"+ target cluster had run for a long time after the divergence, the old WAL","displayNoNewLineWarning":false,"position":15,"left":70,"right":68},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":69,"text":"+ files might not be present anymore. In that case, they can be manually","html":"+ files might not be present anymore. In that case, they can be manually","displayNoNewLineWarning":false,"position":16,"left":70,"right":69},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":70,"text":"+ copied from the WAL archive to the \u003cfilename\u003epg_xlog\u003c/\u003e directory. Fetching","html":"+ copied from the WAL archive to the \u0026lt;filename\u0026gt;pg_xlog\u0026lt;/\u0026gt; directory. Fetching","displayNoNewLineWarning":false,"position":17,"left":70,"right":70},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":71,"text":"+ missing files from a WAL archive automatically is currently not supported.","html":"+ missing files from a WAL archive automatically is currently not supported.","displayNoNewLineWarning":false,"position":18,"left":70,"right":71},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":72,"text":"+ Besides, \u003capplication\u003epg_rewind\u003c/\u003e use cases are not limited by failover.","html":"+ Besides, \u0026lt;application\u0026gt;pg_rewind\u0026lt;/\u0026gt; use cases are not limited by failover.","displayNoNewLineWarning":false,"position":19,"left":70,"right":72},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":73,"text":"+ For instance, standby server could be promoted, run some writes and","html":"+ For instance, standby server could be promoted, run some writes and","displayNoNewLineWarning":false,"position":20,"left":70,"right":73},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":74,"text":"+ then be returned back as stanby. ","html":"+ then be returned back as stanby. ","displayNoNewLineWarning":false,"position":21,"left":70,"right":74},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":75,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":22,"left":71,"right":75},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":76,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":23,"left":72,"right":76},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":77,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":24,"left":73,"right":77}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":246,"linesChanged":18,"newTreeEntry":{"lineCount":246,"path":"doc/src/sgml/ref/pg_rewind.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/ref/pg_rewind.sgml","mode":100644},"linesAdded":11,"linesDeleted":7,"path":"doc/src/sgml/ref/pg_rewind.sgml","pathDigest":"5000439c18f57324735f445c5a22dca20284f501bc0a3bf2e447cde8d3984667","status":"MODIFIED","truncatedReason":null,"oldOid":"0e0776bc99553ff229e0d536ed8c78ab9db62464","newOid":"e50cda78404d6400b1326a996a4fabb144871151","copilotChatReference":null,"deletedSha":"0e0776bc99553ff229e0d536ed8c78ab9db62464","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":7,"text":"@@ -8,7 +8,7 @@","html":"@@ -8,7 +8,7 @@","displayNoNewLineWarning":false,"position":0,"left":7,"right":7},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":8,"text":" #","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":8,"right":8},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":9,"text":" #-------------------------------------------------------------------------","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e-------------------------------------------------------------------------\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":9,"right":9},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":10,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":10,"right":10},{"stylingDirective":null,"type":"DELETION","blobLineNumber":11,"text":"-PGFILEDESC = \"pg_rewind - repurpose an old master server as standby\"","html":"-\u003cspan class=\"pl-smi\"\u003ePGFILEDESC\u003c/span\u003e = \"pg_rewind - \u003cspan class=\"x x-first x-last\"\u003erepurpose an old master server as standby\u003c/span\u003e\"","displayNoNewLineWarning":false,"position":4,"left":11,"right":10},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":11,"text":"+PGFILEDESC = \"pg_rewind - synchronize a data directory with another one forked from\"","html":"+\u003cspan class=\"pl-smi\"\u003ePGFILEDESC\u003c/span\u003e = \"pg_rewind - \u003cspan class=\"x x-first x-last\"\u003esynchronize a data directory with another one forked from\u003c/span\u003e\"","displayNoNewLineWarning":false,"position":5,"left":11,"right":11},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":12,"text":" PGAPPICON = win32","html":" \u003cspan class=\"pl-smi\"\u003ePGAPPICON\u003c/span\u003e = win32","displayNoNewLineWarning":false,"position":6,"left":12,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":7,"left":13,"right":13},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":14,"text":" subdir = src/bin/pg_rewind","html":" \u003cspan class=\"pl-smi\"\u003esubdir\u003c/span\u003e = src/bin/pg_rewind","displayNoNewLineWarning":false,"position":8,"left":14,"right":14}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":54,"linesChanged":2,"newTreeEntry":{"lineCount":54,"path":"src/bin/pg_rewind/Makefile","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/bin/pg_rewind/Makefile","mode":100644},"linesAdded":1,"linesDeleted":1,"path":"src/bin/pg_rewind/Makefile","pathDigest":"fe1f9cbde6fdf06f3004c8da82dc13b3a83856f44da2361d24343530eb249a21","status":"MODIFIED","truncatedReason":null,"oldOid":"0e0776bc99553ff229e0d536ed8c78ab9db62464","newOid":"e50cda78404d6400b1326a996a4fabb144871151","copilotChatReference":null,"deletedSha":"0e0776bc99553ff229e0d536ed8c78ab9db62464","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":44,"text":"@@ -45,7 +45,7 @@ static char xlogfpath[MAXPGPATH];","html":"@@ -45,7 +45,7 @@ static char xlogfpath[MAXPGPATH];","displayNoNewLineWarning":false,"position":0,"left":44,"right":44},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":45,"text":" typedef struct XLogPageReadPrivate","html":" \u003cspan class=pl-k\u003etypedef\u003c/span\u003e \u003cspan class=pl-k\u003estruct\u003c/span\u003e \u003cspan class=pl-smi\u003eXLogPageReadPrivate\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":45,"right":45},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":46,"text":" {","html":" {","displayNoNewLineWarning":false,"position":2,"left":46,"right":46},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":47,"text":" \tconst char *datadir;","html":" \t\u003cspan class=pl-k\u003econst\u003c/span\u003e \u003cspan class=pl-smi\u003echar\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-c1\u003edatadir\u003c/span\u003e;","displayNoNewLineWarning":false,"position":3,"left":47,"right":47},{"stylingDirective":null,"type":"DELETION","blobLineNumber":48,"text":"-\tTimeLineID\ttli;","html":"-\t\u003cspan class=\"pl-smi x x-first\"\u003eTimeLineID\u003c/span\u003e\u003cspan class=\"x\"\u003e\t\u003c/span\u003e\u003cspan class=\"pl-c1 x x-last\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":4,"left":48,"right":47},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":48,"text":"+\tint\t\t\ttliIndex;","html":"+\t\u003cspan class=\"pl-smi x x-first\"\u003eint\u003c/span\u003e\u003cspan class=\"x\"\u003e\t\t\t\u003c/span\u003e\u003cspan class=\"pl-c1 x x-last\"\u003etliIndex\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":48,"right":48},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":49,"text":" } XLogPageReadPrivate;","html":" } \u003cspan class=pl-smi\u003eXLogPageReadPrivate\u003c/span\u003e;","displayNoNewLineWarning":false,"position":6,"left":49,"right":49},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":50,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":7,"left":50,"right":50},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":51,"text":" static int SimpleXLogPageRead(XLogReaderState *xlogreader,","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eint\u003c/span\u003e \u003cspan class=pl-en\u003eSimpleXLogPageRead\u003c/span\u003e(\u003cspan class=pl-smi\u003eXLogReaderState\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e,","displayNoNewLineWarning":false,"position":8,"left":51,"right":51},{"stylingDirective":null,"type":"HUNK","blobLineNumber":54,"text":"@@ -55,11 +55,11 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,","html":"@@ -55,11 +55,11 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,","displayNoNewLineWarning":false,"position":9,"left":54,"right":54},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":55,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":10,"left":55,"right":55},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":56,"text":" /*","html":" \u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":56,"right":56},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":57,"text":" * Read WAL from the datadir/pg_xlog, starting from 'startpoint' on timeline","html":" \u003cspan class=pl-c\u003e * Read WAL from the datadir/pg_xlog, starting from \u0026#39;startpoint\u0026#39; on timeline\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":57,"right":57},{"stylingDirective":null,"type":"DELETION","blobLineNumber":58,"text":"- * 'tli', until 'endpoint'. Make note of the data blocks touched by the WAL","html":"-\u003cspan class=\"pl-c\"\u003e * \u003cspan class=\"x x-first x-last\"\u003e'tli'\u003c/span\u003e, until 'endpoint'. Make note of\u003cspan class=\"x x-first x-last\"\u003e the data blocks touched by the WAL\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":13,"left":58,"right":57},{"stylingDirective":null,"type":"DELETION","blobLineNumber":59,"text":"- * records, and return them in a page map.","html":"-\u003cspan class=\"pl-c\"\u003e * records, and return them in a page map.\u003c/span\u003e","displayNoNewLineWarning":false,"position":14,"left":59,"right":57},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":58,"text":"+ * index 'tliIndex' in target timeline history, until 'endpoint'. Make note of","html":"+\u003cspan class=\"pl-c\"\u003e * \u003cspan class=\"x x-first x-last\"\u003eindex 'tliIndex' in target timeline history\u003c/span\u003e, until 'endpoint'. Make note of\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":59,"right":58},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":59,"text":"+ * the data blocks touched by the WAL records, and return them in a page map.","html":"+\u003cspan class=\"pl-c\"\u003e * \u003cspan class=\"x x-first x-last\"\u003ethe data blocks touched by the WAL \u003c/span\u003erecords, and return them in a page map.\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":59,"right":59},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":60,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":60,"right":60},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":61,"text":" void","html":" \u003cspan class=pl-smi\u003evoid\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":61,"right":61},{"stylingDirective":null,"type":"DELETION","blobLineNumber":62,"text":"-extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,","html":"-\u003cspan class=\"pl-en\"\u003eextractPageMap\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estartpoint\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eTimeLineID\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etli\u003c/span\u003e,","displayNoNewLineWarning":false,"position":19,"left":62,"right":61},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":62,"text":"+extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,","html":"+\u003cspan class=\"pl-en\"\u003eextractPageMap\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estartpoint\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eint\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etliIndex\u003c/span\u003e,","displayNoNewLineWarning":false,"position":20,"left":62,"right":62},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":63,"text":" \t\t\t XLogRecPtr endpoint)","html":" \t\t\t \u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=pl-s1\u003eendpoint\u003c/span\u003e)","displayNoNewLineWarning":false,"position":21,"left":63,"right":63},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":64,"text":" {","html":" {","displayNoNewLineWarning":false,"position":22,"left":64,"right":64},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":65,"text":" \tXLogRecord *record;","html":" \t\u003cspan class=pl-smi\u003eXLogRecord\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003erecord\u003c/span\u003e;","displayNoNewLineWarning":false,"position":23,"left":65,"right":65},{"stylingDirective":null,"type":"HUNK","blobLineNumber":67,"text":"@@ -68,7 +68,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,","html":"@@ -68,7 +68,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,","displayNoNewLineWarning":false,"position":24,"left":67,"right":67},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":68,"text":" \tXLogPageReadPrivate private;","html":" \t\u003cspan class=pl-smi\u003eXLogPageReadPrivate\u003c/span\u003e \u003cspan class=pl-s1\u003eprivate\u003c/span\u003e;","displayNoNewLineWarning":false,"position":25,"left":68,"right":68},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":69,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":26,"left":69,"right":69},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":70,"text":" \tprivate.datadir = datadir;","html":" \t\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e.\u003cspan class=pl-c1\u003edatadir\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003edatadir\u003c/span\u003e;","displayNoNewLineWarning":false,"position":27,"left":70,"right":70},{"stylingDirective":null,"type":"DELETION","blobLineNumber":71,"text":"-\tprivate.tli = tli;","html":"-\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etli\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":28,"left":71,"right":70},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":71,"text":"+\tprivate.tliIndex = tliIndex;","html":"+\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etliIndex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etliIndex\u003c/span\u003e;","displayNoNewLineWarning":false,"position":29,"left":71,"right":71},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":72,"text":" \txlogreader = XLogReaderAllocate(\u0026SimpleXLogPageRead, \u0026private);","html":" \t\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003eXLogReaderAllocate\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eSimpleXLogPageRead\u003c/span\u003e, \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e);","displayNoNewLineWarning":false,"position":30,"left":72,"right":72},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":73,"text":" \tif (xlogreader == NULL)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":31,"left":73,"right":73},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":74,"text":" \t\tpg_fatal(\"out of memory\\n\");","html":" \t\t\u003cspan class=pl-en\u003epg_fatal\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;out of memory\\n\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":32,"left":74,"right":74},{"stylingDirective":null,"type":"HUNK","blobLineNumber":111,"text":"@@ -112,7 +112,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,","html":"@@ -112,7 +112,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,","displayNoNewLineWarning":false,"position":33,"left":111,"right":111},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":112,"text":" * doing anything with the record itself.","html":" \u003cspan class=pl-c\u003e * doing anything with the record itself.\u003c/span\u003e","displayNoNewLineWarning":false,"position":34,"left":112,"right":112},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":113,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":35,"left":113,"right":113},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":114,"text":" XLogRecPtr","html":" \u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e","displayNoNewLineWarning":false,"position":36,"left":114,"right":114},{"stylingDirective":null,"type":"DELETION","blobLineNumber":115,"text":"-readOneRecord(const char *datadir, XLogRecPtr ptr, TimeLineID tli)","html":"-\u003cspan class=\"pl-en\"\u003ereadOneRecord\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eptr\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eTimeLineID\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etli\u003c/span\u003e)","displayNoNewLineWarning":false,"position":37,"left":115,"right":114},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":115,"text":"+readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex)","html":"+\u003cspan class=\"pl-en\"\u003ereadOneRecord\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eptr\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eint\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etliIndex\u003c/span\u003e)","displayNoNewLineWarning":false,"position":38,"left":115,"right":115},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":116,"text":" {","html":" {","displayNoNewLineWarning":false,"position":39,"left":116,"right":116},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":117,"text":" \tXLogRecord *record;","html":" \t\u003cspan class=pl-smi\u003eXLogRecord\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003erecord\u003c/span\u003e;","displayNoNewLineWarning":false,"position":40,"left":117,"right":117},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":118,"text":" \tXLogReaderState *xlogreader;","html":" \t\u003cspan class=pl-smi\u003eXLogReaderState\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e;","displayNoNewLineWarning":false,"position":41,"left":118,"right":118},{"stylingDirective":null,"type":"HUNK","blobLineNumber":120,"text":"@@ -121,7 +121,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, TimeLineID tli)","html":"@@ -121,7 +121,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, TimeLineID tli)","displayNoNewLineWarning":false,"position":42,"left":120,"right":120},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":121,"text":" \tXLogRecPtr\tendptr;","html":" \t\u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e\t\u003cspan class=pl-s1\u003eendptr\u003c/span\u003e;","displayNoNewLineWarning":false,"position":43,"left":121,"right":121},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":122,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":44,"left":122,"right":122},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":123,"text":" \tprivate.datadir = datadir;","html":" \t\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e.\u003cspan class=pl-c1\u003edatadir\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003edatadir\u003c/span\u003e;","displayNoNewLineWarning":false,"position":45,"left":123,"right":123},{"stylingDirective":null,"type":"DELETION","blobLineNumber":124,"text":"-\tprivate.tli = tli;","html":"-\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etli\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":46,"left":124,"right":123},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":124,"text":"+\tprivate.tliIndex = tliIndex;","html":"+\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etliIndex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etliIndex\u003c/span\u003e;","displayNoNewLineWarning":false,"position":47,"left":124,"right":124},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":125,"text":" \txlogreader = XLogReaderAllocate(\u0026SimpleXLogPageRead, \u0026private);","html":" \t\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003eXLogReaderAllocate\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eSimpleXLogPageRead\u003c/span\u003e, \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e);","displayNoNewLineWarning":false,"position":48,"left":125,"right":125},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":126,"text":" \tif (xlogreader == NULL)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":49,"left":126,"right":126},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":127,"text":" \t\tpg_fatal(\"out of memory\\n\");","html":" \t\t\u003cspan class=pl-en\u003epg_fatal\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;out of memory\\n\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":50,"left":127,"right":127},{"stylingDirective":null,"type":"HUNK","blobLineNumber":151,"text":"@@ -152,7 +152,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, TimeLineID tli)","html":"@@ -152,7 +152,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, TimeLineID tli)","displayNoNewLineWarning":false,"position":51,"left":151,"right":151},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":152,"text":" * Find the previous checkpoint preceding given WAL position.","html":" \u003cspan class=pl-c\u003e * Find the previous checkpoint preceding given WAL position.\u003c/span\u003e","displayNoNewLineWarning":false,"position":52,"left":152,"right":152},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":153,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":53,"left":153,"right":153},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":154,"text":" void","html":" \u003cspan class=pl-smi\u003evoid\u003c/span\u003e","displayNoNew
8000
LineWarning":false,"position":54,"left":154,"right":154},{"stylingDirective":null,"type":"DELETION","blobLineNumber":155,"text":"-findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, TimeLineID tli,","html":"-\u003cspan class=\"pl-en\"\u003efindLastCheckpoint\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eforkptr\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eTimeLineID\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etli\u003c/span\u003e,","displayNoNewLineWarning":false,"position":55,"left":155,"right":154},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":155,"text":"+findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,","html":"+\u003cspan class=\"pl-en\"\u003efindLastCheckpoint\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003edatadir\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eforkptr\u003c/span\u003e, \u003cspan class=\"pl-smi x x-first\"\u003eint\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003etliIndex\u003c/span\u003e,","displayNoNewLineWarning":false,"position":56,"left":155,"right":155},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":156,"text":" \t\t\t\t XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli,","html":" \t\t\t\t \u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003elastchkptrec\u003c/span\u003e, \u003cspan class=pl-smi\u003eTimeLineID\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003elastchkpttli\u003c/span\u003e,","displayNoNewLineWarning":false,"position":57,"left":156,"right":156},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":157,"text":" \t\t\t\t XLogRecPtr *lastchkptredo)","html":" \t\t\t\t \u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003elastchkptredo\u003c/span\u003e)","displayNoNewLineWarning":false,"position":58,"left":157,"right":157},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":158,"text":" {","html":" {","displayNoNewLineWarning":false,"position":59,"left":158,"right":158},{"stylingDirective":null,"type":"HUNK","blobLineNumber":172,"text":"@@ -173,7 +173,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, TimeLineID tli,","html":"@@ -173,7 +173,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, TimeLineID tli,","displayNoNewLineWarning":false,"position":60,"left":172,"right":172},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":173,"text":" \t\tforkptr += (forkptr % XLogSegSize == 0) ? SizeOfXLogLongPHD : SizeOfXLogShortPHD;","html":" \t\t\u003cspan class=pl-s1\u003eforkptr\u003c/span\u003e \u003cspan class=pl-c1\u003e+=\u003c/span\u003e (\u003cspan class=pl-s1\u003eforkptr\u003c/span\u003e % \u003cspan class=pl-s1\u003eXLogSegSize\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e) ? \u003cspan class=pl-s1\u003eSizeOfXLogLongPHD\u003c/span\u003e : \u003cspan class=pl-s1\u003eSizeOfXLogShortPHD\u003c/span\u003e;","displayNoNewLineWarning":false,"position":61,"left":173,"right":173},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":174,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":62,"left":174,"right":174},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":175,"text":" \tprivate.datadir = datadir;","html":" \t\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e.\u003cspan class=pl-c1\u003edatadir\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003edatadir\u003c/span\u003e;","displayNoNewLineWarning":false,"position":63,"left":175,"right":175},{"stylingDirective":null,"type":"DELETION","blobLineNumber":176,"text":"-\tprivate.tli = tli;","html":"-\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etli\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":64,"left":176,"right":175},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":176,"text":"+\tprivate.tliIndex = tliIndex;","html":"+\t\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e.\u003cspan class=\"pl-c1 x x-first x-last\"\u003etliIndex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first x-last\"\u003etliIndex\u003c/span\u003e;","displayNoNewLineWarning":false,"position":65,"left":176,"right":176},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":177,"text":" \txlogreader = XLogReaderAllocate(\u0026SimpleXLogPageRead, \u0026private);","html":" \t\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003eXLogReaderAllocate\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eSimpleXLogPageRead\u003c/span\u003e, \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e);","displayNoNewLineWarning":false,"position":66,"left":177,"right":177},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":178,"text":" \tif (xlogreader == NULL)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":67,"left":178,"right":178},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":179,"text":" \t\tpg_fatal(\"out of memory\\n\");","html":" \t\t\u003cspan class=pl-en\u003epg_fatal\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;out of memory\\n\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":68,"left":179,"right":179},{"stylingDirective":null,"type":"HUNK","blobLineNumber":235,"text":"@@ -236,9 +236,11 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","html":"@@ -236,9 +236,11 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","displayNoNewLineWarning":false,"position":69,"left":235,"right":235},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":236,"text":" {","html":" {","displayNoNewLineWarning":false,"position":70,"left":236,"right":236},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":237,"text":" \tXLogPageReadPrivate *private = (XLogPageReadPrivate *) xlogreader-\u003eprivate_data;","html":" \t\u003cspan class=pl-smi\u003eXLogPageReadPrivate\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003eXLogPageReadPrivate\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003exlogreader\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eprivate_data\u003c/span\u003e;","displayNoNewLineWarning":false,"position":71,"left":237,"right":237},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":238,"text":" \tuint32\t\ttargetPageOff;","html":" \t\u003cspan class=pl-smi\u003euint32\u003c/span\u003e\t\t\u003cspan class=pl-s1\u003etargetPageOff\u003c/span\u003e;","displayNoNewLineWarning":false,"position":72,"left":238,"right":238},{"stylingDirective":null,"type":"DELETION","blobLineNumber":239,"text":"-\tXLogSegNo targetSegNo PG_USED_FOR_ASSERTS_ONLY;","html":"-\t\u003cspan class=pl-smi\u003eXLogSegNo\u003c/span\u003e \u003cspan class=pl-s1\u003etargetSegNo\u003c/span\u003e \u003cspan class=pl-c1\u003ePG_USED_FOR_ASSERTS_ONLY\u003c/span\u003e;","displayNoNewLineWarning":false,"position":73,"left":239,"right":238},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":239,"text":"+\tXLogRecPtr\ttargetSegEnd;","html":"+\t\u003cspan class=pl-smi\u003eXLogRecPtr\u003c/span\u003e\t\u003cspan class=pl-s1\u003etargetSegEnd\u003c/span\u003e;","displayNoNewLineWarning":false,"position":74,"left":239,"right":239},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":240,"text":"+\tXLogSegNo\ttargetSegNo;","html":"+\t\u003cspan class=pl-smi\u003eXLogSegNo\u003c/span\u003e\t\u003cspan class=pl-s1\u003etargetSegNo\u003c/span\u003e;","displayNoNewLineWarning":false,"position":75,"left":239,"right":240},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":241,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":76,"left":240,"right":241},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":242,"text":" \tXLByteToSeg(targetPagePtr, targetSegNo);","html":" \t\u003cspan class=pl-en\u003eXLByteToSeg\u003c/span\u003e(\u003cspan class=pl-s1\u003etargetPagePtr\u003c/span\u003e, \u003cspan class=pl-s1\u003etargetSegNo\u003c/span\u003e);","displayNoNewLineWarning":false,"position":77,"left":241,"right":242},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":243,"text":"+\tXLogSegNoOffsetToRecPtr(targetSegNo + 1, 0, targetSegEnd);","html":"+\t\u003cspan class=pl-en\u003eXLogSegNoOffsetToRecPtr\u003c/span\u003e(\u003cspan class=pl-s1\u003etargetSegNo\u003c/span\u003e \u003cspan class=pl-c1\u003e+\u003c/span\u003e \u003cspan class=pl-c1\u003e1\u003c/span\u003e, \u003cspan class=pl-c1\u003e0\u003c/span\u003e, \u003cspan class=pl-s1\u003etargetSegEnd\u003c/span\u003e);","displayNoNewLineWarning":false,"position":78,"left":241,"right":243},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":244,"text":" \ttargetPageOff = targetPagePtr % XLogSegSize;","html":" \t\u003cspan class=pl-s1\u003etargetPageOff\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003etargetPagePtr\u003c/span\u003e % \u003cspan class=pl-s1\u003eXLogSegSize\u003c/span\u003e;","displayNoNewLineWarning":false,"position":79,"left":242,"right":244},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":245,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":80,"left":243,"right":245},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":246,"text":" \t/*","html":" \t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":81,"left":244,"right":246},{"stylingDirective":null,"type":"HUNK","blobLineNumber":258,"text":"@@ -257,7 +259,20 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","html":"@@ -257,7 +259,20 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","displayNoNewLineWarning":false,"position":82,"left":256,"right":258},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":259,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":83,"left":257,"right":259},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":260,"text":" \t\tchar\t\txlogfname[MAXFNAMELEN];","html":" \t\t\u003cspan class=pl-smi\u003echar\u003c/span\u003e\t\t\u003cspan class=pl-s1\u003exlogfname\u003c/span\u003e[\u003cspan class=pl-c1\u003eMAXFNAMELEN\u003c/span\u003e];","displayNoNewLineWarning":false,"position":84,"left":258,"right":260},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":261,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":85,"left":259,"right":261},{"stylingDirective":null,"type":"DELETION","blobLineNumber":260,"text":"-\t\tXLogFileName(xlogfname, private-\u003etli, xlogreadsegno);","html":"-\t\t\u003cspan class=pl-en\u003eXLogFileName\u003c/span\u003e(\u003cspan class=pl-s1\u003exlogfname\u003c/span\u003e, \u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etli\u003c/span\u003e, \u003cspan class=pl-s1\u003exlogreadsegno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":86,"left":260,"right":261},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":262,"text":"+\t\t/*","html":"+\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":87,"left":260,"right":262},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":263,"text":"+\t\t * Since incomplete segments are copied into next timelines, switch to","html":"+\u003cspan class=pl-c\u003e\t\t * Since incomplete segments are copied into next timelines, switch to\u003c/span\u003e","displayNoNewLineWarning":false,"position":88,"left":260,"right":263},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":264,"text":"+\t\t * the timeline holding the required segment. Assuming this scan can be","html":"+\u003cspan class=pl-c\u003e\t\t * the timeline holding the required segment. Assuming this scan can be\u003c/span\u003e","displayNoNewLineWarning":false,"position":89,"left":260,"right":264},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":265,"text":"+\t\t * done both forward and backward, consider also switching timeline","html":"+\u003cspan class=pl-c\u003e\t\t * done both forward and backward, consider also switching timeline\u003c/span\u003e","displayNoNewLineWarning":false,"position":90,"left":260,"right":265},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":266,"text":"+\t\t * accordingly.","html":"+\u003cspan class=pl-c\u003e\t\t * accordingly.\u003c/span\u003e","displayNoNewLineWarning":false,"position":91,"left":260,"right":266},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":267,"text":"+\t\t */","html":"+\u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":92,"left":260,"right":267},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":268,"text":"+\t\twhile (private-\u003etliIndex \u003c targetNentries - 1 \u0026\u0026","html":"+\t\t\u003cspan class=pl-k\u003ewhile\u003c/span\u003e (\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026lt;\u003c/span\u003e \u003cspan class=pl-s1\u003etargetNentries\u003c/span\u003e \u003cspan class=pl-c1\u003e-\u003c/span\u003e \u003cspan class=pl-c1\u003e1\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":93,"left":260,"right":268},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":269,"text":"+\t\t\t\ttargetHistory[private-\u003etliIndex].end \u003c targetSegEnd)","html":"+\t\t\t\t\u003cspan class=pl-s1\u003etargetHistory\u003c/span\u003e[\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e].\u003cspan class=pl-c1\u003eend\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026lt;\u003c/span\u003e \u003cspan class=pl-s1\u003etargetSegEnd\u003c/span\u003e)","displayNoNewLineWarning":false,"position":94,"left":260,"right":269},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":270,"text":"+\t\t\tprivate-\u003etliIndex++;","html":"+\t\t\t\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e\u003cspan class=pl-c1\u003e++\u003c/span\u003e;","displayNoNewLineWarning":false,"position":95,"left":260,"right":270},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":271,"text":"+\t\twhile (private-\u003etliIndex \u003e 0 \u0026\u0026","html":"+\t\t\u003cspan class=pl-k\u003ewhile\u003c/span\u003e (\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":96,"left":260,"right":271},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":272,"text":"+\t\t\t\ttargetHistory[private-\u003etliIndex].begin \u003e= targetSegEnd)","html":"+\t\t\t\t\u003cspan class=pl-s1\u003etargetHistory\u003c/span\u003e[\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e].\u003cspan class=pl-c1\u003ebegin\u003c/span\u003e \u0026gt;= \u003cspan class=pl-s1\u003etargetSegEnd\u003c/span\u003e)","displayNoNewLineWarning":false,"position":97,"left":260,"right":272},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":273,"text":"+\t\t\tprivate-\u003etliIndex--;","html":"+\t\t\t\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e\u003cspan class=pl-c1\u003e--\u003c/span\u003e;","displayNoNewLineWarning":false,"position":98,"left":260,"right":273},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":274,"text":"+","html":"+","displayNoNewLineWarning":false,"position":99,"left":260,"right":274},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":275,"text":"+\t\tXLogFileName(xlogfname, targetHistory[private-\u003etliIndex].tli, xlogreadsegno);","html":"+\t\t\u003cspan class=pl-en\u003eXLogFileName\u003c/span\u003e(\u003cspan class=pl-s1\u003exlogfname\u003c/span\u003e, \u003cspan class=pl-s1\u003etargetHistory\u003c/span\u003e[\u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etliIndex\u003c/span\u003e].\u003cspan class=pl-c1\u003etli\u003c/span\u003e, \u003cspan class=pl-s1\u003exlogreadsegno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":100,"left":260,"right":275},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":276,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":101,"left":261,"right":276},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":277,"text":" \t\tsnprintf(xlogfpath, MAXPGPATH, \"%s/\" XLOGDIR \"/%s\", private-\u003edatadir, xlogfname);","html":" \t\t\u003cspan class=pl-en\u003esnprintf\u003c/span\u003e(\u003cspan class=pl-s1\u003exlogfpath\u003c/span\u003e, \u003cspan class=pl-c1\u003eMAXPGPATH\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;%s/\u0026quot;\u003c/span\u003e \u003cspan class=pl-c1\u003eXLOGDIR\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;/%s\u0026quot;\u003c/span\u003e, \u003cspan class=pl-s1\u003eprivate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003edatadir\u003c/span\u003e, \u003cspan class=pl-s1\u003exlogfname\u003c/span\u003e);","displayNoNewLineWarning":false,"position":102,"left":262,"right":277},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":278,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":103,"left":263,"right":278},{"stylingDirective":null,"type":"HUNK","blobLineNumber":307,"text":"@@ -293,7 +308,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","html":"@@ -293,7 +308,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,","displayNoNewLineWarning":false,"position":104,"left":292,"right":307},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":308,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":105,"left":293,"right":308},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":309,"text":" \tAssert(targetSegNo == xlogreadsegno);","html":" \t\u003cspan class=pl-en\u003eAssert\u003c/span\u003e(\u003cspan class=pl-s1\u003etargetSegNo\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-s1\u003exlogreadsegno\u003c/span\u003e);","displayNoNewLineWarning":false,"position":106,"left":294,"right":309},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":310,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":107,"left":295,"right":310},{"stylingDirective":null,"type":"DELETION","blobLineNumber":296,"text":"-\t*pageTLI = private-\u003etli;","html":"-\t\u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003epageTLI\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":108,"left":296,"right":310},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":311,"text":"+\t*pageTLI = targetHistory[private-\u003etliIndex].tli;","html":"+\t\u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003epageTLI\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1 x x-first\"\u003etargetHistory\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eprivate\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=\"pl-c1 x x-first\"\u003etliIndex\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e].\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003etli\u003c/span\u003e;","displayNoNewLineWarning":false,"position":109,"left":296,"right":311},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":312,"text":" \treturn XLOG_BLCKSZ;","html":" \t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-c1\u003eXLOG_BLCKSZ\u003c/span\u003e;","displayNoNewLineWarning":false,"position":110,"left":297,"right":312},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":313,"text":" }","html":" }","displayNoNewLineWarning":false,"position":111,"left":298,"right":313},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":314,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":112,"left":299,"right":314}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":393,"linesChanged":39,"newTreeEntry":{"lineCount":393,"path":"src/bin/pg_rewind/parsexlog.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/bin/pg_rewind/parsexlog.c","mode":100644},"linesAdded":27,"linesDeleted":12,"path":"src/bin/pg_rewind/parsexlog.c","pathDigest":"e9a45fb624a58f3bf39829a5b5f9f517a5a0572ddc4ab271f4bd7636b0dab1a5","status":"MODIFIED","truncatedReason":null,"oldOid":"0e0776bc99553ff229e0d536ed8c78ab9db62464","newOid":"e50cda78404d6400b1326a996a4fabb144871151","copilotChatReference":null,"deletedSha":"0e0776bc99553ff229e0d536ed8c78ab9db62464","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"path":"src/bin/pg_rewind/pg_rewind.c","pathDigest":"380b9ad6531635eeae0a96dfe39ca4f9e895bee56514f04392ffe2a90fb20ae6","status":"MODIFIED"},{"path":"src/bin/pg_rewind/pg_rewind.h","pathDigest":"6a46cc43c3bcd5d2432627cc2fc636a0bf870da05735a0431c8c172a74ae524b","status":"MODIFIED"}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/e50cda78404d6400b1326a996a4fabb144871151","fileTreeExpanded":true,"headerInfo":{"additions":181,"deletions":77,"filesChanged":5,"filesChangedString":"5"},"moreDiffsToLoad":true,"asyncDiffLoadInfo":{"startIndex":3,"truncated":false,"byteCount":6179,"lineShownCount":147},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"EHlscbl8U3mA8yL8TmbCTJDG5HhN9fAf0fQbbiZjDSxXHjfUfa9uW65eKrz2dgWUMB2sq7RF9vWPWjpwjYXK8w"},"/users/diffview?diff=unified":{"post":"QKhSuOQZ18aakhIP2UzSAAU0oUMZHvDv6qDH4Q0e59AHzwkdIMrq5LQ_Gk9hXBXYpe_pkOCu9gW0Dub_pvggDw"},"/notifications/thread":{"post":"KAObkfNAVlsHCP--YfcePSaavhpcYvqvj3dD2xO3kVAg7PR260ldByfBIIic5VwNFMeJRYcdb8zOgb3jGZMKzw"}}},"title":"Use pg_rewind when target timeline was switched · postgres/postgres@e50cda7","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}}}
Allow pg_rewind to work when target timeline was switched. Now
user can return promoted standby to old master.
Target timeline history becomes a global variable. Index
in target timeline history is used in function interfaces instead of
specifying TLI directly. Thus, SimpleXLogPageRead() can easily start
reading XLOGs from next timeline when current timeline ends.
Author: Alexander Korotkov
Review: Michael Paquier
0 commit comments