From: | Arseny Sher <a(dot)sher(at)postgrespro(dot)ru> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, "Hsu\, John" <hsuchen(at)amazon(dot)com>, "pgsql-bugs\(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: ERROR: subtransaction logged without previous top-level txn record |
Date: | 2020-03-02 13:37:04 |
Message-ID: | 87mu8y7u9r.fsf@ars-thinkpad |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> I think here you are trying to deduce the meaning. I don't see that
> it can clearly define that don't use serialized snapshots. It is not
> clear to me why have you changed the below code, basically why it is
> okay to pass InvalidXLogRecPtr instead of restart_lsn?
>
> @@ -327,7 +327,7 @@ CreateInitDecodingContext(char *plugin,
> ReplicationSlotMarkDirty();
> ReplicationSlotSave();
>
> - ctx = StartupDecodingContext(NIL, restart_lsn, xmin_horizon,
> + ctx = StartupDecodingContext(NIL, InvalidXLogRecPtr, xmin_horizon,
> need_full_snapshot, false,
> read_page, prepare_write, do_write,
> update_progress);
Because when we create the slot we don't demand to stream from some
specific point. In fact we just can't, because we don't know since which
LSN it is actually possible to stream, i.e. when we'd have good snapshot
and no old (which we haven't seen in full) xacts running. It is up to
snapbuild.c to define this point. The previous coding was meaningless:
we asked for some random restart_lsn and snapbuild.c would silently
advance it to earliest suitable LSN.
OTOH, when we are decoding from existing slot not only we know earliest
possible point, but to avoid missing xacts we must enforce streaming
since this very point despite the snapbuilder being unable (because he
might not know which xacts are running at point of the snapshot) to
check its safety.
start_decoding_at reflects the difference between these scenarios, and
serialized snapshots handling stems from here.
Thanks for looking into this.
-- cheers, arseny
From | Date | Subject | |
---|---|---|---|
Next Message | Filip Janus | 2020-03-02 15:27:05 | Ecpg dependency |
Previous Message | Daniel Gustafsson | 2020-03-02 11:06:10 | Re: BUG #16284: Pg_dump is not working and PostgreSQL APP no longer available |
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2020-03-02 13:40:30 | Re: doc: vacuum full, fillfactor, and "extra space" |
Previous Message | David Steele | 2020-03-02 13:33:04 | Re: Psql patch to show access methods info |