Skip to content

Conversation

@0xgouda
Copy link
Collaborator

@0xgouda 0xgouda commented Nov 17, 2025

  • Create new PL/pgSQL functions containing the maintenance logic.
    • admin.try_get_maintenance_lock().
    • admin.update_listing_table(metric_table_name text).
    • admin.remove_dropped_tables_listing(existing_metrics text[]).
  • Call these functions from the Golang maintenance routine.

@0xgouda 0xgouda requested a review from pashagolub November 17, 2025 03:50
@0xgouda 0xgouda added enhancement New feature or request refactoring Something done as it should've been done from the start sinks Where and how to store monitored data labels Nov 17, 2025
@pashagolub pashagolub force-pushed the make-maintenance-in-plpgsql branch from 5c6510c to c245c16 Compare November 17, 2025 16:39
@coveralls
Copy link

coveralls commented Nov 17, 2025

Pull Request Test Coverage Report for Build 19699862818

Details

  • 18 of 22 (81.82%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.09%) to 73.597%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/sinks/postgres.go 18 22 81.82%
Totals Coverage Status
Change from base Build 19665354941: -0.09%
Covered Lines: 3646
Relevant Lines: 4954

💛 - Coveralls

@pashagolub pashagolub self-assigned this Nov 24, 2025
@pashagolub pashagolub force-pushed the make-maintenance-in-plpgsql branch from c245c16 to ef84dfc Compare November 26, 2025 10:03
@pashagolub
Copy link
Collaborator

I want go part look like this:

func (pgw *PostgresWriter) MaintainUniqueSources() {
	sql := "SELECT admin.maintain_tables() WHERE pg_try_advisory_lock(1571543679778230000)"
	logger := log.GetLogger(pgw.ctx)
	logger.Info("Starting maintainence...")
	if _, err := pgw.sinkDb.Exec(pgw.ctx, sql); err != nil {
		logger.Error("Maintaining measurement tables failed:", err)
	}
}

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

Labels

enhancement New feature or request refactoring Something done as it should've been done from the start sinks Where and how to store monitored data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants