mirror of https://github.com/citusdata/citus.git
80 lines
2.2 KiB
Plaintext
80 lines
2.2 KiB
Plaintext
--
|
|
-- TASK_TRACKER_CLEANUP_JOB
|
|
--
|
|
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1060000;
|
|
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1060000;
|
|
\set JobId 401010
|
|
\set CompletedTaskId 801107
|
|
\set RunningTaskId 801108
|
|
-- We assign two tasks to the task tracker. The first task should complete and
|
|
-- the second task should continue to keep running.
|
|
SELECT task_tracker_assign_task(:JobId, :CompletedTaskId,
|
|
'COPY (SELECT * FROM lineitem) TO '
|
|
'''base/pgsql_job_cache/job_401010/task_801107''');
|
|
task_tracker_assign_task
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT task_tracker_assign_task(:JobId, :RunningTaskId,
|
|
'SELECT pg_sleep(100)');
|
|
task_tracker_assign_task
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT pg_sleep(2.0);
|
|
pg_sleep
|
|
----------
|
|
|
|
(1 row)
|
|
|
|
SELECT task_tracker_task_status(:JobId, :CompletedTaskId);
|
|
task_tracker_task_status
|
|
--------------------------
|
|
6
|
|
(1 row)
|
|
|
|
SELECT task_tracker_task_status(:JobId, :RunningTaskId);
|
|
task_tracker_task_status
|
|
--------------------------
|
|
3
|
|
(1 row)
|
|
|
|
SELECT isdir FROM pg_stat_file('base/pgsql_job_cache/job_401010/task_801107');
|
|
isdir
|
|
-------
|
|
f
|
|
(1 row)
|
|
|
|
SELECT isdir FROM pg_stat_file('base/pgsql_job_cache/job_401010');
|
|
isdir
|
|
-------
|
|
t
|
|
(1 row)
|
|
|
|
-- We now clean up all tasks for this job id. As a result, shared hash entries,
|
|
-- files, and connections associated with these tasks should all be cleaned up.
|
|
SELECT task_tracker_cleanup_job(:JobId);
|
|
task_tracker_cleanup_job
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT pg_sleep(1.0);
|
|
pg_sleep
|
|
----------
|
|
|
|
(1 row)
|
|
|
|
SELECT task_tracker_task_status(:JobId, :CompletedTaskId);
|
|
ERROR: could not find the worker task
|
|
DETAIL: Task jobId: 401010 and taskId: 801107
|
|
SELECT task_tracker_task_status(:JobId, :RunningTaskId);
|
|
ERROR: could not find the worker task
|
|
DETAIL: Task jobId: 401010 and taskId: 801108
|
|
SELECT isdir FROM pg_stat_file('base/pgsql_job_cache/job_401010/task_801107');
|
|
ERROR: could not stat file "base/pgsql_job_cache/job_401010/task_801107": No such file or directory
|
|
SELECT isdir FROM pg_stat_file('base/pgsql_job_cache/job_401010');
|
|
ERROR: could not stat file "base/pgsql_job_cache/job_401010": No such file or directory
|