Jira (PDB-3529) Report insertion should determine the latest_report_id without recalculating the latest report from the reports table

0 views
Skip to first unread message

Nick Walker (JIRA)

unread,
May 24, 2017, 1:02:03 PM5/24/17
to puppe...@googlegroups.com
Nick Walker created an issue
 
PuppetDB / Improvement PDB-3529
Report insertion should determine the latest_report_id without recalculating the latest report from the reports table
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2017/05/24 10:01 AM
Priority: Normal Normal
Reporter: Nick Walker

The Problem

Looking at the scale testing postgresql logs I can see that we are repeatedly calculating the latest_report_id from the reports table. This happens every time we insert a report but we should not need to recalculate the latest_report every time.

https://github.com/puppetlabs/puppetdb/blob/def0dc5cedbc31c0d0315abd95dfb20107e2ea45/src/puppetlabs/puppetdb/scf/storage.clj#L1291-L1295

The Suggestion

We should store the latest_report_timestamp ( the producer_timestamp from reports ) in certnames with the latest_report_id. Then when we insert a new report we can compare the producer timestamp to the latest_report_timestamp and update the latest_report_id and _timestamp if it is actually the latest report.

This would eliminate an expensive query that sorts all of the reports for a certname just to find the most recent report.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Nick Walker (JIRA)

unread,
May 24, 2017, 1:15:04 PM5/24/17
to puppe...@googlegroups.com

Nick Walker (JIRA)

unread,
Jun 2, 2017, 1:22:02 PM6/2/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Jun 6, 2017, 4:10:03 PM6/6/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Jun 6, 2017, 4:11:03 PM6/6/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Jun 6, 2017, 6:42:03 PM6/6/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Jun 6, 2017, 6:43:03 PM6/6/17
to puppe...@googlegroups.com
Russell Mull updated an issue
Change By: Russell Mull
Release Notes Summary: Report storage has been optimized by requiring fewer tables to be consulted when updating the record of which report is latest. 

Zachary Kent (Jira)

unread,
Mar 10, 2021, 3:33:02 PM3/10/21
to puppe...@googlegroups.com
Zachary Kent updated an issue
Change By: Zachary Kent
Sprint:
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Zachary Kent (Jira)

unread,
Mar 10, 2021, 3:34:04 PM3/10/21
to puppe...@googlegroups.com

Morgan Rhodes (Jira)

unread,
Mar 11, 2021, 2:25:03 PM3/11/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages