Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-3840

Add additional cleanup of the facts table during migrations

    XMLWordPrintable

Details

    • PuppetDB
    • Customer Feedback
    • Bug Fix
    • Hide
      PuppetDB should no longer crash when performing an older database migration in some (likely rare) situations. The crash should produce an error in the log that mentions "java.sql.BatchUpdateException: Batch entry 3 ALTER TABLE facts ADD CONSTRAINT fact_path_id_fk".
      Show
      PuppetDB should no longer crash when performing an older database migration in some (likely rare) situations. The crash should produce an error in the log that mentions "java.sql.BatchUpdateException: Batch entry 3 ALTER TABLE facts ADD CONSTRAINT fact_path_id_fk".

    Description

      I think we need to add these:

      DELETE from facts WHERE fact_path_id NOT IN (SELECT id FROM fact_paths);
      DELETE FROM facts WHERE fact_value_id NOT IN (SELECT id FROM fact_values);

      We already do something similar here:

      https://github.com/puppetlabs/puppetdb/blob/5.1.4/src/puppetlabs/puppetdb/scf/migrate.clj#L1318

      Attachments

        Activity

          People

            rob.browning Rob Browning
            erik.hansen Erik Hansen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support