greenplumn event_version 源码

  • 2022-08-18
  • 浏览 (105)

greenplumn event_version 代码


 * event_version.c
 *	 Implementation of the event version provider. This module does not provide
 *	 any API. Instead it just sets up shared memory variables so that other
 *	 modules can track and update event versions as necessary. Event versions
 *	 are used to provide a temporal ordering of runaway events and cleanup events,
 *	 as well as the idle and the activation events of different processes.
 * Copyright (c) 2014-Present VMware, Inc. or its affiliates.
 *	    src/backend/utils/mmgr/event_version.c
#include "postgres.h"

#include "cdb/cdbvars.h"
#include "miscadmin.h"
#include "storage/shmem.h"
#include "utils/vmem_tracker.h"

/* External dependencies within the runaway cleanup framework */
extern bool vmemTrackerInited;

#define SHMEM_EVENT_VERSION_PROVIDER "The shared counter for event version provider"
#define SHMEM_RUNAWAY_EVENT_VERSION "Most recent runaway detection version"

 * A shared memory counter that provides a set of monotonically
 * increasing values. The counter is only incremented by the runaway
 * detector, at the time of a new runaway event. In fact, at the time
 * of runaway event, the detector would increment it by 2, using the
 * skipped value as the version of the runaway event. This ensures
 * that the runaway version doesn't overlap with any other version
 * as used by other processes on the segment as activation and
 * deactivation version.
 * The current version would be used by processes during activation
 * or deactivation to identify when it becmes idle/active.
volatile EventVersion *CurrentVersion = NULL;

/* The event version of the latest runaway event */
volatile EventVersion *latestRunawayVersion = 0;

void EventVersion_ShmemInit(void);

 * Initializes the event version provider's shared memory states.

	bool		alreadyInShmem = false;

	CurrentVersion = (EventVersion *)
	Assert(alreadyInShmem || !IsUnderPostmaster);

	latestRunawayVersion = (EventVersion *)
	Assert(alreadyInShmem || !IsUnderPostmaster);

	Assert(NULL != CurrentVersion);
	Assert(NULL != latestRunawayVersion);

		*latestRunawayVersion = 0;
		 * As no runaway event has happened yet, we must make sure that
		 * the CurrentVersion is larger than latestRunawayVersion
		*CurrentVersion = *latestRunawayVersion + 1;


greenplumn 源码目录


greenplumn aset 源码

greenplumn dsa 源码

greenplumn freepage 源码

greenplumn generation 源码

greenplumn idle_tracker 源码

greenplumn mcxt 源码

greenplumn memdebug 源码

greenplumn memprot 源码

greenplumn mpool 源码

greenplumn portalmem 源码

0  赞