Skip to content

Conversation

@evgeni
Copy link
Member

@evgeni evgeni commented Aug 14, 2025

this ensures that the database is restorable or if it isn't (when there are index issues) the user knows at the time of the backup

@evgeni evgeni force-pushed the amcheck branch 3 times, most recently from 50fea81 to bb9f502 Compare August 15, 2025 10:20
@evgeni
Copy link
Member Author

evgeni commented Aug 15, 2025

# foreman-maintain health check --tags db-index
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Make sure Candlepin DB indexes are OK:                                [OK]
--------------------------------------------------------------------------------
Make sure Foreman DB indexes are OK:                                  [FAIL]
Foreman DB indexes have issues:
ERROR:  item order invariant violated for index "index_fact_names_on_name_and_type"
DETAIL:  Lower index tid=(1,7) (points to heap tid=(0,5)) higher index tid=(1,8) (points to heap tid=(0,4)) page lsn=0/2ED6F40.
--------------------------------------------------------------------------------
Make sure Pulpcore DB indexes are OK:                                 [OK]
--------------------------------------------------------------------------------
Scenario [ForemanMaintain::Scenario::FilteredScenario] failed.

The following steps ended up in failing state:

  [foreman-db-index]

Resolve the failed steps and rerun the command.

If the situation persists and, you are unclear what to do next,
contact Red Hat Technical Support.

In case the failures are false positives, use
--whitelist="foreman-db-index"

@evgeni evgeni force-pushed the amcheck branch 2 times, most recently from b1e9cb9 to a4474fa Compare August 15, 2025 10:33
@evgeni evgeni marked this pull request as ready for review August 15, 2025 10:34
@ehelms
Copy link
Member

ehelms commented Aug 15, 2025

Should we just create/enable amcheck as a default extension in our installations?

@evgeni
Copy link
Member Author

evgeni commented Aug 15, 2025

Should we just create/enable amcheck as a default extension in our installations?

We can do that, sure.

Having it here made it easier to test the whole thing on an existing (old) box.

@evgeni
Copy link
Member Author

evgeni commented Aug 20, 2025

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting for myself: we don't need to install postgresql-contrib on external DBS because this check is only executed locally.

def amcheck_installed?
sql = "select 'amcheck_installed' from pg_extension where extname='amcheck'"
result = query(sql)
!result.nil? && !result.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it check for the column we want to be present instead of just non-empty?

Suggested change
!result.nil? && !result.empty?
!result.nil? && result.include?('amcheck_installed')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now result is something like [{"?column?"=>"amcheck_installed"}], so the include? would need to be a tad more smart, but it's really not necessary, as the result will be empty if the extensions is not there.

this ensures that the database is restorable or if it isn't (when there
are index issues) the user knows at the time of the backup
@evgeni evgeni merged commit a3fdf4e into master Aug 25, 2025
8 of 9 checks passed
@evgeni evgeni deleted the amcheck branch August 25, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants