Page MenuHomePhabricator

[report-service] Implement DB item size checks
ClosedPublic

Authored by bartek on Aug 25 2023, 1:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 3:38 AM
Unknown Object (File)
Tue, Apr 16, 8:16 AM
Unknown Object (File)
Sat, Apr 13, 8:55 AM
Unknown Object (File)
Thu, Apr 11, 7:59 AM
Unknown Object (File)
Tue, Apr 9, 4:53 AM
Unknown Object (File)
Sat, Apr 6, 5:30 PM
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Subscribers

Details

Summary

We're going to store ReportItems in DynamoDB. The maximum item size is 400 KiB. We need to ensure that the items we're storing are not larger than that.
In further diffs, such large reports will be stored in Blob service.

Depends on D8939

Test Plan
  • Created a ReportItem with very long generated string content. Repeatedly increased length.
  • Printed value of total_size() and inserted the row to DDB.
  • Verified that for values slightly larger than 409600 (400 KiB) insertion failed with ItemTooLargeException.
    • When called ensure_size_constraints() for failing items, the todo!() was hit.
    • When called for smaller, non-failing items, the function returned early.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Aug 25 2023, 1:49 AM
jon added inline comments.
services/reports/src/database/item.rs
97–102 ↗(On Diff #30301)

although this has the desired behavior, it does feel a little odd at a glance. Maybe use a different name for the inner size calculation?

This revision is now accepted and ready to land.Aug 25 2023, 4:31 PM
services/reports/src/database/item.rs
97–102 ↗(On Diff #30301)

Yep, shadowing is usually an antipattern. I'll change this