struct timeval nap;
TimestampTz current_time = 0;
bool can_launch;
- avl_dbase *avdb;
int rc;
/*
worker->wi_tableoid = InvalidOid;
worker->wi_proc = NULL;
worker->wi_launchtime = 0;
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &worker->wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &worker->wi_links);
AutoVacuumShmem->av_startingWorker = NULL;
elog(WARNING, "worker took too long to start; canceled");
}
* distant adl_next_worker first, we obtain our database from the
* tail of the list.
*/
+ avl_dbase *avdb;
+
avdb = dlist_tail_element(avl_dbase, adl_node, &DatabaseList);
/*
static void
launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
{
- avl_dbase *avdb;
-
/*
* We sleep until the next scheduled vacuum. We trust that when the
* database list was built, care was taken so that no entries have times
{
TimestampTz current_time = GetCurrentTimestamp();
TimestampTz next_wakeup;
+ avl_dbase *avdb;
long secs;
int usecs;
*/
AutovacuumLauncherPid = AutoVacuumShmem->av_launcherpid;
- dlist_delete(&AutoVacuumShmem->av_runningWorkers, &MyWorkerInfo->wi_links);
+ dlist_delete(&MyWorkerInfo->wi_links);
MyWorkerInfo->wi_dboid = InvalidOid;
MyWorkerInfo->wi_tableoid = InvalidOid;
MyWorkerInfo->wi_proc = NULL;
MyWorkerInfo->wi_cost_delay = 0;
MyWorkerInfo->wi_cost_limit = 0;
MyWorkerInfo->wi_cost_limit_base = 0;
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &MyWorkerInfo->wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &MyWorkerInfo->wi_links);
/* not mine anymore */
MyWorkerInfo = NULL;
/* initialize the WorkerInfo free list */
for (i = 0; i < autovacuum_max_workers; i++)
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &worker[i].wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &worker[i].wi_links);
}
else
Assert(found);
return; /* nothing left to do */
}
- dlist_delete(ct->cache_bucket, &ct->cache_elem);
+ dlist_delete(&ct->cache_elem);
/* free associated tuple data */
if (ct->tuple.t_data != NULL)
}
/* delink from linked list */
- dlist_delete(&cache->cc_lists, &cl->cache_elem);
+ dlist_delete(&cl->cache_elem);
/* free associated tuple data */
if (cl->tuple.t_data != NULL)
*/
ct->ct_magic = CT_MAGIC;
ct->my_cache = cache;
- ct->cache_bucket = &cache->cc_bucket[hashIndex];
-
ct->c_list = NULL;
ct->refcount = 0; /* for the moment */
ct->dead = false;
ct->negative = negative;
ct->hash_value = hashValue;
- dlist_push_head(ct->cache_bucket, &ct->cache_elem);
+ dlist_push_head(&cache->cc_bucket[hashIndex], &ct->cache_elem);
cache->cc_ntup++;
CacheHdr->ch_ntup++;
* continue; // don't touch this one
*
* // unlink the current table from the linked list
- * dlist_delete(&db->tables, miter.cur);
+ * dlist_delete(miter.cur);
* // as these lists never manage memory, we can still access the table
* // after it's been unlinked
* drop_table(db, tbl);
extern bool dlist_is_empty(dlist_head *head);
extern void dlist_push_head(dlist_head *head, dlist_node *node);
extern void dlist_push_tail(dlist_head *head, dlist_node *node);
-extern void dlist_insert_after(dlist_head *head,
- dlist_node *after, dlist_node *node);
-extern void dlist_insert_before(dlist_head *head,
- dlist_node *before, dlist_node *node);
-extern void dlist_delete(dlist_head *head, dlist_node *node);
+extern void dlist_insert_after(dlist_node *after, dlist_node *node);
+extern void dlist_insert_before(dlist_node *before, dlist_node *node);
+extern void dlist_delete(dlist_node *node);
extern dlist_node *dlist_pop_head_node(dlist_head *head);
extern void dlist_move_head(dlist_head *head, dlist_node *node);
extern bool dlist_has_next(dlist_head *head, dlist_node *node);
* Insert a node after another *in the same list*
*/
STATIC_IF_INLINE void
-dlist_insert_after(dlist_head *head, dlist_node *after, dlist_node *node)
+dlist_insert_after(dlist_node *after, dlist_node *node)
{
- dlist_check(head);
- /* XXX: assert 'after' is in 'head'? */
-
node->prev = after;
node->next = after->next;
after->next = node;
node->next->prev = node;
-
- dlist_check(head);
}
/*
* Insert a node before another *in the same list*
*/
STATIC_IF_INLINE void
-dlist_insert_before(dlist_head *head, dlist_node *before, dlist_node *node)
+dlist_insert_before(dlist_node *before, dlist_node *node)
{
- dlist_check(head);
- /* XXX: assert 'before' is in 'head'? */
-
node->prev = before->prev;
node->next = before;
before->prev = node;
node->prev->next = node;
-
- dlist_check(head);
}
/*
- * Delete 'node' from list.
- *
- * It is not allowed to delete a 'node' which is is not in the list 'head'
+ * Delete 'node' from its list (it must be in one).
*/
STATIC_IF_INLINE void
-dlist_delete(dlist_head *head, dlist_node *node)
+dlist_delete(dlist_node *node)
{
- dlist_check(head);
-
node->prev->next = node->next;
node->next->prev = node->prev;
-
- dlist_check(head);
}
/*
Assert(!dlist_is_empty(head));
node = head->head.next;
- dlist_delete(head, node);
+ dlist_delete(node);
return node;
}
if (head->head.next == node)
return;
- dlist_delete(head, node);
+ dlist_delete(node);
dlist_push_head(head, node);
dlist_check(head);
extern void slist_init(slist_head *head);
extern bool slist_is_empty(slist_head *head);
extern void slist_push_head(slist_head *head, slist_node *node);
-extern void slist_insert_after(slist_head *head,
- slist_node *after, slist_node *node);
+extern void slist_insert_after(slist_node *after, slist_node *node);
extern slist_node *slist_pop_head_node(slist_head *head);
extern bool slist_has_next(slist_head *head, slist_node *node);
extern slist_node *slist_next_node(slist_head *head, slist_node *node);
* Insert a node after another *in the same list*
*/
STATIC_IF_INLINE void
-slist_insert_after(slist_head *head, slist_node *after, slist_node *node)
+slist_insert_after(slist_node *after, slist_node *node)
{
node->next = after->next;
after->next = node;
-
- slist_check(head);
}
/*