Re: A patch for get origin from commit_ts.

movead.li@highgo.ca <movead.li@highgo.ca>

From: "movead.li@highgo.ca" <movead.li@highgo.ca>
To: michael <michael@paquier.xyz>
Cc: petr <petr@2ndquadrant.com>, simon <simon@2ndquadrant.com>, "Madan Kumar" <madankumar1993@gmail.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, craig <craig@2ndquadrant.com>, "Alvaro Herrera" <alvherre@2ndquadrant.com>, andres <andres@anarazel.de>, soumyadeep2007 <soumyadeep2007@gmail.com>
Date: 2020-07-06T03:12:30Z
Lists: pgsql-hackers

Attachments

>+SELECT pg_replication_origin_create('test_commit_ts: get_origin_1');
>+SELECT pg_replication_origin_create('test_commit_ts: get_origin_2');
>+SELECT pg_replication_origin_create('test_commit_ts: get_origin_3');
>
>Why do you need three replication origins to test three times the same
>pattern?  Wouldn't one be enough and why don't you check after the
>timestamp?  I would also two extra tests: one with a NULL input and an
>extra one where the data could not be found.
> 
>+   found = TransactionIdGetCommitTsData(xid, &ts, &nodeid);
>+
>+   if (!found)
>+       PG_RETURN_NULL();
> 
>This part also looks incorrect to me, I think that you should still
>return two tuples, both marked as NULL.  You can do that just by
>switching the nulls flags to true for the two values if nothing can be
>found.
Thanks for the points and follow them, new patch attached.



Regards,
Highgo Software (Canada/China/Pakistan) 
URL : www.highgo.ca 
EMAIL: mailto:movead(dot)li(at)highgo(dot)ca

Commits

  1. Include replication origins in SQL functions for commit timestamp

  2. Create a script that can renumber manually-assigned OIDs.