Hi Antonin,

v05 fixes the three regressions from my last mail. On those cases
it now gives the same output as master. Tested on master
9ebc9a458c3 with v05-0001 and v05-0002.

> I thought you described all the problem directly in the email, but now it
> seems that the attachment was important too. So I tried to parse it, but
> didn't have much success. Somehow I could reproduce one problem (the xact
> callbacks are called too late, so in v05 I use PG_TRY-PG_CATCH block instead),
> but the output of the script does not look very human readable.

Sorry about that. That fix covers all three: the failed COPY's row
no longer hides the next CREATE INDEX, and a two-scan error caught
in a subtransaction, by an EXCEPTION block or by ROLLBACK TO, no
longer stops progress reporting for the rest of the session.

> If you still see any problem in v05, can you please give me a little bit
> information how I can reproduce it? Thanks.

Only case 2 from my last mail, which master has too, so it is not
a regression. In plain SQL, after "seq 1000 > /tmp/n.txt" and
"seq 3 > /tmp/three.txt":

    CREATE EXTENSION file_fdw;
    CREATE SERVER f FOREIGN DATA WRAPPER file_fdw;
    CREATE FOREIGN TABLE ft (a int) SERVER f
      OPTIONS (filename '/tmp/n.txt');
    CREATE TABLE t (a int);
    CREATE FUNCTION trg() RETURNS trigger LANGUAGE plpgsql
      SET enable_hashjoin = off SET enable_nestloop = off AS $$
    BEGIN
      IF NEW.a = 2 THEN
        -- two file_fdw scans in one query (a merge join)
        PERFORM count(*) FROM ft x JOIN ft y USING (a);
      END IF;
      PERFORM pg_stat_clear_snapshot();
      RAISE NOTICE 'row %: % row(s) in pg_stat_progress_copy',
        NEW.a, (SELECT count(*) FROM pg_stat_progress_copy
                 WHERE pid = pg_backend_pid());
      RETURN NEW;
    END $$;
    CREATE TRIGGER tr BEFORE INSERT ON t
      FOR EACH ROW EXECUTE FUNCTION trg();
    COPY t FROM '/tmp/three.txt';

On both v05 and master:

    NOTICE:  row 1: 1 row(s) in pg_stat_progress_copy
    NOTICE:  row 2: 0 row(s) in pg_stat_progress_copy
    NOTICE:  row 3: 0 row(s) in pg_stat_progress_copy

The COPY's row is gone from the moment the two-scan query in its
trigger finishes until the end of the COPY. I don't think it needs
to block v05.

> > The parallel BRIN build still looks the way Adam described, which I
> > take it you already plan to drop.
>
> Done.

Confirmed: the parallel BRIN build now shows one CREATE INDEX row
for the leader, the same as a serial build.

Regards,
Manu


Reply via email to