supervisor

package
v0.0.0-...-31abfad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// MetakvAppsPath refers to path under metakv where app handlers are stored
	MetakvAppsPath = metakvEventingPath + "apps/"

	// MetakvAppsRetryPath refers to path where retry counter for bailing out
	// from operations that are retried upon failure
	MetakvAppsRetryPath = metakvEventingPath + "retry/"

	// MetakvAppSettingsPath refers to path under metakv where app settings are stored
	MetakvAppSettingsPath = metakvEventingPath + "appsettings/"

	// MetakvOnDeployPath refers to the path under metakv where OnDeploy is triggered when the user clicks deploy/resume for an eventing function in the UI
	MetakvOnDeployPath = metakvEventingPath + "ondeploy/"

	// MetakvClusterSettings houses global configs related to Eventing
	MetakvClusterSettings = metakvEventingPath + "settings/"

	// MetakvRebalanceTokenPath refers to path under metakv where rebalance tokens are stored
	MetakvRebalanceTokenPath = metakvEventingPath + "rebalanceToken/"

	// MetakvChecksumPath within metakv is updated when new function definition is loaded
	MetakvChecksumPath = metakvEventingPath + "checksum/"
)
View Source
const (
	SIGAR_CGROUP_SUPPORTED = 1
	BYTES_TO_MB            = float64(1024 * 1024)
)

Variables

View Source
var NoBucket = errors.New("Bucket not found")

Functions

func NewSystemConfig

func NewSystemConfig() (*systemConfig, error)

func PrintTrackerMap

func PrintTrackerMap(tracker *CursorTracker, level int)

Types

type AdminPortConfig

type AdminPortConfig struct {
	DebuggerPort string
	HTTPPort     string
	SslPort      string
	CAFile       string
	CertFile     string
	KeyFile      string
}

AdminPortConfig captures settings supplied by cluster manager

type AppStatus

type AppStatus struct {
	CompositeStatus string `json:"composite_status"`
}

type CursorRegistry

type CursorRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCursorRegistry

func NewCursorRegistry(limit uint8) *CursorRegistry

func (*CursorRegistry) GetCursors

func (registry *CursorRegistry) GetCursors(k common.KeyspaceName) (map[string]struct{}, bool)

func (*CursorRegistry) PrintTree

func (registry *CursorRegistry) PrintTree()

func (*CursorRegistry) Register

func (registry *CursorRegistry) Register(k common.KeyspaceName, funcId string) bool

func (*CursorRegistry) Unregister

func (registry *CursorRegistry) Unregister(k common.KeyspaceName, funcId string)

func (*CursorRegistry) UpdateLimit

func (registry *CursorRegistry) UpdateLimit(newlimit uint8)

type CursorTracker

type CursorTracker struct {
	// contains filtered or unexported fields
}

type StatusResponse

type StatusResponse struct {
	App  AppStatus `json:"app"`
	Code int       `json:"code"`
}

type SuperSupervisor

type SuperSupervisor struct {
	CancelCh chan struct{}

	sync.RWMutex
	// contains filtered or unexported fields
}

SuperSupervisor is responsible for managing/supervising all producer instances

func NewSuperSupervisor

func NewSuperSupervisor(adminPort AdminPortConfig, eventingDir, kvPort, restPort, uuid, diagDir string) *SuperSupervisor

NewSuperSupervisor creates the super_supervisor handle

func (*SuperSupervisor) AppsRetryCallback

func (s *SuperSupervisor) AppsRetryCallback(kve metakv.KVEntry) error

AppsRetryCallback informs all running functions to update the retry counter

func (*SuperSupervisor) BootstrapAppList

func (s *SuperSupervisor) BootstrapAppList() map[string]string

BootstrapAppList returns list of apps undergoing bootstrap

func (*SuperSupervisor) BootstrapAppStatus

func (s *SuperSupervisor) BootstrapAppStatus(appName string) bool

BootstrapAppStatus reports back status of bootstrap for a particular app on current node

func (*SuperSupervisor) BootstrapStatus

func (s *SuperSupervisor) BootstrapStatus() bool

BootstrapStatus reports back status of bootstrap for all running apps on current node

func (*SuperSupervisor) CheckAndSwitchgocbBucket

func (s *SuperSupervisor) CheckAndSwitchgocbBucket(bucketName, appName string, setting *common.SecuritySetting) error

func (*SuperSupervisor) CheckLifeCycleOpsDuringRebalance

func (s *SuperSupervisor) CheckLifeCycleOpsDuringRebalance() bool

func (*SuperSupervisor) CheckpointBlobDump

func (s *SuperSupervisor) CheckpointBlobDump(appName string) (interface{}, error)

CheckpointBlobDump returns state of metadata blobs stored in Couchbase bucket

func (*SuperSupervisor) CleanupOnDeployTimers

func (s *SuperSupervisor) CleanupOnDeployTimers(appName string, skipCheckpointBlobs bool) error

CleanupOnDeployTimers removes the timer related documents from the metadata bucket of the eventing function during OnDeploy failure

func (*SuperSupervisor) CleanupOnDeployTimersImpl

func (s *SuperSupervisor) CleanupOnDeployTimersImpl(id int, vbsToCleanup []uint16, undeployWG *sync.WaitGroup, skipCheckpointBlobs bool, appName string) error

func (*SuperSupervisor) ClearEventStats

func (s *SuperSupervisor) ClearEventStats() []string

ClearEventStats flushes event processing stats

func (*SuperSupervisor) ClearOnDeployMsgBuffer

func (s *SuperSupervisor) ClearOnDeployMsgBuffer(appName string)

func (*SuperSupervisor) DcpFeedBoundary

func (s *SuperSupervisor) DcpFeedBoundary(fnName string) (string, error)

DcpFeedBoundary returns feed boundary used for vb dcp streams

func (*SuperSupervisor) DebuggerCallback

func (s *SuperSupervisor) DebuggerCallback(kve metakv.KVEntry) error

DebuggerCallback gets invoked to signal start of debug session

func (*SuperSupervisor) DeployedAppList

func (s *SuperSupervisor) DeployedAppList() []string

DeployedAppList returns list of deployed lambdas running under super_supervisor

func (*SuperSupervisor) EncryptionChangedDuringLifecycle

func (s *SuperSupervisor) EncryptionChangedDuringLifecycle() bool

func (*SuperSupervisor) EventHandlerLoadCallback

func (s *SuperSupervisor) EventHandlerLoadCallback(kve metakv.KVEntry) error

EventHandlerLoadCallback is registered as callback from metakv observe calls on event handlers path

func (*SuperSupervisor) GetAppCode

func (s *SuperSupervisor) GetAppCode(appName string) string

GetAppCode returns handler code for requested appname

func (*SuperSupervisor) GetAppCompositeState

func (s *SuperSupervisor) GetAppCompositeState(appName string) int8

GetAppCompositeState returns current state of app

func (*SuperSupervisor) GetAppLog

func (s *SuperSupervisor) GetAppLog(fnName string, sz int64) []string

GetAppLog returns tail of app log

func (*SuperSupervisor) GetBSCSnapshot

func (s *SuperSupervisor) GetBSCSnapshot() (map[string]map[string][]string, error)

func (*SuperSupervisor) GetBucket

func (s *SuperSupervisor) GetBucket(bucketName, appName string) (*couchbase.Bucket, error)

GetBucket returns the bucket to the caller

func (*SuperSupervisor) GetCurlLatencyStats

func (s *SuperSupervisor) GetCurlLatencyStats(appName string) common.StatsData

func (*SuperSupervisor) GetCurrentManifestId

func (s *SuperSupervisor) GetCurrentManifestId(bucketName string) (string, error)

func (*SuperSupervisor) GetDcpEventsRemainingToProcess

func (s *SuperSupervisor) GetDcpEventsRemainingToProcess(appName string) uint64

GetDcpEventsRemainingToProcess returns remaining dcp events to process

func (*SuperSupervisor) GetDebuggerURL

func (s *SuperSupervisor) GetDebuggerURL(appName string) (string, error)

GetDebuggerURL returns the v8 debugger url for supplied appname

func (*SuperSupervisor) GetDeployedApps

func (s *SuperSupervisor) GetDeployedApps() map[string]string

GetDeployedApps returns list of deployed apps and their last deployment time

func (*SuperSupervisor) GetEventProcessingStats

func (s *SuperSupervisor) GetEventProcessingStats(appName string) map[string]uint64

GetEventProcessingStats returns dcp/timer event processing stats

func (*SuperSupervisor) GetEventingConsumerPids

func (s *SuperSupervisor) GetEventingConsumerPids(appName string) map[string]int

GetEventingConsumerPids returns map of Eventing.Consumer worker name and it's os pid

func (*SuperSupervisor) GetExecutionStats

func (s *SuperSupervisor) GetExecutionStats(appName string) map[string]interface{}

GetExecutionStats returns aggregated failure stats from Eventing.Producer instance

func (*SuperSupervisor) GetFailureStats

func (s *SuperSupervisor) GetFailureStats(appName string) map[string]interface{}

GetFailureStats returns aggregated failure stats from Eventing.Producer instance

func (*SuperSupervisor) GetGocbHandle

func (s *SuperSupervisor) GetGocbHandle(bucketName, appName string) (*gocb.Bucket, error)

func (*SuperSupervisor) GetGocbSubscribedApps

func (s *SuperSupervisor) GetGocbSubscribedApps(encryptionEnabled bool) map[string]struct{}

func (*SuperSupervisor) GetInsight

func (s *SuperSupervisor) GetInsight(appName string) *common.Insight

func (*SuperSupervisor) GetKeyspaceID

func (s *SuperSupervisor) GetKeyspaceID(bucketName, scopeName, collectionName string) (keyspaceID common.KeyspaceID, err error)

Empty collectionName returns collection id as 0 Caller of this functions should take care of it

func (*SuperSupervisor) GetLatencyStats

func (s *SuperSupervisor) GetLatencyStats(appName string) common.StatsData

GetLatencyStats dumps stats from cpp world

func (*SuperSupervisor) GetLcbExceptionsStats

func (s *SuperSupervisor) GetLcbExceptionsStats(appName string) map[string]uint64

GetLcbExceptionsStats returns libcouchbase exception stats from CPP workers

func (*SuperSupervisor) GetLocallyDeployedApps

func (s *SuperSupervisor) GetLocallyDeployedApps() map[string]string

GetLocallyDeployedApps returns list of deployed apps and their last deployment time

func (*SuperSupervisor) GetMetaStoreStats

func (s *SuperSupervisor) GetMetaStoreStats(appName string) map[string]uint64

GetMetaStoreStats returns metastore related stats from all running functions on current node

func (*SuperSupervisor) GetMetadataHandle

func (s *SuperSupervisor) GetMetadataHandle(bucketName, scopeName, collectionName, appName string) (*gocb.Collection, error)

func (*SuperSupervisor) GetNumVbucketsForBucket

func (s *SuperSupervisor) GetNumVbucketsForBucket(bucketName string) int

func (*SuperSupervisor) GetOnDeployMsgBuffer

func (s *SuperSupervisor) GetOnDeployMsgBuffer(appName string) []string

func (*SuperSupervisor) GetOnDeployStatus

func (s *SuperSupervisor) GetOnDeployStatus(appName string) common.OnDeployState

func (*SuperSupervisor) GetPreviousOnDeployStatus

func (s *SuperSupervisor) GetPreviousOnDeployStatus(appName string) common.OnDeployState

func (*SuperSupervisor) GetRegisteredPool

func (s *SuperSupervisor) GetRegisteredPool() string

Gets the cluster url and pool supervisor is observing ns_server changes on.

func (*SuperSupervisor) GetSecuritySetting

func (s *SuperSupervisor) GetSecuritySetting() *common.SecuritySetting

func (*SuperSupervisor) GetSeqsProcessed

func (s *SuperSupervisor) GetSeqsProcessed(appName string) map[int]int64

GetSeqsProcessed returns vbucket specific sequence nos processed so far

func (*SuperSupervisor) GetSystemMemoryQuota

func (s *SuperSupervisor) GetSystemMemoryQuota() float64

func (*SuperSupervisor) GetUndeployedApps

func (s *SuperSupervisor) GetUndeployedApps() []string

func (*SuperSupervisor) GlobalConfigChangeCallback

func (s *SuperSupervisor) GlobalConfigChangeCallback(kve metakv.KVEntry) error

GlobalConfigChangeCallback observes the metakv path where Eventing related global configs are written to

func (*SuperSupervisor) HandleGlobalConfigChange

func (s *SuperSupervisor) HandleGlobalConfigChange(config common.Config) error

HandleGlobalConfigChange handles updates to global configs for Eventing

func (*SuperSupervisor) HandleSupCmdMsg

func (s *SuperSupervisor) HandleSupCmdMsg()

HandleSupCmdMsg handles control commands like app (re)deploy, settings update

func (*SuperSupervisor) IncWorkerRespawnedCount

func (s *SuperSupervisor) IncWorkerRespawnedCount()

func (*SuperSupervisor) InternalVbDistributionStats

func (s *SuperSupervisor) InternalVbDistributionStats(appName string) map[string]string

InternalVbDistributionStats returns internal state of vbucket ownership distribution on local eventing node

func (*SuperSupervisor) KillAllConsumers

func (s *SuperSupervisor) KillAllConsumers()

Last ditch effort to kill all consumers

func (*SuperSupervisor) NotifyPrepareTopologyChange

func (s *SuperSupervisor) NotifyPrepareTopologyChange(ejectNodes, keepNodes []string, changeType service.TopologyChangeType)

NotifyPrepareTopologyChange notifies each producer instance running on current eventing nodes about keepNodes supplied by ns_server

func (*SuperSupervisor) OnDeployCallback

func (s *SuperSupervisor) OnDeployCallback(kve metakv.KVEntry) error

func (*SuperSupervisor) PausingAppList

func (s *SuperSupervisor) PausingAppList() map[string]string

PausingAppList returns list of apps which are being Paused

func (*SuperSupervisor) PlannerStats

func (s *SuperSupervisor) PlannerStats(appName string) []*common.PlannerNodeVbMapping

PlannerStats returns vbucket distribution as per planner running on local eventing node for a given app

func (*SuperSupervisor) PublishOnDeployStatus

func (s *SuperSupervisor) PublishOnDeployStatus(appName string, stat string)

func (*SuperSupervisor) ReadOnDeployDoc

func (s *SuperSupervisor) ReadOnDeployDoc(appName string) (nodeLeader, restPort, onDeployStatus string)

func (*SuperSupervisor) RebalanceStatus

func (s *SuperSupervisor) RebalanceStatus() bool

RebalanceStatus reports back status of rebalance for all running apps on current node

func (*SuperSupervisor) RebalanceTaskProgress

func (s *SuperSupervisor) RebalanceTaskProgress(appName string) (*common.RebalanceProgress, error)

RebalanceTaskProgress reports vbuckets remaining to be transferred as per planner during the course of rebalance

func (*SuperSupervisor) RefreshBucketAndManifestInfo

func (s *SuperSupervisor) RefreshBucketAndManifestInfo(bucket *couchbase.Bucket) (bool, error)

func (*SuperSupervisor) RemoveOnDeployLeader

func (s *SuperSupervisor) RemoveOnDeployLeader(appName string)

func (*SuperSupervisor) RemovePauseTimestampDoc

func (s *SuperSupervisor) RemovePauseTimestampDoc(appName string)

func (*SuperSupervisor) RemoveProducerToken

func (s *SuperSupervisor) RemoveProducerToken(appName string)

RemoveProducerToken takes out appName from supervision tree

func (*SuperSupervisor) ResetCounters

func (s *SuperSupervisor) ResetCounters(appName string) error

func (*SuperSupervisor) RestPort

func (s *SuperSupervisor) RestPort() string

RestPort returns ns_server port(typically 8091/9000)

func (*SuperSupervisor) SetSecuritySetting

func (s *SuperSupervisor) SetSecuritySetting(setting *common.SecuritySetting) bool

SetSecuritySetting Sets the new security settings and returns whether reload is required or not

func (*SuperSupervisor) SettingsChangeCallback

func (s *SuperSupervisor) SettingsChangeCallback(kve metakv.KVEntry) error

SettingsChangeCallback is registered as callback from metakv observe calls on event handler settings path

func (*SuperSupervisor) SignalStopDebugger

func (s *SuperSupervisor) SignalStopDebugger(appName string) error

SignalStopDebugger stops V8 Debugger for a specific deployed lambda

func (*SuperSupervisor) SpanBlobDump

func (s *SuperSupervisor) SpanBlobDump(appName string) (interface{}, error)

SpanBlobDump returns state of timer span blobs stored in metadata bucket

func (*SuperSupervisor) StopProducer

func (s *SuperSupervisor) StopProducer(appName string, msg common.UndeployAction)

StopProducer tries to gracefully stop running producer instance for a function

func (*SuperSupervisor) TimerDebugStats

func (s *SuperSupervisor) TimerDebugStats(appName string) (map[int]map[string]interface{}, error)

TimerDebugStats captures timer related stats to assist in debugging mismtaches during rebalance

func (*SuperSupervisor) TopologyChangeNotifCallback

func (s *SuperSupervisor) TopologyChangeNotifCallback(kve metakv.KVEntry) error

TopologyChangeNotifCallback is registered to notify any changes in MetaKvRebalanceTokenPath

func (*SuperSupervisor) UnwatchBucket

func (s *SuperSupervisor) UnwatchBucket(keyspace common.Keyspace, appName string)

UnwatchBucket removes the bucket from supervisor

func (*SuperSupervisor) UpdateEncryptionLevel

func (s *SuperSupervisor) UpdateEncryptionLevel(enforceTLS, encryptOn bool)

func (*SuperSupervisor) UpdateFailedOnDeployStatus

func (s *SuperSupervisor) UpdateFailedOnDeployStatus(appName string)

func (*SuperSupervisor) VbDcpEventsRemainingToProcess

func (s *SuperSupervisor) VbDcpEventsRemainingToProcess(appName string) map[int]int64

VbDcpEventsRemainingToProcess returns remaining dcp events to process

func (*SuperSupervisor) VbDistributionStatsFromMetadata

func (s *SuperSupervisor) VbDistributionStatsFromMetadata(appName string) map[string]map[string]string

VbDistributionStatsFromMetadata returns vbucket distribution across eventing nodes from metadata bucket

func (*SuperSupervisor) VbSeqnoStats

func (s *SuperSupervisor) VbSeqnoStats(appName string) (map[int][]map[string]interface{}, error)

VbSeqnoStats returns seq no stats, which can be useful in figuring out missed events during rebalance

func (*SuperSupervisor) WatchBucket

func (s *SuperSupervisor) WatchBucket(keyspace common.Keyspace, appName string, mType common.MonitorType) error

func (*SuperSupervisor) WorkerRespawnedCount

func (s *SuperSupervisor) WorkerRespawnedCount() uint32

func (*SuperSupervisor) WriteDebuggerToken

func (s *SuperSupervisor) WriteDebuggerToken(appName, token string, hostnames []string)

WriteDebuggerToken signals running function to write debug token

func (*SuperSupervisor) WriteDebuggerURL

func (s *SuperSupervisor) WriteDebuggerURL(appName, url string)

WriteDebuggerURL signals running function to write debug url

func (*SuperSupervisor) WriteOnDeployMsgBuffer

func (s *SuperSupervisor) WriteOnDeployMsgBuffer(appName, msg string)

func (*SuperSupervisor) WritePauseTimestamp

func (s *SuperSupervisor) WritePauseTimestamp(appName string, timestamp time.Time)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL