Re: Replication identifiers, take 4

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Steve Singer <steve(at)ssinger(dot)info>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replication identifiers, take 4
Date: 2015-04-24 13:09:55
Message-ID: 553A40A3.9090604@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24/04/15 14:32, Andres Freund wrote:
> On 2015-04-20 11:26:29 +0300, Heikki Linnakangas wrote:
>> On 04/17/2015 11:54 AM, Andres Freund wrote:
>>> I've attached a rebased patch, that adds decision about origin logging
>>> to the relevant XLogInsert() callsites for "external" 2 byte identifiers
>>> and removes the pad-reusing version in the interest of moving forward.
>>
>> Putting aside the 2 vs. 4 byte identifier issue, let's discuss naming:
>>
>> I just realized that it talks about "replication identifier" as the new
>> fundamental concept. The system table is called "pg_replication_identifier".
>> But that's like talking about "index identifiers", instead of just indexes,
>> and calling the system table pg_index_oid.
>>
>> The important concept this patch actually adds is the *origin* of each
>> transaction. That term is already used in some parts of the patch. I think
>> we should roughly do a search-replace of "replication identifier" ->
>> "replication origin" to the patch. Or even "transaction origin".
>
> Attached is a patch that does this, and some more, renaming. That was
> more work than I'd imagined. I've also made the internal naming in
> origin.c more consistent/simpler and did a bunch of other cleanup.
>

There are few oversights in the renaming:

doc/src/sgml/func.sgml:
+ Return the replay position for the passed in replication
+ identifier. The parameter <parameter>flush</parameter>

src/include/replication/origin.h:
+ * replication_identifier.h
----
+extern PGDLLIMPORT RepOriginId replident_sesssion_origin;
+extern PGDLLIMPORT XLogRecPtr replident_sesssion_origin_lsn;
+extern PGDLLIMPORT TimestampTz replident_sesssion_origin_timestamp;

(these are used then in multiple places in code afterwards and also
mentioned in comment above replorigin_advance)

src/backend/replication/logical/origin.c:
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_IN_USE),
+ errmsg("replication identiefer
----
+ default:
+ elog(PANIC, "replident_redo: unknown op code
----
+ * This function may only be called if a origin was setup with
+ * replident_session_setup().

I also think the "replident_checkpoint" file should be renamed to
"replorigin_checkpoint".

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-04-24 13:23:17 Re: Fwd: [GENERAL] 4B row limit for CLOB tables
Previous Message Amit Kapila 2015-04-24 12:58:11 Re: a fast bloat measurement tool (was Re: Measuring relation free space)