mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 14:11:21 +02:00
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
This commit is contained in:
parent
e788bd924c
commit
002962dc72
@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#include "access/parallel.h"
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
#include "commands/dbcommands.h"
|
#include "commands/dbcommands.h"
|
||||||
#include "executor/spi.h"
|
#include "executor/spi.h"
|
||||||
@ -89,6 +90,10 @@ sample_session_start_hook(void)
|
|||||||
if (!OidIsValid(MyDatabaseId))
|
if (!OidIsValid(MyDatabaseId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* no parallel workers */
|
||||||
|
if (IsParallelWorker())
|
||||||
|
return;
|
||||||
|
|
||||||
register_session_hook("START");
|
register_session_hook("START");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +112,10 @@ sample_session_end_hook(void)
|
|||||||
if (!OidIsValid(MyDatabaseId))
|
if (!OidIsValid(MyDatabaseId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* no parallel workers */
|
||||||
|
if (IsParallelWorker())
|
||||||
|
return;
|
||||||
|
|
||||||
register_session_hook("END");
|
register_session_hook("END");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user