Re: race condition in pg_class

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Noah Misch <noah@leadboat.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Smolkin Grigory <smallkeen@gmail.com>, pgsql-hackers@postgresql.org
Date: 2025-03-18T19:03:52Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Replace tests of ALTER DATABASE RESET TABLESPACE.

  2. meson: Flush stdout in testwrap

  3. Fix catcache invalidation of a list entry that's being built

  4. Stop reading uninitialized memory in heap_inplace_lock().

  5. Fix use of uninitialized value in previous commit.

  6. Back-patch "Refactor code in tablecmds.c to check and process tablespace moves"

  7. Fix data loss at inplace update after heap_update().

  8. For inplace update durability, make heap_update() callers wait.

  9. Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

  10. Don't lose partitioned table reltuples=0 after relhassubclass=f.

  11. Fix new assertion for MERGE view_name ... DO NOTHING.

  12. Remove configuration-dependent output from new inplace-inval test.

  13. AccessExclusiveLock new relations just after assigning the OID.

  14. Cope with inplace update making catcache stale during TOAST fetch.

  15. Expand comments and add an assertion in nodeModifyTable.c.

  16. Improve test coverage for changes to inplace-updated catalogs.

  17. Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX.

  18. Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED }.

  19. Make TAP todo_start effects the same under Meson and prove_check.

  20. Add an injection_points isolation test suite.

  21. Add wait event type "InjectionPoint", a custom type like "Extension".

  22. Create waitfuncs.c for pg_isolation_test_session_is_blocked().

  23. Rework planning and execution of UPDATE and DELETE.

Attachments

Hi,

On 2024-05-12 16:29:23 -0700, Noah Misch wrote:
> Author:     Noah Misch <noah@leadboat.com>
> Commit:     Noah Misch <noah@leadboat.com>
> 
>     Make TAP todo_start effects the same under Meson and prove_check.
>     
>     This could have caused spurious failures only on SPARC Linux, because
>     today's only todo_start tests for that platform.  Back-patch to v16,
>     where Meson support first appeared.
>     
>     Reviewed by FIXME.
>     
>     Discussion: https://postgr.es/m/FIXME
> 
> diff --git a/src/tools/testwrap b/src/tools/testwrap
> index d01e610..9a270be 100755
> --- a/src/tools/testwrap
> +++ b/src/tools/testwrap
> @@ -41,12 +41,22 @@ env_dict = {**os.environ,
>              'TESTDATADIR': os.path.join(testdir, 'data'),
>              'TESTLOGDIR': os.path.join(testdir, 'log')}
>  
> -sp = subprocess.run(args.test_command, env=env_dict)
> +sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
> +# Meson categorizes a passing TODO test point as bad
> +# (https://github.com/mesonbuild/meson/issues/13183).  Remove the TODO
> +# directive, so Meson computes the file result like Perl does.  This could
> +# have the side effect of delaying stdout lines relative to stderr.  That
> +# doesn't affect the log file, and the TAP protocol uses stdout only.
> +for line in sp.stdout:
> +    if line.startswith(b'ok '):
> +        line = line.replace(b' # TODO ', b' # testwrap-overridden-TODO ', 1)
> +    sys.stdout.buffer.write(line)
> +returncode = sp.wait()

This has the issue that it causes the testwrap output to be buffered, which
makes running tests with ``meson test -v <testname>` update the output less
promptly, only updating whenever the output buffer is flushed.

That's not the end of the world, but it'd be nice to get the output more
promptly again. It doesn't matter that much when running the tests normally,
but if you run them with valgrind or such and you just want to see the first
failure, because it's going to take an hour to finish all tests...

The easiest fix is to just explicitly flush after each line, as in the
attached.

Greetings,

Andres Freund