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)
Sat, Dec 21, 4:27 AM
Unknown Object (File)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:41 PM
Unknown Object (File)
Sat, Dec 14, 7:30 PM
Unknown Object (File)
Fri, Dec 13, 8:58 PM
Unknown Object (File)
Sat, Nov 23, 11:38 AM
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
No Lint Coverage
Unit
No Test Coverage

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