On 27/07/2021 19:49, Fujii Masao wrote:
Anyway I attached the patch that changes only xact_redo_abort()
so that it calls XLogFlush() to update min recovery point.

Looks good to me, thanks! FWIW, I used the attached script to reproduce this.

- Heikki
# Repro for https://www.postgresql.org/message-id/b029fce3-4fac-4265-968e-16f36ff4d075.mengjuan.cmj%40alibaba-inc.com

import psycopg2
import subprocess
import time

subprocess.run(["initdb", "-D", "data-master"])

f = open('data-master/postgresql.conf', 'a')
f.write("full_page_writes='off'\n")
f.close();

subprocess.run(["pg_ctl", "-D", "data-master", "start"])

conn = psycopg2.connect("dbname=postgres host=localhost")
cur = conn.cursor()

cur.execute("create table foo (t text)")
cur.execute("insert into foo values ('foo')");

subprocess.run(["pg_basebackup", "-D", "data-standby", "-R"])

f = open('data-standby/postgresql.conf', 'a')
f.write("port='5433'\n")
f.close();

subprocess.run(["pg_ctl", "-D", "data-standby", "start"])

cur.execute("delete from foo");
conn.rollback();

time.sleep(2) # wait for the ROLLBACK record to reach the standby

subprocess.run(["pg_ctl", "-D", "data-standby", "stop", "-m", "immediate"])
subprocess.run(["pg_ctl", "-D", "data-standby", "start"])

Reply via email to