Header And Logo

PostgreSQL
| The world's most advanced open source database.

Defines | Functions | Variables

autovacuum.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define IsAnyAutoVacuumProcess()   (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())

Functions

bool AutoVacuumingActive (void)
bool IsAutoVacuumLauncherProcess (void)
bool IsAutoVacuumWorkerProcess (void)
void autovac_init (void)
int StartAutoVacLauncher (void)
int StartAutoVacWorker (void)
void AutoVacWorkerFailed (void)
void AutoVacuumUpdateDelay (void)
Size AutoVacuumShmemSize (void)
void AutoVacuumShmemInit (void)

Variables

bool autovacuum_start_daemon
int autovacuum_max_workers
int autovacuum_naptime
int autovacuum_vac_thresh
double autovacuum_vac_scale
int autovacuum_anl_thresh
double autovacuum_anl_scale
int autovacuum_freeze_max_age
int autovacuum_vac_cost_delay
int autovacuum_vac_cost_limit
int AutovacuumLauncherPid
int Log_autovacuum_min_duration

Define Documentation

#define IsAnyAutoVacuumProcess (  )     (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())

Definition at line 40 of file autovacuum.h.

Referenced by InitProcess(), and ProcKill().


Function Documentation

void autovac_init ( void   ) 

Definition at line 2831 of file autovacuum.c.

References autovacuum_start_daemon, ereport, errhint(), errmsg(), pgstat_track_counts, and WARNING.

Referenced by PostmasterMain().

{
    if (autovacuum_start_daemon && !pgstat_track_counts)
        ereport(WARNING,
                (errmsg("autovacuum not started because of misconfiguration"),
                 errhint("Enable the \"track_counts\" option.")));
}

bool AutoVacuumingActive ( void   ) 

Definition at line 2817 of file autovacuum.c.

References autovacuum_start_daemon, and pgstat_track_counts.

Referenced by AutoVacLauncherMain(), reaper(), and ServerLoop().

{
    if (!autovacuum_start_daemon || !pgstat_track_counts)
        return false;
    return true;
}

void AutoVacuumShmemInit ( void   ) 
Size AutoVacuumShmemSize ( void   ) 

Definition at line 2862 of file autovacuum.c.

References add_size(), autovacuum_max_workers, MAXALIGN, and mul_size().

Referenced by AutoVacuumShmemInit(), and CreateSharedMemoryAndSemaphores().

{
    Size        size;

    /*
     * Need the fixed struct and the array of WorkerInfoData.
     */
    size = sizeof(AutoVacuumShmemStruct);
    size = MAXALIGN(size);
    size = add_size(size, mul_size(autovacuum_max_workers,
                                   sizeof(WorkerInfoData)));
    return size;
}

void AutoVacuumUpdateDelay ( void   ) 
void AutoVacWorkerFailed ( void   ) 

Definition at line 1348 of file autovacuum.c.

References AutoVacuumShmemStruct::av_signal.

Referenced by StartAutovacuumWorker().

{
    AutoVacuumShmem->av_signal[AutoVacForkFailed] = true;
}

bool IsAutoVacuumLauncherProcess ( void   ) 
bool IsAutoVacuumWorkerProcess ( void   ) 
int StartAutoVacLauncher ( void   ) 

Definition at line 360 of file autovacuum.c.

References AutoVacLauncherMain(), AutoVacPID, ClosePostmasterPorts(), ereport, errmsg(), fork_process(), LOG, NULL, and on_exit_reset().

Referenced by reaper(), and ServerLoop().

{
    pid_t       AutoVacPID;

#ifdef EXEC_BACKEND
    switch ((AutoVacPID = avlauncher_forkexec()))
#else
    switch ((AutoVacPID = fork_process()))
#endif
    {
        case -1:
            ereport(LOG,
                 (errmsg("could not fork autovacuum launcher process: %m")));
            return 0;

#ifndef EXEC_BACKEND
        case 0:
            /* in postmaster child ... */
            /* Close the postmaster's sockets */
            ClosePostmasterPorts(false);

            /* Lose the postmaster's on-exit routines */
            on_exit_reset();

            AutoVacLauncherMain(0, NULL);
            break;
#endif
        default:
            return (int) AutoVacPID;
    }

    /* shouldn't get here */
    return 0;
}

int StartAutoVacWorker ( void   ) 

Definition at line 1435 of file autovacuum.c.

References AutoVacWorkerMain(), ClosePostmasterPorts(), ereport, errmsg(), fork_process(), LOG, NULL, and on_exit_reset().

Referenced by StartAutovacuumWorker().

{
    pid_t       worker_pid;

#ifdef EXEC_BACKEND
    switch ((worker_pid = avworker_forkexec()))
#else
    switch ((worker_pid = fork_process()))
#endif
    {
        case -1:
            ereport(LOG,
                    (errmsg("could not fork autovacuum worker process: %m")));
            return 0;

#ifndef EXEC_BACKEND
        case 0:
            /* in postmaster child ... */
            /* Close the postmaster's sockets */
            ClosePostmasterPorts(false);

            /* Lose the postmaster's on-exit routines */
            on_exit_reset();

            AutoVacWorkerMain(0, NULL);
            break;
#endif
        default:
            return (int) worker_pid;
    }

    /* shouldn't get here */
    return 0;
}


Variable Documentation

Definition at line 117 of file autovacuum.c.

Referenced by relation_needs_vacanalyze().

Definition at line 116 of file autovacuum.c.

Referenced by relation_needs_vacanalyze().

Definition at line 111 of file autovacuum.c.

Referenced by autovac_init(), and AutoVacuumingActive().

Definition at line 120 of file autovacuum.c.

Referenced by autovac_balance_cost(), and table_recheck_autovac().

Definition at line 121 of file autovacuum.c.

Referenced by autovac_balance_cost(), and table_recheck_autovac().

Definition at line 115 of file autovacuum.c.

Referenced by relation_needs_vacanalyze().

Definition at line 114 of file autovacuum.c.

Referenced by relation_needs_vacanalyze().

Definition at line 276 of file autovacuum.c.

Referenced by FreeWorkerInfo(), and ProcKill().

Definition at line 123 of file autovacuum.c.

Referenced by analyze_rel(), do_analyze_rel(), lazy_vacuum_rel(), and vacuum_rel().