@@ -519,9 +519,6 @@ squeeze_table_new(PG_FUNCTION_ARGS)
519
519
*
520
520
* If NULL is returned, *duplicate tells whether it's due to an existing task
521
521
* for given relation.
522
- *
523
- * If 'dbid' is invalid, (i.e. caller is requesting a "cleanup only task"), do
524
- * not check for duplicates.
525
522
*/
526
523
static WorkerTask *
527
524
get_unused_task (Oid dbid , char * relschema , char * relname , int * task_idx ,
@@ -531,10 +528,6 @@ get_unused_task(Oid dbid, char *relschema, char *relname, int *task_idx,
531
528
WorkerTask * task ;
532
529
WorkerTask * result = NULL ;
533
530
int res_idx = -1 ;
534
- bool cleanup_only = !OidIsValid (dbid );
535
-
536
- Assert ((!cleanup_only && relschema && relname ) ||
537
- (cleanup_only && relschema == NULL && relname == NULL ));
538
531
539
532
* duplicate = false;
540
533
@@ -572,15 +565,8 @@ get_unused_task(Oid dbid, char *relschema, char *relname, int *task_idx,
572
565
/*
573
566
* Consider tasks which might be in progress for possible
574
567
* duplicates of the task we're going to submit.
575
- *
576
- * No need to check if the task should only do the initial
577
- * cleanup - this task is only created by the scheduler during
578
- * the startup. Even if a duplicate was created somehow, it
579
- * will make the worker exit too early to waste much CPU time
580
- * or to cause ERROR(s).
581
568
*/
582
- if (!cleanup_only )
583
- needs_check = true;
569
+ needs_check = true;
584
570
}
585
571
else if (result == NULL )
586
572
{
@@ -626,14 +612,6 @@ get_unused_task(Oid dbid, char *relschema, char *relname, int *task_idx,
626
612
*/
627
613
clear_task (task );
628
614
}
629
-
630
- /*
631
- * Exit early if there's no need to check for duplicates. (That might
632
- * also imply missed opportunities to reset tasks that became UNUSED
633
- * recently. We'll do that later when looking for regular tasks.)
634
- */
635
- if (result && cleanup_only )
636
- break ;
637
615
}
638
616
if (result == NULL || * duplicate )
639
617
goto done ;
@@ -651,16 +629,8 @@ get_unused_task(Oid dbid, char *relschema, char *relname, int *task_idx,
651
629
* uniqueness of the task.
652
630
*/
653
631
result -> dbid = dbid ;
654
- if (!cleanup_only )
655
- {
656
- namestrcpy (& result -> relschema , relschema );
657
- namestrcpy (& result -> relname , relname );
658
- }
659
- else
660
- {
661
- NameStr (result -> relschema )[0 ] = '\0' ;
662
- NameStr (result -> relname )[0 ] = '\0' ;
663
- }
632
+ namestrcpy (& result -> relschema , relschema );
633
+ namestrcpy (& result -> relname , relname );
664
634
done :
665
635
LWLockRelease (workerData -> lock );
666
636
* task_idx = res_idx ;
@@ -1936,7 +1906,7 @@ process_task_internal(MemoryContext task_cxt)
1936
1906
{
1937
1907
/*
1938
1908
* TopMemoryContext is o.k. here, this worker only processes a single
1939
- * task and then exists .
1909
+ * task and then exits .
1940
1910
*/
1941
1911
create_replication_slots (1 , TopMemoryContext );
1942
1912
task -> repl_slot = squeezeWorkerSlots [0 ];
0 commit comments