You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: plsh function that runs a script with plsql commands.
For example: create or replace function sp_fact_maintenance_run(get_start_date date DEFAULT (((last_day(('now'::text)::date) - '1 mon'::interval) + '1 day'::interval))::date, get_end_date date DEFAULT (('now'::text)::date - 1)) returns void language plsh as $$ #!/bin/sh export HOME=/var/lib/postgresql echo "#!/bin/sh" > /var/scripts/fact_maintenance.sh psql -d dwh -c "select sp_fact_maintenance_generate(get_start_date := '$1',get_end_date := '$2' );" parallel -j 40 :::: /var/scripts/fact_maintenance.sh $$;
this function generates and runs a file that containing psql commands.
The fact_maintenance.sh file looks like:
#!/bin/sh
psql -d dwh -c "some command"
psql -d dwh -c "some command"
psql -d dwh -c "some command"
psql -d dwh -c "some command"
......
So after you are launching sp_fact_maintenance_run() you see in pg_stat_activity the parent process of sp_fact_maintenance_run() and 40 processes running concurrently of "some command".
So far so good.
The problem is that in case sp_fact_maintenance_run() is canceled or terminated the "some command"'s still running.
So there is no cancel/terminate propagation.
The text was updated successfully, but these errors were encountered:
Scenario: plsh function that runs a script with plsql commands.
For example:
create or replace function sp_fact_maintenance_run(get_start_date date DEFAULT (((last_day(('now'::text)::date) - '1 mon'::interval) + '1 day'::interval))::date, get_end_date date DEFAULT (('now'::text)::date - 1)) returns void language plsh as $$ #!/bin/sh export HOME=/var/lib/postgresql echo "#!/bin/sh" > /var/scripts/fact_maintenance.sh psql -d dwh -c "select sp_fact_maintenance_generate(get_start_date := '$1',get_end_date := '$2' );" parallel -j 40 :::: /var/scripts/fact_maintenance.sh $$;
this function generates and runs a file that containing psql commands.
The fact_maintenance.sh file looks like:
#!/bin/sh
psql -d dwh -c "some command"
psql -d dwh -c "some command"
psql -d dwh -c "some command"
psql -d dwh -c "some command"
......
So after you are launching sp_fact_maintenance_run() you see in pg_stat_activity the parent process of sp_fact_maintenance_run() and 40 processes running concurrently of "some command".
So far so good.
The problem is that in case sp_fact_maintenance_run() is canceled or terminated the "some command"'s still running.
So there is no cancel/terminate propagation.
The text was updated successfully, but these errors were encountered: