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

Add additional cleanup of the facts table during migrations

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 5.2.9, PDB 6.0.4, PDB 6.3.3
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      PuppetDB
    • Method Found:
      Customer Feedback
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      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

            jsd-sla-details-panel

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: