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

Deadlock when creating/inserting into a new report partition

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 6.10.0
    • Component/s: None
    • Labels:
    • Template:
    • Acceptance Criteria:
      • Create partition and insertion happen in a single transaction
    • Team:
      HA
    • Story Points:
      2
    • Sprint:
      HA Team 2020-04-08, HA Team 2020-04-22 (SS 4/15)
    • Method Found:
      Manual Test
    • Zendesk Ticket IDs:
      39812,39963
    • Zendesk Ticket Count:
      2
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      Bug was never released.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When PuppetDB has to create a new partition the creation and insertion happen in different transactions and some of the constraints can deadlock with the insertion

      < 2020-03-18 10:01:23.195 PDT > ERROR:  deadlock detected at character 13
      < 2020-03-18 10:01:23.195 PDT > DETAIL:  Process 71527 waits for RowExclusiveLock on relation 17910 of database 16387; blocked by process 71529.
              Process 71529 waits for ShareRowExclusiveLock on relation 17910 of database 16387; blocked by process 71527.
              Process 71527: INSERT INTO reports_20200318Z ( status_id, environment_id, catalog_uuid, receive_time, hash, transaction_uuid, puppet_version, noop, logs, report_format, start_time, producer_timestamp, cached_catalog_status, end_time, producer_id, configuration_version, code_id, noop_pending, certname, metrics, job_id ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21 )
              RETURNING *
              Process 71529: DO $$ BEGIN BEGIN ALTER TABLE ONLY reports_20200318Z ADD CONSTRAINT reports_certname_fkey_20200318Z
                             FOREIGN KEY (certname) REFERENCES certnames(certname) ON DELETE CASCADE; EXCEPTION WHEN duplicate_object THEN RETURN; END; END $$
      < 2020-03-18 10:01:23.195 PDT > HINT:  See server log for query details.
      < 2020-03-18 10:01:23.195 PDT > STATEMENT:  INSERT INTO reports_20200318Z ( status_id, environment_id, catalog_uuid, receive_time, hash, transaction_uuid, puppet_version, noop, logs, report_format, start_time, producer_timestamp, cached_catalog_status, end_time, producer_id, configuration_version, code_id, noop_pending, certname, metrics, job_id ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21 )
              RETURNING *
      < 2020-03-18 10:01:23.201 PDT > ERROR:  deadlock detected
      < 2020-03-18 10:01:23.201 PDT > DETAIL:  Process 71520 waits for ShareRowExclusiveLock on relation 17910 of database 16387; blocked by process 71529.
              Process 71529 waits for RowExclusiveLock on relation 17910 of database 16387; blocked by process 71520.
              Process 71520: DO $$ BEGIN BEGIN ALTER TABLE ONLY reports_20200318Z ADD CONSTRAINT reports_certname_fkey_20200318Z
                             FOREIGN KEY (certname) REFERENCES certnames(certname) ON DELETE CASCADE; EXCEPTION WHEN duplicate_object THEN RETURN; END; END $$
              Process 71529: INSERT INTO reports_20200318Z ( status_id, environment_id, catalog_uuid, receive_time, hash, transaction_uuid, puppet_version, noop, logs, report_format, start_time, producer_timestamp, cached_catalog_status, end_time, producer_id, configuration_version, code_id, noop_pending, certname, metrics, job_id ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21 )
              RETURNING *
      < 2020-03-18 10:01:23.201 PDT > HINT:  See server log for query details.
      < 2020-03-18 10:01:23.201 PDT > CONTEXT:  SQL statement "ALTER TABLE ONLY reports_20200318Z ADD CONSTRAINT reports_certname_fkey_20200318Z
                             FOREIGN KEY (certname) REFERENCES certnames(certname) ON DELETE CASCADE"
              PL/pgSQL function inline_code_block line 1 at SQL statement
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              austin.blatt Austin Blatt
              Reporter:
              austin.blatt Austin Blatt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support