Commit 002962dc authored by Michael Paquier's avatar Michael Paquier

Fix test_session_hooks with parallel workers

Several buildfarm machines have been complaining about the new module
test_session_hooks to be unstable, like crake and thorntail.  The issue
was that the module was trying to log some start and end session
activity for parallel workers, which makes little sense as they don't
support DML, so just prevent this pattern to happen in the module.

This could be reproduced by enforcing force_parallel_mode=regress, which
is the value used by some of the buildfarm members.

Discussion: https://postgr.es/m/20191001045246.GF2781@paquier.xyz
parent e788bd92
......@@ -13,6 +13,7 @@
*/
#include "postgres.h"
#include "access/parallel.h"
#include "access/xact.h"
#include "commands/dbcommands.h"
#include "executor/spi.h"
......@@ -89,6 +90,10 @@ sample_session_start_hook(void)
if (!OidIsValid(MyDatabaseId))
return;
/* no parallel workers */
if (IsParallelWorker())
return;
register_session_hook("START");
}
......@@ -107,6 +112,10 @@ sample_session_end_hook(void)
if (!OidIsValid(MyDatabaseId))
return;
/* no parallel workers */
if (IsParallelWorker())
return;
register_session_hook("END");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment