Skip to content

Run stats cleanup on the longest-running management server - #14885

Open
zheng1771 wants to merge 1 commit into
apache:4.22from
zheng1771:fix/14671-stats-cleanup-owner
Open

zheng1771 wants to merge 1 commit into
apache:4.22from
zheng1771:fix/14671-stats-cleanup-owner

Conversation

@zheng1771

Copy link
Copy Markdown

Description

Fixes: #14671

VM and volume stats cleanup runs every minute on every management server,
repeating the same retention deletes against the shared database.

Run both cleaners only on the longest-running management server in Up
state. Use findOneByLongestRuntime(), following existing recurring tasks.
Check ownership on each run so another server can take over when the
current owner stops.

Retention settings, cleanup intervals and delete queries stay unchanged.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Repeated cleanup adds unnecessary database work on multi-server setups.

Screenshots (if appropriate):

Not applicable. Backend change.

How Has This Been Tested?

All 68 StatsCollectorTest tests passed. Required modules compiled and
Checkstyle passed.

How did you try to break this feature and the system with this change?

Added tests for both cleaners:

  • Cleanup runs on the longest-running server.
  • Cleanup is skipped on other servers.
  • Cleanup is skipped when no Up server is found.
  • The same cleaner instances take over after ownership changes.

Existing exception-handling tests also passed with the ownership check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant