From 92224ae24349bbecb007784d1cf282c72d17ad98 Mon Sep 17 00:00:00 2001 From: VioletHynes Date: Tue, 23 Jul 2024 14:56:23 -0400 Subject: [PATCH 1/2] VAULT-27563 CE changes --- vault/activity_log.go | 25 ++++--------------------- vault/census_manager.go | 6 ++++++ vault/core.go | 4 ---- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/vault/activity_log.go b/vault/activity_log.go index b7dc6ea470ce..7a01a72e5c4a 100644 --- a/vault/activity_log.go +++ b/vault/activity_log.go @@ -143,7 +143,8 @@ type ActivityLog struct { // nodeID is the ID to use for all fragments that // are generated. - // TODO: use secondary ID when available? + // This uses the primary ID as of right now, but + // could be adapted to use a secondary in the future. nodeID string // current log fragment (may be nil) @@ -187,14 +188,6 @@ type ActivityLog struct { inprocessExport *atomic.Bool - // CensusReportDone is a channel used to signal tests upon successful calls - // to (CensusReporter).Write() in CensusReport. - CensusReportDone chan bool - - // CensusReportInterval is the testing configuration for time between - // Write() calls initiated in CensusReport. - CensusReportInterval time.Duration - // clock is used to support manipulating time in unit and integration tests clock timeutil.Clock // precomputedQueryWritten receives an element whenever a precomputed query @@ -214,9 +207,6 @@ type ActivityLogCoreConfig struct { // Do not start timers to send or persist fragments. DisableTimers bool - // CensusReportInterval is the testing configuration for time - CensusReportInterval time.Duration - // MinimumRetentionMonths defines the minimum value for retention MinimumRetentionMonths int @@ -249,7 +239,6 @@ func NewActivityLog(core *Core, logger log.Logger, view *BarrierView, metrics me sendCh: make(chan struct{}, 1), // buffered so it can be triggered by fragment size doneCh: make(chan struct{}, 1), partialMonthClientTracker: make(map[string]*activity.EntityRecord), - CensusReportInterval: time.Hour * 1, clock: clock, currentSegment: segmentInfo{ startTimestamp: 0, @@ -998,7 +987,7 @@ func (a *ActivityLog) refreshFromStoredLog(ctx context.Context, wg *sync.WaitGro return nil } -// This version is used during construction +// SetConfigInit is used during construction func (a *ActivityLog) SetConfigInit(config activityConfig) { switch config.Enabled { case "enable": @@ -1020,13 +1009,9 @@ func (a *ActivityLog) SetConfigInit(config activityConfig) { if a.configOverrides.MinimumRetentionMonths > 0 { a.retentionMonths = a.configOverrides.MinimumRetentionMonths } - - if a.configOverrides.CensusReportInterval > 0 { - a.CensusReportInterval = a.configOverrides.CensusReportInterval - } } -// This version reacts to user changes +// SetConfig reacts to user changes func (a *ActivityLog) SetConfig(ctx context.Context, config activityConfig) { a.l.Lock() defer a.l.Unlock() @@ -1948,8 +1933,6 @@ type activityConfig struct { // Enabled is one of enable, disable, default. Enabled string `json:"enabled"` - - CensusReportInterval time.Duration `json:"census_report_interval"` } func defaultActivityConfig() activityConfig { diff --git a/vault/census_manager.go b/vault/census_manager.go index 3a98f47b2079..7a9135834b38 100644 --- a/vault/census_manager.go +++ b/vault/census_manager.go @@ -40,3 +40,9 @@ func (c *Core) setupCensusManager(ctx context.Context) error { func (cm *CensusManager) BillingStart() time.Time { return time.Time{} } +<<<<<<< ours +======= + +// StartManualReportingSnapshots is a stub for CE. +func (cm *CensusManager) StartManualReportingSnapshots() {} +>>>>>>> theirs diff --git a/vault/core.go b/vault/core.go index 21145f6a3b4b..3598b5e9f830 100644 --- a/vault/core.go +++ b/vault/core.go @@ -2467,10 +2467,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c if err := c.setupCensusManager(ctx); err != nil { return err } - - c.StartCensusReports(ctx) - c.StartManualCensusSnapshots() - } else { brokerLogger := logger.Named("audit") broker, err := audit.NewBroker(brokerLogger) From 103e478427c6bfc398225faf24ef5452071fb659 Mon Sep 17 00:00:00 2001 From: VioletHynes Date: Tue, 23 Jul 2024 14:57:32 -0400 Subject: [PATCH 2/2] Missed push --- vault/census_manager.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/vault/census_manager.go b/vault/census_manager.go index 7a9135834b38..0bf8977b9258 100644 --- a/vault/census_manager.go +++ b/vault/census_manager.go @@ -40,9 +40,6 @@ func (c *Core) setupCensusManager(ctx context.Context) error { func (cm *CensusManager) BillingStart() time.Time { return time.Time{} } -<<<<<<< ours -======= // StartManualReportingSnapshots is a stub for CE. func (cm *CensusManager) StartManualReportingSnapshots() {} ->>>>>>> theirs