Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the last created subset for matching compressed report #191

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def load_attachment!

# set report.compressed from the attachment.
if compressed_report? || resolution_report?
report_subset = report_subsets.order("created_at ASC").first
report_subset = report_subsets.order("created_at DESC").first
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming this is the only behavioral change, then I think this makes intuitive sense to me.

For report ab28a47e-4b66-4292-a81d-e48e8f880bb9:

Checksum in S3: de0cb0691a3d6f3019e0472ee255b013d9f70a6d0627a67bbdbbe04c3daedb19
Checksums in sashimi:

3.1.0 :001 > r = Report.where(uid:"ab28a47e-4b66-4292-a81d-e48e8f880bb9").first

 => 

#<Report:0x00007f02f5d8acd0

... 
3.1.0 :008 > r.report_subsets.each do |rs|

3.1.0 :009 >   pp rs.checksum

3.1.0 :010 > end

"de0cb0691a3d6f3019e0472ee255b013d9f70a6d0627a67bbdbbe04c3daedb19"

"e58407e2953d055e38b5611f15b55bc790698db5ccc2a0290798a819bc76c236"

"c178b302646ee2c8b77356e3dcb0b1563047bceb696fd81014383f2662c4e2ab"

"c078e954d5042ab7bd39a65d352e31e855a99bc01a0c7908c971eb4af4ee1263"

With ASC (non-matching checksum):

3.1.0 :012 > r.report_subsets.order("created_at ASC").first.checksum
 => "e58407e2953d055e38b5611f15b55bc790698db5ccc2a0290798a819bc76c236" 

With DESC (matching checksum):

3.1.0 :011 > r.report_subsets.order("created_at DESC").first.checksum
 => "de0cb0691a3d6f3019e0472ee255b013d9f70a6d0627a67bbdbbe04c3daedb19"

attachment_subset = attachment.search_subsets(checksum: report_subset.checksum)
fail "[UsageReports] cannot find gzip for a report-subset" if attachment_subset.blank?

Expand Down
Loading