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, Nov 23, 11:38 AM
Unknown Object (File)
Fri, Nov 22, 4:57 AM
Unknown Object (File)
Fri, Nov 22, 4:52 AM
Unknown Object (File)
Thu, Nov 21, 11:50 PM
Unknown Object (File)
Mon, Nov 18, 10:06 AM
Unknown Object (File)
Mon, Nov 18, 6:43 AM
Unknown Object (File)
Mon, Nov 18, 6:33 AM
Unknown Object (File)
Mon, Nov 18, 4:08 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